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(), mtpIsTrue(d.vphone_registered)); 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(), mtpIsTrue(d.vphone_registered)); intro()->setCallTimeout(d.vsend_call_timeout.v); intro()->setCodeByTelegram(true); } intro()->onIntroNext(); }
void UsernameBox::onCheckDone(const MTPBool &result) { _checkRequestId = 0; QString newError = (mtpIsTrue(result) || _checkUsername == App::self()->username) ? QString() : lang(lng_username_occupied); QString newGood = newError.isEmpty() ? lang(lng_username_available) : QString(); if (_errorText != newError || _goodText != newGood) { _errorText = newError; _goodText = newGood; update(); } }
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::phoneCheckDone(const MTPauth_CheckedPhone &result) { stopCheck(); const MTPDauth_checkedPhone &d(result.c_auth_checkedPhone()); if (mtpIsTrue(d.vphone_registered)) { disableAll(); showError(""); checkRequest.start(1000); sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(5), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Global::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } else { showError(lang(lng_bad_phone_noreg), true); enableAll(true); } }
void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestId req) { const MTPDuserFull &d(result.c_userFull()); App::feedUsers(MTP_vector<MTPUser>(1, d.vuser), false); App::feedPhoto(d.vprofile_photo); App::feedUserLink(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link, false); App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); peer->asUser()->setBotInfo(d.vbot_info); peer->asUser()->blocked = mtpIsTrue(d.vblocked) ? UserIsBlocked : UserIsNotBlocked; if (req) { QMap<PeerData*, mtpRequestId>::iterator i = _fullPeerRequests.find(peer); if (i != _fullPeerRequests.cend() && i.value() == req) { _fullPeerRequests.erase(i); } } App::clearPeerUpdated(peer); emit fullPeerUpdated(peer); App::emitPeerUpdated(); }