From c6ce44815e8d846b5c8b1fc12680cc34237931e4 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 5 Dec 2023 12:30:12 +0300 Subject: [PATCH] Update layer to 169. --- td/generate/scheme/td_api.tl | 8 +- td/generate/scheme/telegram_api.tl | 57 ++++++++---- td/telegram/Application.cpp | 6 +- td/telegram/BackgroundType.cpp | 2 +- td/telegram/ContactsManager.cpp | 5 +- td/telegram/DialogEventLog.cpp | 21 ++--- td/telegram/GiveawayParameters.cpp | 4 +- td/telegram/MediaArea.cpp | 5 + td/telegram/MessageContent.cpp | 8 +- td/telegram/MessagesManager.cpp | 4 +- td/telegram/Premium.cpp | 26 ++++-- td/telegram/ReplyMarkup.cpp | 2 +- td/telegram/SpecialStickerSetType.cpp | 3 + td/telegram/StatisticsManager.cpp | 128 ++++++-------------------- td/telegram/StatisticsManager.h | 12 +-- td/telegram/StickersManager.cpp | 3 + td/telegram/StoryManager.cpp | 11 ++- td/telegram/StoryViewer.cpp | 8 +- td/telegram/StoryViewer.h | 2 +- td/telegram/UpdatesManager.cpp | 28 +++++- td/telegram/UpdatesManager.h | 4 + td/telegram/Version.h | 2 +- 22 files changed, 175 insertions(+), 174 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index d31ff5572..db9ee1602 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -696,7 +696,7 @@ premiumGiftCodePaymentOption currency:string amount:int53 user_count:int32 month premiumGiftCodePaymentOptions options:vector = PremiumGiftCodePaymentOptions; //@description Contains information about a Telegram Premium gift code -//@creator_id Identifier of a chat or a user that created the gift code +//@creator_id Identifier of a chat or a user that created the gift code; may be null if unknown //@creation_date Point in time (Unix timestamp) when the code was created //@is_from_giveaway True, if the gift code was created for a giveaway //@giveaway_message_id Identifier of the corresponding giveaway message in the creator_id chat; can be 0 or an identifier of a deleted message @@ -9196,12 +9196,12 @@ getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; //@description Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; -//@description Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib +//@description Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib //@chat_id Chat identifier of the message //@message_id Message identifier //@offset Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results -//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit -getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; +//@limit The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit +getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = StoryPublicForwards; //@description Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true @chat_id Chat identifier @story_id Story identifier @is_dark Pass true if a dark theme is used by the application getStoryStatistics chat_id:int53 story_id:int32 is_dark:Bool = StoryStatistics; diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index fc8c5dead..2421e1cc2 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -118,11 +118,11 @@ 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#8e87ccd8 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:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?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 usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor = Chat; +channel#aadfc8f 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:# stories_hidden:flags2.1?true stories_hidden_min:flags2.2?true stories_unavailable:flags2.3?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 usernames:flags2.0?Vector stories_max_id:flags2.4?int color:flags2.7?PeerColor profile_color:flags2.8?PeerColor emoji_status:flags2.9?EmojiStatus level:flags2.10?int = 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 translations_disabled:flags.19?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; -channelFull#723027bd flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories = ChatFull; +channelFull#f2bcb6f flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true stories_pinned_available:flags2.5?true view_forum_as_messages:flags2.6?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions stories:flags2.4?PeerStories wallpaper:flags2.7?WallPaper = ChatFull; chatParticipant#c02d4007 user_id:long inviter_id:long date:int = ChatParticipant; chatParticipantCreator#e46bcee4 user_id:long = ChatParticipant; @@ -152,7 +152,8 @@ messageMediaGeoLive#b940c666 flags:# geo:GeoPoint heading:flags.0?int period:int messageMediaPoll#4bd6e798 poll:Poll results:PollResults = MessageMedia; messageMediaDice#3f7ee58b value:int emoticon:string = MessageMedia; messageMediaStory#68cb6283 flags:# via_mention:flags.1?true peer:Peer id:int story:flags.0?StoryItem = MessageMedia; -messageMediaGiveaway#58260664 flags:# only_new_subscribers:flags.0?true channels:Vector countries_iso2:flags.1?Vector quantity:int months:int until_date:int = MessageMedia; +messageMediaGiveaway#daad85b0 flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.2?true channels:Vector countries_iso2:flags.1?Vector prize_description:flags.3?string quantity:int months:int until_date:int = MessageMedia; +messageMediaGiveawayResults#c6991068 flags:# only_new_subscribers:flags.0?true refunded:flags.2?true channel_id:long additional_peers_count:flags.3?int launch_msg_id:int winners_count:int unclaimed_count:int winners:Vector months:int prize_description:flags.1?string until_date:int = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#bd47cbad title:string users:Vector = MessageAction; @@ -190,9 +191,9 @@ messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int 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; -messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; +messageActionRequestedPeer#31518e9b button_id:int peers:Vector = MessageAction; messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction; -messageActionGiftCode#d2cfdb0e flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string = MessageAction; +messageActionGiftCode#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long = MessageAction; messageActionGiveawayLaunch#332ba9ed = MessageAction; messageActionGiveawayResults#2a9fadc5 winners_count:int unclaimed_count:int = MessageAction; @@ -416,6 +417,8 @@ updateSentStoryReaction#7d627683 peer:Peer story_id:int reaction:Reaction = Upda updateBotChatBoost#904dd49c peer:Peer boost:Boost qts:int = Update; updateChannelViewForumAsMessages#7b68920 channel_id:long enabled:Bool = Update; updatePeerWallpaper#ae3f101d flags:# wallpaper_overridden:flags.1?true peer:Peer wallpaper:flags.0?WallPaper = Update; +updateBotMessageReaction#ac21d3ce peer:Peer msg_id:int date:int actor:Peer old_reactions:Vector new_reactions:Vector qts:int = Update; +updateBotMessageReactions#9cb7759 peer:Peer msg_id:int date:int reactions:Vector qts:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -612,8 +615,9 @@ inputStickerSetPremiumGifts#c88b3b02 = InputStickerSet; inputStickerSetEmojiGenericAnimations#4c4d4ce = InputStickerSet; inputStickerSetEmojiDefaultStatuses#29d0f5ee = InputStickerSet; inputStickerSetEmojiDefaultTopicIcons#44c1f8e9 = InputStickerSet; +inputStickerSetEmojiChannelDefaultStatuses#49748553 = 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 text_color:flags.9?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; +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 text_color:flags.9?true channel_emoji_status:flags.10?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; messages.stickerSet#6e153f16 set:StickerSet packs:Vector keywords:Vector documents:Vector = messages.StickerSet; messages.stickerSetNotModified#d3f924eb = messages.StickerSet; @@ -637,7 +641,7 @@ inputKeyboardButtonUserProfile#e988037b text:string user_id:InputUser = Keyboard keyboardButtonUserProfile#308660c1 text:string user_id:long = KeyboardButton; keyboardButtonWebView#13767230 text:string url:string = KeyboardButton; keyboardButtonSimpleWebView#a0c0505c text:string url:string = KeyboardButton; -keyboardButtonRequestPeer#d0b468c text:string button_id:int peer_type:RequestPeerType = KeyboardButton; +keyboardButtonRequestPeer#53d7bfd8 text:string button_id:int peer_type:RequestPeerType max_quantity:int = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -990,8 +994,10 @@ channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:For channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction; channelAdminLogEventActionPinTopic#5d8d353b flags:# prev_topic:flags.0?ForumTopic new_topic:flags.1?ForumTopic = ChannelAdminLogEventAction; channelAdminLogEventActionToggleAntiSpam#64f36dfc new_value:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeColor#3c2b247b prev_value:int new_value:int = ChannelAdminLogEventAction; -channelAdminLogEventActionChangeBackgroundEmoji#445fc434 prev_value:long new_value:long = ChannelAdminLogEventAction; +channelAdminLogEventActionChangePeerColor#5796e780 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeProfilePeerColor#5e477b25 prev_value:PeerColor new_value:PeerColor = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeWallpaper#31bb5d52 prev_value:WallPaper new_value:WallPaper = ChannelAdminLogEventAction; +channelAdminLogEventActionChangeEmojiStatus#3ea9feb1 prev_value:EmojiStatus new_value:EmojiStatus = ChannelAdminLogEventAction; channelAdminLogEvent#1fad68cd id:long date:int user_id:long action:ChannelAdminLogEventAction = ChannelAdminLogEvent; @@ -1168,7 +1174,7 @@ account.wallPapers#cdc3858c hash:long wallpapers:Vector = account.Wal codeSettings#ad253d78 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true allow_missed_call:flags.5?true allow_firebase:flags.7?true logout_tokens:flags.6?Vector token:flags.8?string app_sandbox:flags.8?Bool = CodeSettings; -wallPaperSettings#1dc1bca4 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings; +wallPaperSettings#372efcd0 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int third_background_color:flags.5?int fourth_background_color:flags.6?int intensity:flags.3?int rotation:flags.4?int emoticon:flags.7?string = WallPaperSettings; autoDownloadSettings#baa57628 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true stories_preload:flags.4?true photo_size_max:int video_size_max:long file_size_max:long video_upload_maxbitrate:int small_queue_active_operations_max:int large_queue_active_operations_max:int = AutoDownloadSettings; @@ -1447,7 +1453,7 @@ help.premiumPromo#5334759c status_text:string status_entities:Vector boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose; -inputStorePaymentPremiumGiveaway#7c9375e6 flags:# only_new_subscribers:flags.0?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; +inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector countries_iso2:flags.2?Vector prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose; premiumGiftOption#74c34319 flags:# months:int currency:string amount:long bot_url:string store_product:flags.0?string = PremiumGiftOption; @@ -1574,8 +1580,10 @@ stories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string stories.stories#5dd8c3c8 count:int stories:Vector chats:Vector users:Vector = stories.Stories; storyView#b0bdeac5 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true user_id:long date:int reaction:flags.2?Reaction = StoryView; +storyViewPublicForward#9083670b flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true message:Message = StoryView; +storyViewPublicRepost#bd74cf49 flags:# blocked:flags.0?true blocked_my_stories_from:flags.1?true peer_id:Peer story:StoryItem = StoryView; -stories.storyViewsList#46e9b9ec flags:# count:int reactions_count:int views:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; +stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count:int reactions_count:int views:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryViewsList; stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; @@ -1592,6 +1600,8 @@ mediaAreaVenue#be82db9c coordinates:MediaAreaCoordinates geo:GeoPoint title:stri inputMediaAreaVenue#b282217f coordinates:MediaAreaCoordinates query_id:long result_id:string = MediaArea; mediaAreaGeoPoint#df8b3b22 coordinates:MediaAreaCoordinates geo:GeoPoint = MediaArea; mediaAreaSuggestedReaction#14455871 flags:# dark:flags.0?true flipped:flags.1?true coordinates:MediaAreaCoordinates reaction:Reaction = MediaArea; +mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long msg_id:int = MediaArea; +inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea; peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector = PeerStories; @@ -1601,7 +1611,7 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector users:Vector premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption; -payments.checkedGiftCode#b722f158 flags:# via_giveaway:flags.2?true from_id:Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; +payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector users:Vector = payments.CheckedGiftCode; payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo; payments.giveawayInfoResults#cd5570 flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.0?string finish_date:int winners_count:int activated_count:int = payments.GiveawayInfo; @@ -1635,11 +1645,17 @@ peerColor#b54b5acf flags:# color:flags.0?int background_emoji_id:flags.1?long = help.peerColorSet#26219a58 colors:Vector = help.PeerColorSet; help.peerColorProfileSet#767d61eb palette_colors:Vector bg_colors:Vector story_colors:Vector = help.PeerColorSet; -help.peerColorOption#135bd42f flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet = help.PeerColorOption; +help.peerColorOption#ef8430ab flags:# hidden:flags.0?true color_id:int colors:flags.1?help.PeerColorSet dark_colors:flags.2?help.PeerColorSet channel_min_level:flags.3?int = help.PeerColorOption; help.peerColorsNotModified#2ba1f5ce = help.PeerColors; help.peerColors#f8ed08 hash:int colors:Vector = help.PeerColors; +storyReaction#6090d6d5 peer_id:Peer date:int reaction:Reaction = StoryReaction; +storyReactionPublicForward#bbab2643 message:Message = StoryReaction; +storyReactionPublicRepost#cfcd0f13 peer_id:Peer story:StoryItem = StoryReaction; + +stories.storyReactionsList#aa5f789c flags:# count:int reactions:Vector chats:Vector users:Vector next_offset:flags.0?string = stories.StoryReactionsList; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1763,6 +1779,8 @@ account.deleteAutoSaveExceptions#53bc0020 = Bool; account.invalidateSignInCodes#ca8ae8ba codes:Vector = Bool; account.updateColor#7cefa15d flags:# for_profile:flags.1?true color:flags.2?int background_emoji_id:flags.0?long = Bool; account.getDefaultBackgroundEmojis#a60ab9ce hash:long = EmojiList; +account.getChannelDefaultEmojiStatuses#7727a7d5 hash:long = account.EmojiStatuses; +account.getChannelRestrictedStatusEmojis#35a9e0d5 hash:long = EmojiList; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#b60f5918 id:InputUser = users.UserFull; @@ -1972,7 +1990,7 @@ messages.clearRecentReactions#9dfeefb4 = Bool; messages.getExtendedMedia#84f80814 peer:InputPeer id:Vector = Updates; messages.setDefaultHistoryTTL#9eb51445 period:int = Bool; messages.getDefaultHistoryTTL#658b7188 = DefaultHistoryTTL; -messages.sendBotRequestedPeer#fe38d01b peer:InputPeer msg_id:int button_id:int requested_peer:InputPeer = Updates; +messages.sendBotRequestedPeer#91b2d060 peer:InputPeer msg_id:int button_id:int requested_peers:Vector = Updates; messages.getEmojiGroups#7488ce5b hash:int = messages.EmojiGroups; messages.getEmojiStatusGroups#2ecd56cd hash:int = messages.EmojiGroups; messages.getEmojiProfilePhotoGroups#21a548f3 hash:int = messages.EmojiGroups; @@ -2007,7 +2025,6 @@ help.getNearestDc#1fb33026 = NearestDc; help.getAppUpdate#522d5a7d source:string = help.AppUpdate; help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; -help.getAppChangelog#9010ef6f prev_app_version:string = Updates; help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; help.getCdnConfig#52029342 = CdnConfig; help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls; @@ -2084,9 +2101,10 @@ channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; channels.toggleParticipantsHidden#6a6e7854 channel:InputChannel enabled:Bool = Updates; channels.clickSponsoredMessage#18afbc93 channel:InputChannel random_id:bytes = Bool; -channels.updateColor#621a201f flags:# channel:InputChannel color:int background_emoji_id:flags.0?long = Updates; +channels.updateColor#d8aa3671 flags:# for_profile:flags.1?true channel:InputChannel color:flags.2?int background_emoji_id:flags.0?long = Updates; channels.toggleViewForumAsMessages#9738bb15 channel:InputChannel enabled:Bool = Updates; channels.getChannelRecommendations#83b70d97 channel:InputChannel = messages.Chats; +channels.updateEmojiStatus#f0d3e6a8 channel:InputChannel emoji_status:EmojiStatus = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -2176,7 +2194,7 @@ folders.editPeerFolders#6847d0ab folder_peers:Vector = Updates; stats.getBroadcastStats#ab42441a flags:# dark:flags.0?true channel:InputChannel = stats.BroadcastStats; stats.loadAsyncGraph#621d5fa0 flags:# token:string x:flags.0?long = StatsGraph; stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel = stats.MegagroupStats; -stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +stats.getMessagePublicForwards#5f150144 channel:InputChannel msg_id:int offset:string limit:int = stats.PublicForwards; stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats; stats.getStoryStats#374fef40 flags:# dark:flags.0?true peer:InputPeer id:int = stats.StoryStats; stats.getStoryPublicForwards#a6437ef6 peer:InputPeer id:int offset:string limit:int = stats.PublicForwards; @@ -2205,7 +2223,7 @@ stories.getStoriesByID#5774ca74 peer:InputPeer id:Vector = stories.Stories; stories.toggleAllStoriesHidden#7c2557c4 hidden:Bool = Bool; stories.readStories#a556dac8 peer:InputPeer max_id:int = Vector; stories.incrementStoryViews#b2028afb peer:InputPeer id:Vector = Bool; -stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; +stories.getStoryViewsList#7ed23c57 flags:# just_contacts:flags.0?true reactions_first:flags.2?true forwards_first:flags.3?true peer:InputPeer q:flags.1?string id:int offset:string limit:int = stories.StoryViewsList; stories.getStoriesViews#28e16cc8 peer:InputPeer id:Vector = stories.StoryViews; stories.exportStoryLink#7b8def20 peer:InputPeer id:int = ExportedStoryLink; stories.report#1923fa8c peer:InputPeer id:Vector reason:ReportReason message:string = Bool; @@ -2216,6 +2234,7 @@ stories.getAllReadPeerStories#9b5ae7f9 = Updates; stories.getPeerMaxIDs#535983c3 id:Vector = Vector; stories.getChatsToSend#a56a8b60 = messages.Chats; stories.togglePeerStoriesHidden#bd0415c4 peer:InputPeer hidden:Bool = Bool; +stories.getStoryReactionsList#b9b2881f flags:# forwards_first:flags.2?true peer:InputPeer id:int reaction:flags.0?Reaction offset:flags.1?string limit:int = stories.StoryReactionsList; premium.getBoostsList#60f67660 flags:# gifts:flags.0?true peer:InputPeer offset:string limit:int = premium.BoostsList; premium.getMyBoosts#be77b4a = premium.MyBoosts; diff --git a/td/telegram/Application.cpp b/td/telegram/Application.cpp index f84aa1bdb..e0b3e2b7c 100644 --- a/td/telegram/Application.cpp +++ b/td/telegram/Application.cpp @@ -78,7 +78,7 @@ class SaveAppLogQuery final : public Td::ResultHandler { promise_.set_error(std::move(status)); } }; - +/* class GetAppChangelogQuery final : public Td::ResultHandler { Promise promise_; @@ -107,7 +107,7 @@ class GetAppChangelogQuery final : public Td::ResultHandler { promise_.set_error(std::move(status)); } }; - +*/ void get_invite_text(Td *td, Promise &&promise) { td->create_handler(std::move(promise))->send(); } @@ -172,7 +172,7 @@ void on_save_app_log_binlog_event(Td *td, BinlogEvent &&event) { } void add_app_changelog(Td *td, const string &previous_application_version, Promise &&promise) { - td->create_handler(std::move(promise))->send(previous_application_version); + // td->create_handler(std::move(promise))->send(previous_application_version); } } // namespace td diff --git a/td/telegram/BackgroundType.cpp b/td/telegram/BackgroundType.cpp index 8c89ed4ba..4d46d46dd 100644 --- a/td/telegram/BackgroundType.cpp +++ b/td/telegram/BackgroundType.cpp @@ -469,7 +469,7 @@ telegram_api::object_ptr BackgroundType::get_in } return telegram_api::make_object( flags, is_blurred_, is_moving_, fill_.top_color_, fill_.bottom_color_, fill_.third_color_, fill_.fourth_color_, - intensity_, fill_.rotation_angle_); + intensity_, fill_.rotation_angle_, string()); } } // namespace td diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 73d6d3d92..ba981a1e8 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -1374,11 +1374,14 @@ class UpdateChannelColorQuery final : public Td::ResultHandler { auto input_channel = td_->contacts_manager_->get_input_channel(channel_id); CHECK(input_channel != nullptr); int32 flags = 0; + if (accent_color_id.is_valid()) { + flags |= telegram_api::channels_updateColor::COLOR_MASK; + } if (background_custom_emoji_id.is_valid()) { flags |= telegram_api::channels_updateColor::BACKGROUND_EMOJI_ID_MASK; } send_query(G()->net_query_creator().create( - telegram_api::channels_updateColor(flags, std::move(input_channel), accent_color_id.get(), + telegram_api::channels_updateColor(flags, false /*ignored*/, std::move(input_channel), accent_color_id.get(), background_custom_emoji_id.get()), {{channel_id}})); } diff --git a/td/telegram/DialogEventLog.cpp b/td/telegram/DialogEventLog.cpp index f86f969f4..a42ec0184 100644 --- a/td/telegram/DialogEventLog.cpp +++ b/td/telegram/DialogEventLog.cpp @@ -429,19 +429,14 @@ static td_api::object_ptr get_chat_event_action_object( auto action = move_tl_object_as(action_ptr); return td_api::make_object(action->new_value_); } - case telegram_api::channelAdminLogEventActionChangeColor::ID: { - auto action = move_tl_object_as(action_ptr); - auto old_accent_color_id = AccentColorId(action->prev_value_); - auto new_accent_color_id = AccentColorId(action->new_value_); - return td_api::make_object( - td->theme_manager_->get_accent_color_id_object(old_accent_color_id, AccentColorId(channel_id)), - td->theme_manager_->get_accent_color_id_object(new_accent_color_id, AccentColorId(channel_id))); - } - case telegram_api::channelAdminLogEventActionChangeBackgroundEmoji::ID: { - auto action = move_tl_object_as(action_ptr); - return td_api::make_object(action->prev_value_, - action->new_value_); - } + case telegram_api::channelAdminLogEventActionChangePeerColor::ID: + return nullptr; + case telegram_api::channelAdminLogEventActionChangeProfilePeerColor::ID: + return nullptr; + case telegram_api::channelAdminLogEventActionChangeWallpaper::ID: + return nullptr; + case telegram_api::channelAdminLogEventActionChangeEmojiStatus::ID: + return nullptr; default: UNREACHABLE(); return nullptr; diff --git a/td/telegram/GiveawayParameters.cpp b/td/telegram/GiveawayParameters.cpp index a911aceb9..4115b876c 100644 --- a/td/telegram/GiveawayParameters.cpp +++ b/td/telegram/GiveawayParameters.cpp @@ -108,8 +108,8 @@ GiveawayParameters::get_input_store_payment_premium_giveaway(Td *td, const strin flags |= telegram_api::inputStorePaymentPremiumGiveaway::COUNTRIES_ISO2_MASK; } return telegram_api::make_object( - flags, false /*ignored*/, std::move(boost_input_peer), std::move(additional_input_peers), - vector(country_codes_), random_id, date_, currency, amount); + flags, false /*ignored*/, false /*ignored*/, std::move(boost_input_peer), std::move(additional_input_peers), + vector(country_codes_), string(), random_id, date_, currency, amount); } td_api::object_ptr GiveawayParameters::get_premium_giveaway_parameters_object( diff --git a/td/telegram/MediaArea.cpp b/td/telegram/MediaArea.cpp index fb5a88f50..1b4de3616 100644 --- a/td/telegram/MediaArea.cpp +++ b/td/telegram/MediaArea.cpp @@ -52,9 +52,14 @@ MediaArea::MediaArea(Td *td, telegram_api::object_ptr & } break; } + case telegram_api::mediaAreaChannelPost::ID: + break; case telegram_api::inputMediaAreaVenue::ID: LOG(ERROR) << "Receive " << to_string(media_area_ptr); break; + case telegram_api::inputMediaAreaChannelPost::ID: + LOG(ERROR) << "Receive " << to_string(media_area_ptr); + break; default: UNREACHABLE(); } diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 94d1eabe3..d03e55b79 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -5744,6 +5744,8 @@ unique_ptr get_message_content(Td *td, FormattedText message, media->until_date_, std::move(media->countries_iso2_)}, media->quantity_, media->months_); } + case telegram_api::messageMediaGiveawayResults::ID: + return make_unique(); case telegram_api::messageMediaUnsupported::ID: return make_unique(); default: @@ -6361,7 +6363,11 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(action_ptr); - DialogId dialog_id(action->peer_); + if (action->peers_.empty()) { + LOG(ERROR) << "Receive invalid " << oneline(to_string(action)); + break; + } + DialogId dialog_id(action->peers_[0]); if (!dialog_id.is_valid()) { LOG(ERROR) << "Receive invalid " << oneline(to_string(action)); break; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 12db83f37..5958c8203 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -4038,11 +4038,13 @@ class SendBotRequestedPeerQuery final : public Td::ResultHandler { if (requested_peer == nullptr) { return on_error(Status::Error(400, "Can't access the chosen chat")); } + vector> requested_peers; + requested_peers.push_back(std::move(requested_peer)); send_query(G()->net_query_creator().create( telegram_api::messages_sendBotRequestedPeer(std::move(input_peer), message_full_id.get_message_id().get_server_message_id().get(), - button_id, std::move(requested_peer)), + button_id, std::move(requested_peers)), {{dialog_id, MessageContentType::Text}})); } diff --git a/td/telegram/Premium.cpp b/td/telegram/Premium.cpp index b55a12108..146577903 100644 --- a/td/telegram/Premium.cpp +++ b/td/telegram/Premium.cpp @@ -324,15 +324,22 @@ class CheckGiftCodeQuery final : public Td::ResultHandler { td_->contacts_manager_->on_get_users(std::move(result->users_), "CheckGiftCodeQuery"); td_->contacts_manager_->on_get_chats(std::move(result->chats_), "CheckGiftCodeQuery"); - DialogId creator_dialog_id(result->from_id_); - if (!creator_dialog_id.is_valid() || - !td_->messages_manager_->have_dialog_info_force(creator_dialog_id, "CheckGiftCodeQuery") || - result->date_ <= 0 || result->months_ <= 0 || result->used_date_ < 0) { + if (result->date_ <= 0 || result->months_ <= 0 || result->used_date_ < 0) { LOG(ERROR) << "Receive " << to_string(result); return on_error(Status::Error(500, "Receive invalid response")); } - if (creator_dialog_id.get_type() != DialogType::User) { - td_->messages_manager_->force_create_dialog(creator_dialog_id, "CheckGiftCodeQuery", true); + + DialogId creator_dialog_id; + if (result->from_id_ != nullptr) { + creator_dialog_id = DialogId(result->from_id_); + if (!creator_dialog_id.is_valid() || + !td_->messages_manager_->have_dialog_info_force(creator_dialog_id, "CheckGiftCodeQuery")) { + LOG(ERROR) << "Receive " << to_string(result); + return on_error(Status::Error(500, "Receive invalid response")); + } + if (creator_dialog_id.get_type() != DialogType::User) { + td_->messages_manager_->force_create_dialog(creator_dialog_id, "CheckGiftCodeQuery", true); + } } UserId user_id(result->to_id_); if (!user_id.is_valid() && user_id != UserId()) { @@ -349,9 +356,10 @@ class CheckGiftCodeQuery final : public Td::ResultHandler { message_id = MessageId(); } promise_.set_value(td_api::make_object( - get_message_sender_object(td_, creator_dialog_id, "premiumGiftCodeInfo"), result->date_, result->via_giveaway_, - message_id.get(), result->months_, td_->contacts_manager_->get_user_id_object(user_id, "premiumGiftCodeInfo"), - result->used_date_)); + creator_dialog_id == DialogId() ? nullptr + : get_message_sender_object(td_, creator_dialog_id, "premiumGiftCodeInfo"), + result->date_, result->via_giveaway_, message_id.get(), result->months_, + td_->contacts_manager_->get_user_id_object(user_id, "premiumGiftCodeInfo"), result->used_date_)); } void on_error(Status status) final { diff --git a/td/telegram/ReplyMarkup.cpp b/td/telegram/ReplyMarkup.cpp index c538b6a8d..870dceb8a 100644 --- a/td/telegram/ReplyMarkup.cpp +++ b/td/telegram/ReplyMarkup.cpp @@ -867,7 +867,7 @@ static tl_object_ptr get_input_keyboard_button(con case KeyboardButton::Type::RequestDialog: return make_tl_object( keyboard_button.text, keyboard_button.requested_dialog_type->get_button_id(), - keyboard_button.requested_dialog_type->get_input_request_peer_type_object()); + keyboard_button.requested_dialog_type->get_input_request_peer_type_object(), 1); default: UNREACHABLE(); return nullptr; diff --git a/td/telegram/SpecialStickerSetType.cpp b/td/telegram/SpecialStickerSetType.cpp index 7d6ae2e63..8455a4fad 100644 --- a/td/telegram/SpecialStickerSetType.cpp +++ b/td/telegram/SpecialStickerSetType.cpp @@ -66,6 +66,9 @@ SpecialStickerSetType::SpecialStickerSetType( case telegram_api::inputStickerSetEmojiDefaultTopicIcons::ID: *this = default_topic_icons(); break; + case telegram_api::inputStickerSetEmojiChannelDefaultStatuses::ID: + *this = default_statuses(); + break; default: UNREACHABLE(); break; diff --git a/td/telegram/StatisticsManager.cpp b/td/telegram/StatisticsManager.cpp index bc40a19fd..1ef465b77 100644 --- a/td/telegram/StatisticsManager.cpp +++ b/td/telegram/StatisticsManager.cpp @@ -394,28 +394,23 @@ class LoadAsyncGraphQuery final : public Td::ResultHandler { }; class GetMessagePublicForwardsQuery final : public Td::ResultHandler { - Promise> promise_; + Promise> promise_; DialogId dialog_id_; public: - explicit GetMessagePublicForwardsQuery(Promise> &&promise) + explicit GetMessagePublicForwardsQuery(Promise> &&promise) : promise_(std::move(promise)) { } - void send(DcId dc_id, MessageFullId message_full_id, int32 offset_date, DialogId offset_dialog_id, - ServerMessageId offset_message_id, int32 limit) { + void send(DcId dc_id, MessageFullId message_full_id, const string &offset, int32 limit) { dialog_id_ = message_full_id.get_dialog_id(); - auto input_peer = MessagesManager::get_input_peer_force(offset_dialog_id); - CHECK(input_peer != nullptr); - auto input_channel = td_->contacts_manager_->get_input_channel(dialog_id_.get_channel_id()); CHECK(input_channel != nullptr); send_query(G()->net_query_creator().create( telegram_api::stats_getMessagePublicForwards( - std::move(input_channel), message_full_id.get_message_id().get_server_message_id().get(), offset_date, - std::move(input_peer), offset_message_id.get(), limit), + std::move(input_channel), message_full_id.get_message_id().get_server_message_id().get(), offset, limit), {}, dc_id)); } @@ -425,19 +420,18 @@ class GetMessagePublicForwardsQuery final : public Td::ResultHandler { return on_error(result_ptr.move_as_error()); } - auto info = get_messages_info(td_, DialogId(), result_ptr.move_as_ok(), "GetMessagePublicForwardsQuery"); td_->messages_manager_->get_channel_differences_if_needed( - std::move(info), - PromiseCreator::lambda([actor_id = td_->statistics_manager_actor_.get(), - promise = std::move(promise_)](Result &&result) mutable { - if (result.is_error()) { - promise.set_error(result.move_as_error()); - } else { - auto info = result.move_as_ok(); - send_closure(actor_id, &StatisticsManager::on_get_message_public_forwards, info.total_count, - std::move(info.messages), info.next_rate, std::move(promise)); - } - }), + result_ptr.move_as_ok(), + PromiseCreator::lambda( + [actor_id = td_->statistics_manager_actor_.get(), promise = std::move(promise_)]( + Result> &&result) mutable { + if (result.is_error()) { + promise.set_error(result.move_as_error()); + } else { + send_closure(actor_id, &StatisticsManager::on_get_public_forwards, result.move_as_ok(), + std::move(promise)); + } + }), "GetMessagePublicForwardsQuery"); } @@ -484,7 +478,7 @@ class GetStoryPublicForwardsQuery final : public Td::ResultHandler { if (result.is_error()) { promise.set_error(result.move_as_error()); } else { - send_closure(actor_id, &StatisticsManager::on_get_story_public_forwards, result.move_as_ok(), + send_closure(actor_id, &StatisticsManager::on_get_public_forwards, result.move_as_ok(), std::move(promise)); } }), @@ -609,8 +603,9 @@ void StatisticsManager::send_load_async_graph_query(DcId dc_id, string token, in td_->create_handler(std::move(promise))->send(token, x, dc_id); } -void StatisticsManager::get_message_public_forwards(MessageFullId message_full_id, string offset, int32 limit, - Promise> &&promise) { +void StatisticsManager::get_message_public_forwards( + MessageFullId message_full_id, string offset, int32 limit, + Promise> &&promise) { if (limit <= 0) { return promise.set_error(Status::Error(400, "Parameter limit must be positive")); } @@ -629,7 +624,7 @@ void StatisticsManager::get_message_public_forwards(MessageFullId message_full_i void StatisticsManager::send_get_message_public_forwards_query( DcId dc_id, MessageFullId message_full_id, string offset, int32 limit, - Promise> &&promise) { + Promise> &&promise) { if (!td_->messages_manager_->have_message_force(message_full_id, "send_get_message_public_forwards_query")) { return promise.set_error(Status::Error(400, "Message not found")); } @@ -642,78 +637,7 @@ void StatisticsManager::send_get_message_public_forwards_query( limit = MAX_MESSAGE_FORWARDS; } - int32 offset_date = std::numeric_limits::max(); - DialogId offset_dialog_id; - ServerMessageId offset_server_message_id; - - if (!offset.empty()) { - auto parts = full_split(offset, ','); - if (parts.size() != 3) { - return promise.set_error(Status::Error(400, "Invalid offset specified")); - } - auto r_offset_date = to_integer_safe(parts[0]); - auto r_offset_dialog_id = to_integer_safe(parts[1]); - auto r_offset_server_message_id = to_integer_safe(parts[2]); - if (r_offset_date.is_error() || r_offset_dialog_id.is_error() || r_offset_server_message_id.is_error()) { - return promise.set_error(Status::Error(400, "Invalid offset specified")); - } - - offset_date = r_offset_date.ok(); - offset_dialog_id = DialogId(r_offset_dialog_id.ok()); - offset_server_message_id = ServerMessageId(r_offset_server_message_id.ok()); - } - - td_->create_handler(std::move(promise)) - ->send(dc_id, message_full_id, offset_date, offset_dialog_id, offset_server_message_id, limit); -} - -void StatisticsManager::on_get_message_public_forwards( - int32 total_count, vector> &&messages, int32 next_rate, - Promise> &&promise) { - TRY_STATUS_PROMISE(promise, G()->close_status()); - - LOG(INFO) << "Receive " << messages.size() << " forwarded messages"; - vector> result; - int32 last_message_date = 0; - MessageId last_message_id; - DialogId last_dialog_id; - for (auto &message : messages) { - auto message_date = MessagesManager::get_message_date(message); - auto message_id = MessageId::get_message_id(message, false); - auto dialog_id = DialogId::get_message_dialog_id(message); - if (message_date > 0 && message_id.is_valid() && dialog_id.is_valid()) { - last_message_date = message_date; - last_message_id = message_id; - last_dialog_id = dialog_id; - } - - auto new_message_full_id = - td_->messages_manager_->on_get_message(std::move(message), false, dialog_id.get_type() == DialogType::Channel, - false, "on_get_message_public_forwards"); - if (new_message_full_id != MessageFullId()) { - CHECK(dialog_id == new_message_full_id.get_dialog_id()); - result.push_back( - td_->messages_manager_->get_message_object(new_message_full_id, "on_get_message_public_forwards")); - CHECK(result.back() != nullptr); - } else { - total_count--; - } - } - if (total_count < static_cast(result.size())) { - LOG(ERROR) << "Receive " << result.size() << " valid messages out of " << total_count << " in " << messages.size() - << " messages"; - total_count = static_cast(result.size()); - } - string next_offset; - if (!result.empty()) { - if (next_rate > 0) { - last_message_date = next_rate; - } - next_offset = PSTRING() << last_message_date << ',' << last_dialog_id.get() << ',' - << last_message_id.get_server_message_id().get(); - } - - promise.set_value(td_api::make_object(total_count, std::move(result), next_offset)); + td_->create_handler(std::move(promise))->send(dc_id, message_full_id, offset, limit); } void StatisticsManager::get_story_public_forwards(StoryFullId story_full_id, string offset, int32 limit, @@ -760,13 +684,13 @@ void StatisticsManager::send_get_story_public_forwards_query( td_->create_handler(std::move(promise))->send(dc_id, story_full_id, offset, limit); } -void StatisticsManager::on_get_story_public_forwards( +void StatisticsManager::on_get_public_forwards( telegram_api::object_ptr &&public_forwards, Promise> &&promise) { TRY_STATUS_PROMISE(promise, G()->close_status()); - td_->contacts_manager_->on_get_users(std::move(public_forwards->users_), "on_get_story_public_forwards"); - td_->contacts_manager_->on_get_chats(std::move(public_forwards->chats_), "on_get_story_public_forwards"); + td_->contacts_manager_->on_get_users(std::move(public_forwards->users_), "on_get_public_forwards"); + td_->contacts_manager_->on_get_chats(std::move(public_forwards->chats_), "on_get_public_forwards"); auto total_count = public_forwards->count_; LOG(INFO) << "Receive " << public_forwards->forwards_.size() << " forwarded stories out of " @@ -779,11 +703,11 @@ void StatisticsManager::on_get_story_public_forwards( auto dialog_id = DialogId::get_message_dialog_id(forward->message_); auto message_full_id = td_->messages_manager_->on_get_message(std::move(forward->message_), false, dialog_id.get_type() == DialogType::Channel, - false, "on_get_story_public_forwards"); + false, "on_get_public_forwards"); if (message_full_id != MessageFullId()) { CHECK(dialog_id == message_full_id.get_dialog_id()); result.push_back(td_api::make_object( - td_->messages_manager_->get_message_object(message_full_id, "on_get_story_public_forwards"))); + td_->messages_manager_->get_message_object(message_full_id, "on_get_public_forwards"))); CHECK(result.back() != nullptr); } else { total_count--; diff --git a/td/telegram/StatisticsManager.h b/td/telegram/StatisticsManager.h index f5f272f2b..da26a95fb 100644 --- a/td/telegram/StatisticsManager.h +++ b/td/telegram/StatisticsManager.h @@ -40,17 +40,13 @@ class StatisticsManager final : public Actor { Promise> &&promise); void get_message_public_forwards(MessageFullId message_full_id, string offset, int32 limit, - Promise> &&promise); - - void on_get_message_public_forwards(int32 total_count, - vector> &&messages, - int32 next_rate, Promise> &&promise); + Promise> &&promise); void get_story_public_forwards(StoryFullId story_full_id, string offset, int32 limit, Promise> &&promise); - void on_get_story_public_forwards(telegram_api::object_ptr &&public_forwards, - Promise> &&promise); + void on_get_public_forwards(telegram_api::object_ptr &&public_forwards, + Promise> &&promise); private: void tear_down() final; @@ -68,7 +64,7 @@ class StatisticsManager final : public Actor { Promise> &&promise); void send_get_message_public_forwards_query(DcId dc_id, MessageFullId message_full_id, string offset, int32 limit, - Promise> &&promise); + Promise> &&promise); void send_get_story_public_forwards_query(DcId dc_id, StoryFullId story_full_id, string offset, int32 limit, Promise> &&promise); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 5b27097f0..ab61f77c3 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -3067,6 +3067,7 @@ StickerSetId StickersManager::get_sticker_set_id(const tl_object_ptrnet_query_creator().create(telegram_api::stories_getStoryViewsList( - flags, false /*ignored*/, false /*ignored*/, std::move(input_peer), query, story_id.get(), offset, limit))); + send_query(G()->net_query_creator().create( + telegram_api::stories_getStoryViewsList(flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, + std::move(input_peer), query, story_id.get(), offset, limit))); } void on_result(BufferSlice packet) final { @@ -2850,7 +2851,11 @@ void StoryManager::on_get_story_viewers( << " story viewers"; total_reaction_count = total_count; } - for (auto &view : view_list->views_) { + for (auto &view_ptr : view_list->views_) { + if (view_ptr->get_id() != telegram_api::storyView::ID) { + continue; + } + auto view = telegram_api::move_object_as(view_ptr); td_->contacts_manager_->on_update_user_is_blocked(UserId(view->user_id_), view->blocked_, view->blocked_my_stories_from_); } diff --git a/td/telegram/StoryViewer.cpp b/td/telegram/StoryViewer.cpp index 69e703067..91bc082b4 100644 --- a/td/telegram/StoryViewer.cpp +++ b/td/telegram/StoryViewer.cpp @@ -26,10 +26,14 @@ StringBuilder &operator<<(StringBuilder &string_builder, const StoryViewer &view } StoryViewers::StoryViewers(int32 total_count, int32 total_reaction_count, - vector> &&story_views, + vector> &&story_views, string &&next_offset) : total_count_(total_count), total_reaction_count_(total_reaction_count), next_offset_(std::move(next_offset)) { - for (auto &story_view : story_views) { + for (auto &story_view_ptr : story_views) { + if (story_view_ptr->get_id() != telegram_api::storyView::ID) { + continue; + } + auto story_view = telegram_api::move_object_as(story_view_ptr); story_viewers_.emplace_back(std::move(story_view)); auto user_id = story_viewers_.back().get_user_id(); if (!user_id.is_valid()) { diff --git a/td/telegram/StoryViewer.h b/td/telegram/StoryViewer.h index aeb930241..1d0a04291 100644 --- a/td/telegram/StoryViewer.h +++ b/td/telegram/StoryViewer.h @@ -55,7 +55,7 @@ class StoryViewers { public: StoryViewers(int32 total_count, int32 total_reaction_count, - vector> &&story_views, string &&next_offset); + vector> &&story_views, string &&next_offset); vector get_user_ids() const; diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 685f65a57..4dd504170 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -817,6 +817,18 @@ bool UpdatesManager::is_acceptable_message_media( } return true; } + case telegram_api::messageMediaGiveawayResults::ID: { + auto message_media = static_cast(media_ptr.get()); + if (!is_acceptable_channel(ChannelId(message_media->channel_id_))) { + return false; + } + for (auto user_id : message_media->winners_) { + if (!is_acceptable_user(UserId(user_id))) { + return false; + } + } + return true; + } case telegram_api::messageMediaPoll::ID: /* // the users and chats are always min, so no need to check @@ -1026,8 +1038,12 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_ } case telegram_api::messageActionRequestedPeer::ID: { auto requested_peer = static_cast(action); - if (!td_->auth_manager_->is_bot() && !is_acceptable_peer(requested_peer->peer_)) { - return false; + if (!td_->auth_manager_->is_bot()) { + for (auto &peer : requested_peer->peers_) { + if (!is_acceptable_peer(peer)) { + return false; + } + } } break; } @@ -4344,4 +4360,12 @@ void UpdatesManager::on_update(tl_object_ptr update, Promise &&promise) { + promise.set_value(Unit()); +} + +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 55a368ed2..eadcadf44 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -631,6 +631,10 @@ 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); + + void on_update(tl_object_ptr update, Promise &&promise); }; } // namespace td diff --git a/td/telegram/Version.h b/td/telegram/Version.h index ce6bced1c..818d4e640 100644 --- a/td/telegram/Version.h +++ b/td/telegram/Version.h @@ -10,7 +10,7 @@ namespace td { -constexpr int32 MTPROTO_LAYER = 167; +constexpr int32 MTPROTO_LAYER = 169; enum class Version : int32 { Initial, // 0