Update API scheme on layer 160: Replies.
This commit is contained in:
parent
455cb0d21b
commit
04e7ce4408
|
@ -412,6 +412,7 @@ updateAutoSaveSettings#ec05b097 = Update;
|
||||||
updateGroupInvitePrivacyForbidden#ccf08ad6 user_id:long = Update;
|
updateGroupInvitePrivacyForbidden#ccf08ad6 user_id:long = Update;
|
||||||
updateStories#66fad7b5 stories:UserStories = Update;
|
updateStories#66fad7b5 stories:UserStories = Update;
|
||||||
updateReadStories#feb5345a user_id:long max_id:int = Update;
|
updateReadStories#feb5345a user_id:long max_id:int = Update;
|
||||||
|
updateStoryID#1bf335b9 id:int random_id:long = Update;
|
||||||
|
|
||||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||||
|
|
||||||
|
@ -1280,6 +1281,7 @@ messages.messageViews#b6c4f543 views:Vector<MessageViews> chats:Vector<Chat> use
|
||||||
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
messages.discussionMessage#a6341782 flags:# messages:Vector<Message> max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector<Chat> users:Vector<User> = messages.DiscussionMessage;
|
||||||
|
|
||||||
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;
|
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;
|
||||||
|
messageReplyStoryHeader#9c98bfc1 user_id:long story_id:int = MessageReplyHeader;
|
||||||
|
|
||||||
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector<Peer> channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies;
|
||||||
|
|
||||||
|
@ -1551,25 +1553,30 @@ messagePeerVoteMultiple#4628f6e6 peer:Peer options:Vector<bytes> date:int = Mess
|
||||||
|
|
||||||
sponsoredWebPage#3db8ec63 flags:# url:string site_name:string photo:flags.0?Photo = SponsoredWebPage;
|
sponsoredWebPage#3db8ec63 flags:# url:string site_name:string photo:flags.0?Photo = SponsoredWebPage;
|
||||||
|
|
||||||
storyViews#518b47d8 recent_viewers:Vector<long> views_count:int = StoryViews;
|
storyViews#d36760cf flags:# views_count:int recent_viewers:flags.0?Vector<long> = StoryViews;
|
||||||
|
|
||||||
storyItemDeleted#51e6ee4f id:int = StoryItem;
|
storyItemDeleted#51e6ee4f id:int = StoryItem;
|
||||||
storyItemSkipped#a1d8cf8f id:int date:int = StoryItem;
|
storyItemSkipped#a1d8cf8f id:int date:int = StoryItem;
|
||||||
storyItem#8fcd96ac flags:# pinned:flags.5?true expired:flags.6?true id:int date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews = StoryItem;
|
storyItem#8fcd96ac flags:# pinned:flags.5?true expired:flags.6?true public:flags.7?true id:int date:int caption:flags.0?string entities:flags.1?Vector<MessageEntity> media:MessageMedia privacy:flags.2?Vector<PrivacyRule> views:flags.3?StoryViews = StoryItem;
|
||||||
|
|
||||||
userStories#8611a200 flags:# user_id:long max_read_id:flags.0?int stories:Vector<StoryItem> = UserStories;
|
userStories#8611a200 flags:# user_id:long max_read_id:flags.0?int stories:Vector<StoryItem> = UserStories;
|
||||||
|
|
||||||
stories.allStoriesNotModified#47e0a07e state:string = stories.AllStories;
|
stories.allStoriesNotModified#47e0a07e state:string = stories.AllStories;
|
||||||
stories.allStories#5b1aa68c flags:# has_more:flags.0?true state:string user_stories:Vector<UserStories> users:Vector<User> = stories.AllStories;
|
stories.allStories#839e0428 flags:# has_more:flags.0?true count:int state:string user_stories:Vector<UserStories> users:Vector<User> = stories.AllStories;
|
||||||
|
|
||||||
stories.stories#4fe57df1 count:int stories:Vector<StoryItem> users:Vector<User> = stories.Stories;
|
stories.stories#4fe57df1 count:int stories:Vector<StoryItem> users:Vector<User> = stories.Stories;
|
||||||
|
|
||||||
|
stories.userStories#37a6ff5f stories:UserStories users:Vector<User> = stories.UserStories;
|
||||||
|
|
||||||
storyView#a71aacc2 user_id:long date:int = StoryView;
|
storyView#a71aacc2 user_id:long date:int = StoryView;
|
||||||
|
|
||||||
stories.storyViewsList#fb3f77ac count:int views:Vector<StoryView> users:Vector<User> = stories.StoryViewsList;
|
stories.storyViewsList#fb3f77ac count:int views:Vector<StoryView> users:Vector<User> = stories.StoryViewsList;
|
||||||
|
|
||||||
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
stories.storyViews#de9eed1d views:Vector<StoryViews> users:Vector<User> = stories.StoryViews;
|
||||||
|
|
||||||
|
inputReplyToMessage#9c5386e4 flags:# reply_to_msg_id:int top_msg_id:flags.0?int = InputReplyTo;
|
||||||
|
inputReplyToStory#15b0f283 user_id:InputUser story_id:int = InputReplyTo;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1730,8 +1737,8 @@ messages.deleteHistory#b08f922a flags:# just_clear:flags.0?true revoke:flags.1?t
|
||||||
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
|
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
|
||||||
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
|
||||||
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
|
messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;
|
||||||
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<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
messages.sendMessage#280d096f 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:flags.0?InputReplyTo message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> 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<MessageEntity> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
messages.sendMedia#72ccc23d 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:flags.0?InputReplyTo media:InputMedia message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> 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<int> random_id:Vector<long> to_peer:InputPeer top_msg_id:flags.9?int 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<int> random_id:Vector<long> 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.reportSpam#cf1592db peer:InputPeer = Bool;
|
||||||
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
|
messages.getPeerSettings#efd9a6a2 peer:InputPeer = messages.PeerSettings;
|
||||||
|
@ -1775,7 +1782,7 @@ messages.getSavedGifs#5cf09635 hash:long = messages.SavedGifs;
|
||||||
messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
|
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.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
|
||||||
messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool;
|
messages.setInlineBotResults#bb12a419 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM switch_webview:flags.4?InlineBotWebView = Bool;
|
||||||
messages.sendInlineBotResult#d3fbdccb flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to_msg_id:flags.0?int top_msg_id:flags.9?int random_id:long query_id:long id:string schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
messages.sendInlineBotResult#f7bc68ba flags:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true hide_via:flags.11?true peer:InputPeer reply_to:flags.0?InputReplyTo 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.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<MessageEntity> schedule_date:flags.15?int = Updates;
|
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<MessageEntity> 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<MessageEntity> = Bool;
|
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<MessageEntity> = Bool;
|
||||||
|
@ -1804,13 +1811,13 @@ messages.getPinnedDialogs#d6b94df2 folder_id:int = messages.PeerDialogs;
|
||||||
messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool;
|
messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = Bool;
|
||||||
messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool;
|
messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool;
|
||||||
messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
|
messages.uploadMedia#519bc2b1 peer:InputPeer media:InputMedia = MessageMedia;
|
||||||
messages.sendScreenshotNotification#c97df020 peer:InputPeer reply_to_msg_id:int random_id:long = Updates;
|
messages.sendScreenshotNotification#a1405817 peer:InputPeer reply_to:InputReplyTo random_id:long = Updates;
|
||||||
messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers;
|
messages.getFavedStickers#4f1aaa9 hash:long = messages.FavedStickers;
|
||||||
messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
|
messages.faveSticker#b9ffc55b id:InputDocument unfave:Bool = Bool;
|
||||||
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.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.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.getRecentLocations#702a40e0 peer:InputPeer limit:int hash:long = messages.Messages;
|
||||||
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<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
messages.sendMultiMedia#456e8987 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:flags.0?InputReplyTo multi_media:Vector<InputSingleMedia> schedule_date:flags.10?int send_as:flags.13?InputPeer = Updates;
|
||||||
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
|
messages.uploadEncryptedFile#5057c497 peer:InputEncryptedChat file:InputEncryptedFile = EncryptedFile;
|
||||||
messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
|
messages.searchStickerSets#35705b8a flags:# exclude_featured:flags.0?true q:string hash:long = messages.FoundStickerSets;
|
||||||
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
|
messages.getSplitRanges#1cff7e08 = Vector<MessageRange>;
|
||||||
|
@ -1882,8 +1889,8 @@ messages.searchSentMedia#107e31a0 q:string filter:MessagesFilter limit:int = mes
|
||||||
messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;
|
messages.getAttachMenuBots#16fcc2cb hash:long = AttachMenuBots;
|
||||||
messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;
|
messages.getAttachMenuBot#77216192 bot:InputUser = AttachMenuBotsBot;
|
||||||
messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool;
|
messages.toggleBotInAttachMenu#69f59d69 flags:# write_allowed:flags.0?true bot:InputUser enabled:Bool = Bool;
|
||||||
messages.requestWebView#178b480b flags:# from_bot_menu:flags.4?true silent:flags.5?true peer:InputPeer bot:InputUser url:flags.1?string start_param:flags.3?string theme_params:flags.2?DataJSON platform:string reply_to_msg_id:flags.0?int top_msg_id:flags.9?int send_as:flags.13?InputPeer = WebViewResult;
|
messages.requestWebView#269dc2c1 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:flags.0?InputReplyTo 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.prolongWebView#b0d81a83 flags:# silent:flags.5?true peer:InputPeer bot:InputUser query_id:long reply_to:flags.0?InputReplyTo send_as:flags.13?InputPeer = Bool;
|
||||||
messages.requestSimpleWebView#299bec8e flags:# from_switch_webview:flags.1?true bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult;
|
messages.requestSimpleWebView#299bec8e flags:# from_switch_webview:flags.1?true bot:InputUser url:string theme_params:flags.0?DataJSON platform:string = SimpleWebViewResult;
|
||||||
messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;
|
messages.sendWebViewResultMessage#a4314f5 bot_query_id:string result:InputBotInlineResult = WebViewMessageSent;
|
||||||
messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates;
|
messages.sendWebViewData#dc0242c8 bot:InputUser random_id:long button_text:string data:string = Updates;
|
||||||
|
@ -2104,15 +2111,17 @@ chatlists.hideChatlistUpdates#66e486fb chatlist:InputChatlist = Bool;
|
||||||
chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>;
|
chatlists.getLeaveChatlistSuggestions#fdbcd714 chatlist:InputChatlist = Vector<Peer>;
|
||||||
chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates;
|
chatlists.leaveChatlist#74fae13a chatlist:InputChatlist peers:Vector<InputPeer> = Updates;
|
||||||
|
|
||||||
stories.sendStory#8e826f5d flags:# pinned:flags.2?true media:InputMedia caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> = Updates;
|
stories.sendStory#8b5c6986 flags:# pinned:flags.2?true media:InputMedia caption:flags.0?string entities:flags.1?Vector<MessageEntity> privacy_rules:Vector<InputPrivacyRule> random_id:long = Updates;
|
||||||
|
stories.editStory#2aae7a41 flags:# id:int media:flags.0?InputMedia caption:flags.1?string entities:flags.1?Vector<MessageEntity> privacy_rules:flags.2?Vector<InputPrivacyRule> = Updates;
|
||||||
stories.deleteStories#b5d501d7 id:Vector<int> = Vector<int>;
|
stories.deleteStories#b5d501d7 id:Vector<int> = Vector<int>;
|
||||||
stories.editStoryPrivacy#78981875 id:int privacy_rules:Vector<InputPrivacyRule> = Updates;
|
|
||||||
stories.togglePinned#51602944 id:Vector<int> pinned:Bool = Vector<int>;
|
stories.togglePinned#51602944 id:Vector<int> pinned:Bool = Vector<int>;
|
||||||
stories.getAllStories#eeb0d625 flags:# next:flags.1?true state:flags.0?string = stories.AllStories;
|
stories.getAllStories#eeb0d625 flags:# next:flags.1?true state:flags.0?string = stories.AllStories;
|
||||||
stories.getUserStories#c946f3c0 flags:# pinned:flags.0?true user_id:InputUser offset_id:int limit:int = stories.Stories;
|
stories.getUserStories#96d528e0 user_id:InputUser = stories.UserStories;
|
||||||
stories.getStoriesByID#6a15cf46 user_id:InputUser id:Vector<int> = stories.Stories;
|
stories.getPinnedStories#b471137 user_id:InputUser offset_id:int limit:int = stories.Stories;
|
||||||
stories.getExpiredStories#8f792f2 offset_id:int limit:int = stories.Stories;
|
stories.getExpiredStories#8f792f2 offset_id:int limit:int = stories.Stories;
|
||||||
|
stories.getStoriesByID#6a15cf46 user_id:InputUser id:Vector<int> = stories.Stories;
|
||||||
stories.readStories#edc5105b user_id:InputUser max_id:int = Vector<int>;
|
stories.readStories#edc5105b user_id:InputUser max_id:int = Vector<int>;
|
||||||
|
stories.incrementStoryViews#22126127 user_id:InputUser id:Vector<int> = Bool;
|
||||||
stories.getStoryViewsList#4b3b5e97 id:int offset_date:int offset_id:long limit:int = stories.StoryViewsList;
|
stories.getStoryViewsList#4b3b5e97 id:int offset_date:int offset_id:long limit:int = stories.StoryViewsList;
|
||||||
stories.getStoriesViews#9a75d6a6 id:Vector<int> = stories.StoryViews;
|
stories.getStoriesViews#9a75d6a6 id:Vector<int> = stories.StoryViews;
|
||||||
|
|
||||||
|
|
|
@ -375,8 +375,10 @@ void ActivateBotCommand(ClickHandlerContext context, int row, int column) {
|
||||||
ShowAtTheEndMsgId);
|
ShowAtTheEndMsgId);
|
||||||
auto action = Api::SendAction(history);
|
auto action = Api::SendAction(history);
|
||||||
action.clearDraft = false;
|
action.clearDraft = false;
|
||||||
action.replyTo = itemId;
|
action.replyTo = {
|
||||||
action.topicRootId = topicRootId;
|
.msgId = itemId,
|
||||||
|
.topicRootId = topicRootId,
|
||||||
|
};
|
||||||
history->session().api().shareContact(
|
history->session().api().shareContact(
|
||||||
history->session().user(),
|
history->session().user(),
|
||||||
action);
|
action);
|
||||||
|
|
|
@ -8,7 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "api/api_common.h"
|
#include "api/api_common.h"
|
||||||
|
|
||||||
#include "base/qt/qt_key_modifiers.h"
|
#include "base/qt/qt_key_modifiers.h"
|
||||||
|
#include "data/data_histories.h"
|
||||||
#include "data/data_thread.h"
|
#include "data/data_thread.h"
|
||||||
|
#include "history/history.h"
|
||||||
|
|
||||||
namespace Api {
|
namespace Api {
|
||||||
|
|
||||||
|
@ -17,8 +19,8 @@ SendAction::SendAction(
|
||||||
SendOptions options)
|
SendOptions options)
|
||||||
: history(thread->owningHistory())
|
: history(thread->owningHistory())
|
||||||
, options(options)
|
, options(options)
|
||||||
, replyTo(thread->topicRootId())
|
, replyTo({ .msgId = thread->topicRootId() }) {
|
||||||
, topicRootId(replyTo) {
|
replyTo.topicRootId = replyTo.msgId;
|
||||||
}
|
}
|
||||||
|
|
||||||
SendOptions DefaultSendWhenOnlineOptions() {
|
SendOptions DefaultSendWhenOnlineOptions() {
|
||||||
|
@ -28,4 +30,8 @@ SendOptions DefaultSendWhenOnlineOptions() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MTPInputReplyTo SendAction::mtpReplyTo() const {
|
||||||
|
return Data::ReplyToForMTP(&history->owner(), replyTo);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -40,11 +40,12 @@ struct SendAction {
|
||||||
|
|
||||||
not_null<History*> history;
|
not_null<History*> history;
|
||||||
SendOptions options;
|
SendOptions options;
|
||||||
MsgId replyTo = 0;
|
FullReplyTo replyTo;
|
||||||
MsgId topicRootId = 0;
|
|
||||||
bool clearDraft = true;
|
bool clearDraft = true;
|
||||||
bool generateLocal = true;
|
bool generateLocal = true;
|
||||||
MsgId replaceMediaOf = 0;
|
MsgId replaceMediaOf = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] MTPInputReplyTo mtpReplyTo() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MessageToSend {
|
struct MessageToSend {
|
||||||
|
|
|
@ -97,8 +97,7 @@ constexpr auto kSharedMediaLimit = 100;
|
||||||
photo,
|
photo,
|
||||||
photoThumbs,
|
photoThumbs,
|
||||||
MTP_documentEmpty(MTP_long(0)),
|
MTP_documentEmpty(MTP_long(0)),
|
||||||
jpeg,
|
jpeg);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::optional<MTPVideoSize> PrepareMtpMarkup(
|
[[nodiscard]] std::optional<MTPVideoSize> PrepareMtpMarkup(
|
||||||
|
|
|
@ -43,13 +43,12 @@ void Polls::create(
|
||||||
|
|
||||||
const auto history = action.history;
|
const auto history = action.history;
|
||||||
const auto peer = history->peer;
|
const auto peer = history->peer;
|
||||||
const auto topicRootId = action.replyTo ? action.topicRootId : 0;
|
const auto topicRootId = action.replyTo.msgId
|
||||||
|
? action.replyTo.topicRootId
|
||||||
|
: 0;
|
||||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||||
if (action.replyTo) {
|
if (action.replyTo) {
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||||
if (topicRootId) {
|
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const auto clearCloudDraft = action.clearDraft;
|
const auto clearCloudDraft = action.clearDraft;
|
||||||
if (clearCloudDraft) {
|
if (clearCloudDraft) {
|
||||||
|
@ -74,13 +73,11 @@ void Polls::create(
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
action.replyTo,
|
action.replyTo,
|
||||||
topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(sendFlags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
PollDataToInputMedia(&data),
|
PollDataToInputMedia(&data),
|
||||||
MTP_string(),
|
MTP_string(),
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
|
|
|
@ -60,8 +60,7 @@ SendMediaReady PrepareRingtoneDocument(
|
||||||
MTP_photoEmpty(MTP_long(0)),
|
MTP_photoEmpty(MTP_long(0)),
|
||||||
PreparedPhotoThumbs(),
|
PreparedPhotoThumbs(),
|
||||||
document,
|
document,
|
||||||
QByteArray(),
|
QByteArray());
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -86,10 +86,7 @@ void SendExistingMedia(
|
||||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||||
if (message.action.replyTo) {
|
if (message.action.replyTo) {
|
||||||
flags |= MessageFlag::HasReplyInfo;
|
flags |= MessageFlag::HasReplyInfo;
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||||
if (message.action.topicRootId) {
|
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const auto anonymousPost = peer->amAnonymous();
|
const auto anonymousPost = peer->amAnonymous();
|
||||||
const auto silentPost = ShouldSendSilent(peer, message.action.options);
|
const auto silentPost = ShouldSendSilent(peer, message.action.options);
|
||||||
|
@ -150,13 +147,11 @@ void SendExistingMedia(
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
message.action.replyTo,
|
message.action.replyTo,
|
||||||
message.action.topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(sendFlags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
inputMedia(),
|
inputMedia(),
|
||||||
MTP_string(captionText),
|
MTP_string(captionText),
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
|
@ -273,10 +268,7 @@ bool SendDice(MessageToSend &message) {
|
||||||
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
auto sendFlags = MTPmessages_SendMedia::Flags(0);
|
||||||
if (message.action.replyTo) {
|
if (message.action.replyTo) {
|
||||||
flags |= MessageFlag::HasReplyInfo;
|
flags |= MessageFlag::HasReplyInfo;
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||||
if (message.action.topicRootId) {
|
|
||||||
sendFlags |= MTPmessages_SendMedia::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const auto replyHeader = NewMessageReplyHeader(message.action);
|
const auto replyHeader = NewMessageReplyHeader(message.action);
|
||||||
const auto anonymousPost = peer->amAnonymous();
|
const auto anonymousPost = peer->amAnonymous();
|
||||||
|
@ -320,13 +312,11 @@ bool SendDice(MessageToSend &message) {
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
message.action.replyTo,
|
message.action.replyTo,
|
||||||
message.action.topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(sendFlags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
MTP_inputMediaDice(MTP_string(emoji)),
|
MTP_inputMediaDice(MTP_string(emoji)),
|
||||||
MTP_string(),
|
MTP_string(),
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
|
@ -378,12 +368,12 @@ void SendConfirmedFile(
|
||||||
|
|
||||||
if (!isEditing) {
|
if (!isEditing) {
|
||||||
const auto histories = &session->data().histories();
|
const auto histories = &session->data().histories();
|
||||||
file->to.replyTo = histories->convertTopicReplyTo(
|
file->to.replyTo.msgId = histories->convertTopicReplyToId(
|
||||||
history,
|
history,
|
||||||
file->to.replyTo);
|
file->to.replyTo.msgId);
|
||||||
file->to.topicRootId = histories->convertTopicReplyTo(
|
file->to.replyTo.topicRootId = histories->convertTopicReplyToId(
|
||||||
history,
|
history,
|
||||||
file->to.topicRootId);
|
file->to.replyTo.topicRootId);
|
||||||
}
|
}
|
||||||
|
|
||||||
session->uploader().upload(newId, file);
|
session->uploader().upload(newId, file);
|
||||||
|
@ -391,7 +381,6 @@ void SendConfirmedFile(
|
||||||
auto action = SendAction(history, file->to.options);
|
auto action = SendAction(history, file->to.options);
|
||||||
action.clearDraft = false;
|
action.clearDraft = false;
|
||||||
action.replyTo = file->to.replyTo;
|
action.replyTo = file->to.replyTo;
|
||||||
action.topicRootId = file->to.topicRootId;
|
|
||||||
action.generateLocal = true;
|
action.generateLocal = true;
|
||||||
action.replaceMediaOf = file->to.replaceMediaOf;
|
action.replaceMediaOf = file->to.replaceMediaOf;
|
||||||
session->api().sendAction(action);
|
session->api().sendAction(action);
|
||||||
|
|
|
@ -3091,8 +3091,9 @@ void ApiWrap::sharedMediaDone(
|
||||||
|
|
||||||
void ApiWrap::sendAction(const SendAction &action) {
|
void ApiWrap::sendAction(const SendAction &action) {
|
||||||
if (!action.options.scheduled && !action.replaceMediaOf) {
|
if (!action.options.scheduled && !action.replaceMediaOf) {
|
||||||
const auto topic = action.topicRootId
|
const auto topicRootId = action.replyTo.topicRootId;
|
||||||
? action.history->peer->forumTopicFor(action.topicRootId)
|
const auto topic = topicRootId
|
||||||
|
? action.history->peer->forumTopicFor(topicRootId)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
if (topic) {
|
if (topic) {
|
||||||
topic->readTillEnd();
|
topic->readTillEnd();
|
||||||
|
@ -3106,12 +3107,13 @@ void ApiWrap::sendAction(const SendAction &action) {
|
||||||
|
|
||||||
void ApiWrap::finishForwarding(const SendAction &action) {
|
void ApiWrap::finishForwarding(const SendAction &action) {
|
||||||
const auto history = action.history;
|
const auto history = action.history;
|
||||||
auto toForward = history->resolveForwardDraft(action.topicRootId);
|
const auto topicRootId = action.replyTo.topicRootId;
|
||||||
|
auto toForward = history->resolveForwardDraft(topicRootId);
|
||||||
if (!toForward.items.empty()) {
|
if (!toForward.items.empty()) {
|
||||||
const auto error = GetErrorTextForSending(
|
const auto error = GetErrorTextForSending(
|
||||||
history->peer,
|
history->peer,
|
||||||
{
|
{
|
||||||
.topicRootId = action.topicRootId,
|
.topicRootId = topicRootId,
|
||||||
.forward = &toForward.items,
|
.forward = &toForward.items,
|
||||||
});
|
});
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
|
@ -3119,7 +3121,7 @@ void ApiWrap::finishForwarding(const SendAction &action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardMessages(std::move(toForward), action);
|
forwardMessages(std::move(toForward), action);
|
||||||
history->setForwardDraft(action.topicRootId, {});
|
history->setForwardDraft(topicRootId, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
_session->data().sendHistoryChangeNotifications();
|
_session->data().sendHistoryChangeNotifications();
|
||||||
|
@ -3163,31 +3165,33 @@ void ApiWrap::forwardMessages(
|
||||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||||
const auto sendAs = action.options.sendAs;
|
const auto sendAs = action.options.sendAs;
|
||||||
|
|
||||||
|
using SendFlag = MTPmessages_ForwardMessages::Flag;
|
||||||
auto flags = MessageFlags();
|
auto flags = MessageFlags();
|
||||||
auto sendFlags = MTPmessages_ForwardMessages::Flags(0);
|
auto sendFlags = SendFlag() | SendFlag();
|
||||||
FillMessagePostFlags(action, peer, flags);
|
FillMessagePostFlags(action, peer, flags);
|
||||||
if (silentPost) {
|
if (silentPost) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_silent;
|
sendFlags |= SendFlag::f_silent;
|
||||||
}
|
}
|
||||||
if (action.options.scheduled) {
|
if (action.options.scheduled) {
|
||||||
flags |= MessageFlag::IsOrWasScheduled;
|
flags |= MessageFlag::IsOrWasScheduled;
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_schedule_date;
|
sendFlags |= SendFlag::f_schedule_date;
|
||||||
}
|
}
|
||||||
if (draft.options != Data::ForwardOptions::PreserveInfo) {
|
if (draft.options != Data::ForwardOptions::PreserveInfo) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_drop_author;
|
sendFlags |= SendFlag::f_drop_author;
|
||||||
}
|
}
|
||||||
if (draft.options == Data::ForwardOptions::NoNamesAndCaptions) {
|
if (draft.options == Data::ForwardOptions::NoNamesAndCaptions) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_drop_media_captions;
|
sendFlags |= SendFlag::f_drop_media_captions;
|
||||||
}
|
}
|
||||||
if (sendAs) {
|
if (sendAs) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_send_as;
|
sendFlags |= SendFlag::f_send_as;
|
||||||
}
|
}
|
||||||
const auto kGeneralId = Data::ForumTopic::kGeneralId;
|
const auto kGeneralId = Data::ForumTopic::kGeneralId;
|
||||||
const auto topMsgId = (action.topicRootId == kGeneralId)
|
const auto topicRootId = action.replyTo.topicRootId;
|
||||||
|
const auto topMsgId = (topicRootId == kGeneralId)
|
||||||
? MsgId(0)
|
? MsgId(0)
|
||||||
: action.topicRootId;
|
: topicRootId;
|
||||||
if (topMsgId) {
|
if (topMsgId) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_top_msg_id;
|
sendFlags |= SendFlag::f_top_msg_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto forwardFrom = draft.items.front()->history()->peer;
|
auto forwardFrom = draft.items.front()->history()->peer;
|
||||||
|
@ -3529,14 +3533,14 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
action.generateLocal = true;
|
action.generateLocal = true;
|
||||||
sendAction(action);
|
sendAction(action);
|
||||||
|
|
||||||
const auto replyToId = action.replyTo;
|
const auto replyToId = action.replyTo.msgId;
|
||||||
const auto replyTo = replyToId
|
const auto replyTo = replyToId
|
||||||
? peer->owner().message(peer, replyToId)
|
? peer->owner().message(peer, replyToId)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto topicRootId = replyTo
|
const auto topicRootId = replyTo
|
||||||
? replyTo->topicRootId()
|
? replyTo->topicRootId()
|
||||||
: action.topicRootId
|
: action.replyTo.topicRootId
|
||||||
? action.topicRootId
|
? action.replyTo.topicRootId
|
||||||
: Data::ForumTopic::kGeneralId;
|
: Data::ForumTopic::kGeneralId;
|
||||||
const auto topic = peer->forumTopicFor(topicRootId);
|
const auto topic = peer->forumTopicFor(topicRootId);
|
||||||
if (!(topic ? Data::CanSendTexts(topic) : Data::CanSendTexts(peer))
|
if (!(topic ? Data::CanSendTexts(topic) : Data::CanSendTexts(peer))
|
||||||
|
@ -3575,10 +3579,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
auto sendFlags = MTPmessages_SendMessage::Flags(0);
|
auto sendFlags = MTPmessages_SendMessage::Flags(0);
|
||||||
if (action.replyTo) {
|
if (action.replyTo) {
|
||||||
flags |= MessageFlag::HasReplyInfo;
|
flags |= MessageFlag::HasReplyInfo;
|
||||||
sendFlags |= MTPmessages_SendMessage::Flag::f_reply_to_msg_id;
|
sendFlags |= MTPmessages_SendMessage::Flag::f_reply_to;
|
||||||
if (action.topicRootId) {
|
|
||||||
sendFlags |= MTPmessages_SendMessage::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const auto replyHeader = NewMessageReplyHeader(action);
|
const auto replyHeader = NewMessageReplyHeader(action);
|
||||||
MTPMessageMedia media = MTP_messageMediaEmpty();
|
MTPMessageMedia media = MTP_messageMediaEmpty();
|
||||||
|
@ -3605,7 +3606,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
sendFlags |= MTPmessages_SendMessage::Flag::f_entities;
|
sendFlags |= MTPmessages_SendMessage::Flag::f_entities;
|
||||||
}
|
}
|
||||||
const auto clearCloudDraft = action.clearDraft;
|
const auto clearCloudDraft = action.clearDraft;
|
||||||
const auto topicRootId = action.topicRootId;
|
const auto topicRootId = action.replyTo.topicRootId;
|
||||||
if (clearCloudDraft) {
|
if (clearCloudDraft) {
|
||||||
sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
|
sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
|
||||||
history->clearCloudDraft(topicRootId);
|
history->clearCloudDraft(topicRootId);
|
||||||
|
@ -3642,13 +3643,11 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
action.replyTo,
|
action.replyTo,
|
||||||
topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMessage>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMessage>(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(sendFlags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
msgText,
|
msgText,
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
MTPReplyMarkup(),
|
MTPReplyMarkup(),
|
||||||
|
@ -3737,29 +3736,29 @@ void ApiWrap::sendInlineResult(
|
||||||
? (*localMessageId)
|
? (*localMessageId)
|
||||||
: _session->data().nextLocalMessageId());
|
: _session->data().nextLocalMessageId());
|
||||||
const auto randomId = base::RandomValue<uint64>();
|
const auto randomId = base::RandomValue<uint64>();
|
||||||
const auto topicRootId = action.replyTo ? action.topicRootId : 0;
|
const auto topicRootId = action.replyTo.msgId
|
||||||
|
? action.replyTo.topicRootId
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
using SendFlag = MTPmessages_SendInlineBotResult::Flag;
|
||||||
auto flags = NewMessageFlags(peer);
|
auto flags = NewMessageFlags(peer);
|
||||||
auto sendFlags = MTPmessages_SendInlineBotResult::Flag::f_clear_draft | 0;
|
auto sendFlags = SendFlag::f_clear_draft | SendFlag();
|
||||||
if (action.replyTo) {
|
if (action.replyTo) {
|
||||||
flags |= MessageFlag::HasReplyInfo;
|
flags |= MessageFlag::HasReplyInfo;
|
||||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_reply_to_msg_id;
|
sendFlags |= SendFlag::f_reply_to;
|
||||||
if (topicRootId) {
|
|
||||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const auto anonymousPost = peer->amAnonymous();
|
const auto anonymousPost = peer->amAnonymous();
|
||||||
const auto silentPost = ShouldSendSilent(peer, action.options);
|
const auto silentPost = ShouldSendSilent(peer, action.options);
|
||||||
FillMessagePostFlags(action, peer, flags);
|
FillMessagePostFlags(action, peer, flags);
|
||||||
if (silentPost) {
|
if (silentPost) {
|
||||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent;
|
sendFlags |= SendFlag::f_silent;
|
||||||
}
|
}
|
||||||
if (action.options.scheduled) {
|
if (action.options.scheduled) {
|
||||||
flags |= MessageFlag::IsOrWasScheduled;
|
flags |= MessageFlag::IsOrWasScheduled;
|
||||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_schedule_date;
|
sendFlags |= SendFlag::f_schedule_date;
|
||||||
}
|
}
|
||||||
if (action.options.hideViaBot) {
|
if (action.options.hideViaBot) {
|
||||||
sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_hide_via;
|
sendFlags |= SendFlag::f_hide_via;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto sendAs = action.options.sendAs;
|
const auto sendAs = action.options.sendAs;
|
||||||
|
@ -3793,13 +3792,11 @@ void ApiWrap::sendInlineResult(
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
action.replyTo,
|
action.replyTo,
|
||||||
topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendInlineBotResult>(
|
Data::Histories::PrepareMessage<MTPmessages_SendInlineBotResult>(
|
||||||
MTP_flags(sendFlags),
|
MTP_flags(sendFlags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
MTP_long(data->getQueryId()),
|
MTP_long(data->getQueryId()),
|
||||||
MTP_string(data->getId()),
|
MTP_string(data->getId()),
|
||||||
|
@ -3912,8 +3909,7 @@ void ApiWrap::sendMediaWithRandomId(
|
||||||
Api::SendOptions options,
|
Api::SendOptions options,
|
||||||
uint64 randomId) {
|
uint64 randomId) {
|
||||||
const auto history = item->history();
|
const auto history = item->history();
|
||||||
const auto replyTo = item->replyToId();
|
const auto replyTo = item->replyTo();
|
||||||
const auto topicRootId = item->topicRootId();
|
|
||||||
|
|
||||||
auto caption = item->originalText();
|
auto caption = item->originalText();
|
||||||
TextUtilities::Trim(caption);
|
TextUtilities::Trim(caption);
|
||||||
|
@ -3926,8 +3922,7 @@ void ApiWrap::sendMediaWithRandomId(
|
||||||
|
|
||||||
using Flag = MTPmessages_SendMedia::Flag;
|
using Flag = MTPmessages_SendMedia::Flag;
|
||||||
const auto flags = Flag(0)
|
const auto flags = Flag(0)
|
||||||
| (replyTo ? Flag::f_reply_to_msg_id : Flag(0))
|
| (replyTo ? Flag::f_reply_to : Flag(0))
|
||||||
| (topicRootId ? Flag::f_top_msg_id : Flag(0))
|
|
||||||
| (ShouldSendSilent(history->peer, options)
|
| (ShouldSendSilent(history->peer, options)
|
||||||
? Flag::f_silent
|
? Flag::f_silent
|
||||||
: Flag(0))
|
: Flag(0))
|
||||||
|
@ -3941,13 +3936,11 @@ void ApiWrap::sendMediaWithRandomId(
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
replyTo,
|
replyTo,
|
||||||
topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
media,
|
media,
|
||||||
MTP_string(caption.text),
|
MTP_string(caption.text),
|
||||||
MTP_long(randomId),
|
MTP_long(randomId),
|
||||||
|
@ -4028,13 +4021,11 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto history = sample->history();
|
const auto history = sample->history();
|
||||||
const auto replyTo = sample->replyToId();
|
const auto replyTo = sample->replyTo();
|
||||||
const auto topicRootId = sample->topicRootId();
|
|
||||||
const auto sendAs = album->options.sendAs;
|
const auto sendAs = album->options.sendAs;
|
||||||
using Flag = MTPmessages_SendMultiMedia::Flag;
|
using Flag = MTPmessages_SendMultiMedia::Flag;
|
||||||
const auto flags = Flag(0)
|
const auto flags = Flag(0)
|
||||||
| (replyTo ? Flag::f_reply_to_msg_id : Flag(0))
|
| (replyTo ? Flag::f_reply_to : Flag(0))
|
||||||
| (topicRootId ? Flag::f_top_msg_id : Flag(0))
|
|
||||||
| (ShouldSendSilent(history->peer, album->options)
|
| (ShouldSendSilent(history->peer, album->options)
|
||||||
? Flag::f_silent
|
? Flag::f_silent
|
||||||
: Flag(0))
|
: Flag(0))
|
||||||
|
@ -4045,13 +4036,11 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
replyTo,
|
replyTo,
|
||||||
topicRootId,
|
|
||||||
uint64(0), // randomId
|
uint64(0), // randomId
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMultiMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMultiMedia>(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
peer->input,
|
peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
MTP_vector<MTPInputSingleMedia>(medias),
|
MTP_vector<MTPInputSingleMedia>(medias),
|
||||||
MTP_int(album->options.scheduled),
|
MTP_int(album->options.scheduled),
|
||||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty())
|
(sendAs ? sendAs->input : MTP_inputPeerEmpty())
|
||||||
|
@ -4074,7 +4063,6 @@ FileLoadTo ApiWrap::fileLoadTaskOptions(const SendAction &action) const {
|
||||||
peer->id,
|
peer->id,
|
||||||
action.options,
|
action.options,
|
||||||
action.replyTo,
|
action.replyTo,
|
||||||
action.topicRootId,
|
|
||||||
action.replaceMediaOf);
|
action.replaceMediaOf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ constexpr auto kDefaultDimming = 50;
|
||||||
const auto flags = MessageFlag::FakeHistoryItem
|
const auto flags = MessageFlag::FakeHistoryItem
|
||||||
| MessageFlag::HasFromId
|
| MessageFlag::HasFromId
|
||||||
| (out ? MessageFlag::Outgoing : MessageFlag(0));
|
| (out ? MessageFlag::Outgoing : MessageFlag(0));
|
||||||
const auto replyTo = MsgId();
|
const auto replyTo = FullReplyTo();
|
||||||
const auto viaBotId = UserId();
|
const auto viaBotId = UserId();
|
||||||
const auto groupedId = uint64();
|
const auto groupedId = uint64();
|
||||||
const auto item = history->makeMessage(
|
const auto item = history->makeMessage(
|
||||||
|
|
|
@ -76,11 +76,11 @@ AdminLog::OwnedItem GenerateItem(
|
||||||
|
|
||||||
const auto item = history->addNewLocalMessage(
|
const auto item = history->addNewLocalMessage(
|
||||||
history->nextNonHistoryEntryId(),
|
history->nextNonHistoryEntryId(),
|
||||||
MessageFlag::FakeHistoryItem
|
(MessageFlag::FakeHistoryItem
|
||||||
| MessageFlag::HasFromId
|
| MessageFlag::HasFromId
|
||||||
| MessageFlag::HasReplyInfo,
|
| MessageFlag::HasReplyInfo),
|
||||||
UserId(), // via
|
UserId(), // via
|
||||||
replyTo,
|
FullReplyTo{ .msgId = replyTo },
|
||||||
base::unixtime::now(), // date
|
base::unixtime::now(), // date
|
||||||
from,
|
from,
|
||||||
QString(), // postAuthor
|
QString(), // postAuthor
|
||||||
|
|
|
@ -128,7 +128,7 @@ void DicePack::generateLocal(int index, const QString &name) {
|
||||||
QByteArray(),
|
QByteArray(),
|
||||||
nullptr,
|
nullptr,
|
||||||
SendMediaType::File,
|
SendMediaType::File,
|
||||||
FileLoadTo(0, {}, 0, 0, 0),
|
FileLoadTo(0, {}, {}, 0),
|
||||||
{},
|
{},
|
||||||
false);
|
false);
|
||||||
task.process({ .generateGoodThumbnail = false });
|
task.process({ .generateGoodThumbnail = false });
|
||||||
|
|
|
@ -865,7 +865,7 @@ not_null<HistoryItem*> DownloadManager::generateItem(
|
||||||
? previousItem->history()
|
? previousItem->history()
|
||||||
: session->data().history(session->user());
|
: session->data().history(session->user());
|
||||||
const auto flags = MessageFlag::FakeHistoryItem;
|
const auto flags = MessageFlag::FakeHistoryItem;
|
||||||
const auto replyTo = MsgId();
|
const auto replyTo = FullReplyTo();
|
||||||
const auto viaBotId = UserId();
|
const auto viaBotId = UserId();
|
||||||
const auto date = base::unixtime::now();
|
const auto date = base::unixtime::now();
|
||||||
const auto postAuthor = QString();
|
const auto postAuthor = QString();
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_forum.h"
|
#include "data/data_forum.h"
|
||||||
#include "data/data_forum_topic.h"
|
#include "data/data_forum_topic.h"
|
||||||
#include "data/data_scheduled_messages.h"
|
#include "data/data_scheduled_messages.h"
|
||||||
|
#include "data/data_user.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "base/random.h"
|
#include "base/random.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
@ -31,6 +32,29 @@ constexpr auto kReadRequestTimeout = 3 * crl::time(1000);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
MTPInputReplyTo ReplyToForMTP(
|
||||||
|
not_null<Session*> owner,
|
||||||
|
FullReplyTo replyTo) {
|
||||||
|
if (replyTo.msgId || replyTo.topicRootId) {
|
||||||
|
using Flag = MTPDinputReplyToMessage::Flag;
|
||||||
|
return MTP_inputReplyToMessage(
|
||||||
|
(replyTo.topicRootId
|
||||||
|
? MTP_flags(Flag::f_top_msg_id)
|
||||||
|
: MTP_flags(0)),
|
||||||
|
MTP_int(replyTo.msgId ? replyTo.msgId : replyTo.topicRootId),
|
||||||
|
MTP_int(replyTo.topicRootId));
|
||||||
|
} else if (replyTo.storyId) {
|
||||||
|
if (const auto peer = owner->peerLoaded(replyTo.storyId.peer)) {
|
||||||
|
if (const auto user = peer->asUser()) {
|
||||||
|
return MTP_inputReplyToStory(
|
||||||
|
user->inputUser,
|
||||||
|
MTP_int(replyTo.storyId.story));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return MTPInputReplyTo();
|
||||||
|
}
|
||||||
|
|
||||||
Histories::Histories(not_null<Session*> owner)
|
Histories::Histories(not_null<Session*> owner)
|
||||||
: _owner(owner)
|
: _owner(owner)
|
||||||
, _readRequestsTimer([=] { sendReadRequests(); }) {
|
, _readRequestsTimer([=] { sendReadRequests(); }) {
|
||||||
|
@ -885,23 +909,24 @@ bool Histories::isCreatingTopic(
|
||||||
|
|
||||||
int Histories::sendPreparedMessage(
|
int Histories::sendPreparedMessage(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
MsgId topicRootId,
|
|
||||||
uint64 randomId,
|
uint64 randomId,
|
||||||
Fn<PreparedMessage(MsgId replyTo, MsgId topicRootId)> message,
|
Fn<PreparedMessage(not_null<Session*>, FullReplyTo)> message,
|
||||||
Fn<void(const MTPUpdates&, const MTP::Response&)> done,
|
Fn<void(const MTPUpdates&, const MTP::Response&)> done,
|
||||||
Fn<void(const MTP::Error&, const MTP::Response&)> fail) {
|
Fn<void(const MTP::Error&, const MTP::Response&)> fail) {
|
||||||
if (isCreatingTopic(history, topicRootId)) {
|
if (isCreatingTopic(history, replyTo.topicRootId)) {
|
||||||
const auto id = ++_requestAutoincrement;
|
const auto id = ++_requestAutoincrement;
|
||||||
const auto creatingId = FullMsgId(history->peer->id, topicRootId);
|
const auto creatingId = FullMsgId(
|
||||||
|
history->peer->id,
|
||||||
|
replyTo.topicRootId);
|
||||||
auto i = _creatingTopics.find(creatingId);
|
auto i = _creatingTopics.find(creatingId);
|
||||||
if (i == end(_creatingTopics)) {
|
if (i == end(_creatingTopics)) {
|
||||||
sendCreateTopicRequest(history, topicRootId);
|
sendCreateTopicRequest(history, replyTo.topicRootId);
|
||||||
i = _creatingTopics.emplace(creatingId).first;
|
i = _creatingTopics.emplace(creatingId).first;
|
||||||
}
|
}
|
||||||
i->second.push_back({
|
i->second.push_back({
|
||||||
.randomId = randomId,
|
.randomId = randomId,
|
||||||
.replyTo = replyTo,
|
.replyTo = replyTo.msgId,
|
||||||
.message = std::move(message),
|
.message = std::move(message),
|
||||||
.done = std::move(done),
|
.done = std::move(done),
|
||||||
.fail = std::move(fail),
|
.fail = std::move(fail),
|
||||||
|
@ -910,9 +935,12 @@ int Histories::sendPreparedMessage(
|
||||||
_creatingTopicRequests.emplace(id);
|
_creatingTopicRequests.emplace(id);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
const auto realReply = convertTopicReplyTo(history, replyTo);
|
const auto realReplyTo = FullReplyTo{
|
||||||
const auto realRoot = convertTopicReplyTo(history, topicRootId);
|
.msgId = convertTopicReplyToId(history, replyTo.msgId),
|
||||||
return v::match(message(realReply, realRoot), [&](const auto &request) {
|
.topicRootId = convertTopicReplyToId(history, replyTo.topicRootId),
|
||||||
|
.storyId = replyTo.storyId,
|
||||||
|
};
|
||||||
|
return v::match(message(_owner, realReplyTo), [&](const auto &request) {
|
||||||
const auto type = RequestType::Send;
|
const auto type = RequestType::Send;
|
||||||
return sendRequest(history, type, [=](Fn<void()> finish) {
|
return sendRequest(history, type, [=](Fn<void()> finish) {
|
||||||
const auto session = &_owner->session();
|
const auto session = &_owner->session();
|
||||||
|
@ -955,8 +983,10 @@ void Histories::checkTopicCreated(FullMsgId rootId, MsgId realRoot) {
|
||||||
_creatingTopicRequests.erase(entry.requestId);
|
_creatingTopicRequests.erase(entry.requestId);
|
||||||
sendPreparedMessage(
|
sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
entry.replyTo,
|
FullReplyTo{
|
||||||
realRoot,
|
.msgId = entry.replyTo,
|
||||||
|
.topicRootId = realRoot,
|
||||||
|
},
|
||||||
entry.randomId,
|
entry.randomId,
|
||||||
std::move(entry.message),
|
std::move(entry.message),
|
||||||
std::move(entry.done),
|
std::move(entry.done),
|
||||||
|
@ -976,14 +1006,14 @@ void Histories::checkTopicCreated(FullMsgId rootId, MsgId realRoot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgId Histories::convertTopicReplyTo(
|
MsgId Histories::convertTopicReplyToId(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId replyTo) const {
|
MsgId replyToId) const {
|
||||||
if (!replyTo) {
|
if (!replyToId) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const auto i = _createdTopicIds.find({ history->peer->id, replyTo });
|
const auto i = _createdTopicIds.find({ history->peer->id, replyToId });
|
||||||
return (i != end(_createdTopicIds)) ? i->second : replyTo;
|
return (i != end(_createdTopicIds)) ? i->second : replyToId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Histories::checkPostponed(not_null<History*> history, int id) {
|
void Histories::checkPostponed(not_null<History*> history, int id) {
|
||||||
|
|
|
@ -26,6 +26,10 @@ namespace Data {
|
||||||
class Session;
|
class Session;
|
||||||
class Folder;
|
class Folder;
|
||||||
|
|
||||||
|
[[nodiscard]] MTPInputReplyTo ReplyToForMTP(
|
||||||
|
not_null<Session*> owner,
|
||||||
|
FullReplyTo replyTo);
|
||||||
|
|
||||||
class Histories final {
|
class Histories final {
|
||||||
public:
|
public:
|
||||||
enum class RequestType : uchar {
|
enum class RequestType : uchar {
|
||||||
|
@ -102,29 +106,27 @@ public:
|
||||||
MTPmessages_SendMultiMedia>;
|
MTPmessages_SendMultiMedia>;
|
||||||
int sendPreparedMessage(
|
int sendPreparedMessage(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
MsgId topicRootId,
|
|
||||||
uint64 randomId,
|
uint64 randomId,
|
||||||
Fn<PreparedMessage(MsgId replyTo, MsgId topicRootId)> message,
|
Fn<PreparedMessage(not_null<Session*>, FullReplyTo)> message,
|
||||||
Fn<void(const MTPUpdates&, const MTP::Response&)> done,
|
Fn<void(const MTPUpdates&, const MTP::Response&)> done,
|
||||||
Fn<void(const MTP::Error&, const MTP::Response&)> fail);
|
Fn<void(const MTP::Error&, const MTP::Response&)> fail);
|
||||||
|
|
||||||
struct ReplyToPlaceholder {
|
struct ReplyToPlaceholder {
|
||||||
};
|
};
|
||||||
struct TopicRootPlaceholder {
|
|
||||||
};
|
|
||||||
template <typename RequestType, typename ...Args>
|
template <typename RequestType, typename ...Args>
|
||||||
static Fn<Histories::PreparedMessage(MsgId, MsgId)> PrepareMessage(
|
static auto PrepareMessage(const Args &...args)
|
||||||
const Args &...args) {
|
-> Fn<Histories::PreparedMessage(not_null<Session*>, FullReplyTo)> {
|
||||||
return [=](MsgId replyTo, MsgId topicRootId) -> RequestType {
|
return [=](not_null<Session*> owner, FullReplyTo replyTo)
|
||||||
return { ReplaceReplyIds(args, replyTo, topicRootId)... };
|
-> RequestType {
|
||||||
|
return { ReplaceReplyIds(owner, args, replyTo)... };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkTopicCreated(FullMsgId rootId, MsgId realRoot);
|
void checkTopicCreated(FullMsgId rootId, MsgId realRoot);
|
||||||
[[nodiscard]] MsgId convertTopicReplyTo(
|
[[nodiscard]] MsgId convertTopicReplyToId(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId replyTo) const;
|
MsgId replyToId) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PostponedHistoryRequest {
|
struct PostponedHistoryRequest {
|
||||||
|
@ -151,7 +153,7 @@ private:
|
||||||
struct DelayedByTopicMessage {
|
struct DelayedByTopicMessage {
|
||||||
uint64 randomId = 0;
|
uint64 randomId = 0;
|
||||||
MsgId replyTo = 0;
|
MsgId replyTo = 0;
|
||||||
Fn<PreparedMessage(MsgId replyTo, MsgId topicRootId)> message;
|
Fn<PreparedMessage(not_null<Session*>, FullReplyTo)> message;
|
||||||
Fn<void(const MTPUpdates&, const MTP::Response&)> done;
|
Fn<void(const MTPUpdates&, const MTP::Response&)> done;
|
||||||
Fn<void(const MTP::Error&, const MTP::Response&)> fail;
|
Fn<void(const MTP::Error&, const MTP::Response&)> fail;
|
||||||
int requestId = 0;
|
int requestId = 0;
|
||||||
|
@ -166,11 +168,12 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
static auto ReplaceReplyIds(Arg arg, MsgId replyTo, MsgId topicRootId) {
|
static auto ReplaceReplyIds(
|
||||||
|
not_null<Session*> owner,
|
||||||
|
Arg arg,
|
||||||
|
FullReplyTo replyTo) {
|
||||||
if constexpr (std::is_same_v<Arg, ReplyToPlaceholder>) {
|
if constexpr (std::is_same_v<Arg, ReplyToPlaceholder>) {
|
||||||
return MTP_int(replyTo);
|
return ReplyToForMTP(owner, replyTo);
|
||||||
} else if constexpr (std::is_same_v<Arg, TopicRootPlaceholder>) {
|
|
||||||
return MTP_int(topicRootId);
|
|
||||||
} else {
|
} else {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,37 @@ struct GlobalMsgId {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using StoryId = int32;
|
||||||
|
|
||||||
|
struct FullStoryId {
|
||||||
|
PeerId peer = 0;
|
||||||
|
StoryId story = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] bool valid() const {
|
||||||
|
return peer != 0 && story != 0;
|
||||||
|
}
|
||||||
|
explicit operator bool() const {
|
||||||
|
return valid();
|
||||||
|
}
|
||||||
|
friend inline auto operator<=>(FullStoryId, FullStoryId) = default;
|
||||||
|
friend inline bool operator==(FullStoryId, FullStoryId) = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FullReplyTo {
|
||||||
|
MsgId msgId = 0;
|
||||||
|
MsgId topicRootId = 0;
|
||||||
|
FullStoryId storyId;
|
||||||
|
|
||||||
|
[[nodiscard]] bool valid() const {
|
||||||
|
return msgId || storyId;
|
||||||
|
}
|
||||||
|
explicit operator bool() const {
|
||||||
|
return valid();
|
||||||
|
}
|
||||||
|
friend inline auto operator<=>(FullReplyTo, FullReplyTo) = default;
|
||||||
|
friend inline bool operator==(FullReplyTo, FullReplyTo) = default;
|
||||||
|
};
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -192,13 +192,13 @@ void ScheduledMessages::sendNowSimpleMessage(
|
||||||
|
|
||||||
const auto history = local->history();
|
const auto history = local->history();
|
||||||
auto action = Api::SendAction(history);
|
auto action = Api::SendAction(history);
|
||||||
action.replyTo = local->replyToId();
|
action.replyTo = local->replyTo();
|
||||||
const auto replyHeader = NewMessageReplyHeader(action);
|
const auto replyHeader = NewMessageReplyHeader(action);
|
||||||
const auto localFlags = NewMessageFlags(history->peer)
|
const auto localFlags = NewMessageFlags(history->peer)
|
||||||
& ~MessageFlag::BeingSent;
|
& ~MessageFlag::BeingSent;
|
||||||
const auto flags = MTPDmessage::Flag::f_entities
|
const auto flags = MTPDmessage::Flag::f_entities
|
||||||
| MTPDmessage::Flag::f_from_id
|
| MTPDmessage::Flag::f_from_id
|
||||||
| (local->replyToId()
|
| (action.replyTo
|
||||||
? MTPDmessage::Flag::f_reply_to
|
? MTPDmessage::Flag::f_reply_to
|
||||||
: MTPDmessage::Flag(0))
|
: MTPDmessage::Flag(0))
|
||||||
| (update.vttl_period()
|
| (update.vttl_period()
|
||||||
|
|
|
@ -46,20 +46,6 @@ struct StoriesList {
|
||||||
friend inline bool operator==(StoriesList, StoriesList) = default;
|
friend inline bool operator==(StoriesList, StoriesList) = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FullStoryId {
|
|
||||||
UserData *user = nullptr;
|
|
||||||
StoryId id = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] bool valid() const {
|
|
||||||
return user != nullptr && id != 0;
|
|
||||||
}
|
|
||||||
explicit operator bool() const {
|
|
||||||
return valid();
|
|
||||||
}
|
|
||||||
friend inline auto operator<=>(FullStoryId, FullStoryId) = default;
|
|
||||||
friend inline bool operator==(FullStoryId, FullStoryId) = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Stories final {
|
class Stories final {
|
||||||
public:
|
public:
|
||||||
explicit Stories(not_null<Session*> owner);
|
explicit Stories(not_null<Session*> owner);
|
||||||
|
|
|
@ -135,7 +135,6 @@ using PollId = uint64;
|
||||||
using WallPaperId = uint64;
|
using WallPaperId = uint64;
|
||||||
using CallId = uint64;
|
using CallId = uint64;
|
||||||
using BotAppId = uint64;
|
using BotAppId = uint64;
|
||||||
using StoryId = int32;
|
|
||||||
|
|
||||||
constexpr auto CancelledWebPageId = WebPageId(0xFFFFFFFFFFFFFFFFULL);
|
constexpr auto CancelledWebPageId = WebPageId(0xFFFFFFFFFFFFFFFFULL);
|
||||||
|
|
||||||
|
|
|
@ -1260,6 +1260,8 @@ Message ParseMessage(
|
||||||
if (result.replyToPeerId == result.peerId) {
|
if (result.replyToPeerId == result.peerId) {
|
||||||
result.replyToPeerId = 0;
|
result.replyToPeerId = 0;
|
||||||
}
|
}
|
||||||
|
}, [&](const MTPDmessageReplyStoryHeader &data) {
|
||||||
|
// #TODO stories export
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1307,6 +1309,8 @@ Message ParseMessage(
|
||||||
result.replyToPeerId = data.vreply_to_peer_id()
|
result.replyToPeerId = data.vreply_to_peer_id()
|
||||||
? ParsePeerId(*data.vreply_to_peer_id())
|
? ParsePeerId(*data.vreply_to_peer_id())
|
||||||
: PeerId(0);
|
: PeerId(0);
|
||||||
|
}, [&](const MTPDmessageReplyStoryHeader &data) {
|
||||||
|
// #TODO stories export
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (const auto viaBotId = data.vvia_bot_id()) {
|
if (const auto viaBotId = data.vvia_bot_id()) {
|
||||||
|
|
|
@ -820,7 +820,7 @@ void GenerateItems(
|
||||||
const auto makeSimpleTextMessage = [&](TextWithEntities &&text) {
|
const auto makeSimpleTextMessage = [&](TextWithEntities &&text) {
|
||||||
const auto bodyFlags = MessageFlag::HasFromId
|
const auto bodyFlags = MessageFlag::HasFromId
|
||||||
| MessageFlag::AdminLogEntry;
|
| MessageFlag::AdminLogEntry;
|
||||||
const auto bodyReplyTo = MsgId();
|
const auto bodyReplyTo = FullReplyTo();
|
||||||
const auto bodyViaBotId = UserId();
|
const auto bodyViaBotId = UserId();
|
||||||
const auto bodyGroupedId = uint64();
|
const auto bodyGroupedId = uint64();
|
||||||
return history->makeMessage(
|
return history->makeMessage(
|
||||||
|
|
|
@ -631,7 +631,7 @@ not_null<HistoryItem*> History::addNewLocalMessage(
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -679,7 +679,7 @@ not_null<HistoryItem*> History::addNewLocalMessage(
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -705,7 +705,7 @@ not_null<HistoryItem*> History::addNewLocalMessage(
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -731,7 +731,7 @@ not_null<HistoryItem*> History::addNewLocalMessage(
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -1144,6 +1144,8 @@ void History::applyServiceChanges(
|
||||||
topic->setHasPinnedMessages(true);
|
topic->setHasPinnedMessages(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, [&](const MTPDmessageReplyStoryHeader &data) {
|
||||||
|
LOG(("API Error: story reply in messageActionPinMessage."));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [&](const MTPDmessageActionGroupCall &data) {
|
}, [&](const MTPDmessageActionGroupCall &data) {
|
||||||
|
|
|
@ -148,7 +148,7 @@ public:
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
@ -190,7 +190,7 @@ public:
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
|
|
|
@ -390,7 +390,7 @@ bool HistoryInner::BotAbout::refresh() {
|
||||||
| MessageFlag::Local;
|
| MessageFlag::Local;
|
||||||
const auto postAuthor = QString();
|
const auto postAuthor = QString();
|
||||||
const auto date = TimeId(0);
|
const auto date = TimeId(0);
|
||||||
const auto replyTo = MsgId(0);
|
const auto replyTo = FullReplyTo();
|
||||||
const auto viaBotId = UserId(0);
|
const auto viaBotId = UserId(0);
|
||||||
const auto groupedId = uint64(0);
|
const auto groupedId = uint64(0);
|
||||||
const auto textWithEntities = TextUtilities::ParseEntities(
|
const auto textWithEntities = TextUtilities::ParseEntities(
|
||||||
|
|
|
@ -131,6 +131,7 @@ struct HistoryItem::CreateConfig {
|
||||||
PeerId replyToPeer = 0;
|
PeerId replyToPeer = 0;
|
||||||
MsgId replyTo = 0;
|
MsgId replyTo = 0;
|
||||||
MsgId replyToTop = 0;
|
MsgId replyToTop = 0;
|
||||||
|
StoryId replyToStory = 0;
|
||||||
bool replyIsTopicPost = false;
|
bool replyIsTopicPost = false;
|
||||||
UserId viaBotId = 0;
|
UserId viaBotId = 0;
|
||||||
int viewsCount = -1;
|
int viewsCount = -1;
|
||||||
|
@ -506,7 +507,7 @@ HistoryItem::HistoryItem(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -541,7 +542,7 @@ HistoryItem::HistoryItem(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -576,7 +577,7 @@ HistoryItem::HistoryItem(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -606,7 +607,7 @@ HistoryItem::HistoryItem(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -648,7 +649,7 @@ HistoryItem::HistoryItem(
|
||||||
/*from.peer ? from.peer->id : */PeerId(0)) {
|
/*from.peer ? from.peer->id : */PeerId(0)) {
|
||||||
createComponentsHelper(
|
createComponentsHelper(
|
||||||
_flags,
|
_flags,
|
||||||
MsgId(0), // replyTo
|
FullReplyTo(),
|
||||||
UserId(0), // viaBotId
|
UserId(0), // viaBotId
|
||||||
QString(), // postAuthor
|
QString(), // postAuthor
|
||||||
HistoryMessageMarkupData());
|
HistoryMessageMarkupData());
|
||||||
|
@ -1542,6 +1543,7 @@ void HistoryItem::applySentMessage(const MTPDmessage &data) {
|
||||||
data.vreply_to_top_id().value_or(
|
data.vreply_to_top_id().value_or(
|
||||||
data.vreply_to_msg_id().v),
|
data.vreply_to_msg_id().v),
|
||||||
data.is_forum_topic());
|
data.is_forum_topic());
|
||||||
|
}, [](const MTPDmessageReplyStoryHeader &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setPostAuthor(data.vpost_author().value_or_empty());
|
setPostAuthor(data.vpost_author().value_or_empty());
|
||||||
|
@ -2742,6 +2744,26 @@ MsgId HistoryItem::topicRootId() const {
|
||||||
return Data::ForumTopic::kGeneralId;
|
return Data::ForumTopic::kGeneralId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FullStoryId HistoryItem::replyToStory() const {
|
||||||
|
if (const auto reply = Get<HistoryMessageReply>()) {
|
||||||
|
if (reply->replyToStoryId) {
|
||||||
|
const auto peerId = reply->replyToPeerId
|
||||||
|
? reply->replyToPeerId
|
||||||
|
: _history->peer->id;
|
||||||
|
return { .peer = peerId, .story = reply->replyToStoryId };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
FullReplyTo HistoryItem::replyTo() const {
|
||||||
|
return {
|
||||||
|
.msgId = replyToId(),
|
||||||
|
.topicRootId = topicRootId(),
|
||||||
|
.storyId = replyToStory(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryItem::setText(const TextWithEntities &textWithEntities) {
|
void HistoryItem::setText(const TextWithEntities &textWithEntities) {
|
||||||
for (const auto &entity : textWithEntities.entities) {
|
for (const auto &entity : textWithEntities.entities) {
|
||||||
auto type = entity.type();
|
auto type = entity.type();
|
||||||
|
@ -2903,7 +2925,7 @@ const std::vector<ClickHandlerPtr> &HistoryItem::customTextLinks() const {
|
||||||
|
|
||||||
void HistoryItem::createComponents(CreateConfig &&config) {
|
void HistoryItem::createComponents(CreateConfig &&config) {
|
||||||
uint64 mask = 0;
|
uint64 mask = 0;
|
||||||
if (config.replyTo) {
|
if (config.replyTo || config.replyToStory) {
|
||||||
mask |= HistoryMessageReply::Bit();
|
mask |= HistoryMessageReply::Bit();
|
||||||
}
|
}
|
||||||
if (config.viaBotId) {
|
if (config.viaBotId) {
|
||||||
|
@ -3125,17 +3147,19 @@ void HistoryItem::setSponsoredFrom(const Data::SponsoredFrom &from) {
|
||||||
|
|
||||||
void HistoryItem::createComponentsHelper(
|
void HistoryItem::createComponentsHelper(
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) {
|
HistoryMessageMarkupData &&markup) {
|
||||||
auto config = CreateConfig();
|
auto config = CreateConfig();
|
||||||
config.viaBotId = viaBotId;
|
config.viaBotId = viaBotId;
|
||||||
if (flags & MessageFlag::HasReplyInfo) {
|
if (flags & MessageFlag::HasReplyInfo) {
|
||||||
config.replyTo = replyTo;
|
config.replyTo = replyTo.msgId;
|
||||||
const auto to = LookupReplyTo(_history, replyTo);
|
config.replyToStory = replyTo.storyId.story;
|
||||||
|
config.replyToPeer = replyTo.storyId ? replyTo.storyId.peer : 0;
|
||||||
|
const auto to = LookupReplyTo(_history, replyTo.msgId);
|
||||||
const auto replyToTop = LookupReplyToTop(to);
|
const auto replyToTop = LookupReplyToTop(to);
|
||||||
config.replyToTop = replyToTop ? replyToTop : replyTo;
|
config.replyToTop = replyToTop ? replyToTop : replyTo.msgId;
|
||||||
const auto forum = _history->asForum();
|
const auto forum = _history->asForum();
|
||||||
config.replyIsTopicPost = LookupReplyIsTopicPost(to)
|
config.replyIsTopicPost = LookupReplyIsTopicPost(to)
|
||||||
|| (to && to->Has<HistoryServiceTopicInfo>())
|
|| (to && to->Has<HistoryServiceTopicInfo>())
|
||||||
|
@ -3245,6 +3269,9 @@ void HistoryItem::createComponents(const MTPDmessage &data) {
|
||||||
: id;
|
: id;
|
||||||
config.replyToTop = data.vreply_to_top_id().value_or(id);
|
config.replyToTop = data.vreply_to_top_id().value_or(id);
|
||||||
config.replyIsTopicPost = data.is_forum_topic();
|
config.replyIsTopicPost = data.is_forum_topic();
|
||||||
|
}, [&](const MTPDmessageReplyStoryHeader &data) {
|
||||||
|
config.replyToPeer = peerFromUser(data.vuser_id());
|
||||||
|
config.replyToStory = data.vstory_id().v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
config.viaBotId = data.vvia_bot_id().value_or_empty();
|
config.viaBotId = data.vvia_bot_id().value_or_empty();
|
||||||
|
@ -3499,6 +3526,7 @@ void HistoryItem::createServiceFromMtp(const MTPDmessageService &message) {
|
||||||
dependent->msgId);
|
dependent->msgId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}, [](const MTPDmessageReplyStoryHeader &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setServiceMessageByAction(action);
|
setServiceMessageByAction(action);
|
||||||
|
|
|
@ -117,7 +117,7 @@ public:
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -171,7 +171,7 @@ public:
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId id,
|
MsgId id,
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
PeerId from,
|
PeerId from,
|
||||||
|
@ -458,6 +458,8 @@ public:
|
||||||
[[nodiscard]] MsgId replyToId() const;
|
[[nodiscard]] MsgId replyToId() const;
|
||||||
[[nodiscard]] MsgId replyToTop() const;
|
[[nodiscard]] MsgId replyToTop() const;
|
||||||
[[nodiscard]] MsgId topicRootId() const;
|
[[nodiscard]] MsgId topicRootId() const;
|
||||||
|
[[nodiscard]] FullStoryId replyToStory() const;
|
||||||
|
[[nodiscard]] FullReplyTo replyTo() const;
|
||||||
[[nodiscard]] bool inThread(MsgId rootId) const;
|
[[nodiscard]] bool inThread(MsgId rootId) const;
|
||||||
|
|
||||||
[[nodiscard]] not_null<PeerData*> author() const;
|
[[nodiscard]] not_null<PeerData*> author() const;
|
||||||
|
@ -518,7 +520,7 @@ private:
|
||||||
|
|
||||||
void createComponentsHelper(
|
void createComponentsHelper(
|
||||||
MessageFlags flags,
|
MessageFlags flags,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup);
|
HistoryMessageMarkupData &&markup);
|
||||||
|
|
|
@ -243,6 +243,7 @@ struct HistoryMessageReply
|
||||||
PeerId replyToPeerId = 0;
|
PeerId replyToPeerId = 0;
|
||||||
MsgId replyToMsgId = 0;
|
MsgId replyToMsgId = 0;
|
||||||
MsgId replyToMsgTop = 0;
|
MsgId replyToMsgTop = 0;
|
||||||
|
StoryId replyToStoryId = 0;
|
||||||
using ColorKey = PeerId;
|
using ColorKey = PeerId;
|
||||||
ColorKey replyToColorKey = 0;
|
ColorKey replyToColorKey = 0;
|
||||||
DocumentId replyToDocumentId = 0;
|
DocumentId replyToDocumentId = 0;
|
||||||
|
|
|
@ -309,8 +309,13 @@ MessageFlags FlagsFromMTP(
|
||||||
}
|
}
|
||||||
|
|
||||||
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {
|
MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {
|
||||||
if (const auto id = action.replyTo) {
|
if (const auto replyTo = action.replyTo) {
|
||||||
const auto to = LookupReplyTo(action.history, id);
|
if (replyTo.storyId) {
|
||||||
|
return MTP_messageReplyStoryHeader(
|
||||||
|
MTP_long(peerToUser(replyTo.storyId.peer).bare),
|
||||||
|
MTP_int(replyTo.storyId.story));
|
||||||
|
}
|
||||||
|
const auto to = LookupReplyTo(action.history, replyTo.msgId);
|
||||||
if (const auto replyToTop = LookupReplyToTop(to)) {
|
if (const auto replyToTop = LookupReplyToTop(to)) {
|
||||||
using Flag = MTPDmessageReplyHeader::Flag;
|
using Flag = MTPDmessageReplyHeader::Flag;
|
||||||
return MTP_messageReplyHeader(
|
return MTP_messageReplyHeader(
|
||||||
|
@ -318,13 +323,13 @@ MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) {
|
||||||
| (LookupReplyIsTopicPost(to)
|
| (LookupReplyIsTopicPost(to)
|
||||||
? Flag::f_forum_topic
|
? Flag::f_forum_topic
|
||||||
: Flag(0))),
|
: Flag(0))),
|
||||||
MTP_int(id),
|
MTP_int(replyTo.msgId),
|
||||||
MTPPeer(),
|
MTPPeer(),
|
||||||
MTP_int(replyToTop));
|
MTP_int(replyToTop));
|
||||||
}
|
}
|
||||||
return MTP_messageReplyHeader(
|
return MTP_messageReplyHeader(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_int(id),
|
MTP_int(replyTo.msgId),
|
||||||
MTPPeer(),
|
MTPPeer(),
|
||||||
MTPint());
|
MTPint());
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,7 +853,7 @@ HistoryWidget::HistoryWidget(
|
||||||
}) | rpl::start_with_next([=](const Api::SendAction &action) {
|
}) | rpl::start_with_next([=](const Api::SendAction &action) {
|
||||||
const auto lastKeyboardUsed = lastForceReplyReplied(FullMsgId(
|
const auto lastKeyboardUsed = lastForceReplyReplied(FullMsgId(
|
||||||
action.history->peer->id,
|
action.history->peer->id,
|
||||||
action.replyTo));
|
action.replyTo.msgId));
|
||||||
if (action.replaceMediaOf) {
|
if (action.replaceMediaOf) {
|
||||||
} else if (action.options.scheduled) {
|
} else if (action.options.scheduled) {
|
||||||
cancelReply(lastKeyboardUsed);
|
cancelReply(lastKeyboardUsed);
|
||||||
|
@ -3841,8 +3841,7 @@ void HistoryWidget::hideSelectorControlsAnimated() {
|
||||||
Api::SendAction HistoryWidget::prepareSendAction(
|
Api::SendAction HistoryWidget::prepareSendAction(
|
||||||
Api::SendOptions options) const {
|
Api::SendOptions options) const {
|
||||||
auto result = Api::SendAction(_history, options);
|
auto result = Api::SendAction(_history, options);
|
||||||
result.replyTo = replyToId();
|
result.replyTo = { .msgId = replyToId() };
|
||||||
result.topicRootId = 0;
|
|
||||||
result.options.sendAs = _sendAs
|
result.options.sendAs = _sendAs
|
||||||
? _history->session().sendAsPeers().resolveChosen(
|
? _history->session().sendAsPeers().resolveChosen(
|
||||||
_history->peer).get()
|
_history->peer).get()
|
||||||
|
@ -4348,7 +4347,7 @@ void HistoryWidget::sendBotCommand(const Bot::SendCommandRequest &request) {
|
||||||
|
|
||||||
auto message = Api::MessageToSend(prepareSendAction({}));
|
auto message = Api::MessageToSend(prepareSendAction({}));
|
||||||
message.textWithTags = { toSend, TextWithTags::Tags() };
|
message.textWithTags = { toSend, TextWithTags::Tags() };
|
||||||
message.action.replyTo = request.replyTo
|
message.action.replyTo.msgId = request.replyTo
|
||||||
? ((!_peer->isUser()/* && (botStatus == 0 || botStatus == 2)*/)
|
? ((!_peer->isUser()/* && (botStatus == 0 || botStatus == 2)*/)
|
||||||
? request.replyTo
|
? request.replyTo
|
||||||
: replyToId())
|
: replyToId())
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ void RepliesWidget::sendingFilesConfirmed(
|
||||||
album,
|
album,
|
||||||
action);
|
action);
|
||||||
}
|
}
|
||||||
if (_composeControls->replyingToMessage().msg == action.replyTo) {
|
if (_composeControls->replyingToMessage().msg == action.replyTo.msgId) {
|
||||||
_composeControls->cancelReplyMessage();
|
_composeControls->cancelReplyMessage();
|
||||||
refreshTopBarActiveChat();
|
refreshTopBarActiveChat();
|
||||||
}
|
}
|
||||||
|
@ -1135,8 +1135,7 @@ bool RepliesWidget::showSendingFilesError(
|
||||||
Api::SendAction RepliesWidget::prepareSendAction(
|
Api::SendAction RepliesWidget::prepareSendAction(
|
||||||
Api::SendOptions options) const {
|
Api::SendOptions options) const {
|
||||||
auto result = Api::SendAction(_history, options);
|
auto result = Api::SendAction(_history, options);
|
||||||
result.replyTo = replyToId();
|
result.replyTo = { .msgId = replyToId(), .topicRootId = _rootId };
|
||||||
result.topicRootId = _rootId;
|
|
||||||
result.options.sendAs = _composeControls->sendAsPeer();
|
result.options.sendAs = _composeControls->sendAsPeer();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,7 +481,6 @@ bool AttachWebView::IsSame(
|
||||||
&& (a->fromSwitch == b.fromSwitch)
|
&& (a->fromSwitch == b.fromSwitch)
|
||||||
&& (a->action.history == b.action.history)
|
&& (a->action.history == b.action.history)
|
||||||
&& (a->action.replyTo == b.action.replyTo)
|
&& (a->action.replyTo == b.action.replyTo)
|
||||||
&& (a->action.topicRootId == b.action.topicRootId)
|
|
||||||
&& (a->action.options.sendAs == b.action.options.sendAs)
|
&& (a->action.options.sendAs == b.action.options.sendAs)
|
||||||
&& (a->action.options.silent == b.action.options.silent);
|
&& (a->action.options.silent == b.action.options.silent);
|
||||||
}
|
}
|
||||||
|
@ -533,8 +532,7 @@ void AttachWebView::request(const WebViewButton &button) {
|
||||||
const auto flags = Flag::f_theme_params
|
const auto flags = Flag::f_theme_params
|
||||||
| (button.url.isEmpty() ? Flag(0) : Flag::f_url)
|
| (button.url.isEmpty() ? Flag(0) : Flag::f_url)
|
||||||
| (_startCommand.isEmpty() ? Flag(0) : Flag::f_start_param)
|
| (_startCommand.isEmpty() ? Flag(0) : Flag::f_start_param)
|
||||||
| (action.replyTo ? Flag::f_reply_to_msg_id : Flag(0))
|
| (action.replyTo ? Flag::f_reply_to : Flag(0))
|
||||||
| (action.topicRootId ? Flag::f_top_msg_id : Flag(0))
|
|
||||||
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
||||||
| (action.options.silent ? Flag::f_silent : Flag(0));
|
| (action.options.silent ? Flag::f_silent : Flag(0));
|
||||||
_requestId = _session->api().request(MTPmessages_RequestWebView(
|
_requestId = _session->api().request(MTPmessages_RequestWebView(
|
||||||
|
@ -545,8 +543,7 @@ void AttachWebView::request(const WebViewButton &button) {
|
||||||
MTP_string(_startCommand),
|
MTP_string(_startCommand),
|
||||||
MTP_dataJSON(MTP_bytes(Window::Theme::WebViewParams().json)),
|
MTP_dataJSON(MTP_bytes(Window::Theme::WebViewParams().json)),
|
||||||
MTP_string("tdesktop"),
|
MTP_string("tdesktop"),
|
||||||
MTP_int(action.replyTo.bare),
|
action.mtpReplyTo(),
|
||||||
MTP_int(action.topicRootId.bare),
|
|
||||||
(action.options.sendAs
|
(action.options.sendAs
|
||||||
? action.options.sendAs->input
|
? action.options.sendAs->input
|
||||||
: MTP_inputPeerEmpty())
|
: MTP_inputPeerEmpty())
|
||||||
|
@ -810,8 +807,7 @@ void AttachWebView::requestMenu(
|
||||||
MTP_flags(Flag::f_theme_params
|
MTP_flags(Flag::f_theme_params
|
||||||
| Flag::f_url
|
| Flag::f_url
|
||||||
| Flag::f_from_bot_menu
|
| Flag::f_from_bot_menu
|
||||||
| (action.replyTo? Flag::f_reply_to_msg_id : Flag(0))
|
| (action.replyTo? Flag::f_reply_to : Flag(0))
|
||||||
| (action.topicRootId ? Flag::f_top_msg_id : Flag(0))
|
|
||||||
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
||||||
| (action.options.silent ? Flag::f_silent : Flag(0))),
|
| (action.options.silent ? Flag::f_silent : Flag(0))),
|
||||||
action.history->peer->input,
|
action.history->peer->input,
|
||||||
|
@ -820,8 +816,7 @@ void AttachWebView::requestMenu(
|
||||||
MTPstring(), // start_param
|
MTPstring(), // start_param
|
||||||
MTP_dataJSON(MTP_bytes(Window::Theme::WebViewParams().json)),
|
MTP_dataJSON(MTP_bytes(Window::Theme::WebViewParams().json)),
|
||||||
MTP_string("tdesktop"),
|
MTP_string("tdesktop"),
|
||||||
MTP_int(action.replyTo.bare),
|
action.mtpReplyTo(),
|
||||||
MTP_int(action.topicRootId.bare),
|
|
||||||
(action.options.sendAs
|
(action.options.sendAs
|
||||||
? action.options.sendAs->input
|
? action.options.sendAs->input
|
||||||
: MTP_inputPeerEmpty())
|
: MTP_inputPeerEmpty())
|
||||||
|
@ -1189,15 +1184,13 @@ void AttachWebView::started(uint64 queryId) {
|
||||||
_session->api().request(base::take(_prolongId)).cancel();
|
_session->api().request(base::take(_prolongId)).cancel();
|
||||||
_prolongId = _session->api().request(MTPmessages_ProlongWebView(
|
_prolongId = _session->api().request(MTPmessages_ProlongWebView(
|
||||||
MTP_flags(Flag(0)
|
MTP_flags(Flag(0)
|
||||||
| (action.replyTo ? Flag::f_reply_to_msg_id : Flag(0))
|
| (action.replyTo ? Flag::f_reply_to : Flag(0))
|
||||||
| (action.topicRootId ? Flag::f_top_msg_id : Flag(0))
|
|
||||||
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
| (action.options.sendAs ? Flag::f_send_as : Flag(0))
|
||||||
| (action.options.silent ? Flag::f_silent : Flag(0))),
|
| (action.options.silent ? Flag::f_silent : Flag(0))),
|
||||||
action.history->peer->input,
|
action.history->peer->input,
|
||||||
_bot->inputUser,
|
_bot->inputUser,
|
||||||
MTP_long(queryId),
|
MTP_long(queryId),
|
||||||
MTP_int(action.replyTo.bare),
|
action.mtpReplyTo(),
|
||||||
MTP_int(action.topicRootId.bare),
|
|
||||||
(action.options.sendAs
|
(action.options.sendAs
|
||||||
? action.options.sendAs->input
|
? action.options.sendAs->input
|
||||||
: MTP_inputPeerEmpty())
|
: MTP_inputPeerEmpty())
|
||||||
|
|
|
@ -374,7 +374,7 @@ void Result::addToHistory(
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor) const {
|
const QString &postAuthor) const {
|
||||||
flags |= MessageFlag::FromInlineBot;
|
flags |= MessageFlag::FromInlineBot;
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ void Result::addToHistory(
|
||||||
fromId,
|
fromId,
|
||||||
date,
|
date,
|
||||||
viaBotId,
|
viaBotId,
|
||||||
replyToId,
|
replyTo,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
std::move(markup));
|
std::move(markup));
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor) const;
|
const QString &postAuthor) const;
|
||||||
QString getErrorOnSend(not_null<History*> history) const;
|
QString getErrorOnSend(not_null<History*> history) const;
|
||||||
|
|
||||||
|
|
|
@ -36,18 +36,18 @@ void SendDataCommon::addToHistory(
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const {
|
HistoryMessageMarkupData &&markup) const {
|
||||||
auto fields = getSentMessageFields();
|
auto fields = getSentMessageFields();
|
||||||
if (replyToId) {
|
if (replyTo) {
|
||||||
flags |= MessageFlag::HasReplyInfo;
|
flags |= MessageFlag::HasReplyInfo;
|
||||||
}
|
}
|
||||||
history->addNewLocalMessage(
|
history->addNewLocalMessage(
|
||||||
msgId,
|
msgId,
|
||||||
flags,
|
flags,
|
||||||
viaBotId,
|
viaBotId,
|
||||||
replyToId,
|
replyTo,
|
||||||
date,
|
date,
|
||||||
fromId,
|
fromId,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
|
@ -119,14 +119,14 @@ void SendPhoto::addToHistory(
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const {
|
HistoryMessageMarkupData &&markup) const {
|
||||||
history->addNewLocalMessage(
|
history->addNewLocalMessage(
|
||||||
msgId,
|
msgId,
|
||||||
flags,
|
flags,
|
||||||
viaBotId,
|
viaBotId,
|
||||||
replyToId,
|
replyTo,
|
||||||
date,
|
date,
|
||||||
fromId,
|
fromId,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
|
@ -150,14 +150,14 @@ void SendFile::addToHistory(
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const {
|
HistoryMessageMarkupData &&markup) const {
|
||||||
history->addNewLocalMessage(
|
history->addNewLocalMessage(
|
||||||
msgId,
|
msgId,
|
||||||
flags,
|
flags,
|
||||||
viaBotId,
|
viaBotId,
|
||||||
replyToId,
|
replyTo,
|
||||||
date,
|
date,
|
||||||
fromId,
|
fromId,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
|
@ -181,14 +181,14 @@ void SendGame::addToHistory(
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const {
|
HistoryMessageMarkupData &&markup) const {
|
||||||
history->addNewLocalMessage(
|
history->addNewLocalMessage(
|
||||||
msgId,
|
msgId,
|
||||||
flags,
|
flags,
|
||||||
viaBotId,
|
viaBotId,
|
||||||
replyToId,
|
replyTo,
|
||||||
date,
|
date,
|
||||||
fromId,
|
fromId,
|
||||||
postAuthor,
|
postAuthor,
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const = 0;
|
HistoryMessageMarkupData &&markup) const = 0;
|
||||||
virtual QString getErrorOnSend(
|
virtual QString getErrorOnSend(
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const override;
|
HistoryMessageMarkupData &&markup) const override;
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const override;
|
HistoryMessageMarkupData &&markup) const override;
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const override;
|
HistoryMessageMarkupData &&markup) const override;
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public:
|
||||||
PeerId fromId,
|
PeerId fromId,
|
||||||
TimeId date,
|
TimeId date,
|
||||||
UserId viaBotId,
|
UserId viaBotId,
|
||||||
MsgId replyToId,
|
FullReplyTo replyTo,
|
||||||
const QString &postAuthor,
|
const QString &postAuthor,
|
||||||
HistoryMessageMarkupData &&markup) const override;
|
HistoryMessageMarkupData &&markup) const override;
|
||||||
|
|
||||||
|
|
|
@ -363,9 +363,9 @@ void Controller::show(
|
||||||
}
|
}
|
||||||
_index = subindex;
|
_index = subindex;
|
||||||
|
|
||||||
const auto id = Data::FullStoryId{
|
const auto id = FullStoryId{
|
||||||
.user = list.user,
|
.peer = list.user->id,
|
||||||
.id = item.id,
|
.story = item.id,
|
||||||
};
|
};
|
||||||
if (_shown == id) {
|
if (_shown == id) {
|
||||||
return;
|
return;
|
||||||
|
@ -425,7 +425,7 @@ void Controller::updatePlayback(const Player::TrackState &state) {
|
||||||
updatePowerSaveBlocker(state);
|
updatePowerSaveBlocker(state);
|
||||||
if (Player::IsStoppedAtEnd(state.state)) {
|
if (Player::IsStoppedAtEnd(state.state)) {
|
||||||
if (!subjumpFor(1)) {
|
if (!subjumpFor(1)) {
|
||||||
_delegate->storiesJumpTo({});
|
_delegate->storiesClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,9 +448,9 @@ bool Controller::subjumpFor(int delta) {
|
||||||
} else if (!_list || _list->items.empty()) {
|
} else if (!_list || _list->items.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_delegate->storiesJumpTo({
|
_delegate->storiesJumpTo(&_list->user->session(), {
|
||||||
.user = _list->user,
|
.peer = _list->user->id,
|
||||||
.id = _list->items.front().id
|
.story = _list->items.front().id
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} else if (index >= _list->total) {
|
} else if (index >= _list->total) {
|
||||||
|
@ -459,9 +459,9 @@ bool Controller::subjumpFor(int delta) {
|
||||||
&& jumpFor(1);
|
&& jumpFor(1);
|
||||||
} else if (index < _list->items.size()) {
|
} else if (index < _list->items.size()) {
|
||||||
// #TODO stories load more
|
// #TODO stories load more
|
||||||
_delegate->storiesJumpTo({
|
_delegate->storiesJumpTo(&_list->user->session(), {
|
||||||
.user = _list->user,
|
.peer = _list->user->id,
|
||||||
.id = _list->items[index].id
|
.story = _list->items[index].id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -471,12 +471,16 @@ bool Controller::subjumpFor(int delta) {
|
||||||
bool Controller::jumpFor(int delta) {
|
bool Controller::jumpFor(int delta) {
|
||||||
if (delta == -1) {
|
if (delta == -1) {
|
||||||
if (const auto left = _siblingLeft.get()) {
|
if (const auto left = _siblingLeft.get()) {
|
||||||
_delegate->storiesJumpTo(left->shownId());
|
_delegate->storiesJumpTo(
|
||||||
|
&left->peer()->session(),
|
||||||
|
left->shownId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (delta == 1) {
|
} else if (delta == 1) {
|
||||||
if (const auto right = _siblingRight.get()) {
|
if (const auto right = _siblingRight.get()) {
|
||||||
_delegate->storiesJumpTo(right->shownId());
|
_delegate->storiesJumpTo(
|
||||||
|
&right->peer()->session(),
|
||||||
|
right->shownId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ private:
|
||||||
Ui::Animations::Simple _contentFadeAnimation;
|
Ui::Animations::Simple _contentFadeAnimation;
|
||||||
bool _contentFaded = false;
|
bool _contentFaded = false;
|
||||||
|
|
||||||
Data::FullStoryId _shown;
|
FullStoryId _shown;
|
||||||
TextWithEntities _captionText;
|
TextWithEntities _captionText;
|
||||||
std::optional<Data::StoriesList> _list;
|
std::optional<Data::StoriesList> _list;
|
||||||
int _index = 0;
|
int _index = 0;
|
||||||
|
|
|
@ -12,9 +12,9 @@ class Show;
|
||||||
struct FileChosen;
|
struct FileChosen;
|
||||||
} // namespace ChatHelpers
|
} // namespace ChatHelpers
|
||||||
|
|
||||||
namespace Data {
|
namespace Main {
|
||||||
struct FullStoryId;
|
class Session;
|
||||||
} // namespace Data
|
} // namespace Main
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class RpWidget;
|
class RpWidget;
|
||||||
|
@ -39,7 +39,10 @@ public:
|
||||||
-> std::shared_ptr<ChatHelpers::Show> = 0;
|
-> std::shared_ptr<ChatHelpers::Show> = 0;
|
||||||
[[nodiscard]] virtual auto storiesStickerOrEmojiChosen()
|
[[nodiscard]] virtual auto storiesStickerOrEmojiChosen()
|
||||||
-> rpl::producer<ChatHelpers::FileChosen> = 0;
|
-> rpl::producer<ChatHelpers::FileChosen> = 0;
|
||||||
virtual void storiesJumpTo(Data::FullStoryId id) = 0;
|
virtual void storiesJumpTo(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
FullStoryId id) = 0;
|
||||||
|
virtual void storiesClose() = 0;
|
||||||
[[nodiscard]] virtual bool storiesPaused() = 0;
|
[[nodiscard]] virtual bool storiesPaused() = 0;
|
||||||
[[nodiscard]] virtual float64 storiesSiblingOver(SiblingType type) = 0;
|
[[nodiscard]] virtual float64 storiesSiblingOver(SiblingType type) = 0;
|
||||||
virtual void storiesTogglePaused(bool paused) = 0;
|
virtual void storiesTogglePaused(bool paused) = 0;
|
||||||
|
|
|
@ -217,7 +217,8 @@ Sibling::Sibling(
|
||||||
not_null<Controller*> controller,
|
not_null<Controller*> controller,
|
||||||
const Data::StoriesList &list)
|
const Data::StoriesList &list)
|
||||||
: _controller(controller)
|
: _controller(controller)
|
||||||
, _id{ list.user, list.items.front().id } {
|
, _id{ list.user->id, list.items.front().id }
|
||||||
|
, _peer(list.user) {
|
||||||
const auto &item = list.items.front();
|
const auto &item = list.items.front();
|
||||||
const auto &data = item.media.data;
|
const auto &data = item.media.data;
|
||||||
const auto origin = Data::FileOrigin();
|
const auto origin = Data::FileOrigin();
|
||||||
|
@ -239,14 +240,18 @@ Sibling::Sibling(
|
||||||
|
|
||||||
Sibling::~Sibling() = default;
|
Sibling::~Sibling() = default;
|
||||||
|
|
||||||
Data::FullStoryId Sibling::shownId() const {
|
FullStoryId Sibling::shownId() const {
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
not_null<PeerData*> Sibling::peer() const {
|
||||||
|
return _peer;
|
||||||
|
}
|
||||||
|
|
||||||
bool Sibling::shows(const Data::StoriesList &list) const {
|
bool Sibling::shows(const Data::StoriesList &list) const {
|
||||||
Expects(!list.items.empty());
|
Expects(!list.items.empty());
|
||||||
|
|
||||||
return _id == Data::FullStoryId{ list.user, list.items.front().id };
|
return _id == FullStoryId{ list.user->id, list.items.front().id };
|
||||||
}
|
}
|
||||||
|
|
||||||
SiblingView Sibling::view(const SiblingLayout &layout, float64 over) {
|
SiblingView Sibling::view(const SiblingLayout &layout, float64 over) {
|
||||||
|
@ -268,22 +273,18 @@ SiblingView Sibling::view(const SiblingLayout &layout, float64 over) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Sibling::userpicImage(const SiblingLayout &layout) {
|
QImage Sibling::userpicImage(const SiblingLayout &layout) {
|
||||||
Expects(_id.user != nullptr);
|
|
||||||
|
|
||||||
const auto ratio = style::DevicePixelRatio();
|
const auto ratio = style::DevicePixelRatio();
|
||||||
const auto size = layout.userpic.width() * ratio;
|
const auto size = layout.userpic.width() * ratio;
|
||||||
const auto key = _id.user->userpicUniqueKey(_userpicView);
|
const auto key = _peer->userpicUniqueKey(_userpicView);
|
||||||
if (_userpicImage.width() != size || _userpicKey != key) {
|
if (_userpicImage.width() != size || _userpicKey != key) {
|
||||||
_userpicKey = key;
|
_userpicKey = key;
|
||||||
_userpicImage = _id.user->generateUserpicImage(_userpicView, size);
|
_userpicImage = _peer->generateUserpicImage(_userpicView, size);
|
||||||
_userpicImage.setDevicePixelRatio(ratio);
|
_userpicImage.setDevicePixelRatio(ratio);
|
||||||
}
|
}
|
||||||
return _userpicImage;
|
return _userpicImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage Sibling::nameImage(const SiblingLayout &layout) {
|
QImage Sibling::nameImage(const SiblingLayout &layout) {
|
||||||
Expects(_id.user != nullptr);
|
|
||||||
|
|
||||||
if (_nameFontSize != layout.nameFontSize) {
|
if (_nameFontSize != layout.nameFontSize) {
|
||||||
_nameFontSize = layout.nameFontSize;
|
_nameFontSize = layout.nameFontSize;
|
||||||
|
|
||||||
|
@ -299,7 +300,7 @@ QImage Sibling::nameImage(const SiblingLayout &layout) {
|
||||||
.linkFontOver = font,
|
.linkFontOver = font,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const auto text = _id.user->shortName();
|
const auto text = _peer->shortName();
|
||||||
if (_nameText != text) {
|
if (_nameText != text) {
|
||||||
_name.reset();
|
_name.reset();
|
||||||
_nameText = text;
|
_nameText = text;
|
||||||
|
|
|
@ -29,7 +29,8 @@ public:
|
||||||
const Data::StoriesList &list);
|
const Data::StoriesList &list);
|
||||||
~Sibling();
|
~Sibling();
|
||||||
|
|
||||||
[[nodiscard]] Data::FullStoryId shownId() const;
|
[[nodiscard]] FullStoryId shownId() const;
|
||||||
|
[[nodiscard]] not_null<PeerData*> peer() const;
|
||||||
[[nodiscard]] bool shows(const Data::StoriesList &list) const;
|
[[nodiscard]] bool shows(const Data::StoriesList &list) const;
|
||||||
|
|
||||||
[[nodiscard]] SiblingView view(
|
[[nodiscard]] SiblingView view(
|
||||||
|
@ -51,7 +52,8 @@ private:
|
||||||
|
|
||||||
const not_null<Controller*> _controller;
|
const not_null<Controller*> _controller;
|
||||||
|
|
||||||
Data::FullStoryId _id;
|
FullStoryId _id;
|
||||||
|
not_null<PeerData*> _peer;
|
||||||
QImage _blurred;
|
QImage _blurred;
|
||||||
QImage _good;
|
QImage _good;
|
||||||
Ui::Animations::Simple _goodShown;
|
Ui::Animations::Simple _goodShown;
|
||||||
|
|
|
@ -4028,28 +4028,27 @@ auto OverlayWidget::storiesStickerOrEmojiChosen()
|
||||||
return _storiesStickerOrEmojiChosen.events();
|
return _storiesStickerOrEmojiChosen.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::storiesJumpTo(Data::FullStoryId id) {
|
void OverlayWidget::storiesJumpTo(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
FullStoryId id) {
|
||||||
Expects(_stories != nullptr);
|
Expects(_stories != nullptr);
|
||||||
|
Expects(id.valid());
|
||||||
|
|
||||||
if (!id) {
|
const auto &all = session->data().stories().all();
|
||||||
close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto &all = id.user->owner().stories().all();
|
|
||||||
const auto i = ranges::find(
|
const auto i = ranges::find(
|
||||||
all,
|
all,
|
||||||
not_null(id.user),
|
id.peer,
|
||||||
&Data::StoriesList::user);
|
[](const Data::StoriesList &list) { return list.user->id; });
|
||||||
if (i == end(all)) {
|
if (i == end(all)) {
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto j = ranges::find(i->items, id.id, &Data::StoryItem::id);
|
const auto j = ranges::find(i->items, id.story, &Data::StoryItem::id);
|
||||||
if (j == end(i->items)) {
|
if (j == end(i->items)) {
|
||||||
close();
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setContext(StoriesContext{ i->user, id.id });
|
setContext(StoriesContext{ i->user, id.story });
|
||||||
clearStreaming();
|
clearStreaming();
|
||||||
_streamingStartPaused = false;
|
_streamingStartPaused = false;
|
||||||
const auto &data = j->media.data;
|
const auto &data = j->media.data;
|
||||||
|
@ -4061,6 +4060,10 @@ void OverlayWidget::storiesJumpTo(Data::FullStoryId id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OverlayWidget::storiesClose() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
bool OverlayWidget::storiesPaused() {
|
bool OverlayWidget::storiesPaused() {
|
||||||
return _streamed
|
return _streamed
|
||||||
&& !_streamed->instance.player().failed()
|
&& !_streamed->instance.player().failed()
|
||||||
|
|
|
@ -30,7 +30,6 @@ enum class activation : uchar;
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class PhotoMedia;
|
class PhotoMedia;
|
||||||
class DocumentMedia;
|
class DocumentMedia;
|
||||||
struct FullStoryId;
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -243,7 +242,10 @@ private:
|
||||||
std::shared_ptr<ChatHelpers::Show> storiesShow() override;
|
std::shared_ptr<ChatHelpers::Show> storiesShow() override;
|
||||||
auto storiesStickerOrEmojiChosen()
|
auto storiesStickerOrEmojiChosen()
|
||||||
-> rpl::producer<ChatHelpers::FileChosen> override;
|
-> rpl::producer<ChatHelpers::FileChosen> override;
|
||||||
void storiesJumpTo(Data::FullStoryId id) override;
|
void storiesJumpTo(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
FullStoryId id) override;
|
||||||
|
void storiesClose() override;
|
||||||
bool storiesPaused() override;
|
bool storiesPaused() override;
|
||||||
void storiesTogglePaused(bool paused) override;
|
void storiesTogglePaused(bool paused) override;
|
||||||
float64 storiesSiblingOver(Stories::SiblingType type) override;
|
float64 storiesSiblingOver(Stories::SiblingType type) override;
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ void FormController::uploadEncryptedFile(
|
||||||
auto prepared = std::make_shared<FileLoadResult>(
|
auto prepared = std::make_shared<FileLoadResult>(
|
||||||
TaskId(),
|
TaskId(),
|
||||||
file.uploadData->fileId,
|
file.uploadData->fileId,
|
||||||
FileLoadTo(PeerId(), Api::SendOptions(), MsgId(), MsgId(), MsgId()),
|
FileLoadTo(PeerId(), Api::SendOptions(), FullReplyTo(), MsgId()),
|
||||||
TextWithTags(),
|
TextWithTags(),
|
||||||
false,
|
false,
|
||||||
std::shared_ptr<SendingAlbum>(nullptr));
|
std::shared_ptr<SendingAlbum>(nullptr));
|
||||||
|
|
|
@ -221,56 +221,6 @@ int PhotoSideLimit() {
|
||||||
return PhotoSideLimit(SendLargePhotos.value());
|
return PhotoSideLimit(SendLargePhotos.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMediaPrepare::SendMediaPrepare(
|
|
||||||
const QString &file,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo)
|
|
||||||
: id(base::RandomValue<PhotoId>())
|
|
||||||
, file(file)
|
|
||||||
, peer(peer)
|
|
||||||
, type(type)
|
|
||||||
, replyTo(replyTo) {
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMediaPrepare::SendMediaPrepare(
|
|
||||||
const QImage &img,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo)
|
|
||||||
: id(base::RandomValue<PhotoId>())
|
|
||||||
, img(img)
|
|
||||||
, peer(peer)
|
|
||||||
, type(type)
|
|
||||||
, replyTo(replyTo) {
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMediaPrepare::SendMediaPrepare(
|
|
||||||
const QByteArray &data,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo)
|
|
||||||
: id(base::RandomValue<PhotoId>())
|
|
||||||
, data(data)
|
|
||||||
, peer(peer)
|
|
||||||
, type(type)
|
|
||||||
, replyTo(replyTo) {
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMediaPrepare::SendMediaPrepare(
|
|
||||||
const QByteArray &data,
|
|
||||||
int duration,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo)
|
|
||||||
: id(base::RandomValue<PhotoId>())
|
|
||||||
, data(data)
|
|
||||||
, peer(peer)
|
|
||||||
, type(type)
|
|
||||||
, duration(duration)
|
|
||||||
, replyTo(replyTo) {
|
|
||||||
}
|
|
||||||
|
|
||||||
SendMediaReady::SendMediaReady(
|
SendMediaReady::SendMediaReady(
|
||||||
SendMediaType type,
|
SendMediaType type,
|
||||||
const QString &file,
|
const QString &file,
|
||||||
|
@ -284,10 +234,8 @@ SendMediaReady::SendMediaReady(
|
||||||
const MTPPhoto &photo,
|
const MTPPhoto &photo,
|
||||||
const PreparedPhotoThumbs &photoThumbs,
|
const PreparedPhotoThumbs &photoThumbs,
|
||||||
const MTPDocument &document,
|
const MTPDocument &document,
|
||||||
const QByteArray &jpeg,
|
const QByteArray &jpeg)
|
||||||
MsgId replyTo)
|
: type(type)
|
||||||
: replyTo(replyTo)
|
|
||||||
, type(type)
|
|
||||||
, file(file)
|
, file(file)
|
||||||
, filename(filename)
|
, filename(filename)
|
||||||
, filesize(filesize)
|
, filesize(filesize)
|
||||||
|
|
|
@ -36,41 +36,6 @@ enum class SendMediaType {
|
||||||
Secure,
|
Secure,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SendMediaPrepare {
|
|
||||||
SendMediaPrepare(
|
|
||||||
const QString &file,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo);
|
|
||||||
SendMediaPrepare(
|
|
||||||
const QImage &img,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo);
|
|
||||||
SendMediaPrepare(
|
|
||||||
const QByteArray &data,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo);
|
|
||||||
SendMediaPrepare(
|
|
||||||
const QByteArray &data,
|
|
||||||
int duration,
|
|
||||||
const PeerId &peer,
|
|
||||||
SendMediaType type,
|
|
||||||
MsgId replyTo);
|
|
||||||
|
|
||||||
PhotoId id;
|
|
||||||
QString file;
|
|
||||||
QImage img;
|
|
||||||
QByteArray data;
|
|
||||||
PeerId peer;
|
|
||||||
SendMediaType type;
|
|
||||||
int duration = 0;
|
|
||||||
MsgId replyTo;
|
|
||||||
|
|
||||||
};
|
|
||||||
using SendMediaPrepareList = QList<SendMediaPrepare>;
|
|
||||||
|
|
||||||
using UploadFileParts = QMap<int, QByteArray>;
|
using UploadFileParts = QMap<int, QByteArray>;
|
||||||
struct SendMediaReady {
|
struct SendMediaReady {
|
||||||
SendMediaReady() = default; // temp
|
SendMediaReady() = default; // temp
|
||||||
|
@ -87,10 +52,8 @@ struct SendMediaReady {
|
||||||
const MTPPhoto &photo,
|
const MTPPhoto &photo,
|
||||||
const PreparedPhotoThumbs &photoThumbs,
|
const PreparedPhotoThumbs &photoThumbs,
|
||||||
const MTPDocument &document,
|
const MTPDocument &document,
|
||||||
const QByteArray &jpeg,
|
const QByteArray &jpeg);
|
||||||
MsgId replyTo);
|
|
||||||
|
|
||||||
MsgId replyTo;
|
|
||||||
SendMediaType type;
|
SendMediaType type;
|
||||||
QString file, filename;
|
QString file, filename;
|
||||||
int64 filesize = 0;
|
int64 filesize = 0;
|
||||||
|
@ -206,19 +169,16 @@ struct FileLoadTo {
|
||||||
FileLoadTo(
|
FileLoadTo(
|
||||||
PeerId peer,
|
PeerId peer,
|
||||||
Api::SendOptions options,
|
Api::SendOptions options,
|
||||||
MsgId replyTo,
|
FullReplyTo replyTo,
|
||||||
MsgId topicRootId,
|
|
||||||
MsgId replaceMediaOf)
|
MsgId replaceMediaOf)
|
||||||
: peer(peer)
|
: peer(peer)
|
||||||
, options(options)
|
, options(options)
|
||||||
, replyTo(replyTo)
|
, replyTo(replyTo)
|
||||||
, topicRootId(topicRootId)
|
|
||||||
, replaceMediaOf(replaceMediaOf) {
|
, replaceMediaOf(replaceMediaOf) {
|
||||||
}
|
}
|
||||||
PeerId peer;
|
PeerId peer;
|
||||||
Api::SendOptions options;
|
Api::SendOptions options;
|
||||||
MsgId replyTo;
|
FullReplyTo replyTo;
|
||||||
MsgId topicRootId;
|
|
||||||
MsgId replaceMediaOf;
|
MsgId replaceMediaOf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ AdminLog::OwnedItem GenerateCommentItem(
|
||||||
const auto flags = MessageFlag::HasFromId
|
const auto flags = MessageFlag::HasFromId
|
||||||
| MessageFlag::Outgoing
|
| MessageFlag::Outgoing
|
||||||
| MessageFlag::FakeHistoryItem;
|
| MessageFlag::FakeHistoryItem;
|
||||||
const auto replyTo = MsgId();
|
const auto replyTo = FullReplyTo();
|
||||||
const auto viaBotId = UserId();
|
const auto viaBotId = UserId();
|
||||||
const auto groupedId = uint64();
|
const auto groupedId = uint64();
|
||||||
const auto item = history->makeMessage(
|
const auto item = history->makeMessage(
|
||||||
|
@ -298,7 +298,7 @@ AdminLog::OwnedItem GenerateContactItem(
|
||||||
not_null<HistoryView::ElementDelegate*> delegate,
|
not_null<HistoryView::ElementDelegate*> delegate,
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
const Contact &data) {
|
const Contact &data) {
|
||||||
const auto replyTo = MsgId();
|
const auto replyTo = FullReplyTo();
|
||||||
const auto viaBotId = UserId();
|
const auto viaBotId = UserId();
|
||||||
const auto postAuthor = QString();
|
const auto postAuthor = QString();
|
||||||
const auto groupedId = uint64();
|
const auto groupedId = uint64();
|
||||||
|
|
|
@ -1113,13 +1113,16 @@ void Manager::notificationReplied(
|
||||||
|
|
||||||
auto message = Api::MessageToSend(Api::SendAction(history));
|
auto message = Api::MessageToSend(Api::SendAction(history));
|
||||||
message.textWithTags = reply;
|
message.textWithTags = reply;
|
||||||
message.action.replyTo = (id.msgId > 0 && !history->peer->isUser()
|
const auto replyToId = (id.msgId > 0 && !history->peer->isUser()
|
||||||
&& id.msgId != topicRootId)
|
&& id.msgId != topicRootId)
|
||||||
? id.msgId
|
? id.msgId
|
||||||
: history->peer->isForum()
|
: history->peer->isForum()
|
||||||
? topicRootId
|
? topicRootId
|
||||||
: MsgId(0);
|
: MsgId(0);
|
||||||
message.action.topicRootId = topic ? topic->rootId() : 0;
|
message.action.replyTo = {
|
||||||
|
.msgId = replyToId,
|
||||||
|
.topicRootId = topic ? topic->rootId() : 0,
|
||||||
|
};
|
||||||
message.action.clearDraft = false;
|
message.action.clearDraft = false;
|
||||||
history->session().api().sendMessage(std::move(message));
|
history->session().api().sendMessage(std::move(message));
|
||||||
|
|
||||||
|
|
|
@ -1581,8 +1581,7 @@ SendMediaReady PrepareWallPaper(MTP::DcId dcId, const QImage &image) {
|
||||||
MTP_photoEmpty(MTP_long(0)),
|
MTP_photoEmpty(MTP_long(0)),
|
||||||
thumbnails,
|
thumbnails,
|
||||||
document,
|
document,
|
||||||
QByteArray(),
|
QByteArray());
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Theme
|
} // namespace Theme
|
||||||
|
|
|
@ -451,8 +451,7 @@ SendMediaReady PrepareThemeMedia(
|
||||||
MTP_photoEmpty(MTP_long(0)),
|
MTP_photoEmpty(MTP_long(0)),
|
||||||
thumbnails,
|
thumbnails,
|
||||||
document,
|
document,
|
||||||
thumbnailBytes,
|
thumbnailBytes);
|
||||||
0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Fn<void()> SavePreparedTheme(
|
Fn<void()> SavePreparedTheme(
|
||||||
|
|
|
@ -108,21 +108,16 @@ void ShareBotGame(
|
||||||
const auto topicRootId = replyTo;
|
const auto topicRootId = replyTo;
|
||||||
auto flags = MTPmessages_SendMedia::Flags(0);
|
auto flags = MTPmessages_SendMedia::Flags(0);
|
||||||
if (replyTo) {
|
if (replyTo) {
|
||||||
flags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
flags |= MTPmessages_SendMedia::Flag::f_reply_to;
|
||||||
if (topicRootId) {
|
|
||||||
flags |= MTPmessages_SendMedia::Flag::f_top_msg_id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
histories.sendPreparedMessage(
|
histories.sendPreparedMessage(
|
||||||
history,
|
history,
|
||||||
replyTo,
|
FullReplyTo{ .msgId = replyTo, .topicRootId = topicRootId },
|
||||||
topicRootId,
|
|
||||||
randomId,
|
randomId,
|
||||||
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
history->peer->input,
|
history->peer->input,
|
||||||
Data::Histories::ReplyToPlaceholder(),
|
Data::Histories::ReplyToPlaceholder(),
|
||||||
Data::Histories::TopicRootPlaceholder(),
|
|
||||||
MTP_inputMediaGame(
|
MTP_inputMediaGame(
|
||||||
MTP_inputGameShortName(
|
MTP_inputGameShortName(
|
||||||
bot->inputUser,
|
bot->inputUser,
|
||||||
|
@ -1447,8 +1442,7 @@ void PeerMenuCreatePoll(
|
||||||
peer->owner().history(peer),
|
peer->owner().history(peer),
|
||||||
result.options);
|
result.options);
|
||||||
action.clearDraft = false;
|
action.clearDraft = false;
|
||||||
action.replyTo = replyToId;
|
action.replyTo = { .msgId = replyToId, .topicRootId = topicRootId };
|
||||||
action.topicRootId = topicRootId;
|
|
||||||
if (const auto local = action.history->localDraft(topicRootId)) {
|
if (const auto local = action.history->localDraft(topicRootId)) {
|
||||||
action.clearDraft = local->textWithTags.text.isEmpty();
|
action.clearDraft = local->textWithTags.text.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user