From 6974c511ea612f2ec50cd63b4cbe0d20b06abb4c Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 5 Sep 2025 11:51:37 +0400 Subject: [PATCH] Update API scheme to layer 216. --- Telegram/SourceFiles/api/api_updates.cpp | 2 ++ .../boxes/peer_list_controllers.cpp | 6 ++--- .../boxes/peers/edit_forum_topic_box.cpp | 6 ++--- Telegram/SourceFiles/data/data_forum.cpp | 8 +++--- .../SourceFiles/data/data_forum_topic.cpp | 6 ++--- Telegram/SourceFiles/data/data_histories.cpp | 6 ++--- .../SourceFiles/dialogs/dialogs_widget.cpp | 6 ++--- .../history/view/history_view_send_action.cpp | 1 + Telegram/SourceFiles/mtproto/scheme/api.tl | 25 ++++++++++--------- .../SourceFiles/window/window_peer_menu.cpp | 4 +-- 10 files changed, 37 insertions(+), 33 deletions(-) diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 893476bfe4..c33a66b1a0 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -1108,6 +1108,8 @@ void Updates::handleSendActionUpdate( const auto &data = action.c_sendMessageEmojiInteractionSeen(); handleEmojiInteraction(peer, qs(data.vemoticon())); return; + } else if (action.type() == mtpc_sendMessageTextDraftAction) { + return; } const auto when = requestingDifference() ? 0 diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 0f0a8e0da3..b962012f51 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -981,9 +981,9 @@ void ChooseTopicSearchController::searchQuery(const QString &query) { } void ChooseTopicSearchController::searchOnServer() { - _requestId = _api.request(MTPchannels_GetForumTopics( - MTP_flags(MTPchannels_GetForumTopics::Flag::f_q), - _forum->channel()->inputChannel, + _requestId = _api.request(MTPmessages_GetForumTopics( + MTP_flags(MTPmessages_GetForumTopics::Flag::f_q), + _forum->channel()->input, MTP_string(_query), MTP_int(_offsetDate), MTP_int(_offsetId), diff --git a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp index e651ae7d05..354a5608f5 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp @@ -554,13 +554,13 @@ void EditForumTopicBox( topic->applyIconId(state->iconId.current()); box->closeBox(); } else { - using Flag = MTPchannels_EditForumTopic::Flag; + using Flag = MTPmessages_EditForumTopic::Flag; const auto api = &forum->session().api(); const auto weak = base::make_weak(box); - state->requestId = api->request(MTPchannels_EditForumTopic( + state->requestId = api->request(MTPmessages_EditForumTopic( MTP_flags(Flag::f_title | (topic->isGeneral() ? Flag() : Flag::f_icon_emoji_id)), - topic->channel()->inputChannel, + topic->channel()->input, MTP_int(rootId), MTP_string(title->getLastText().trimmed()), MTP_long(state->iconId.current()), diff --git a/Telegram/SourceFiles/data/data_forum.cpp b/Telegram/SourceFiles/data/data_forum.cpp index 4fa805b6e3..e125fe21e3 100644 --- a/Telegram/SourceFiles/data/data_forum.cpp +++ b/Telegram/SourceFiles/data/data_forum.cpp @@ -142,9 +142,9 @@ void Forum::requestTopics() { } const auto firstLoad = !_offset.date; const auto loadCount = firstLoad ? kTopicsFirstLoad : kTopicsPerPage; - _requestId = session().api().request(MTPchannels_GetForumTopics( + _requestId = session().api().request(MTPmessages_GetForumTopics( MTP_flags(0), - channel()->inputChannel, + channel()->input, MTPstring(), // q MTP_int(_offset.date), MTP_int(_offset.id), @@ -404,8 +404,8 @@ void Forum::requestSomeStale() { _staleRequestId = histories.sendRequest(_history, type, [=]( Fn finish) { return session().api().request( - MTPchannels_GetForumTopicsByID( - channel()->inputChannel, + MTPmessages_GetForumTopicsByID( + channel()->input, MTP_vector(rootIds)) ).done([=](const MTPmessages_ForumTopics &result) { _staleRequestId = 0; diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index a8d05913e0..721fb2bc41 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -463,9 +463,9 @@ void ForumTopic::setClosedAndSave(bool closed) { const auto api = &session().api(); const auto weak = base::make_weak(this); - api->request(MTPchannels_EditForumTopic( - MTP_flags(MTPchannels_EditForumTopic::Flag::f_closed), - channel()->inputChannel, + api->request(MTPmessages_EditForumTopic( + MTP_flags(MTPmessages_EditForumTopic::Flag::f_closed), + channel()->input, MTP_int(_rootId), MTPstring(), // title MTPlong(), // icon_emoji_id diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 047f1ba9bd..408e9e85db 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -1054,11 +1054,11 @@ void Histories::sendCreateTopicRequest( randomId, { history->peer->id, rootId }); const auto api = &session().api(); - using Flag = MTPchannels_CreateForumTopic::Flag; - api->request(MTPchannels_CreateForumTopic( + using Flag = MTPmessages_CreateForumTopic::Flag; + api->request(MTPmessages_CreateForumTopic( MTP_flags(Flag::f_icon_color | (topic->iconId() ? Flag::f_icon_emoji_id : Flag(0))), - history->peer->asChannel()->inputChannel, + history->peer->input, MTP_string(topic->title()), MTP_int(topic->colorId()), MTP_long(topic->iconId()), diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index d559c17406..1dedffae5f 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -2761,9 +2761,9 @@ void Widget::searchTopics() { return; } _api.request(base::take(_topicSearchRequest)).cancel(); - _topicSearchRequest = _api.request(MTPchannels_GetForumTopics( - MTP_flags(MTPchannels_GetForumTopics::Flag::f_q), - _openedForum->channel()->inputChannel, + _topicSearchRequest = _api.request(MTPmessages_GetForumTopics( + MTP_flags(MTPmessages_GetForumTopics::Flag::f_q), + _openedForum->channel()->input, MTP_string(_topicSearchQuery), MTP_int(_topicSearchOffsetDate), MTP_int(_topicSearchOffsetId), diff --git a/Telegram/SourceFiles/history/view/history_view_send_action.cpp b/Telegram/SourceFiles/history/view/history_view_send_action.cpp index 460941e6d1..73f4ad47af 100644 --- a/Telegram/SourceFiles/history/view/history_view_send_action.cpp +++ b/Telegram/SourceFiles/history/view/history_view_send_action.cpp @@ -131,6 +131,7 @@ bool SendActionPainter::updateNeedsAnimating( Unexpected("EmojiInteraction here."); }, [&](const MTPDsendMessageEmojiInteractionSeen &) { // #TODO interaction + }, [&](const MTPDsendMessageTextDraftAction &) { }, [&](const MTPDsendMessageCancelAction &) { Unexpected("CancelAction here."); }); diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index 85f487b5e0..478af77705 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -85,7 +85,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType; storage.fileWebp#1081464c = storage.FileType; userEmpty#d3bc4b7a id:long = User; -user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; +user#20b1422 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true bot_attach_menu:flags.27?true premium:flags.28?true attach_menu_enabled:flags.29?true flags2:# bot_can_edit:flags2.1?true close_friend:flags2.2?true stories_hidden:flags2.3?true stories_unavailable:flags2.4?true contact_require_premium:flags2.10?true bot_business:flags2.11?true bot_has_main_app:flags2.13?true bot_forum_view:flags2.16?true id:long access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector bot_inline_placeholder:flags.19?string lang_code:flags.22?string emoji_status:flags.30?EmojiStatus usernames:flags2.0?Vector stories_max_id:flags2.5?int color:flags2.8?PeerColor profile_color:flags2.9?PeerColor bot_active_users:flags2.12?int bot_verification_icon:flags2.14?long send_paid_messages_stars:flags2.15?long = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#82d1f706 flags:# has_video:flags.0?true personal:flags.2?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto; @@ -268,8 +268,8 @@ messages.dialogs#15ba6c40 dialogs:Vector messages:Vector chats: messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector chats:Vector users:Vector = messages.Dialogs; messages.dialogsNotModified#f0e3e596 count:int = messages.Dialogs; -messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; -messages.messagesSlice#762b263d flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int search_flood:flags.3?SearchPostsFlood messages:Vector chats:Vector users:Vector = messages.Messages; +messages.messages#1d73e7ea messages:Vector topics:Vector chats:Vector users:Vector = messages.Messages; +messages.messagesSlice#5f206716 flags:# inexact:flags.1?true count:int next_rate:flags.0?int offset_id_offset:flags.2?int search_flood:flags.3?SearchPostsFlood messages:Vector topics:Vector chats:Vector users:Vector = messages.Messages; messages.channelMessages#c776ba4e flags:# inexact:flags.1?true pts:int count:int offset_id_offset:flags.2?int messages:Vector topics:Vector chats:Vector users:Vector = messages.Messages; messages.messagesNotModified#74535f21 count:int = messages.Messages; @@ -301,7 +301,7 @@ inputMessagesFilterPinned#1bb00451 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; -updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update; +updateUserTyping#2a17bf5c flags:# user_id:long top_msg_id:flags.0?int action:SendMessageAction = Update; updateChatUserTyping#83487af0 chat_id:long from_id:Peer action:SendMessageAction = Update; updateChatParticipants#7761198 participants:ChatParticipants = Update; updateUserStatus#e5bdf8de user_id:long status:UserStatus = Update; @@ -318,7 +318,7 @@ updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings updateServiceNotification#ebe46819 flags:# popup:flags.0?true invert_media:flags.2?true inbox_date:flags.1?int type:string message:string media:MessageMedia entities:Vector = Update; updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; updateUserPhone#5492a13 user_id:long phone:string = Update; -updateReadHistoryInbox#9c974fdf flags:# folder_id:flags.0?int peer:Peer max_id:int still_unread_count:int pts:int pts_count:int = Update; +updateReadHistoryInbox#9e84bc99 flags:# folder_id:flags.0?int peer:Peer top_msg_id:flags.1?int max_id:int still_unread_count:int pts:int pts_count:int = Update; updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; updateWebPage#7f891213 webpage:WebPage pts:int pts_count:int = Update; updateReadMessagesContents#f8227181 flags:# messages:Vector pts:int pts_count:int date:flags.0?int = Update; @@ -535,6 +535,7 @@ sendMessageHistoryImportAction#dbda9246 progress:int = SendMessageAction; sendMessageChooseStickerAction#b05ac6b1 = SendMessageAction; sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction; sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction; +sendMessageTextDraftAction#376d975c random_id:long text:TextWithEntities = SendMessageAction; contacts.found#b3134d9d my_results:Vector results:Vector chats:Vector users:Vector = contacts.Found; @@ -1574,7 +1575,7 @@ stickerKeyword#fcfeb29c document_id:long keyword:Vector = StickerKeyword username#b4073647 flags:# editable:flags.0?true active:flags.1?true username:string = Username; forumTopicDeleted#23f109b id:int = ForumTopic; -forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; +forumTopic#71701da9 flags:# my:flags.1?true closed:flags.2?true pinned:flags.3?true short:flags.5?true hidden:flags.6?true title_missing:flags.7?true id:int date:int title:string icon_color:int icon_emoji_id:flags.0?long top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int from_id:Peer notify_settings:PeerNotifySettings draft:flags.4?DraftMessage = ForumTopic; messages.forumTopics#367617d3 flags:# order_by_create_date:flags.0?true count:int topics:Vector messages:Vector chats:Vector users:Vector pts:int = messages.ForumTopics; @@ -2463,6 +2464,11 @@ messages.readSavedHistory#ba4a3b5b parent_peer:InputPeer peer:InputPeer max_id:i messages.toggleTodoCompleted#d3e03124 peer:InputPeer msg_id:int completed:Vector incompleted:Vector = Updates; messages.appendTodoList#21a61057 peer:InputPeer msg_id:int list:Vector = Updates; messages.toggleSuggestedPostApproval#8107455c flags:# reject:flags.1?true peer:InputPeer msg_id:int schedule_date:flags.0?int reject_comment:flags.2?string = Updates; +messages.getForumTopics#3ba47bff flags:# peer:InputPeer q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; +messages.getForumTopicsByID#af0a4a08 peer:InputPeer topics:Vector = messages.ForumTopics; +messages.editForumTopic#cecc1134 flags:# peer:InputPeer topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; +messages.createForumTopic#2f98c3d5 flags:# title_missing:flags.4?true peer:InputPeer title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; +messages.deleteTopicHistory#d2816f10 peer:InputPeer top_msg_id:int = messages.AffectedHistory; updates.getState#edd4882a = updates.State; updates.getDifference#19c2f763 flags:# pts:int pts_limit:flags.1?int pts_total_limit:flags.0?int date:int qts:int qts_limit:flags.2?int = updates.Difference; @@ -2552,12 +2558,7 @@ channels.reorderUsernames#b45ced1d channel:InputChannel order:Vector = B channels.toggleUsername#50f24105 channel:InputChannel username:string active:Bool = Bool; channels.deactivateAllUsernames#a245dd3 channel:InputChannel = Bool; channels.toggleForum#3ff75734 channel:InputChannel enabled:Bool tabs:Bool = Updates; -channels.createForumTopic#f40c0224 flags:# channel:InputChannel title:string icon_color:flags.0?int icon_emoji_id:flags.3?long random_id:long send_as:flags.2?InputPeer = Updates; -channels.getForumTopics#de560d1 flags:# channel:InputChannel q:flags.0?string offset_date:int offset_id:int offset_topic:int limit:int = messages.ForumTopics; -channels.getForumTopicsByID#b0831eb9 channel:InputChannel topics:Vector = messages.ForumTopics; -channels.editForumTopic#f4dfa185 flags:# channel:InputChannel topic_id:int title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = Updates; channels.updatePinnedForumTopic#6c2d9026 channel:InputChannel topic_id:int pinned:Bool = Updates; -channels.deleteTopicHistory#34435f2d channel:InputChannel top_msg_id:int = messages.AffectedHistory; channels.reorderPinnedForumTopics#2950a18f flags:# force:flags.0?true channel:InputChannel order:Vector = Updates; channels.toggleAntiSpam#68f3e4eb channel:InputChannel enabled:Bool = Updates; channels.reportAntiSpamFalsePositive#a850a693 channel:InputChannel msg_id:int = Bool; @@ -2792,4 +2793,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool; fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo; -// LAYER 215 +// LAYER 216 diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index d06f2794a0..5202659722 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1808,8 +1808,8 @@ void PeerMenuDeleteTopic( not_null channel, MsgId rootId) { const auto api = &channel->session().api(); - api->request(MTPchannels_DeleteTopicHistory( - channel->inputChannel, + api->request(MTPmessages_DeleteTopicHistory( + channel->input, MTP_int(rootId) )).done([=](const MTPmessages_AffectedHistory &result) { const auto offset = api->applyAffectedHistory(channel, result);