diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 5f158e89f..2abe99df1 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -101,7 +101,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#5d99adee flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus = User; +user#8f97c628 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; @@ -116,7 +116,7 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#29562865 id:long = Chat; chat#41cbf256 flags:# creator:flags.0?true left:flags.2?true deactivated:flags.5?true call_active:flags.23?true call_not_empty:flags.24?true noforwards:flags.25?true id:long 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#6592a1a7 id:long title:string = Chat; -channel#8261ac61 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 call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat; +channel#83259464 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 call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector = Chat; channelForbidden#17d493d5 flags:# broadcast:flags.5?true megagroup:flags.8?true id:long access_hash:long title:string until_date:flags.16?int = Chat; chatFull#c9d31138 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:long about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:flags.13?ExportedChatInvite bot_info:flags.3?Vector pinned_msg_id:flags.6?int folder_id:flags.11?int call:flags.12?InputGroupCall ttl_period:flags.14?int groupcall_default_join_as:flags.15?Peer theme_emoticon:flags.16?string requests_pending:flags.17?int recent_requesters:flags.17?Vector available_reactions:flags.18?ChatReactions = ChatFull; @@ -183,6 +183,8 @@ messageActionChatJoinedByRequest#ebbca3cb = MessageAction; messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction; messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction; messageActionGiftPremium#aba0f5c6 currency:string amount:long months:int = MessageAction; +messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction; +messageActionTopicEdit#b18a431c flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = MessageAction; dialog#a8edd0f5 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 = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -211,6 +213,7 @@ inputNotifyPeer#b8bc5b0c peer:InputPeer = InputNotifyPeer; inputNotifyUsers#193b4417 = InputNotifyPeer; inputNotifyChats#4a95e84e = InputNotifyPeer; inputNotifyBroadcasts#b1db7c7e = InputNotifyPeer; +inputNotifyForumTopic#5c467992 peer:InputPeer top_msg_id:int = InputNotifyPeer; inputPeerNotifySettings#df1f002b flags:# show_previews:flags.0?Bool silent:flags.1?Bool mute_until:flags.2?int sound:flags.3?NotificationSound = InputPeerNotifySettings; @@ -289,7 +292,7 @@ updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update; updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update; -updateUserName#c3f202e0 user_id:long first_name:string last_name:string username:string = Update; +updateUserName#a7848924 user_id:long first_name:string last_name:string usernames:Vector = Update; updateUserPhoto#f227868c user_id:long date:int photo:UserProfilePhoto previous:Bool = Update; updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; updateEncryptedChatTyping#1710f156 chat_id:int = Update; @@ -324,7 +327,7 @@ updateBotCallbackQuery#b9cfc48d flags:# query_id:long user_id:long peer:Peer msg updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#691e9052 flags:# query_id:long user_id:long msg_id:InputBotInlineMessageID chat_instance:long data:flags.0?bytes game_short_name:flags.1?string = Update; updateReadChannelOutbox#b75f99a9 channel_id:long max_id:int = Update; -updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; +updateDraftMessage#1b49ec6d flags:# peer:Peer top_msg_id:flags.0?int draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; @@ -340,7 +343,7 @@ updatePhoneCall#ab0f6b1e phone_call:PhoneCall = Update; updateLangPackTooLong#46560264 lang_code:string = Update; updateLangPack#56022f4d difference:LangPackDifference = Update; updateFavedStickers#e511996d = Update; -updateChannelReadMessagesContents#44bdd535 channel_id:long messages:Vector = Update; +updateChannelReadMessagesContents#ea29055d flags:# channel_id:long top_msg_id:flags.0?int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#b23fc698 channel_id:long available_min_id:int = Update; updateDialogUnreadMark#e16459c3 flags:# unread:flags.0?true peer:DialogPeer = Update; @@ -377,7 +380,7 @@ updateGroupCallConnection#b783982 flags:# presentation:flags.0?true params:DataJ updateBotCommands#4d712f2e peer:Peer bot_id:long commands:Vector = Update; updatePendingJoinRequests#7063c3db peer:Peer requests_pending:int recent_requesters:Vector = Update; updateBotChatInviteRequester#11dfa986 peer:Peer date:int user_id:long about:string invite:ExportedChatInvite qts:int = Update; -updateMessageReactions#154798c3 peer:Peer msg_id:int reactions:MessageReactions = Update; +updateMessageReactions#5e1b3cb8 flags:# peer:Peer msg_id:int top_msg_id:flags.0?int reactions:MessageReactions = Update; updateAttachMenuBots#17b7a20b = Update; updateWebViewResultSent#1592b79d query_id:long = Update; updateBotMenuButton#14b85813 bot_id:long button:BotMenuButton = Update; @@ -389,6 +392,7 @@ updateRecentEmojiStatuses#30f443db = Update; updateRecentReactions#6f7863f4 = Update; updateMoveStickerSetToTop#86fccf85 flags:# masks:flags.0?true emojis:flags.1?true stickerset:long = Update; updateMessageExtendedMedia#5a73a98c peer:Peer msg_id:int extended_media:MessageExtendedMedia = Update; +updateChannelPinnedTopic#f694b0ae flags:# channel_id:long topic_id:flags.0?int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -461,6 +465,7 @@ notifyPeer#9fd40bd8 peer:Peer = NotifyPeer; notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyBroadcasts#d612e8ef = NotifyPeer; +notifyForumTopic#226e6308 peer:Peer top_msg_id:int = NotifyPeer; sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; @@ -579,6 +584,7 @@ inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet; inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet; inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; +inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; stickerSet#2dd14edc flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true videos:flags.6?true emojis:flags.7?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector thumb_dc_id:flags.4?int thumb_version:flags.4?int thumb_document_id:flags.8?long count:int hash:int = StickerSet; @@ -943,12 +949,18 @@ channelAdminLogEventActionParticipantJoinByRequest#afb6144a invite:ExportedChatI channelAdminLogEventActionToggleNoForwards#cb2ac766 new_value:Bool = ChannelAdminLogEventAction; channelAdminLogEventActionSendMessage#278f2868 message:Message = ChannelAdminLogEventAction; channelAdminLogEventActionChangeAvailableReactions#be4e0ef8 prev_value:ChatReactions new_value:ChatReactions = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeUsernames#f04fb3a9 prev_value:Vector new_value:Vector = ChannelAdminLogEventAction; +channelAdminLogEventActionToggleForum#2cc6383 new_value:Bool = ChannelAdminLogEventAction; +channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction; +channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; channels.adminLogResults#ed8af74d events:Vector chats:Vector users:Vector = channels.AdminLogResults; -channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true = ChannelAdminLogEventsFilter; +channelAdminLogEventsFilter#ea107ae4 flags:# join:flags.0?true leave:flags.1?true invite:flags.2?true ban:flags.3?true unban:flags.4?true kick:flags.5?true unkick:flags.6?true promote:flags.7?true demote:flags.8?true info:flags.9?true settings:flags.10?true pinned:flags.11?true edit:flags.12?true delete:flags.13?true group_call:flags.14?true invites:flags.15?true send:flags.16?true forums:flags.17?true = ChannelAdminLogEventsFilter; popularContact#5ce14175 client_id:long importers:int = PopularContact; @@ -1106,9 +1118,9 @@ chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true = ChatAdminRights; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true until_date:int = ChatBannedRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true until_date:int = ChatBannedRights; inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; inputWallPaperSlug#72091c80 slug:string = InputWallPaper; @@ -1239,7 +1251,7 @@ messages.messageViews#b6c4f543 views:Vector chats:Vector use messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; -messageReplyHeader#a6d57763 flags:# reply_to_scheduled:flags.2?true reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader; +messageReplyHeader#a6d57763 flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true reply_to_msg_id:int reply_to_peer_id:flags.0?Peer reply_to_top_id:flags.1?int = MessageReplyHeader; messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; @@ -1307,9 +1319,10 @@ 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 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#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; -messages.sponsoredMessages#65a4c7d5 messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; +messages.sponsoredMessages#c9ee1d87 flags:# posts_between:flags.0?int messages:Vector chats:Vector users:Vector = messages.SponsoredMessages; +messages.sponsoredMessagesEmpty#1839490f = messages.SponsoredMessages; searchResultsCalendarPeriod#c9b0539f date:int min_msg_id:int max_msg_id:int count:int = SearchResultsCalendarPeriod; @@ -1441,6 +1454,13 @@ messageExtendedMedia#ee479c64 media:MessageMedia = MessageExtendedMedia; stickerKeyword#fcfeb29c document_id:long keyword:Vector = StickerKeyword; +username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username; + +forumTopicDeleted#23f109b id:int = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; + +messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1531,7 +1551,7 @@ account.createTheme#652e4400 flags:# slug:string title:string document:flags.2?I account.updateTheme#2bf40ccc flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?Vector = Theme; account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; account.installTheme#c727bb3b flags:# dark:flags.0?true theme:flags.1?InputTheme format:flags.2?string base_theme:flags.3?BaseTheme = Bool; -account.getTheme#8d9d742b format:string theme:InputTheme document_id:long = Theme; +account.getTheme#3a5869ec format:string theme:InputTheme = Theme; account.getThemes#7206e458 format:string hash:long = account.Themes; account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool; account.getContentSettings#8b9b4dae = account.ContentSettings; @@ -1551,6 +1571,8 @@ account.updateEmojiStatus#fbd3de6b emoji_status:EmojiStatus = Bool; account.getDefaultEmojiStatuses#d6753386 hash:long = account.EmojiStatuses; account.getRecentEmojiStatuses#f578105 hash:long = account.EmojiStatuses; account.clearRecentEmojiStatuses#18201aae = Bool; +account.reorderUsernames#ef500eab order:Vector = Bool; +account.toggleUsername#58d6b376 username:string active:Bool = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -1587,9 +1609,9 @@ messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?t messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector = messages.AffectedMessages; messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool; -messages.sendMessage#d9d75a4 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; -messages.sendMedia#e25ff8e0 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; -messages.forwardMessages#cc30290b flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMessage#1cc20387 flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMedia#7547c966 flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.forwardMessages#c661bbc4 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true drop_author:flags.11?true drop_media_captions:flags.12?true noforwards:flags.14?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer top_msg_id:flags.9?int schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings; messages.report#8953ab4e peer:InputPeer id:Vector reason:ReportReason message:string = Bool; @@ -1632,14 +1654,14 @@ 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.sendInlineBotResult#7aa11297 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 random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +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; messages.editInlineBotMessage#83557dba flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string media:flags.14?InputMedia reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#9342ca07 flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes password:flags.2?InputCheckPasswordSRP = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; -messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; +messages.saveDraft#b4331e3f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int top_msg_id:flags.2?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#64780b14 hash:long = messages.FeaturedStickers; messages.readFeaturedStickers#5b118126 id:Vector = Bool; @@ -1665,10 +1687,10 @@ messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia; messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates; messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers; messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool; -messages.getUnreadMentions#46578472 peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; -messages.readMentions#f0189d3 peer:InputPeer = messages.AffectedHistory; +messages.getUnreadMentions#f107e790 flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readMentions#36e5bf4d flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; messages.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages; -messages.sendMultiMedia#f803138f flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; +messages.sendMultiMedia#b6f11a1c flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true noforwards:flags.14?true update_stickersets_order:flags.15?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int multi_media:Vector schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates; messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile; messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets; messages.getSplitRanges#1cff7e08 = Vector; @@ -1685,7 +1707,7 @@ messages.getEmojiKeywords#35a0e062 lang_code:string = EmojiKeywordsDifference; messages.getEmojiKeywordsDifference#1508b6af lang_code:string from_version:int = EmojiKeywordsDifference; messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector = Vector; messages.getEmojiURL#d5b10c26 lang_code:string = EmojiURL; -messages.getSearchCounters#732eef00 peer:InputPeer filters:Vector = Vector; +messages.getSearchCounters#ae7cc1 flags:# peer:InputPeer top_msg_id:flags.0?int filters:Vector = Vector; messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; @@ -1703,7 +1725,7 @@ messages.getOldFeaturedStickers#7ed094a1 offset:int limit:int hash:long = messag messages.getReplies#22ddd30c peer:InputPeer msg_id:int offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages; messages.getDiscussionMessage#446972fd peer:InputPeer msg_id:int = messages.DiscussionMessage; messages.readDiscussion#f731a9f4 peer:InputPeer msg_id:int read_max_id:int = Bool; -messages.unpinAllMessages#f025bc8b peer:InputPeer = messages.AffectedHistory; +messages.unpinAllMessages#ee22b9a8 flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; messages.deleteChat#5bd0ee50 chat_id:long = Bool; messages.deletePhoneCallHistory#f9cbe409 flags:# revoke:flags.0?true = messages.AffectedFoundMessages; messages.checkHistoryImport#43fe19f3 import_head:string = messages.HistoryImportParsed; @@ -1734,14 +1756,14 @@ messages.setChatAvailableReactions#feb16771 peer:InputPeer available_reactions:C messages.getAvailableReactions#18dea0ac hash:int = messages.AvailableReactions; messages.setDefaultReaction#4f47a016 reaction:Reaction = Bool; messages.translateText#24ce6dee flags:# peer:flags.0?InputPeer msg_id:flags.0?int text:flags.1?string from_lang:flags.2?string to_lang:string = messages.TranslatedText; -messages.getUnreadReactions#e85bae1a peer:InputPeer offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; -messages.readReactions#82e251d7 peer:InputPeer = messages.AffectedHistory; +messages.getUnreadReactions#3223495b flags:# peer:InputPeer top_msg_id:flags.0?int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; +messages.readReactions#54aa7f8e flags:# peer:InputPeer top_msg_id:flags.0?int = messages.AffectedHistory; messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = messages.Messages; messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots; messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot; messages.toggleBotInAttachMenu#1aee33af bot:InputUser enabled:Bool = Bool; -messages.requestWebView#fc87a53c 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 send_as:flags.13?InputPeer = WebViewResult; -messages.prolongWebView#ea5fbcce flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to_msg_id:flags.0?int send_as:flags.13?InputPeer = 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.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent; messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates; @@ -1839,6 +1861,16 @@ channels.getSendAs#dc770ee peer:InputPeer = channels.SendAsPeers; channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory; channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates; channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates; +channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector = Bool; +channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool; +channels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool; +channels.toggleForum#a4298b29 channel:InputChannel enabled:Bool = Updates; +channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; +channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; +channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; +channels.editForumTopic#6c883e2d flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool = Updates; +channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; +channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; diff --git a/td/telegram/AttachMenuManager.cpp b/td/telegram/AttachMenuManager.cpp index c52ca42c5..cfdb087a1 100644 --- a/td/telegram/AttachMenuManager.cpp +++ b/td/telegram/AttachMenuManager.cpp @@ -104,7 +104,7 @@ class RequestWebViewQuery final : public Td::ResultHandler { send_query(G()->net_query_creator().create(telegram_api::messages_requestWebView( flags, false /*ignored*/, false /*ignored*/, std::move(input_peer), std::move(input_user), url, start_parameter, - std::move(theme_parameters), platform, reply_to_message_id.get_server_message_id().get(), + std::move(theme_parameters), platform, reply_to_message_id.get_server_message_id().get(), 0, std::move(as_input_peer)))); } @@ -163,7 +163,7 @@ class ProlongWebViewQuery final : public Td::ResultHandler { send_query(G()->net_query_creator().create(telegram_api::messages_prolongWebView( flags, false /*ignored*/, std::move(input_peer), r_input_user.move_as_ok(), query_id, - reply_to_message_id.get_server_message_id().get(), std::move(as_input_peer)))); + reply_to_message_id.get_server_message_id().get(), 0, std::move(as_input_peer)))); } void on_result(BufferSlice packet) final { diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 04de07b1e..3a35e5917 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -9212,8 +9212,9 @@ ContactsManager::User *ContactsManager::get_user_force(UserId user_id) { flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, user_id.get(), 1, first_name, string(), username, - phone_number, std::move(profile_photo), nullptr, bot_info_version, Auto(), string(), string(), nullptr); + false /*ignored*/, false /*ignored*/, false /*ignored*/, 0, user_id.get(), 1, first_name, string(), username, + phone_number, std::move(profile_photo), nullptr, bot_info_version, Auto(), string(), string(), nullptr, + vector>()); on_get_user(std::move(user), "get_user_force"); u = get_user(user_id); CHECK(u != nullptr && u->is_received); diff --git a/td/telegram/DialogEventLog.cpp b/td/telegram/DialogEventLog.cpp index 235ac676e..359289b0e 100644 --- a/td/telegram/DialogEventLog.cpp +++ b/td/telegram/DialogEventLog.cpp @@ -127,6 +127,10 @@ static td_api::object_ptr get_chat_event_action_object( return td_api::make_object(std::move(action->prev_value_), std::move(action->new_value_)); } + case telegram_api::channelAdminLogEventActionChangeUsernames::ID: { + auto action = move_tl_object_as(action_ptr); + return nullptr; + } case telegram_api::channelAdminLogEventActionChangePhoto::ID: { auto action = move_tl_object_as(action_ptr); auto file_manager = td->file_manager_.get(); @@ -352,6 +356,12 @@ static td_api::object_ptr get_chat_event_action_object( old_available_reactions.get_chat_available_reactions_object(), new_available_reactions.get_chat_available_reactions_object()); } + case telegram_api::channelAdminLogEventActionToggleForum::ID: + case telegram_api::channelAdminLogEventActionCreateTopic::ID: + case telegram_api::channelAdminLogEventActionEditTopic::ID: + case telegram_api::channelAdminLogEventActionDeleteTopic::ID: + case telegram_api::channelAdminLogEventActionPinTopic::ID: + return nullptr; default: UNREACHABLE(); return nullptr; @@ -489,7 +499,8 @@ static telegram_api::object_ptr get_i return telegram_api::make_object( flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/); + false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, + false /*ignored*/); } void get_dialog_event_log(Td *td, DialogId dialog_id, const string &query, int64 from_event_id, int32 limit, diff --git a/td/telegram/DialogParticipant.cpp b/td/telegram/DialogParticipant.cpp index 8962e25cb..9ce68662c 100644 --- a/td/telegram/DialogParticipant.cpp +++ b/td/telegram/DialogParticipant.cpp @@ -119,7 +119,8 @@ telegram_api::object_ptr AdministratorRights::get return telegram_api::make_object( flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/); + false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, + false /*ignored*/); } td_api::object_ptr AdministratorRights::get_chat_administrator_rights_object() const { @@ -268,10 +269,10 @@ tl_object_ptr RestrictedRights::get_chat_banned_ } LOG(INFO) << "Create chat banned rights " << flags; - return make_tl_object(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, 0); + return make_tl_object( + flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, + false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, + false /*ignored*/, false /*ignored*/, 0); } bool operator==(const RestrictedRights &lhs, const RestrictedRights &rhs) { diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 7aba8741c..f178893f2 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -5063,6 +5063,14 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(std::move(action->currency_), action->amount_, action->months_); } + case telegram_api::messageActionTopicCreate::ID: { + auto action = move_tl_object_as(action_ptr); + break; + } + case telegram_api::messageActionTopicEdit::ID: { + auto action = move_tl_object_as(action_ptr); + break; + } default: UNREACHABLE(); } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index d2686c622..71644abe2 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -650,7 +650,9 @@ class UnpinAllMessagesQuery final : public Td::ResultHandler { return on_error(Status::Error(400, "Can't unpin all messages")); } - send_query(G()->net_query_creator().create(telegram_api::messages_unpinAllMessages(std::move(input_peer)))); + int32 flags = 0; + send_query( + G()->net_query_creator().create(telegram_api::messages_unpinAllMessages(flags, std::move(input_peer), 0))); } void on_result(BufferSlice packet) final { @@ -1658,7 +1660,7 @@ class SaveDraftMessageQuery final : public Td::ResultHandler { td_->contacts_manager_.get(), draft_message->input_message_text.text.entities, "SaveDraftMessageQuery"); } send_query(G()->net_query_creator().create( - telegram_api::messages_saveDraft(flags, false /*ignored*/, reply_to_message_id.get(), std::move(input_peer), + telegram_api::messages_saveDraft(flags, false /*ignored*/, reply_to_message_id.get(), 0, std::move(input_peer), draft_message == nullptr ? "" : draft_message->input_message_text.text.text, std::move(input_message_entities)), {{dialog_id}})); @@ -2510,21 +2512,28 @@ class SearchMessagesQuery final : public Td::ResultHandler { top_thread_message_id_ = top_thread_message_id; random_id_ = random_id; + auto top_msg_id = top_thread_message_id.get_server_message_id().get(); + auto offset_id = from_message_id.get_server_message_id().get(); if (filter == MessageSearchFilter::UnreadMention) { - send_query(G()->net_query_creator().create( - telegram_api::messages_getUnreadMentions(std::move(input_peer), from_message_id.get_server_message_id().get(), - offset, limit, std::numeric_limits::max(), 0))); + int32 flags = 0; + if (top_thread_message_id.is_valid()) { + flags |= telegram_api::messages_getUnreadMentions::TOP_MSG_ID_MASK; + } + send_query(G()->net_query_creator().create(telegram_api::messages_getUnreadMentions( + flags, std::move(input_peer), top_msg_id, offset_id, offset, limit, std::numeric_limits::max(), 0))); } else if (filter == MessageSearchFilter::UnreadReaction) { + int32 flags = 0; + if (top_thread_message_id.is_valid()) { + flags |= telegram_api::messages_getUnreadReactions::TOP_MSG_ID_MASK; + } send_query(G()->net_query_creator().create(telegram_api::messages_getUnreadReactions( - std::move(input_peer), from_message_id.get_server_message_id().get(), offset, limit, - std::numeric_limits::max(), 0))); + flags, std::move(input_peer), top_msg_id, offset_id, offset, limit, std::numeric_limits::max(), 0))); } else if (top_thread_message_id.is_valid() && query.empty() && !sender_dialog_id.is_valid() && filter == MessageSearchFilter::Empty) { handle_errors_ = dialog_id.get_type() != DialogType::Channel || !td_->contacts_manager_->is_broadcast_channel(dialog_id.get_channel_id()); send_query(G()->net_query_creator().create(telegram_api::messages_getReplies( - std::move(input_peer), top_thread_message_id.get_server_message_id().get(), - from_message_id.get_server_message_id().get(), 0, offset, limit, std::numeric_limits::max(), 0, 0))); + std::move(input_peer), top_msg_id, offset_id, 0, offset, limit, std::numeric_limits::max(), 0, 0))); } else { int32 flags = 0; tl_object_ptr sender_input_peer; @@ -2537,11 +2546,10 @@ class SearchMessagesQuery final : public Td::ResultHandler { flags |= telegram_api::messages_search::TOP_MSG_ID_MASK; } - send_query(G()->net_query_creator().create(telegram_api::messages_search( - flags, std::move(input_peer), query, std::move(sender_input_peer), - top_thread_message_id.get_server_message_id().get(), get_input_messages_filter(filter), 0, - std::numeric_limits::max(), from_message_id.get_server_message_id().get(), offset, limit, - std::numeric_limits::max(), 0, 0))); + send_query(G()->net_query_creator().create( + telegram_api::messages_search(flags, std::move(input_peer), query, std::move(sender_input_peer), top_msg_id, + get_input_messages_filter(filter), 0, std::numeric_limits::max(), + offset_id, offset, limit, std::numeric_limits::max(), 0, 0))); } } @@ -2651,8 +2659,10 @@ class GetSearchCountersQuery final : public Td::ResultHandler { CHECK(filter != MessageSearchFilter::UnreadReaction); vector> filters; filters.push_back(get_input_messages_filter(filter)); + + int32 flags = 0; send_query(G()->net_query_creator().create( - telegram_api::messages_getSearchCounters(std::move(input_peer), std::move(filters)))); + telegram_api::messages_getSearchCounters(flags, std::move(input_peer), 0, std::move(filters)))); } void on_result(BufferSlice packet) final { @@ -3224,8 +3234,8 @@ class ReadMentionsQuery final : public Td::ResultHandler { return promise_.set_error(Status::Error(400, "Chat is not accessible")); } - send_query( - G()->net_query_creator().create(telegram_api::messages_readMentions(std::move(input_peer)), {{dialog_id}})); + send_query(G()->net_query_creator().create(telegram_api::messages_readMentions(0, std::move(input_peer), 0), + {{dialog_id}})); } void on_result(BufferSlice packet) final { @@ -3259,8 +3269,9 @@ class ReadReactionsQuery final : public Td::ResultHandler { return promise_.set_error(Status::Error(400, "Chat is not accessible")); } - send_query( - G()->net_query_creator().create(telegram_api::messages_readReactions(std::move(input_peer)), {{dialog_id}})); + int32 flags = 0; + send_query(G()->net_query_creator().create(telegram_api::messages_readReactions(flags, std::move(input_peer), 0), + {{dialog_id}})); } void on_result(BufferSlice packet) final { @@ -3343,7 +3354,7 @@ class SendMessageQuery final : public Td::ResultHandler { auto query = G()->net_query_creator().create( telegram_api::messages_sendMessage( flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, std::move(input_peer), reply_to_message_id.get_server_message_id().get(), text, + false /*ignored*/, std::move(input_peer), reply_to_message_id.get_server_message_id().get(), 0, text, random_id, std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)), {{dialog_id, MessageContentType::Text}, {dialog_id, is_copy ? MessageContentType::Photo : MessageContentType::Text}}); @@ -3476,7 +3487,7 @@ class SendInlineBotResultQuery final : public Td::ResultHandler { auto query = G()->net_query_creator().create( telegram_api::messages_sendInlineBotResult(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer), - reply_to_message_id.get_server_message_id().get(), random_id, + reply_to_message_id.get_server_message_id().get(), 0, random_id, query_id, result_id, schedule_date, std::move(as_input_peer)), {{dialog_id, MessageContentType::Text}, {dialog_id, MessageContentType::Photo}}); auto send_query_ref = query.get_weak(); @@ -3540,7 +3551,7 @@ class SendMultiMediaQuery final : public Td::ResultHandler { send_query(G()->net_query_creator().create( telegram_api::messages_sendMultiMedia(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(input_peer), - reply_to_message_id.get_server_message_id().get(), + reply_to_message_id.get_server_message_id().get(), 0, std::move(input_single_media), schedule_date, std::move(as_input_peer)), {{dialog_id, is_copy ? MessageContentType::Text : MessageContentType::Photo}, {dialog_id, MessageContentType::Photo}})); @@ -3657,7 +3668,7 @@ class SendMediaQuery final : public Td::ResultHandler { auto query = G()->net_query_creator().create( telegram_api::messages_sendMedia( flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - std::move(input_peer), reply_to_message_id.get_server_message_id().get(), std::move(input_media), text, + std::move(input_peer), reply_to_message_id.get_server_message_id().get(), 0, std::move(input_media), text, random_id, std::move(reply_markup), std::move(entities), schedule_date, std::move(as_input_peer)), {{dialog_id, content_type}, {dialog_id, is_copy ? MessageContentType::Text : content_type}}); if (td_->option_manager_->get_option_boolean("use_quick_ack") && was_uploaded_) { @@ -4022,7 +4033,7 @@ class ForwardMessagesQuery final : public Td::ResultHandler { telegram_api::messages_forwardMessages( flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, std::move(from_input_peer), MessagesManager::get_server_message_ids(message_ids), - std::move(random_ids), std::move(to_input_peer), schedule_date, std::move(as_input_peer)), + std::move(random_ids), std::move(to_input_peer), 0, schedule_date, std::move(as_input_peer)), {{to_dialog_id, MessageContentType::Text}, {to_dialog_id, MessageContentType::Photo}}); if (td_->option_manager_->get_option_boolean("use_quick_ack")) { query->quick_ack_promise_ = PromiseCreator::lambda([random_ids = random_ids_](Result result) { @@ -6728,7 +6739,6 @@ void MessagesManager::on_update_read_channel_messages_contents( LOG(ERROR) << "Receive invalid " << channel_id << " in updateChannelReadMessagesContents"; return; } - DialogId dialog_id = DialogId(channel_id); Dialog *d = get_dialog_force(dialog_id, "on_update_read_channel_messages_contents"); @@ -6737,6 +6747,11 @@ void MessagesManager::on_update_read_channel_messages_contents( return; } + if ((update->flags_ & telegram_api::updateChannelReadMessagesContents::TOP_MSG_ID_MASK) != 0) { + // TODO + return; + } + for (auto &server_message_id : update->messages_) { read_channel_message_content_from_updates(d, MessageId(ServerMessageId(server_message_id))); } diff --git a/td/telegram/NotificationManager.cpp b/td/telegram/NotificationManager.cpp index 3151095d6..3f0df1b7b 100644 --- a/td/telegram/NotificationManager.cpp +++ b/td/telegram/NotificationManager.cpp @@ -3327,8 +3327,9 @@ Status NotificationManager::process_push_notification_payload(string payload, bo flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, sender_user_id.get(), sender_access_hash, user_name, - string(), string(), string(), std::move(sender_photo), nullptr, 0, Auto(), string(), string(), nullptr); + false /*ignored*/, false /*ignored*/, false /*ignored*/, 0, sender_user_id.get(), sender_access_hash, user_name, + string(), string(), string(), std::move(sender_photo), nullptr, 0, Auto(), string(), string(), nullptr, + vector>()); td_->contacts_manager_->on_get_user(std::move(user), "process_push_notification_payload"); } @@ -3685,8 +3686,9 @@ void NotificationManager::add_message_push_notification(DialogId dialog_id, Mess flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, - false /*ignored*/, false /*ignored*/, false /*ignored*/, sender_user_id.get(), 0, user_name, string(), string(), - string(), nullptr, nullptr, 0, Auto(), string(), string(), nullptr); + false /*ignored*/, false /*ignored*/, false /*ignored*/, 0, sender_user_id.get(), 0, user_name, string(), + string(), string(), nullptr, nullptr, 0, Auto(), string(), string(), nullptr, + vector>()); td_->contacts_manager_->on_get_user(std::move(user), "add_message_push_notification"); } diff --git a/td/telegram/SpecialStickerSetType.cpp b/td/telegram/SpecialStickerSetType.cpp index 106a8079c..e84bfe406 100644 --- a/td/telegram/SpecialStickerSetType.cpp +++ b/td/telegram/SpecialStickerSetType.cpp @@ -59,6 +59,9 @@ SpecialStickerSetType::SpecialStickerSetType( case telegram_api::inputStickerSetEmojiDefaultStatuses::ID: *this = default_statuses(); break; + case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID: + *this = default_statuses(); + break; default: UNREACHABLE(); break; diff --git a/td/telegram/SponsoredMessageManager.cpp b/td/telegram/SponsoredMessageManager.cpp index 57b8f3815..64b9ab199 100644 --- a/td/telegram/SponsoredMessageManager.cpp +++ b/td/telegram/SponsoredMessageManager.cpp @@ -30,12 +30,12 @@ namespace td { class GetSponsoredMessagesQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; ChannelId channel_id_; public: explicit GetSponsoredMessagesQuery( - Promise> &&promise) + Promise> &&promise) : promise_(std::move(promise)) { } @@ -225,7 +225,7 @@ void SponsoredMessageManager::get_dialog_sponsored_message( if (messages->promises.size() == 1) { auto query_promise = PromiseCreator::lambda( [actor_id = actor_id(this), - dialog_id](Result> &&result) mutable { + dialog_id](Result> &&result) mutable { send_closure(actor_id, &SponsoredMessageManager::on_get_dialog_sponsored_messages, dialog_id, std::move(result)); }); @@ -234,7 +234,7 @@ void SponsoredMessageManager::get_dialog_sponsored_message( } void SponsoredMessageManager::on_get_dialog_sponsored_messages( - DialogId dialog_id, Result> &&result) { + DialogId dialog_id, Result> &&result) { if (result.is_ok() && G()->close_flag()) { result = Global::request_aborted_error(); } @@ -252,75 +252,87 @@ void SponsoredMessageManager::on_get_dialog_sponsored_messages( return; } - auto sponsored_messages = result.move_as_ok(); + auto sponsored_messages_ptr = result.move_as_ok(); + switch (sponsored_messages_ptr->get_id()) { + case telegram_api::messages_sponsoredMessages::ID: { + auto sponsored_messages = + telegram_api::move_object_as(sponsored_messages_ptr); - td_->contacts_manager_->on_get_users(std::move(sponsored_messages->users_), "on_get_dialog_sponsored_messages"); - td_->contacts_manager_->on_get_chats(std::move(sponsored_messages->chats_), "on_get_dialog_sponsored_messages"); + td_->contacts_manager_->on_get_users(std::move(sponsored_messages->users_), "on_get_dialog_sponsored_messages"); + td_->contacts_manager_->on_get_chats(std::move(sponsored_messages->chats_), "on_get_dialog_sponsored_messages"); - for (auto &sponsored_message : sponsored_messages->messages_) { - DialogId sponsor_dialog_id; - ServerMessageId server_message_id; - string invite_hash; - if (sponsored_message->from_id_ != nullptr) { - sponsor_dialog_id = DialogId(sponsored_message->from_id_); - if (!sponsor_dialog_id.is_valid() || !td_->messages_manager_->have_dialog_info_force(sponsor_dialog_id)) { - LOG(ERROR) << "Receive unknown sponsor " << sponsor_dialog_id; - continue; + for (auto &sponsored_message : sponsored_messages->messages_) { + DialogId sponsor_dialog_id; + ServerMessageId server_message_id; + string invite_hash; + if (sponsored_message->from_id_ != nullptr) { + sponsor_dialog_id = DialogId(sponsored_message->from_id_); + if (!sponsor_dialog_id.is_valid() || !td_->messages_manager_->have_dialog_info_force(sponsor_dialog_id)) { + LOG(ERROR) << "Receive unknown sponsor " << sponsor_dialog_id; + continue; + } + server_message_id = ServerMessageId(sponsored_message->channel_post_); + if (!server_message_id.is_valid() && server_message_id != ServerMessageId()) { + LOG(ERROR) << "Receive invalid channel post in " << to_string(sponsored_message); + server_message_id = ServerMessageId(); + } + td_->messages_manager_->force_create_dialog(sponsor_dialog_id, "on_get_dialog_sponsored_messages"); + } else if (sponsored_message->chat_invite_ != nullptr && !sponsored_message->chat_invite_hash_.empty()) { + auto invite_link = LinkManager::get_dialog_invite_link(sponsored_message->chat_invite_hash_, false); + if (invite_link.empty()) { + LOG(ERROR) << "Receive invalid invite link hash in " << to_string(sponsored_message); + continue; + } + auto chat_invite = to_string(sponsored_message->chat_invite_); + td_->contacts_manager_->on_get_dialog_invite_link_info( + invite_link, std::move(sponsored_message->chat_invite_), Promise()); + auto chat_invite_link_info = td_->contacts_manager_->get_chat_invite_link_info_object(invite_link); + if (chat_invite_link_info == nullptr) { + LOG(ERROR) << "Failed to get invite link info from " << chat_invite << " for " + << to_string(sponsored_message); + continue; + } + invite_hash = std::move(sponsored_message->chat_invite_hash_); + } else { + LOG(ERROR) << "Receive " << to_string(sponsored_message); + continue; + } + + auto message_text = get_message_text(td_->contacts_manager_.get(), std::move(sponsored_message->message_), + std::move(sponsored_message->entities_), true, true, 0, false, + "on_get_dialog_sponsored_messages"); + int32 ttl = 0; + bool disable_web_page_preview = false; + auto content = get_message_content(td_, std::move(message_text), nullptr, sponsor_dialog_id, true, UserId(), + &ttl, &disable_web_page_preview, "on_get_dialog_sponsored_messages"); + if (ttl != 0) { + LOG(ERROR) << "Receive sponsored message with TTL " << ttl; + continue; + } + CHECK(disable_web_page_preview); + + current_sponsored_message_id_ = current_sponsored_message_id_.get_next_message_id(MessageType::Local); + if (!current_sponsored_message_id_.is_valid_sponsored()) { + LOG(ERROR) << "Sponsored message ID overflowed"; + current_sponsored_message_id_ = MessageId::max().get_next_message_id(MessageType::Local); + CHECK(current_sponsored_message_id_.is_valid_sponsored()); + } + auto local_id = current_sponsored_message_id_.get(); + CHECK(!current_sponsored_message_id_.is_valid()); + CHECK(!current_sponsored_message_id_.is_scheduled()); + auto is_inserted = + messages->message_random_ids.emplace(local_id, sponsored_message->random_id_.as_slice().str()).second; + CHECK(is_inserted); + messages->messages.emplace_back(local_id, sponsored_message->recommended_, sponsor_dialog_id, server_message_id, + std::move(sponsored_message->start_param_), std::move(invite_hash), + std::move(content)); + break; } - server_message_id = ServerMessageId(sponsored_message->channel_post_); - if (!server_message_id.is_valid() && server_message_id != ServerMessageId()) { - LOG(ERROR) << "Receive invalid channel post in " << to_string(sponsored_message); - server_message_id = ServerMessageId(); - } - td_->messages_manager_->force_create_dialog(sponsor_dialog_id, "on_get_dialog_sponsored_messages"); - } else if (sponsored_message->chat_invite_ != nullptr && !sponsored_message->chat_invite_hash_.empty()) { - auto invite_link = LinkManager::get_dialog_invite_link(sponsored_message->chat_invite_hash_, false); - if (invite_link.empty()) { - LOG(ERROR) << "Receive invalid invite link hash in " << to_string(sponsored_message); - continue; - } - auto chat_invite = to_string(sponsored_message->chat_invite_); - td_->contacts_manager_->on_get_dialog_invite_link_info(invite_link, std::move(sponsored_message->chat_invite_), - Promise()); - auto chat_invite_link_info = td_->contacts_manager_->get_chat_invite_link_info_object(invite_link); - if (chat_invite_link_info == nullptr) { - LOG(ERROR) << "Failed to get invite link info from " << chat_invite << " for " << to_string(sponsored_message); - continue; - } - invite_hash = std::move(sponsored_message->chat_invite_hash_); - } else { - LOG(ERROR) << "Receive " << to_string(sponsored_message); - continue; } - - auto message_text = get_message_text(td_->contacts_manager_.get(), std::move(sponsored_message->message_), - std::move(sponsored_message->entities_), true, true, 0, false, - "on_get_dialog_sponsored_messages"); - int32 ttl = 0; - bool disable_web_page_preview = false; - auto content = get_message_content(td_, std::move(message_text), nullptr, sponsor_dialog_id, true, UserId(), &ttl, - &disable_web_page_preview, "on_get_dialog_sponsored_messages"); - if (ttl != 0) { - LOG(ERROR) << "Receive sponsored message with TTL " << ttl; - continue; - } - CHECK(disable_web_page_preview); - - current_sponsored_message_id_ = current_sponsored_message_id_.get_next_message_id(MessageType::Local); - if (!current_sponsored_message_id_.is_valid_sponsored()) { - LOG(ERROR) << "Sponsored message ID overflowed"; - current_sponsored_message_id_ = MessageId::max().get_next_message_id(MessageType::Local); - CHECK(current_sponsored_message_id_.is_valid_sponsored()); - } - auto local_id = current_sponsored_message_id_.get(); - CHECK(!current_sponsored_message_id_.is_valid()); - CHECK(!current_sponsored_message_id_.is_scheduled()); - auto is_inserted = - messages->message_random_ids.emplace(local_id, sponsored_message->random_id_.as_slice().str()).second; - CHECK(is_inserted); - messages->messages.emplace_back(local_id, sponsored_message->recommended_, sponsor_dialog_id, server_message_id, - std::move(sponsored_message->start_param_), std::move(invite_hash), - std::move(content)); + case telegram_api::messages_sponsoredMessagesEmpty::ID: + break; + default: + UNREACHABLE(); } for (auto &promise : promises) { diff --git a/td/telegram/SponsoredMessageManager.h b/td/telegram/SponsoredMessageManager.h index 9c522d3b2..0163930bc 100644 --- a/td/telegram/SponsoredMessageManager.h +++ b/td/telegram/SponsoredMessageManager.h @@ -55,7 +55,7 @@ class SponsoredMessageManager final : public Actor { DialogId dialog_id, const DialogSponsoredMessages &sponsored_messages) const; void on_get_dialog_sponsored_messages( - DialogId dialog_id, Result> &&result); + DialogId dialog_id, Result> &&result); FlatHashMap, DialogIdHash> dialog_sponsored_messages_; diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 0393905bc..c8b6456d5 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -2919,6 +2919,7 @@ StickerSetId StickersManager::get_sticker_set_id(const tl_object_ptr(action); @@ -2910,6 +2912,9 @@ void UpdatesManager::on_update(tl_object_ptr td_->notification_settings_manager_->on_update_scope_notify_settings(NotificationSettingsScope::Channel, std::move(update->notify_settings_)); break; + case telegram_api::notifyForumTopic::ID: + // TODO + break; default: UNREACHABLE(); } @@ -3176,7 +3181,7 @@ void UpdatesManager::on_update(tl_object_ptr upd void UpdatesManager::on_update(tl_object_ptr update, Promise &&promise) { td_->contacts_manager_->on_update_user_name(UserId(update->user_id_), std::move(update->first_name_), - std::move(update->last_name_), std::move(update->username_)); + std::move(update->last_name_), string()); promise.set_value(Unit()); } @@ -3609,4 +3614,8 @@ void UpdatesManager::on_update(tl_object_ptr update, Promise &&promise) { + promise.set_value(Unit()); +} + } // namespace td diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index 9841ab7c1..40645785f 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -541,6 +541,8 @@ class UpdatesManager final : public Actor { void on_update(tl_object_ptr update, Promise &&promise); // unsupported updates + + void on_update(tl_object_ptr update, Promise &&promise); }; } // namespace td diff --git a/td/telegram/Version.h b/td/telegram/Version.h index a037edbda..fe3f22527 100644 --- a/td/telegram/Version.h +++ b/td/telegram/Version.h @@ -10,7 +10,7 @@ namespace td { -constexpr int32 MTPROTO_LAYER = 147; +constexpr int32 MTPROTO_LAYER = 148; enum class Version : int32 { Initial, // 0