Update layer to 104.

GitOrigin-RevId: a83eaf0a77fba5ccb0d34f690b2031c2ff5550f2
This commit is contained in:
levlam 2019-11-08 19:23:05 +03:00
parent 9628ec78df
commit 56eb8e0f9a
10 changed files with 56 additions and 51 deletions

View File

@ -111,11 +111,11 @@ userStatusLastMonth#77ebc742 = UserStatus;
chatEmpty#9ba2d800 id:int = Chat; chatEmpty#9ba2d800 id:int = Chat;
chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat; chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
chatForbidden#7328bdb id:int title:string = Chat; chatForbidden#7328bdb id:int title:string = Chat;
channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat; channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#1b7c9db3 flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull; chatFull#1b7c9db3 flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;
channelFull#10916653 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation pts:int = ChatFull; channelFull#2d895c74 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_view_stats:flags.12?true can_set_location:flags.16?true id:int about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?int migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?int location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int pts:int = ChatFull;
chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant;
chatParticipantCreator#da13538a user_id:int = ChatParticipant; chatParticipantCreator#da13538a user_id:int = ChatParticipant;
@ -182,9 +182,10 @@ photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
geoPointEmpty#1117dd5f = GeoPoint; geoPointEmpty#1117dd5f = GeoPoint;
geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint; geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode; auth.sentCode#5e002502 flags:# type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode;
auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization; auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
auth.authorizationSignUpRequired#44747e9a flags:# terms_of_service:flags.0?help.TermsOfService = auth.Authorization;
auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization; auth.exportedAuthorization#df969c2d id:int bytes:bytes = auth.ExportedAuthorization;
@ -504,6 +505,7 @@ chatInvite#dfc2f58e flags:# channel:flags.0?true broadcast:flags.1?true public:f
inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet; stickerSet#eeb46f27 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumb:flags.4?PhotoSize thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
@ -567,8 +569,8 @@ channelMessagesFilter#cd77d957 flags:# exclude_new_messages:flags.1?true ranges:
channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant; channelParticipant#15ebac1d user_id:int date:int = ChannelParticipant;
channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant; channelParticipantSelf#a3289a6d user_id:int inviter_id:int date:int = ChannelParticipant;
channelParticipantCreator#e3e2e1f9 user_id:int = ChannelParticipant; channelParticipantCreator#808d15a4 flags:# user_id:int rank:flags.0?string = ChannelParticipant;
channelParticipantAdmin#5daa6e23 flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights = ChannelParticipant; channelParticipantAdmin#ccbebbaf flags:# can_edit:flags.0?true self:flags.1?true user_id:int inviter_id:flags.1?int promoted_by:int date:int admin_rights:ChatAdminRights rank:flags.2?string = ChannelParticipant;
channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant; channelParticipantBanned#1c0facaf flags:# left:flags.0?true user_id:int kicked_by:int date:int banned_rights:ChatBannedRights = ChannelParticipant;
channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter; channelParticipantsRecent#de3f3c79 = ChannelParticipantsFilter;
@ -769,7 +771,7 @@ payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password
payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo; payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult; payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;
payments.paymentVerficationNeeded#6b56b921 url:string = payments.PaymentResult; payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;
payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt; payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
@ -836,6 +838,7 @@ channelAdminLogEventActionDefaultBannedRights#2df5fc0a prev_banned_rights:ChatBa
channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionStopPoll#8f079643 message:Message = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction; channelAdminLogEventActionChangeLinkedChat#a26f881b prev_value:int new_value:int = ChannelAdminLogEventAction;
channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction; channelAdminLogEventActionChangeLocation#e6b76ae prev_value:ChannelLocation new_value:ChannelLocation = ChannelAdminLogEventAction;
channelAdminLogEventActionToggleSlowMode#53909779 prev_value:int new_value:int = ChannelAdminLogEventAction;
channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channelAdminLogEvent#3b5a3e40 id:long date:int user_id:int action:ChannelAdminLogEventAction = ChannelAdminLogEvent;
@ -1011,7 +1014,7 @@ inputWallPaperSlug#72091c80 slug:string = InputWallPaper;
account.wallPapersNotModified#1c199183 = account.WallPapers; account.wallPapersNotModified#1c199183 = account.WallPapers;
account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers; account.wallPapers#702b65a9 hash:int wallpapers:Vector<WallPaper> = account.WallPapers;
codeSettings#302f59f3 flags:# allow_flashcall:flags.0?true current_number:flags.1?true app_hash_persistent:flags.2?true app_hash:flags.3?string = CodeSettings; codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings;
wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings; wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings;
@ -1062,7 +1065,7 @@ invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X;
invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X;
auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode; auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode;
auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signUp#80eee427 phone_number:string phone_code_hash:string first_name:string last_name:string = auth.Authorization;
auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization;
auth.logOut#5717da40 = Bool; auth.logOut#5717da40 = Bool;
auth.resetAuthorizations#9fab0d1a = Bool; auth.resetAuthorizations#9fab0d1a = Bool;
@ -1281,7 +1284,7 @@ photos.deletePhotos#87cf7f2f id:Vector<InputPhoto> = Vector<long>;
photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos;
upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool;
upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; upload.getFile#b15a9afc flags:# precise:flags.0?true location:InputFileLocation offset:int limit:int = upload.File;
upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool;
upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile; upload.getWebFile#24e6818d location:InputWebFileLocation offset:int limit:int = upload.WebFile;
upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile; upload.getCdnFile#2000bcc3 file_token:bytes offset:int limit:int = upload.CdnFile;
@ -1319,7 +1322,7 @@ channels.getParticipant#546dd7a6 channel:InputChannel user_id:InputUser = channe
channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats; channels.getChannels#a7f6bbb id:Vector<InputChannel> = messages.Chats;
channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull; channels.getFullChannel#8736a09 channel:InputChannel = messages.ChatFull;
channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates; channels.createChannel#3d5fb10f flags:# broadcast:flags.0?true megagroup:flags.1?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string = Updates;
channels.editAdmin#70f893ba channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights = Updates; channels.editAdmin#d33c8902 channel:InputChannel user_id:InputUser admin_rights:ChatAdminRights rank:string = Updates;
channels.editTitle#566decd0 channel:InputChannel title:string = Updates; channels.editTitle#566decd0 channel:InputChannel title:string = Updates;
channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates; channels.editPhoto#f12e57c9 channel:InputChannel photo:InputChatPhoto = Updates;
channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool; channels.checkUsername#10e6bd2c channel:InputChannel username:string = Bool;
@ -1342,6 +1345,7 @@ channels.getGroupsForDiscussion#f5dad378 = messages.Chats;
channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool; channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates;
channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool;
channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;

Binary file not shown.

View File

@ -254,10 +254,10 @@ void AuthManager::register_user(uint64 query_id, string first_name, string last_
last_name = clean_name(last_name, MAX_NAME_LENGTH); last_name = clean_name(last_name, MAX_NAME_LENGTH);
start_net_query( start_net_query(
NetQueryType::SignUp, NetQueryType::SignUp,
G()->net_query_creator().create(create_storer(telegram_api::auth_signUp(send_code_helper_.phone_number().str(), G()->net_query_creator().create(
send_code_helper_.phone_code_hash().str(), create_storer(telegram_api::auth_signUp(send_code_helper_.phone_number().str(),
code_, first_name, last_name)), send_code_helper_.phone_code_hash().str(), first_name, last_name)),
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off)); DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
} }
void AuthManager::check_password(uint64 query_id, string password) { void AuthManager::check_password(uint64 query_id, string password) {
@ -391,10 +391,6 @@ void AuthManager::on_send_code_result(NetQueryPtr &result) {
LOG(INFO) << "Receive " << to_string(sent_code); LOG(INFO) << "Receive " << to_string(sent_code);
if (terms_of_service_.get_id().empty()) {
terms_of_service_ = TermsOfService(std::move(sent_code->terms_of_service_));
}
send_code_helper_.on_sent_code(std::move(sent_code)); send_code_helper_.on_sent_code(std::move(sent_code));
update_state(State::WaitCode, true); update_state(State::WaitCode, true);
@ -476,9 +472,7 @@ void AuthManager::on_authentication_result(NetQueryPtr &result, bool expected_fl
} }
return; return;
} }
auto sign_in = r_sign_in.move_as_ok(); on_authorization(r_sign_in.move_as_ok());
CHECK(sign_in->get_id() == telegram_api::auth_authorization::ID);
on_authorization(std::move(sign_in));
} }
void AuthManager::on_log_out_result(NetQueryPtr &result) { void AuthManager::on_log_out_result(NetQueryPtr &result) {
@ -549,14 +543,26 @@ void AuthManager::on_delete_account_result(NetQueryPtr &result) {
} }
} }
void AuthManager::on_authorization(tl_object_ptr<telegram_api::auth_authorization> auth) { void AuthManager::on_authorization(tl_object_ptr<telegram_api::auth_Authorization> auth_ptr) {
if (state_ == State::Ok) { if (state_ == State::Ok) {
LOG(WARNING) << "Ignore duplicated auth.authorization"; LOG(WARNING) << "Ignore duplicated auth.Authorization";
if (query_id_ != 0) { if (query_id_ != 0) {
on_query_ok(); on_query_ok();
} }
return; return;
} }
CHECK(auth_ptr != nullptr);
if (auth_ptr->get_id() == telegram_api::auth_authorizationSignUpRequired::ID) {
auto sign_up_required = telegram_api::move_object_as<telegram_api::auth_authorizationSignUpRequired>(auth_ptr);
terms_of_service_ = TermsOfService(std::move(sign_up_required->terms_of_service_));
update_state(State::WaitRegistration);
if (query_id_ != 0) {
on_query_ok();
}
return;
}
auto auth = telegram_api::move_object_as<telegram_api::auth_authorization>(auth_ptr);
G()->shared_config().set_option_integer("authorization_date", G()->unix_time()); G()->shared_config().set_option_integer("authorization_date", G()->unix_time());
if (was_check_bot_token_) { if (was_check_bot_token_) {
is_bot_ = true; is_bot_ = true;
@ -610,12 +616,6 @@ void AuthManager::on_result(NetQueryPtr result) {
DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off)); DcId::main(), NetQuery::Type::Common, NetQuery::AuthFlag::Off));
return; return;
} }
if (type == NetQueryType::SignIn && result->error().message() == CSlice("PHONE_NUMBER_UNOCCUPIED")) {
code_ = "11111";
update_state(State::WaitRegistration);
on_query_ok();
return;
}
if (type != NetQueryType::LogOut) { if (type != NetQueryType::LogOut) {
if (query_id_ != 0) { if (query_id_ != 0) {
if (state_ == State::WaitPhoneNumber) { if (state_ == State::WaitPhoneNumber) {
@ -697,7 +697,7 @@ bool AuthManager::load_state() {
return false; return false;
} }
if (!db_state.state_timestamp_.is_in_past()) { if (!db_state.state_timestamp_.is_in_past()) {
LOG(INFO) << "Ignore auth_state: timestamp in future"; LOG(INFO) << "Ignore auth_state: timestamp in the future";
return false; return false;
} }
if (Timestamp::at(db_state.state_timestamp_.at() + 5 * 60).is_in_past()) { if (Timestamp::at(db_state.state_timestamp_.at() + 5 * 60).is_in_past()) {
@ -708,11 +708,10 @@ bool AuthManager::load_state() {
LOG(INFO) << "Load auth_state from database: " << tag("state", static_cast<int32>(db_state.state_)); LOG(INFO) << "Load auth_state from database: " << tag("state", static_cast<int32>(db_state.state_));
if (db_state.state_ == State::WaitCode) { if (db_state.state_ == State::WaitCode) {
send_code_helper_ = std::move(db_state.send_code_helper_); send_code_helper_ = std::move(db_state.send_code_helper_);
terms_of_service_ = std::move(db_state.terms_of_service_);
} else if (db_state.state_ == State::WaitPassword) { } else if (db_state.state_ == State::WaitPassword) {
wait_password_state_ = std::move(db_state.wait_password_state_); wait_password_state_ = std::move(db_state.wait_password_state_);
} else if (db_state.state_ == State::WaitRegistration) { } else if (db_state.state_ == State::WaitRegistration) {
code_ = "11111"; // the code has already been checked send_code_helper_ = std::move(db_state.send_code_helper_);
terms_of_service_ = std::move(db_state.terms_of_service_); terms_of_service_ = std::move(db_state.terms_of_service_);
} else { } else {
UNREACHABLE(); UNREACHABLE();
@ -731,12 +730,12 @@ void AuthManager::save_state() {
DbState db_state = [&] { DbState db_state = [&] {
if (state_ == State::WaitCode) { if (state_ == State::WaitCode) {
return DbState::wait_code(api_id_, api_hash_, send_code_helper_, terms_of_service_); return DbState::wait_code(api_id_, api_hash_, send_code_helper_);
} else if (state_ == State::WaitPassword) { } else if (state_ == State::WaitPassword) {
return DbState::wait_password(api_id_, api_hash_, wait_password_state_); return DbState::wait_password(api_id_, api_hash_, wait_password_state_);
} else { } else {
CHECK(state_ == State::WaitRegistration); CHECK(state_ == State::WaitRegistration);
return DbState::wait_registration(api_id_, api_hash_, terms_of_service_); return DbState::wait_registration(api_id_, api_hash_, send_code_helper_, terms_of_service_);
} }
}(); }();
G()->td_db()->get_binlog_pmc()->set("auth_state", log_event_store(db_state).as_slice().str()); G()->td_db()->get_binlog_pmc()->set("auth_state", log_event_store(db_state).as_slice().str());

View File

@ -112,12 +112,9 @@ class AuthManager : public NetActor {
TermsOfService terms_of_service_; TermsOfService terms_of_service_;
DbState() = default; DbState() = default;
// TODO layer 104+: remove terms_of_service static DbState wait_code(int32 api_id, string api_hash, SendCodeHelper send_code_helper) {
static DbState wait_code(int32 api_id, string api_hash, SendCodeHelper send_code_helper,
TermsOfService terms_of_service) {
DbState state(State::WaitCode, api_id, api_hash); DbState state(State::WaitCode, api_id, api_hash);
state.send_code_helper_ = std::move(send_code_helper); state.send_code_helper_ = std::move(send_code_helper);
state.terms_of_service_ = std::move(terms_of_service);
return state; return state;
} }
@ -127,8 +124,10 @@ class AuthManager : public NetActor {
return state; return state;
} }
static DbState wait_registration(int32 api_id, string api_hash, TermsOfService terms_of_service) { static DbState wait_registration(int32 api_id, string api_hash, SendCodeHelper send_code_helper,
TermsOfService terms_of_service) {
DbState state(State::WaitRegistration, api_id, api_hash); DbState state(State::WaitRegistration, api_id, api_hash);
state.send_code_helper_ = std::move(send_code_helper);
state.terms_of_service_ = std::move(terms_of_service); state.terms_of_service_ = std::move(terms_of_service);
return state; return state;
} }
@ -191,7 +190,7 @@ class AuthManager : public NetActor {
void on_authentication_result(NetQueryPtr &result, bool expected_flag); void on_authentication_result(NetQueryPtr &result, bool expected_flag);
void on_log_out_result(NetQueryPtr &result); void on_log_out_result(NetQueryPtr &result);
void on_delete_account_result(NetQueryPtr &result); void on_delete_account_result(NetQueryPtr &result);
void on_authorization(tl_object_ptr<telegram_api::auth_authorization> auth); void on_authorization(tl_object_ptr<telegram_api::auth_Authorization> auth_ptr);
void on_result(NetQueryPtr result) override; void on_result(NetQueryPtr result) override;

View File

@ -52,11 +52,13 @@ void AuthManager::DbState::store(StorerT &storer) const {
bool is_pbkdf2_supported = true; bool is_pbkdf2_supported = true;
bool is_srp_supported = true; bool is_srp_supported = true;
bool is_wait_registration_supported = true; bool is_wait_registration_supported = true;
bool is_wait_registration_stores_phone_number = true;
BEGIN_STORE_FLAGS(); BEGIN_STORE_FLAGS();
STORE_FLAG(has_terms_of_service); STORE_FLAG(has_terms_of_service);
STORE_FLAG(is_pbkdf2_supported); STORE_FLAG(is_pbkdf2_supported);
STORE_FLAG(is_srp_supported); STORE_FLAG(is_srp_supported);
STORE_FLAG(is_wait_registration_supported); STORE_FLAG(is_wait_registration_supported);
STORE_FLAG(is_wait_registration_stores_phone_number);
END_STORE_FLAGS(); END_STORE_FLAGS();
store(state_, storer); store(state_, storer);
store(api_id_, storer); store(api_id_, storer);
@ -72,6 +74,7 @@ void AuthManager::DbState::store(StorerT &storer) const {
} else if (state_ == State::WaitPassword) { } else if (state_ == State::WaitPassword) {
store(wait_password_state_, storer); store(wait_password_state_, storer);
} else if (state_ == State::WaitRegistration) { } else if (state_ == State::WaitRegistration) {
store(send_code_helper_, storer);
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
@ -84,15 +87,17 @@ void AuthManager::DbState::parse(ParserT &parser) {
bool is_pbkdf2_supported = false; bool is_pbkdf2_supported = false;
bool is_srp_supported = false; bool is_srp_supported = false;
bool is_wait_registration_supported = false; bool is_wait_registration_supported = false;
bool is_wait_registration_stores_phone_number = false;
if (parser.version() >= static_cast<int32>(Version::AddTermsOfService)) { if (parser.version() >= static_cast<int32>(Version::AddTermsOfService)) {
BEGIN_PARSE_FLAGS(); BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_terms_of_service); PARSE_FLAG(has_terms_of_service);
PARSE_FLAG(is_pbkdf2_supported); PARSE_FLAG(is_pbkdf2_supported);
PARSE_FLAG(is_srp_supported); PARSE_FLAG(is_srp_supported);
PARSE_FLAG(is_wait_registration_supported); PARSE_FLAG(is_wait_registration_supported);
PARSE_FLAG(is_wait_registration_stores_phone_number);
END_PARSE_FLAGS(); END_PARSE_FLAGS();
} }
if (!is_wait_registration_supported) { if (!is_wait_registration_stores_phone_number) {
return parser.set_error("Have no wait registration support"); return parser.set_error("Have no wait registration support");
} }
CHECK(is_pbkdf2_supported); CHECK(is_pbkdf2_supported);
@ -112,6 +117,7 @@ void AuthManager::DbState::parse(ParserT &parser) {
} else if (state_ == State::WaitPassword) { } else if (state_ == State::WaitPassword) {
parse(wait_password_state_, parser); parse(wait_password_state_, parser);
} else if (state_ == State::WaitRegistration) { } else if (state_ == State::WaitRegistration) {
parse(send_code_helper_, parser);
} else { } else {
parser.set_error(PSTRING() << "Unexpected " << tag("state", static_cast<int32>(state_))); parser.set_error(PSTRING() << "Unexpected " << tag("state", static_cast<int32>(state_)));
} }

View File

@ -1767,7 +1767,7 @@ class EditChannelAdminQuery : public Td::ResultHandler {
auto input_channel = td->contacts_manager_->get_input_channel(channel_id); auto input_channel = td->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr); CHECK(input_channel != nullptr);
send_query(G()->net_query_creator().create(create_storer(telegram_api::channels_editAdmin( send_query(G()->net_query_creator().create(create_storer(telegram_api::channels_editAdmin(
std::move(input_channel), std::move(input_user), status.get_chat_admin_rights())))); std::move(input_channel), std::move(input_user), status.get_chat_admin_rights(), string()))));
} }
void on_result(uint64 id, BufferSlice packet) override { void on_result(uint64 id, BufferSlice packet) override {

View File

@ -367,8 +367,8 @@ class SendPaymentFormQuery : public Td::ResultHandler {
promise_.set_value(make_tl_object<td_api::paymentResult>(true, string())); promise_.set_value(make_tl_object<td_api::paymentResult>(true, string()));
return; return;
} }
case telegram_api::payments_paymentVerficationNeeded::ID: { case telegram_api::payments_paymentVerificationNeeded::ID: {
auto result = move_tl_object_as<telegram_api::payments_paymentVerficationNeeded>(payment_result); auto result = move_tl_object_as<telegram_api::payments_paymentVerificationNeeded>(payment_result);
promise_.set_value(make_tl_object<td_api::paymentResult>(false, std::move(result->url_))); promise_.set_value(make_tl_object<td_api::paymentResult>(false, std::move(result->url_)));
return; return;
} }

View File

@ -38,7 +38,6 @@ Result<telegram_api::auth_resendCode> SendCodeHelper::resend_code() {
telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_code_settings(const Settings &settings) { telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_code_settings(const Settings &settings) {
int32 flags = 0; int32 flags = 0;
string app_hash;
if (settings != nullptr) { if (settings != nullptr) {
if (settings->allow_flash_call_) { if (settings->allow_flash_call_) {
flags |= telegram_api::codeSettings::ALLOW_FLASHCALL_MASK; flags |= telegram_api::codeSettings::ALLOW_FLASHCALL_MASK;
@ -47,13 +46,11 @@ telegram_api::object_ptr<telegram_api::codeSettings> SendCodeHelper::get_input_c
flags |= telegram_api::codeSettings::CURRENT_NUMBER_MASK; flags |= telegram_api::codeSettings::CURRENT_NUMBER_MASK;
} }
if (settings->allow_sms_retriever_api_) { if (settings->allow_sms_retriever_api_) {
flags |= telegram_api::codeSettings::APP_HASH_PERSISTENT_MASK; flags |= telegram_api::codeSettings::ALLOW_APP_HASH_MASK;
flags |= telegram_api::codeSettings::APP_HASH_MASK;
app_hash = "ignored1234";
} }
} }
return telegram_api::make_object<telegram_api::codeSettings>(flags, false /*ignored*/, false /*ignored*/, return telegram_api::make_object<telegram_api::codeSettings>(flags, false /*ignored*/, false /*ignored*/,
false /*ignored*/, app_hash); false /*ignored*/);
} }
Result<telegram_api::auth_sendCode> SendCodeHelper::send_code(Slice phone_number, const Settings &settings, Result<telegram_api::auth_sendCode> SendCodeHelper::send_code(Slice phone_number, const Settings &settings,

View File

@ -8,7 +8,7 @@
namespace td { namespace td {
constexpr int32 MTPROTO_LAYER = 103; constexpr int32 MTPROTO_LAYER = 104;
enum class Version : int32 { enum class Version : int32 {
Initial, Initial,

View File

@ -241,7 +241,7 @@ Result<std::pair<NetQueryPtr, bool>> FileDownloader::start_part(Part part, int32
remote_.is_web() remote_.is_web()
? create_storer(telegram_api::upload_getWebFile(remote_.as_input_web_file_location(), ? create_storer(telegram_api::upload_getWebFile(remote_.as_input_web_file_location(),
static_cast<int32>(part.offset), static_cast<int32>(size))) static_cast<int32>(part.offset), static_cast<int32>(size)))
: create_storer(telegram_api::upload_getFile(remote_.as_input_file_location(), : create_storer(telegram_api::upload_getFile(0, false /*ignored*/, remote_.as_input_file_location(),
static_cast<int32>(part.offset), static_cast<int32>(size))), static_cast<int32>(part.offset), static_cast<int32>(size))),
dc_id, is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download); dc_id, is_small_ ? NetQuery::Type::DownloadSmall : NetQuery::Type::Download);
} else { } else {