diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index 0287acf5f..3208541fb 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -178,7 +178,7 @@ messageActionPaymentSent#96163f56 flags:# recurring_init:flags.2?true recurring_ messageActionPhoneCall#80e11a7f flags:# video:flags.2?true call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction; messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; -messageActionBotAllowed#abe9affe domain:string = MessageAction; +messageActionBotAllowed#c516d679 flags:# attach_menu:flags.1?true domain:flags.0?string app:flags.2?BotApp = MessageAction; messageActionSecureValuesSentMe#1b287353 values:Vector credentials:SecureCredentialsEncrypted = MessageAction; messageActionSecureValuesSent#d95c6154 types:Vector = MessageAction; messageActionContactSignUp#f3f25f76 = MessageAction; @@ -195,7 +195,6 @@ messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = Messa messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; -messageActionAttachMenuBotAllowed#e7e75f97 = MessageAction; messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; @@ -434,7 +433,7 @@ upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true this_port_only:flags.5?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; -config#232566ac flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true pfs_enabled:flags.13?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int pinned_infolder_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction = Config; +config#cc1a241e flags:# default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true revoke_pm_inbox:flags.6?true blocked_mode:flags.8?true force_try_ipv6:flags.14?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector dc_txt_domain_name:string chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int channels_read_media_period:int tmp_sessions:flags.0?int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string autoupdate_url_prefix:flags.7?string gif_search_username:flags.9?string venue_search_username:flags.10?string img_search_username:flags.11?string static_maps_provider:flags.12?string caption_length_max:int message_length_max:int webfile_dc_id:int suggested_lang_code:flags.2?string lang_pack_version:flags.2?int base_lang_pack_version:flags.2?int reactions_default:flags.15?Reaction autologin_token:flags.16?string = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -720,7 +719,7 @@ botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1 botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; -messages.botResults#947ca848 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int users:Vector = messages.BotResults; +messages.botResults#e021f2f6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM switch_webview:flags.3?InlineBotWebView results:Vector cache_time:int users:Vector = messages.BotResults; exportedMessageLink#5dab1af4 link:string html:string = ExportedMessageLink; @@ -900,7 +899,7 @@ account.tmpPassword#db64fd34 tmp_password:bytes valid_until:int = account.TmpPas shippingOption#b6213cdf id:string title:string prices:Vector = ShippingOption; -inputStickerSetItem#ffa0a496 flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords = InputStickerSetItem; +inputStickerSetItem#32da9e9c flags:# document:InputDocument emoji:string mask_coords:flags.0?MaskCoords keywords:flags.1?string = InputStickerSetItem; inputPhoneCall#1e36fded id:long access_hash:long = InputPhoneCall; @@ -1342,7 +1341,7 @@ account.resetPasswordFailedWait#e3779861 retry_date:int = account.ResetPasswordR account.resetPasswordRequestedWait#e9effc7d until_date:int = account.ResetPasswordResult; account.resetPasswordOk#e926d63e = account.ResetPasswordResult; -sponsoredMessage#3a836df8 flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector = SponsoredMessage; +sponsoredMessage#fc25b828 flags:# recommended:flags.5?true show_peer_photo:flags.6?true random_id:bytes from_id:flags.3?Peer chat_invite:flags.4?ChatInvite chat_invite_hash:flags.4?string channel_post:flags.2?int start_param:flags.0?string message:string entities:flags.1?Vector sponsor_info:flags.7?string additional_info:flags.8?string = SponsoredMessage; messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; messages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages; @@ -1507,6 +1506,23 @@ autoSaveException#81602d47 peer:Peer settings:AutoSaveSettings = AutoSaveExcepti account.autoSaveSettings#4c3e069d users_settings:AutoSaveSettings chats_settings:AutoSaveSettings broadcasts_settings:AutoSaveSettings exceptions:Vector chats:Vector users:Vector = account.AutoSaveSettings; +help.appConfigNotModified#7cde641d = help.AppConfig; +help.appConfig#dd18782e hash:int config:JSONValue = help.AppConfig; + +inputBotAppID#a920bd7a id:long access_hash:long = InputBotApp; +inputBotAppShortName#908c0407 bot_id:InputUser short_name:string = InputBotApp; + +botAppNotModified#5da674b7 = BotApp; +botApp#95fcd1d6 flags:# id:long access_hash:long short_name:string title:string description:string photo:Photo document:flags.0?Document hash:long = BotApp; + +messages.botApp#eb50adf5 flags:# inactive:flags.0?true request_write_access:flags.1?true app:BotApp = messages.BotApp; + +appWebViewResultUrl#3c1b4f0d url:string = AppWebViewResult; + +inlineBotWebView#b57295d5 text:string url:string = InlineBotWebView; + +readParticipantDate#4a4ff172 user_id:long date:int = ReadParticipantDate; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1708,7 +1724,7 @@ messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Do messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; -messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; +messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool; messages.sendInlineBotResult#d3fbdccb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#48f71778 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.15?int = Updates; @@ -1797,7 +1813,7 @@ messages.getChatInviteImporters#df04dd4e flags:# requested:flags.0?true peer:Inp messages.setHistoryTTL#b80e5fe4 peer:InputPeer period:int = Updates; messages.checkHistoryImportPeer#5dc60f03 peer:InputPeer = messages.CheckedHistoryImportPeer; messages.setChatTheme#e63be13f peer:InputPeer emoticon:string = Updates; -messages.getMessageReadParticipants#2c6f97b7 peer:InputPeer msg_id:int = Vector; +messages.getMessageReadParticipants#31c1c44f peer:InputPeer msg_id:int = Vector; messages.getSearchResultsCalendar#49f0bde9 peer:InputPeer filter:MessagesFilter offset_id:int offset_date:int = messages.SearchResultsCalendar; messages.getSearchResultsPositions#6e9583a3 peer:InputPeer filter:MessagesFilter offset_id:int limit:int = messages.SearchResultsPositions; messages.hideChatJoinRequest#7fe7e815 flags:# approved:flags.0?true peer:InputPeer user_id:InputUser = Updates; @@ -1819,7 +1835,7 @@ messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool; messages.requestWebView#178b480b flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to_msg_id:flags.0?int top_msg_id:flags.9?int send_as:flags.13?InputPeer = WebViewResult; messages.prolongWebView#7ff34309 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int top_msg_id:flags.9?int send_as:flags.13?InputPeer = Bool; -messages.requestSimpleWebView#299bec8e flags:# bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult; +messages.requestSimpleWebView#299bec8e flags:# from_switch_webview:flags.1?true bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult; messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; messages.transcribeAudio#269e9a49 peer:InputPeer msg_id:int = messages.TranscribedAudio; @@ -1840,6 +1856,8 @@ messages.getEmojiStatusGroups#2ecd56cd hash:int = messages.EmojiGroups; messages.getEmojiProfilePhotoGroups#21a548f3 hash:int = messages.EmojiGroups; messages.searchCustomEmoji#2c11c0d7 emoticon:string hash:long = EmojiList; messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool; +messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; +messages.requestAppWebView#8c5a3b3c flags:# write_allowed:flags.0?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = AppWebViewResult; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -1872,7 +1890,7 @@ help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate; help.acceptTermsOfService#ee72f79a id:DataJSON = Bool; help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo; -help.getAppConfig#98914110 = JSONValue; +help.getAppConfig#61e3f854 hash:int = help.AppConfig; help.saveAppLog#6f02f748 events:Vector = Bool; help.getPassportConfig#c661ad08 hash:int = help.PassportConfig; help.getSupportName#d360e72c = help.SupportName; @@ -1949,6 +1967,8 @@ bots.setBotMenuButton#4504d54f user_id:InputUser button:BotMenuButton = Bool; bots.getBotMenuButton#9c60eb28 user_id:InputUser = BotMenuButton; bots.setBotBroadcastDefaultAdminRights#788464e1 admin_rights:ChatAdminRights = Bool; bots.setBotGroupDefaultAdminRights#925ec9ea admin_rights:ChatAdminRights = Bool; +bots.setBotInfo#a365df7a flags:# lang_code:string about:flags.0?string description:flags.1?string = Bool; +bots.getBotInfo#75ec12e6 lang_code:string = Vector; payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm; payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt; @@ -1962,13 +1982,16 @@ payments.assignAppStoreTransaction#80ed747d receipt:bytes purpose:InputStorePaym payments.assignPlayMarketTransaction#dffd50d3 receipt:DataJSON purpose:InputStorePaymentPurpose = Updates; payments.canPurchasePremium#9fc19eb6 purpose:InputStorePaymentPurpose = Bool; -stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true videos:flags.4?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; +stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true animated:flags.1?true videos:flags.4?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector software:flags.3?string = messages.StickerSet; stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet; stickers.changeStickerPosition#ffb6d4ca sticker:InputDocument position:int = messages.StickerSet; stickers.addStickerToSet#8653febe stickerset:InputStickerSet sticker:InputStickerSetItem = messages.StickerSet; -stickers.setStickerSetThumb#9a364e30 stickerset:InputStickerSet thumb:InputDocument = messages.StickerSet; +stickers.setStickerSetThumb#a76a5392 flags:# stickerset:InputStickerSet thumb:flags.0?InputDocument thumb_document_id:flags.1?long = messages.StickerSet; stickers.checkShortName#284b3639 short_name:string = Bool; stickers.suggestShortName#4dafc503 title:string = stickers.SuggestedShortName; +stickers.changeSticker#f5537ebc flags:# sticker:InputDocument emoji:flags.0?string mask_coords:flags.1?MaskCoords keywords:flags.2?string = messages.StickerSet; +stickers.renameStickerSet#124b1c00 stickerset:InputStickerSet title:string = messages.StickerSet; +stickers.deleteStickerSet#87704394 stickerset:InputStickerSet = Bool; phone.getCallConfig#55451fa9 = DataJSON; phone.requestCall#42ff96ed flags:# video:flags.0?true user_id:InputUser random_id:int g_a_hash:bytes protocol:PhoneCallProtocol = phone.PhoneCall; @@ -2017,4 +2040,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; -// LAYER 152 +// LAYER 154 diff --git a/Telegram/SourceFiles/api/api_who_reacted.cpp b/Telegram/SourceFiles/api/api_who_reacted.cpp index 82b178b87..121b75901 100644 --- a/Telegram/SourceFiles/api/api_who_reacted.cpp +++ b/Telegram/SourceFiles/api/api_who_reacted.cpp @@ -228,13 +228,13 @@ struct State { item->history()->peer->input, MTP_int(item->id) ) - ).done([=](const MTPVector &result) { + ).done([=](const MTPVector &result) { auto &entry = context->cacheRead(item); entry.requestId = 0; auto parsed = Peers(); parsed.list.reserve(result.v.size()); for (const auto &id : result.v) { - parsed.list.push_back(UserId(id)); + parsed.list.push_back(UserId(id.data().vuser_id())); } entry.data = std::move(parsed); }).fail([=] { diff --git a/Telegram/SourceFiles/core/ui_integration.cpp b/Telegram/SourceFiles/core/ui_integration.cpp index e3ca5248a..d0d7580cc 100644 --- a/Telegram/SourceFiles/core/ui_integration.cpp +++ b/Telegram/SourceFiles/core/ui_integration.cpp @@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_account.h" #include "main/main_session.h" #include "main/main_app_config.h" +#include "mtproto/mtproto_config.h" #include "window/window_controller.h" #include "mainwindow.h" @@ -48,9 +49,9 @@ const auto kBadPrefix = u"http://"_q; const QString &url, QUrl parsed, const QString &domain) { - const auto &config = Core::App().activeAccount().appConfig(); - const auto token = config.get("autologin_token", {}); - const auto domains = config.get>( + const auto &active = Core::App().activeAccount(); + const auto token = active.mtp().configValues().autologinToken; + const auto domains = active.appConfig().get>( "autologin_domains", {}); if (token.isEmpty() diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index b3f8dbb7a..17d1c84b6 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -1059,7 +1059,10 @@ ServiceAction ParseServiceAction( result.content = content; }, [&](const MTPDmessageActionBotAllowed &data) { auto content = ActionBotAllowed(); - content.domain = ParseString(data.vdomain()); + if (const auto domain = data.vdomain()) { + content.domain = ParseString(*domain); + } + content.attachMenu = data.is_attach_menu(); result.content = content; }, [&](const MTPDmessageActionSecureValuesSentMe &data) { // Should not be in user inbox. @@ -1173,8 +1176,6 @@ ServiceAction ParseServiceAction( + "photos/" + PreparePhotoFileName(++context.photos, date)); result.content = content; - }, [&](const MTPDmessageActionAttachMenuBotAllowed &data) { - result.content = ActionAttachMenuBotAllowed(); }, [&](const MTPDmessageActionRequestedPeer &data) { auto content = ActionRequestedPeer(); content.peerId = ParsePeerId(data.vpeer()); diff --git a/Telegram/SourceFiles/export/data/export_data_types.h b/Telegram/SourceFiles/export/data/export_data_types.h index 13e7ea116..ee665c79e 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.h +++ b/Telegram/SourceFiles/export/data/export_data_types.h @@ -432,6 +432,7 @@ struct ActionCustomAction { struct ActionBotAllowed { Utf8String domain; + bool attachMenu = false; }; struct ActionSecureValuesSent { @@ -512,9 +513,6 @@ struct ActionSuggestProfilePhoto { Photo photo; }; -struct ActionAttachMenuBotAllowed { -}; - struct ActionRequestedPeer { PeerId peerId = 0; int buttonId = 0; @@ -556,7 +554,6 @@ struct ServiceAction { ActionTopicCreate, ActionTopicEdit, ActionSuggestProfilePhoto, - ActionAttachMenuBotAllowed, ActionRequestedPeer> content; }; diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index 23ec0ae9d..6044ef33c 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -1030,8 +1030,11 @@ auto HtmlWriter::Wrap::pushMessage( }, [&](const ActionCustomAction &data) { return data.message; }, [&](const ActionBotAllowed &data) { - return "You allowed this bot to message you when you logged in on " - + SerializeString(data.domain); + return data.attachMenu + ? "You allowed this bot to message you " + "when you added it in the attachment menu."_q + : ("You allowed this bot to message you when you logged in on " + + SerializeString(data.domain)); }, [&](const ActionSecureValuesSent &data) { auto list = std::vector(); for (const auto type : data.types) { @@ -1165,9 +1168,6 @@ auto HtmlWriter::Wrap::pushMessage( return serviceFrom + " changed topic " + parts.join(','); }, [&](const ActionSuggestProfilePhoto &data) { return serviceFrom + " suggests to use this photo"; - }, [&](const ActionAttachMenuBotAllowed &data) { - return "You allowed this bot to message you " - "when you added it in the attachment menu."_q; }, [&](const ActionRequestedPeer &data) { return "requested: "_q/* + data.peerId*/; }, [](v::null_t) { return QByteArray(); }); diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index 3489a0887..eccb6bb0b 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -475,8 +475,12 @@ QByteArray SerializeMessage( pushActor(); push("information_text", data.message); }, [&](const ActionBotAllowed &data) { - pushAction("allow_sending_messages"); - push("reason_domain", data.domain); + if (data.attachMenu) { + pushAction("attach_menu_bot_allowed"); + } else { + pushAction("allow_sending_messages"); + push("reason_domain", data.domain); + } }, [&](const ActionSecureValuesSent &data) { pushAction("send_passport_values"); auto list = std::vector(); @@ -577,9 +581,6 @@ QByteArray SerializeMessage( pushActor(); pushAction("suggest_profile_photo"); pushPhoto(data.photo.image); - }, [&](const ActionAttachMenuBotAllowed &data) { - pushActor(); - pushAction("attach_menu_bot_allowed"); }, [&](const ActionRequestedPeer &data) { pushActor(); pushAction("requested_peer"); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 28b921fbe..ce595def5 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -3685,12 +3685,18 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { auto prepareBotAllowed = [&](const MTPDmessageActionBotAllowed &action) { auto result = PreparedServiceText(); - const auto domain = qs(action.vdomain()); - result.text = tr::lng_action_bot_allowed_from_domain( - tr::now, - lt_domain, - Ui::Text::Link(domain, u"http://"_q + domain), - Ui::Text::WithEntities); + if (action.is_attach_menu()) { + result.text = { + tr::lng_action_attach_menu_bot_allowed(tr::now) + }; + } else { + const auto domain = qs(action.vdomain().value_or_empty()); + result.text = tr::lng_action_bot_allowed_from_domain( + tr::now, + lt_domain, + Ui::Text::Link(domain, u"http://"_q + domain), + Ui::Text::WithEntities); + } return result; }; @@ -4118,13 +4124,6 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { return result; }; - auto prepareAttachMenuBotAllowed = []( - const MTPDmessageActionAttachMenuBotAllowed &action) { - return PreparedServiceText{ { - tr::lng_action_attach_menu_bot_allowed(tr::now) - } }; - }; - auto prepareRequestedPeer = [&]( const MTPDmessageActionRequestedPeer &action) { const auto peerId = peerFromMTP(action.vpeer()); @@ -4216,8 +4215,6 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { return PreparedServiceText{ { tr::lng_message_empty(tr::now) } }; }, [&](const MTPDmessageActionSuggestProfilePhoto &data) { return prepareSuggestProfilePhoto(data); - }, [&](const MTPDmessageActionAttachMenuBotAllowed &data) { - return prepareAttachMenuBotAllowed(data); }, [&](const MTPDmessageActionRequestedPeer &data) { return prepareRequestedPeer(data); }, [](const MTPDmessageActionEmpty &) { diff --git a/Telegram/SourceFiles/main/main_app_config.cpp b/Telegram/SourceFiles/main/main_app_config.cpp index cf5c4ea42..b2556600b 100644 --- a/Telegram/SourceFiles/main/main_app_config.cpp +++ b/Telegram/SourceFiles/main/main_app_config.cpp @@ -40,19 +40,27 @@ void AppConfig::refresh() { return; } _requestId = _api->request(MTPhelp_GetAppConfig( - )).done([=](const MTPJSONValue &result) { + MTP_int(_hash) + )).done([=](const MTPhelp_AppConfig &result) { _requestId = 0; refreshDelayed(); - if (result.type() == mtpc_jsonObject) { + result.match([&](const MTPDhelp_appConfig &data) { + _hash = data.vhash().v; + + const auto &config = data.vconfig(); + if (config.type() != mtpc_jsonObject) { + LOG(("API Error: Unexpected config type.")); + return; + } _data.clear(); - for (const auto &element : result.c_jsonObject().vvalue().v) { + for (const auto &element : config.c_jsonObject().vvalue().v) { element.match([&](const MTPDjsonObjectValue &data) { _data.emplace_or_assign(qs(data.vkey()), data.vvalue()); }); } DEBUG_LOG(("getAppConfig result handled.")); - } - _refreshed.fire({}); + _refreshed.fire({}); + }, [](const MTPDhelp_appConfigNotModified &) {}); }).fail([=] { _requestId = 0; refreshDelayed(); diff --git a/Telegram/SourceFiles/main/main_app_config.h b/Telegram/SourceFiles/main/main_app_config.h index a46c33571..b0273b8de 100644 --- a/Telegram/SourceFiles/main/main_app_config.h +++ b/Telegram/SourceFiles/main/main_app_config.h @@ -76,6 +76,7 @@ private: const not_null _account; std::optional _api; mtpRequestId _requestId = 0; + int32 _hash = 0; base::flat_map _data; rpl::event_stream<> _refreshed; base::flat_set _dismissedSuggestions; diff --git a/Telegram/SourceFiles/mtproto/mtproto_config.cpp b/Telegram/SourceFiles/mtproto/mtproto_config.cpp index c45fefd43..4986f7190 100644 --- a/Telegram/SourceFiles/mtproto/mtproto_config.cpp +++ b/Telegram/SourceFiles/mtproto/mtproto_config.cpp @@ -68,15 +68,15 @@ QByteArray Config::serialize() const { << qint32(_fields.onlineCloudTimeout) << qint32(_fields.notifyCloudDelay) << qint32(_fields.notifyDefaultDelay) - << qint32(_fields.savedGifsLimit) + << qint32(0) // legacy savedGifsLimit << qint32(_fields.editTimeLimit) << qint32(_fields.revokeTimeLimit) << qint32(_fields.revokePrivateTimeLimit) << qint32(_fields.revokePrivateInbox ? 1 : 0) << qint32(_fields.stickersRecentLimit) - << qint32(_fields.stickersFavedLimit) - << qint32(_fields.pinnedDialogsCountMax.current()) - << qint32(_fields.pinnedDialogsInFolderMax.current()) + << qint32(0) // legacy stickersFavedLimit + << qint32(0) // legacy pinnedDialogsCountMax + << qint32(0) // legacy pinnedDialogsInFolderMax << _fields.internalLinksDomain << qint32(_fields.channelsReadMediaPeriod) << qint32(_fields.callReceiveTimeoutMs) @@ -121,6 +121,10 @@ std::unique_ptr Config::FromSerialized(const QByteArray &serialized) { } auto dcOptionsSerialized = QByteArray(); + auto legacySavedGifsLimit = int(); + auto legacyStickersFavedLimit = int(); + auto legacyPinnedDialogsCountMax = 0; + auto legacyPinnedDialogsInFolderMax = 0; auto legacyPhoneCallsEnabled = rpl::variable(); const auto read = [&](auto &field) { using Type = std::remove_reference_t; @@ -157,15 +161,15 @@ std::unique_ptr Config::FromSerialized(const QByteArray &serialized) { read(raw->_fields.onlineCloudTimeout); read(raw->_fields.notifyCloudDelay); read(raw->_fields.notifyDefaultDelay); - read(raw->_fields.savedGifsLimit); + read(legacySavedGifsLimit); read(raw->_fields.editTimeLimit); read(raw->_fields.revokeTimeLimit); read(raw->_fields.revokePrivateTimeLimit); read(raw->_fields.revokePrivateInbox); read(raw->_fields.stickersRecentLimit); - read(raw->_fields.stickersFavedLimit); - read(raw->_fields.pinnedDialogsCountMax); - read(raw->_fields.pinnedDialogsInFolderMax); + read(legacyStickersFavedLimit); + read(legacyPinnedDialogsCountMax); + read(legacyPinnedDialogsInFolderMax); read(raw->_fields.internalLinksDomain); read(raw->_fields.channelsReadMediaPeriod); read(raw->_fields.callReceiveTimeoutMs); @@ -220,17 +224,11 @@ void Config::apply(const MTPDconfig &data) { _fields.onlineCloudTimeout = data.vonline_cloud_timeout_ms().v; _fields.notifyCloudDelay = data.vnotify_cloud_delay_ms().v; _fields.notifyDefaultDelay = data.vnotify_default_delay_ms().v; - _fields.savedGifsLimit = data.vsaved_gifs_limit().v; _fields.editTimeLimit = data.vedit_time_limit().v; _fields.revokeTimeLimit = data.vrevoke_time_limit().v; _fields.revokePrivateTimeLimit = data.vrevoke_pm_time_limit().v; _fields.revokePrivateInbox = data.is_revoke_pm_inbox(); _fields.stickersRecentLimit = data.vstickers_recent_limit().v; - _fields.stickersFavedLimit = data.vstickers_faved_limit().v; - _fields.pinnedDialogsCountMax = - std::max(data.vpinned_dialogs_count_max().v, 1); - _fields.pinnedDialogsInFolderMax = - std::max(data.vpinned_infolder_count_max().v, 1); _fields.internalLinksDomain = qs(data.vme_url_prefix()); _fields.channelsReadMediaPeriod = data.vchannels_read_media_period().v; _fields.webFileDcId = data.vwebfile_dc_id().v; @@ -250,6 +248,7 @@ void Config::apply(const MTPDconfig &data) { _fields.reactionDefaultCustom = data.vdocument_id().v; }); } + _fields.autologinToken = qs(data.vautologin_token().value_or_empty()); if (data.vdc_options().v.empty()) { LOG(("MTP Error: config with empty dc_options received!")); @@ -268,18 +267,10 @@ void Config::setChatSizeMax(int value) { _fields.chatSizeMax = value; } -void Config::setSavedGifsLimit(int value) { - _fields.savedGifsLimit = value; -} - void Config::setStickersRecentLimit(int value) { _fields.stickersRecentLimit = value; } -void Config::setStickersFavedLimit(int value) { - _fields.stickersFavedLimit = value; -} - void Config::setMegagroupSizeMax(int value) { _fields.megagroupSizeMax = value; } diff --git a/Telegram/SourceFiles/mtproto/mtproto_config.h b/Telegram/SourceFiles/mtproto/mtproto_config.h index 35f45c003..fc2ed1c17 100644 --- a/Telegram/SourceFiles/mtproto/mtproto_config.h +++ b/Telegram/SourceFiles/mtproto/mtproto_config.h @@ -24,15 +24,11 @@ struct ConfigFields { int onlineCloudTimeout = 300000; int notifyCloudDelay = 30000; int notifyDefaultDelay = 1500; - int savedGifsLimit = 200; int editTimeLimit = 172800; int revokeTimeLimit = 172800; int revokePrivateTimeLimit = 172800; bool revokePrivateInbox = false; int stickersRecentLimit = 30; - int stickersFavedLimit = 5; - rpl::variable pinnedDialogsCountMax = 5; - rpl::variable pinnedDialogsInFolderMax = 100; QString internalLinksDomain = u"https://t.me/"_q; int channelsReadMediaPeriod = 86400 * 7; int callReceiveTimeoutMs = 20000; @@ -45,6 +41,7 @@ struct ConfigFields { int captionLengthMax = 1024; QString reactionDefaultEmoji = ConfigDefaultReactionEmoji(); uint64 reactionDefaultCustom; + QString autologinToken; }; class Config final { @@ -79,9 +76,7 @@ public: // Set from legacy local stored values. void setChatSizeMax(int value); - void setSavedGifsLimit(int value); void setStickersRecentLimit(int value); - void setStickersFavedLimit(int value); void setMegagroupSizeMax(int value); void setTxtDomainString(const QString &value); diff --git a/Telegram/SourceFiles/storage/details/storage_settings_scheme.cpp b/Telegram/SourceFiles/storage/details/storage_settings_scheme.cpp index 3aab1ab47..6940e8139 100644 --- a/Telegram/SourceFiles/storage/details/storage_settings_scheme.cpp +++ b/Telegram/SourceFiles/storage/details/storage_settings_scheme.cpp @@ -1180,18 +1180,10 @@ void ApplyReadFallbackConfig(ReadSettingsContext &context) { if (context.fallbackConfigLegacyChatSizeMax > 0) { config.setChatSizeMax(context.fallbackConfigLegacyChatSizeMax); } - if (context.fallbackConfigLegacySavedGifsLimit > 0) { - config.setSavedGifsLimit( - context.fallbackConfigLegacySavedGifsLimit); - } if (context.fallbackConfigLegacyStickersRecentLimit > 0) { config.setStickersRecentLimit( context.fallbackConfigLegacyStickersRecentLimit); } - if (context.fallbackConfigLegacyStickersFavedLimit > 0) { - config.setStickersFavedLimit( - context.fallbackConfigLegacyStickersFavedLimit); - } if (context.fallbackConfigLegacyMegagroupSizeMax > 0) { config.setMegagroupSizeMax( context.fallbackConfigLegacyMegagroupSizeMax);