bool IntroPwdCheck::pwdSubmitFail(const RPCError &error) { if (MTP::isFloodError(error)) { sentRequest = 0; stopCheck(); _codeField.setDisabled(false); showError(lang(lng_flood_error)); _pwdField.setDisabled(false); _pwdField.notaBene(); return true; } if (MTP::isDefaultHandledError(error)) return false; sentRequest = 0; stopCheck(); _pwdField.setDisabled(false); _codeField.setDisabled(false); const QString &err = error.type(); if (err == qstr("PASSWORD_HASH_INVALID")) { showError(lang(lng_signin_bad_password)); _pwdField.selectAll(); _pwdField.notaBene(); return true; } else if (err == qstr("PASSWORD_EMPTY")) { intro()->onBack(); } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } _pwdField.setFocus(); return false; }
bool PhoneWidget::phoneSubmitFail(const RPCError &error) { if (MTP::isFloodError(error)) { stopCheck(); _sentRequest = 0; showPhoneError(langFactory(lng_flood_error)); return true; } if (MTP::isDefaultHandledError(error)) return false; stopCheck(); _sentRequest = 0; auto &err = error.type(); if (err == qstr("PHONE_NUMBER_FLOOD")) { Ui::show(Box<InformBox>(lang(lng_error_phone_flood))); return true; } else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error showPhoneError(langFactory(lng_bad_phone)); return true; } if (cDebug()) { // internal server error auto text = err + ": " + error.description(); showPhoneError([text] { return text; }); } else { showPhoneError(langFactory(lng_server_error)); } return false; }
bool IntroPhone::phoneSubmitFail(const RPCError &error) { if (MTP::isFloodError(error)) { stopCheck(); sentRequest = 0; showError(lang(lng_flood_error)); enableAll(true); return true; } if (MTP::isDefaultHandledError(error)) return false; stopCheck(); sentRequest = 0; const QString &err = error.type(); if (err == qstr("PHONE_NUMBER_INVALID")) { // show error showError(lang(lng_bad_phone)); enableAll(true); return true; } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } enableAll(true); return false; }
void CodeWidget::gotPassword(const MTPaccount_Password &result) { Expects(result.type() == mtpc_account_password); stopCheck(); _sentRequest = 0; const auto &d = result.c_account_password(); getData()->pwdRequest = Core::ParseCloudPasswordCheckRequest(d); if (!d.has_current_algo() || !d.has_srp_id() || !d.has_srp_B()) { LOG(("API Error: No current password received on login.")); _code->setFocus(); return; } else if (!getData()->pwdRequest) { const auto box = std::make_shared<QPointer<BoxContent>>(); const auto callback = [=] { Core::UpdateApplication(); if (*box) (*box)->closeBox(); }; *box = Ui::show(Box<ConfirmBox>( lang(lng_passport_app_out_of_date), lang(lng_menu_update), callback)); return; } getData()->hasRecovery = d.is_has_recovery(); getData()->pwdHint = qs(d.vhint); getData()->pwdNotEmptyPassport = d.is_has_secure_values(); goReplace(new Intro::PwdCheckWidget(parentWidget(), getData())); }
bool IntroCode::codeSubmitFail(const RPCError &error) { stopCheck(); code.setDisabled(false); const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID" || err == "PHONE_CODE_EXPIRED") { // show error onBack(); return true; } else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") { showError(lang(lng_bad_code)); code.setFocus(); return true; } else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp intro()->setCode(sentCode); intro()->onIntroNext(); return true; } if (QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(err).hasMatch()) { showError(lang(lng_flood_error)); code.setFocus(); return true; } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } code.setFocus(); return false; }
bool IntroPwdCheck::codeSubmitFail(const RPCError &error) { sentRequest = 0; stopCheck(); _pwdField.setDisabled(false); _codeField.setDisabled(false); const QString &err = error.type(); if (err == "PASSWORD_EMPTY") { intro()->onIntroBack(); return true; } else if (err == "PASSWORD_RECOVERY_NA") { recoverStartFail(error); return true; } else if (err == "PASSWORD_RECOVERY_EXPIRED") { _emailPattern = QString(); onToPassword(); return true; } else if (err == "CODE_INVALID") { showError(lang(lng_signin_wrong_code)); _codeField.selectAll(); _codeField.notaBene(); return true; } else if (mtpIsFlood(error)) { showError(lang(lng_flood_error)); _codeField.notaBene(); return true; } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } _codeField.setFocus(); return false; }
void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) { stopCheck(); sentRequest = 0; enableAll(true); if (result.type() != mtpc_auth_sentCode) { showError(lang(lng_server_error)); return; } const auto &d(result.c_auth_sentCode()); switch (d.vtype.type()) { case mtpc_auth_sentCodeTypeApp: intro()->setCodeByTelegram(true); break; case mtpc_auth_sentCodeTypeSms: case mtpc_auth_sentCodeTypeCall: intro()->setCodeByTelegram(false); break; case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break; } intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.is_phone_registered()); if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) { intro()->setCallStatus({ IntroWidget::CallWaiting, d.has_timeout() ? d.vtimeout.v : 60 }); } else { intro()->setCallStatus({ IntroWidget::CallDisabled, 0 }); } intro()->nextStep(new IntroCode(intro())); }
void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) { stopCheck(); enableAll(false); const MTPDauth_sentCode &d(result.c_auth_sentCode()); intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v); intro()->setCallTimeout(result.c_auth_sentCode().vsend_call_timeout.v); intro()->onIntroNext(); }
void f3_launcher::startCheck(QString devPath) { if (stage != 0) stopCheck(); f3_cui_output.clear(); progress = 0; status = f3_launcher_running; emit f3_launcher_status_changed(f3_launcher_running); this->devPath = devPath; QString command; QStringList args; if (getOption("mode") == "quick") { command = QString(F3_PROBE_COMMAND); if (!probeCommand(command)) { emitError(f3_launcher_no_quick); status = f3_launcher_stopped; emit f3_launcher_status_changed(f3_launcher_stopped); return; } if (getOption("memory") == "minimum") args << QString(F3_OPTION_MIN_MEM); if (getOption("destructive") == "true") args << QString(F3_OPTION_DESTRUCTIVE); args << QString(F3_OPTION_TIME); stage = 11; emit f3_launcher_status_changed(f3_launcher_staged); } else { command = QString(F3_WRITE_COMMAND); stage = 1; if (getOption("cache") == "write") { if (probeDiskFull(devPath) && probeCacheFile(devPath)) { command = QString(F3_READ_COMMAND); stage = 2; } else emitError(f3_launcher_cache_nofound); } if (showProgress) args << QString(F3_OPTION_SHOW_PROGRESS); emit f3_launcher_status_changed(f3_launcher_staged); } args << devPath; f3_cui.start(command, args); if (showProgress) { timer.start(); } }
void IntroCode::codeSubmitDone(const MTPauth_Authorization &result) { stopCheck(); code.setDisabled(false); const MTPDauth_authorization &d(result.c_auth_authorization()); if (d.vuser.type() != mtpc_userSelf) { // wtf? showError(lang(lng_server_error)); return; } cSetLoggedPhoneNumber(intro()->getPhone()); intro()->finish(d.vuser); }
bool IntroPwdCheck::recoverStartFail(const RPCError &error) { stopCheck(); _pwdField.setDisabled(false); _codeField.setDisabled(false); _pwdField.show(); _codeField.hide(); _pwdField.setFocus(); update(); showError(""); return true; }
void CodeWidget::codeSubmitDone(const MTPauth_Authorization &result) { stopCheck(); _sentRequest = 0; auto &d = result.c_auth_authorization(); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? showCodeError(&Lang::Hard::ServerError); return; } cSetLoggedPhoneNumber(getData()->phone); finish(d.vuser); }
void PhoneWidget::onCheckRequest() { auto status = MTP::state(_sentRequest); if (status < 0) { auto leftms = -status; if (leftms >= 1000) { MTP::cancel(base::take(_sentRequest)); } } if (!_sentRequest && status == MTP::RequestSent) { stopCheck(); } }
void IntroPhone::onCheckRequest() { int32 status = MTP::state(sentRequest); if (status < 0) { int32 leftms = -status; if (leftms >= 1000) { MTP::cancel(sentRequest); sentRequest = 0; if (!phone.isEnabled()) enableAll(true); } } if (!sentRequest && status == MTP::RequestSent) { stopCheck(); } }
bool PhoneWidget::phoneSubmitFail(const RPCError &error) { if (MTP::isFloodError(error)) { stopCheck(); _sentRequest = 0; showPhoneError(langFactory(lng_flood_error)); return true; } if (MTP::isDefaultHandledError(error)) return false; stopCheck(); _sentRequest = 0; auto &err = error.type(); if (err == qstr("PHONE_NUMBER_FLOOD")) { Ui::show(Box<InformBox>(lang(lng_error_phone_flood))); return true; } else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error showPhoneError(langFactory(lng_bad_phone)); return true; } else if (err == qstr("PHONE_NUMBER_BANNED")) { const auto phone = _sentPhone; Ui::show(Box<ConfirmBox>( lang(lng_signin_banned_text), lang(lng_box_ok), lang(lng_signin_banned_help), [] { Ui::hideLayer(); }, [phone] { SendToBannedHelp(phone); Ui::hideLayer(); })); return true; } if (Logs::DebugEnabled()) { // internal server error auto text = err + ": " + error.description(); showPhoneError([text] { return text; }); } else { showPhoneError(&Lang::Hard::ServerError); } return false; }
bool CodeWidget::codeSubmitFail(const RPCError &error) { if (MTP::isFloodError(error)) { stopCheck(); _sentRequest = 0; showCodeError(langFactory(lng_flood_error)); return true; } if (MTP::isDefaultHandledError(error)) return false; stopCheck(); _sentRequest = 0; auto &err = error.type(); if (err == qstr("PHONE_NUMBER_INVALID") || err == qstr("PHONE_CODE_EXPIRED")) { // show error goBack(); return true; } else if (err == qstr("PHONE_CODE_EMPTY") || err == qstr("PHONE_CODE_INVALID")) { showCodeError(langFactory(lng_bad_code)); return true; } else if (err == qstr("PHONE_NUMBER_UNOCCUPIED")) { // success, need to signUp getData()->code = _sentCode; goReplace(new Intro::SignupWidget(parentWidget(), getData())); return true; } else if (err == qstr("SESSION_PASSWORD_NEEDED")) { getData()->code = _sentCode; _checkRequest->start(1000); _sentRequest = MTP::send(MTPaccount_GetPassword(), rpcDone(&CodeWidget::gotPassword), rpcFail(&CodeWidget::codeSubmitFail)); return true; } if (Logs::DebugEnabled()) { // internal server error auto text = err + ": " + error.description(); showCodeError([text] { return text; }); } else { showCodeError(&Lang::Hard::ServerError); } return false; }
void IntroPwdCheck::pwdSubmitDone(bool recover, const MTPauth_Authorization &result) { sentRequest = 0; stopCheck(); if (recover) { cSetPasswordRecovered(true); } _pwdField.setDisabled(false); _codeField.setDisabled(false); const MTPDauth_authorization &d(result.c_auth_authorization()); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? showError(lang(lng_server_error)); return; } intro()->finish(d.vuser); }
void PhoneWidget::phoneCheckDone(const MTPauth_CheckedPhone &result) { stopCheck(); auto &d = result.c_auth_checkedPhone(); if (mtpIsTrue(d.vphone_registered)) { hidePhoneError(); _checkRequest->start(1000); _sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(0), MTP_string(_sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail)); } else { showSignup(); _sentRequest = 0; } }
void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) { stopCheck(); enableAll(false); if (result.type() == mtpc_auth_sentCode) { const MTPDauth_sentCode &d(result.c_auth_sentCode()); intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v); intro()->setCallTimeout(d.vsend_call_timeout.v); } else if (result.type() == mtpc_auth_sentAppCode) { const MTPDauth_sentAppCode &d(result.c_auth_sentAppCode()); intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.vphone_registered.v); intro()->setCallTimeout(d.vsend_call_timeout.v); intro()->setCodeByTelegram(true); } intro()->onIntroNext(); }
void IntroPhone::phoneCheckDone(const MTPauth_CheckedPhone &result) { stopCheck(); const MTPDauth_checkedPhone &d(result.c_auth_checkedPhone()); if (d.vphone_registered.v) { disableAll(); showError(""); checkRequest.start(1000); sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(5), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Application::language())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } else { showError(lang(lng_bad_phone_noreg), true); enableAll(true); } }
void IntroPwdCheck::onCheckRequest() { int32 status = MTP::state(sentRequest); if (status < 0) { int32 leftms = -status; if (leftms >= 1000) { MTP::cancel(sentRequest); sentRequest = 0; if (!_pwdField.isEnabled()) { _pwdField.setDisabled(false); _codeField.setDisabled(false); activate(); } } } if (!sentRequest && status == MTP::RequestSent) { stopCheck(); } }
void IntroPhone::phoneCheckDone(const MTPauth_CheckedPhone &result) { stopCheck(); const auto &d(result.c_auth_checkedPhone()); if (mtpIsTrue(d.vphone_registered)) { disableAll(); showError(QString()); checkRequest.start(1000); MTPauth_SendCode::Flags flags = 0; sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } else { showError(lang(lng_bad_phone_noreg), true); enableAll(true); sentRequest = 0; } }
//------------------------------------------------- void itemSelector::update() { if(!_startCheck) { return; } _itemSelector.update(); if(_itemSelector.getIsMovieDone()) { if(_Callback) { _clickAudio.play(); _Callback(); } stopCheck(); } }
void IntroCode::onCheckRequest() { int32 status = MTP::state(sentRequest); if (status < 0) { int32 leftms = -status; if (leftms >= 1000) { if (sentRequest) { MTP::cancel(sentRequest); sentCode = ""; } sentRequest = 0; if (!code.isEnabled()) { code.setDisabled(false); code.setFocus(); } } } if (!sentRequest && status == MTP::RequestSent) { stopCheck(); } }
bool IntroPhone::phoneSubmitFail(const RPCError &error) { stopCheck(); const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID") { // show error showError(lang(lng_bad_phone)); enableAll(true); return true; } else if (mtpIsFlood(error)) { showError(lang(lng_flood_error)); enableAll(true); return true; } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } enableAll(true); return false; }
bool IntroPhone::phoneSubmitFail(const RPCError &error) { stopCheck(); const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID") { // show error showError(lang(lng_bad_phone)); enableAll(true); return true; } if (QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(err).hasMatch()) { showError(lang(lng_flood_error)); enableAll(true); return true; } if (cDebug()) { // internal server error showError(err + ": " + error.description()); } else { showError(lang(lng_server_error)); } enableAll(true); return false; }
void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) { stopCheck(); _sentRequest = 0; if (result.type() != mtpc_auth_sentCode) { showPhoneError(&Lang::Hard::ServerError); return; } const auto &d = result.c_auth_sentCode(); fillSentCodeData(d); getData()->phone = _sentPhone; getData()->phoneHash = qba(d.vphone_code_hash); getData()->phoneIsRegistered = d.is_phone_registered(); if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) { getData()->callStatus = Widget::Data::CallStatus::Waiting; getData()->callTimeout = d.has_timeout() ? d.vtimeout.v : 60; } else { getData()->callStatus = Widget::Data::CallStatus::Disabled; getData()->callTimeout = 0; } goNext(new Intro::CodeWidget(parentWidget(), getData())); }
void SearchContext::searchProc() { int id = searchID_; HANDLE findHandle = INVALID_HANDLE_VALUE; StringList paths; paths = params_.paths; RegexList filespecRegexes; pcre *matchRegex = NULL; directoriesSearched_ = 0; directoriesSkipped_ = 0; filesSearched_ = 0; filesSkipped_ = 0; filesWithHits_ = 0; linesWithHits_ = 0; hits_ = 0; unsigned int startTick = GetTickCount(); bool filespecUsesRegexes = ((params_.flags & SF_FILESPEC_REGEXES) != 0); bool matchUsesRegexes = ((params_.flags & SF_MATCH_REGEXES) != 0); delete pokeData_; pokeData_ = new PokeData; if(matchUsesRegexes) { const char *error; int erroffset; int flags = 0; if(!(params_.flags & SF_MATCH_CASE_SENSITIVE)) flags |= PCRE_CASELESS; matchRegex = pcre_compile(params_.match.c_str(), flags, &error, &erroffset, NULL); if(!matchRegex) { MessageBox(window_, error, "Match Regex Error", MB_OK); goto cleanup; } } for(StringList::iterator it = params_.filespecs.begin(); it != params_.filespecs.end(); ++it) { std::string regexString = it->c_str(); if(!filespecUsesRegexes) convertWildcard(regexString); int flags = 0; if(!(params_.flags & SF_FILESPEC_CASE_SENSITIVE)) flags |= PCRE_CASELESS; const char *error; int erroffset; pcre *regex = pcre_compile(regexString.c_str(), flags, &error, &erroffset, NULL); if(regex) filespecRegexes.push_back(regex); else { MessageBox(window_, error, "Filespec Regex Error", MB_OK); goto cleanup; } } PostMessage(window_, WM_SEARCHCONTEXT_STATE, 1, 0); while(!paths.empty()) { directoriesSearched_++; stopCheck(); std::string currentSearchPath = paths.back(); std::string currentSearchWildcard = currentSearchPath + "\\*"; paths.pop_back(); WIN32_FIND_DATA wfd; findHandle = FindFirstFile(currentSearchWildcard.c_str(), &wfd); if(findHandle == INVALID_HANDLE_VALUE) continue; while(FindNextFile(findHandle, &wfd)) { stopCheck(); bool isDirectory = ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); if((wfd.cFileName[0] == '.') || (wfd.cFileName[0] == 0)) { if(isDirectory) directoriesSkipped_++; else filesSkipped_++; continue; } std::string filename = currentSearchPath; filename += "\\"; filename += wfd.cFileName; if(isDirectory) { if(params_.flags & SF_RECURSIVE) paths.push_back(filename); } else { if(searchFile(id, filename, filespecRegexes, matchRegex)) { filesSearched_++; } else { filesSkipped_++; } poke(id, "", HighlightList(), 0, false); } } if(findHandle != INVALID_HANDLE_VALUE) { FindClose(findHandle); } } cleanup: for(RegexList::iterator it = filespecRegexes.begin(); it != filespecRegexes.end(); ++it) { pcre_free(*it); } if(matchRegex) pcre_free(matchRegex); filespecRegexes.clear(); if(!stop_) { unsigned int endTick = GetTickCount(); char buffer[512]; float sec = (endTick - startTick) / 1000.0f; const char *verb = "searched"; if(params_.flags & SF_REPLACE) verb = "updated"; sprintf(buffer, "\n%d hits in %d lines across %d files.\n%d directories scanned, %d files %s, %d files skipped (%3.3f sec)", hits_, linesWithHits_, filesWithHits_, directoriesSearched_, filesSearched_, verb, filesSkipped_, sec); poke(id, buffer, HighlightList(), 0, true); } delete pokeData_; pokeData_ = NULL; PostMessage(window_, WM_SEARCHCONTEXT_STATE, 0, 0); }