2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 23:45:44 +00:00

Use getters in MTP classes.

This commit is contained in:
John Preston
2019-07-05 15:38:38 +02:00
parent 3ca28c0cf9
commit 567bf60644
100 changed files with 2807 additions and 2672 deletions

View File

@@ -167,22 +167,24 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const
auto codeLength = 0;
auto &data = result.c_auth_sentCode();
switch (data.vtype.type()) {
switch (data.vtype().type()) {
case mtpc_auth_sentCodeTypeApp:
LOG(("Error: should not be in-app code!"));
showError(Lang::Hard::ServerError());
return;
case mtpc_auth_sentCodeTypeSms: codeLength = data.vtype.c_auth_sentCodeTypeSms().vlength.v; break;
case mtpc_auth_sentCodeTypeCall: codeLength = data.vtype.c_auth_sentCodeTypeCall().vlength.v; break;
case mtpc_auth_sentCodeTypeSms: codeLength = data.vtype().c_auth_sentCodeTypeSms().vlength().v; break;
case mtpc_auth_sentCodeTypeCall: codeLength = data.vtype().c_auth_sentCodeTypeCall().vlength().v; break;
case mtpc_auth_sentCodeTypeFlashCall:
LOG(("Error: should not be flashcall!"));
showError(Lang::Hard::ServerError());
return;
}
auto phoneCodeHash = qs(data.vphone_code_hash);
auto phoneCodeHash = qs(data.vphone_code_hash());
auto callTimeout = 0;
if (data.has_next_type() && data.vnext_type.type() == mtpc_auth_codeTypeCall) {
callTimeout = data.has_timeout() ? data.vtimeout.v : 60;
if (const auto nextType = data.vnext_type()) {
if (nextType->type() == mtpc_auth_codeTypeCall) {
callTimeout = data.vtimeout().value_or(60);
}
}
Ui::show(
Box<EnterCode>(