From 11f084729556cad68bc4949df2740409b41fb03b Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 12 Feb 2024 12:45:37 +0400 Subject: [PATCH] Update API scheme on layer 174. --- Telegram/SourceFiles/data/data_histories.cpp | 8 +++----- Telegram/SourceFiles/data/data_msg_id.h | 2 +- Telegram/SourceFiles/history/history_item_components.cpp | 6 +++--- Telegram/SourceFiles/history/history_item_helpers.cpp | 2 +- Telegram/SourceFiles/mtproto/scheme/api.tl | 6 +++--- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 34bc7b6d22..0dde157adc 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -40,11 +40,9 @@ MTPInputReplyTo ReplyToForMTP( const auto owner = &history->owner(); 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 MTP_inputReplyToStory( + peer->input, + MTP_int(replyTo.storyId.story)); } } else if (replyTo.messageId || replyTo.topicRootId) { const auto to = LookupReplyTo(history, replyTo.messageId); diff --git a/Telegram/SourceFiles/data/data_msg_id.h b/Telegram/SourceFiles/data/data_msg_id.h index 4555bda3bb..d2790a2881 100644 --- a/Telegram/SourceFiles/data/data_msg_id.h +++ b/Telegram/SourceFiles/data/data_msg_id.h @@ -164,7 +164,7 @@ struct FullReplyTo { int quoteOffset = 0; [[nodiscard]] bool valid() const { - return messageId || (storyId && peerIsUser(storyId.peer)); + return messageId || (storyId && storyId.peer); } explicit operator bool() const { return valid(); diff --git a/Telegram/SourceFiles/history/history_item_components.cpp b/Telegram/SourceFiles/history/history_item_components.cpp index 26fca0b19e..ae6d3dc3a9 100644 --- a/Telegram/SourceFiles/history/history_item_components.cpp +++ b/Telegram/SourceFiles/history/history_item_components.cpp @@ -330,7 +330,7 @@ ReplyFields ReplyFieldsFromMTP( return result; }, [&](const MTPDmessageReplyStoryHeader &data) { return ReplyFields{ - .externalPeerId = peerFromUser(data.vuser_id()), + .externalPeerId = peerFromMTP(data.vpeer()), .storyId = data.vstory_id().v, }; }); @@ -362,9 +362,9 @@ FullReplyTo ReplyToFromMTP( result.quoteOffset = data.vquote_offset().value_or_empty(); return result; }, [&](const MTPDinputReplyToStory &data) { - if (const auto parsed = Data::UserFromInputMTP( + if (const auto parsed = Data::PeerFromInputMTP( &history->owner(), - data.vuser_id())) { + data.vpeer())) { return FullReplyTo{ .storyId = { parsed->id, data.vstory_id().v }, }; diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 911ec90681..752560a7f5 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -416,7 +416,7 @@ MTPMessageReplyHeader NewMessageReplyHeader(const Api::SendAction &action) { if (const auto replyTo = action.replyTo) { if (replyTo.storyId) { return MTP_messageReplyStoryHeader( - MTP_long(peerToUser(replyTo.storyId.peer).bare), + peerToMTP(replyTo.storyId.peer), MTP_int(replyTo.storyId.story)); } using Flag = MTPDmessageReplyHeader::Flag; diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index a1ebf13f64..1f17c1a7d3 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -1277,7 +1277,7 @@ messages.messageViews#b6c4f543 views:Vector chats:Vector use messages.discussionMessage#a6341782 flags:# messages:Vector max_id:flags.0?int read_inbox_max_id:flags.1?int read_outbox_max_id:flags.2?int unread_count:int chats:Vector users:Vector = messages.DiscussionMessage; messageReplyHeader#afbc09db flags:# reply_to_scheduled:flags.2?true forum_topic:flags.3?true quote:flags.9?true reply_to_msg_id:flags.4?int reply_to_peer_id:flags.0?Peer reply_from:flags.5?MessageFwdHeader reply_media:flags.8?MessageMedia reply_to_top_id:flags.1?int quote_text:flags.6?string quote_entities:flags.7?Vector quote_offset:flags.10?int = MessageReplyHeader; -messageReplyStoryHeader#9c98bfc1 user_id:long story_id:int = MessageReplyHeader; +messageReplyStoryHeader#e5af939 peer:Peer story_id:int = MessageReplyHeader; messageReplies#83d60fc2 flags:# comments:flags.0?true replies:int replies_pts:int recent_repliers:flags.1?Vector channel_id:flags.0?long max_id:flags.2?int read_max_id:flags.3?int = MessageReplies; @@ -1556,7 +1556,7 @@ storyViews#8d595cd6 flags:# has_viewers:flags.1?true views_count:int forwards_co storyItemDeleted#51e6ee4f id:int = StoryItem; storyItemSkipped#ffadc913 flags:# close_friends:flags.8?true id:int date:int expire_date:int = StoryItem; -storyItem#af6365a1 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; +storyItem#79b26a24 flags:# pinned:flags.5?true public:flags.7?true close_friends:flags.8?true min:flags.9?true noforwards:flags.10?true edited:flags.11?true contacts:flags.12?true selected_contacts:flags.13?true out:flags.16?true id:int date:int from_id:flags.18?Peer fwd_from:flags.17?StoryFwdHeader expire_date:int caption:flags.0?string entities:flags.1?Vector media:MessageMedia media_areas:flags.14?Vector privacy:flags.2?Vector views:flags.3?StoryViews sent_reaction:flags.15?Reaction = StoryItem; stories.allStoriesNotModified#1158fe3e flags:# state:string stealth_mode:StoriesStealthMode = stories.AllStories; stories.allStories#6efc5e81 flags:# has_more:flags.0?true count:int state:string peer_stories:Vector chats:Vector users:Vector stealth_mode:StoriesStealthMode = stories.AllStories; @@ -1572,7 +1572,7 @@ stories.storyViewsList#59d78fc5 flags:# count:int views_count:int forwards_count stories.storyViews#de9eed1d views:Vector users:Vector = stories.StoryViews; inputReplyToMessage#22c0f6d5 flags:# reply_to_msg_id:int top_msg_id:flags.0?int reply_to_peer_id:flags.1?InputPeer quote_text:flags.2?string quote_entities:flags.3?Vector quote_offset:flags.4?int = InputReplyTo; -inputReplyToStory#15b0f283 user_id:InputUser story_id:int = InputReplyTo; +inputReplyToStory#5881323a peer:InputPeer story_id:int = InputReplyTo; exportedStoryLink#3fc9053b link:string = ExportedStoryLink;