From 31234cb487adc363b008aa83085cbed9e29b7c50 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Jan 2018 17:37:21 +0300 Subject: [PATCH] API scheme updated to layer 75. --- Telegram/Resources/scheme.tl | 41 +++++++-- Telegram/SourceFiles/apiwrap.cpp | 28 +++--- .../dialogs/dialogs_inner_widget.cpp | 6 +- .../SourceFiles/dialogs/dialogs_widget.cpp | 32 ++++--- Telegram/SourceFiles/history/history.cpp | 13 +-- Telegram/SourceFiles/mainwidget.cpp | 89 ++++++++++++++----- .../SourceFiles/window/window_peer_menu.cpp | 5 +- 7 files changed, 154 insertions(+), 60 deletions(-) diff --git a/Telegram/Resources/scheme.tl b/Telegram/Resources/scheme.tl index 1c458f7477..ae2addbe05 100644 --- a/Telegram/Resources/scheme.tl +++ b/Telegram/Resources/scheme.tl @@ -219,7 +219,7 @@ userStatusLastMonth#77ebc742 = UserStatus; chatEmpty#9ba2d800 id:int = Chat; chat#d91cdd54 flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true admins_enabled:flags.3?true admin:flags.4?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel = Chat; chatForbidden#7328bdb id:int title:string = Chat; -channel#450b7115 flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int = Chat; +channel#c88974ac flags:# creator:flags.0?true left:flags.2?true editor:flags.3?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true democracy:flags.10?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChannelAdminRights banned_rights:flags.15?ChannelBannedRights participants_count:flags.17?int feed_id:flags.18?int = Chat; channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; @@ -272,6 +272,7 @@ messageActionScreenshotTaken#4792929b = MessageAction; messageActionCustomAction#fae69f56 message:string = MessageAction; dialog#e4def5db flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; +dialogFeed#36086d42 flags:# pinned:flags.2?true peer:Peer top_message:int feed_id:int feed_other_channels:Vector read_max_position:flags.3?FeedPosition unread_count:int unread_muted_count:int = Dialog; photoEmpty#2331b22d id:long = Photo; photo#9288dd29 flags:# has_stickers:flags.0?true id:long access_hash:long date:int sizes:Vector = Photo; @@ -422,8 +423,8 @@ updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; -updateDialogPinned#d711a2cc flags:# pinned:flags.0?true peer:Peer = Update; -updatePinnedDialogs#d8caf68d flags:# order:flags.0?Vector = Update; +updateDialogPinned#19d27f3c flags:# pinned:flags.0?true peer:DialogPeer = Update; +updatePinnedDialogs#ea4cb65b flags:# order:flags.0?Vector = Update; updateBotWebhookJSON#8317c0c3 data:DataJSON = Update; updateBotWebhookJSONQuery#9b9240a6 query_id:long data:DataJSON timeout:int = Update; updateBotShippingQuery#e0cdc940 query_id:long user_id:int payload:bytes shipping_address:PostAddress = Update; @@ -435,6 +436,7 @@ updateFavedStickers#e511996d = Update; updateChannelReadMessagesContents#89893b45 channel_id:int messages:Vector = Update; updateContactsReset#7084a7be = Update; updateChannelAvailableMessages#70db6837 channel_id:int available_min_id:int = Update; +updateReadFeed#994852a9 feed_id:int max_position:FeedPosition = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -937,6 +939,23 @@ help.recentMeUrls#e0310d7 urls:Vector chats:Vector users:Vect inputSingleMedia#5eaa7809 media:InputMedia random_id:long = InputSingleMedia; +feedPosition#5059dc73 date:int peer:Peer id:int = FeedPosition; + +messages.feedMessagesNotModified#4678d0cf = messages.FeedMessages; +messages.feedMessages#55c3a1b1 flags:# max_position:flags.0?FeedPosition min_position:flags.1?FeedPosition read_max_position:flags.2?FeedPosition messages:Vector chats:Vector users:Vector = messages.FeedMessages; + +feedBroadcasts#4f4feaf1 feed_id:int channels:Vector = FeedBroadcasts; +feedBroadcastsUngrouped#9a687cba channels:Vector = FeedBroadcasts; + +channels.feedSourcesNotModified#88b12a17 = channels.FeedSources; +channels.feedSources#8e8bca3d flags:# newly_joined_feed:flags.0?int feeds:Vector chats:Vector users:Vector = channels.FeedSources; + +inputDialogPeerFeed#2c38b8cf feed_id:int = InputDialogPeer; +inputDialogPeer#fcaafeb7 peer:InputPeer = InputDialogPeer; + +dialogPeerFeed#da429411 feed_id:int = DialogPeer; +dialogPeer#e56dbf05 peer:Peer = DialogPeer; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1011,7 +1030,7 @@ contacts.resetTopPeerRating#1ae373ac category:TopPeerCategory peer:InputPeer = B contacts.resetSaved#879537f1 = Bool; messages.getMessages#4222fa74 id:Vector = messages.Messages; -messages.getDialogs#191ba9c5 flags:# exclude_pinned:flags.0?true offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; +messages.getDialogs#5c0fae2 flags:# exclude_pinned:flags.0?true feed_id:flags.1?int offset_date:int offset_id:int offset_peer:InputPeer limit:int = messages.Dialogs; messages.getHistory#dcbb8260 peer:InputPeer offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int hash:int = messages.Messages; messages.search#39e9ea0 flags:# peer:InputPeer q:string from_id:flags.0?InputUser filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages; @@ -1072,7 +1091,7 @@ messages.editMessage#5d1b8dd flags:# no_webpage:flags.1?true stop_geo_live:flags messages.editInlineBotMessage#b0e08243 flags:# no_webpage:flags.1?true stop_geo_live:flags.12?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector geo_point:flags.13?InputGeoPoint = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#d58f130a flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string cache_time:int = Bool; -messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; +messages.getPeerDialogs#e470bcfd peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; @@ -1090,8 +1109,8 @@ messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:Inpu messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; messages.getWebPage#32ca8f91 url:string hash:int = WebPage; -messages.toggleDialogPin#3289be6a flags:# pinned:flags.0?true peer:InputPeer = Bool; -messages.reorderPinnedDialogs#959ff644 flags:# force:flags.0?true order:Vector = Bool; +messages.toggleDialogPin#a731e257 flags:# pinned:flags.0?true peer:InputDialogPeer = Bool; +messages.reorderPinnedDialogs#5b51d63f flags:# force:flags.0?true order:Vector = Bool; messages.getPinnedDialogs#e254d64e = messages.PeerDialogs; messages.setBotShippingResults#e5f672fa flags:# query_id:long error:flags.0?string shipping_options:flags.1?Vector = Bool; messages.setBotPrecheckoutResults#9c2dd95 flags:# success:flags.1?true query_id:long error:flags.0?string = Bool; @@ -1166,6 +1185,12 @@ channels.setStickers#ea8ca4f9 channel:InputChannel stickerset:InputStickerSet = channels.readMessageContents#eab5dc38 channel:InputChannel id:Vector = Bool; channels.deleteHistory#af369d42 channel:InputChannel max_id:int = Bool; channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates; +channels.getFeed#18117df2 flags:# offset_to_max_read:flags.3?true feed_id:int offset_position:flags.0?FeedPosition add_offset:int limit:int max_position:flags.1?FeedPosition min_position:flags.2?FeedPosition sources_hash:int hash:int = messages.FeedMessages; +channels.searchFeed#88325369 feed_id:int q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages; +channels.getFeedSources#d8ce236e flags:# feed_id:flags.0?int hash:int = channels.FeedSources; +channels.changeFeedBroadcast#2528871e flags:# channel:InputChannel feed_id:flags.0?int = Bool; +channels.setFeedBroadcasts#7e91b8f2 feed_id:int channels:Vector also_newly_joined:Bool = Bool; +channels.readFeed#9c3011d feed_id:int max_position:FeedPosition = Updates; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; @@ -1196,4 +1221,4 @@ langpack.getStrings#2e1ee318 lang_code:string keys:Vector = Vector; -// LAYER 74 +// LAYER 75 diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 208e1ed033..2db3f65def 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -322,10 +322,14 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt auto &d = result.c_messages_chatFull(); auto &vc = d.vchats.v; auto badVersion = false; - if (peer->isChat()) { - badVersion = (!vc.isEmpty() && vc[0].type() == mtpc_chat && vc[0].c_chat().vversion.v < peer->asChat()->version); - } else if (peer->isChannel()) { - badVersion = (!vc.isEmpty() && vc[0].type() == mtpc_channel && vc[0].c_channel().vversion.v < peer->asChannel()->version); + if (const auto chat = peer->asChat()) { + badVersion = !vc.isEmpty() + && (vc[0].type() == mtpc_chat) + && (vc[0].c_chat().vversion.v < chat->version); + } else if (const auto channel = peer->asChannel()) { + badVersion = !vc.isEmpty() + && (vc[0].type() == mtpc_channel) + && (vc[0].c_channel().vversion.v < channel->version); } App::feedUsers(d.vusers); @@ -455,9 +459,9 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt } } if (badVersion) { - if (auto chat = peer->asChat()) { + if (const auto chat = peer->asChat()) { chat->version = vc[0].c_chat().vversion.v; - } else if (auto channel = peer->asChannel()) { + } else if (const auto channel = peer->asChannel()) { channel->version = vc[0].c_channel().vversion.v; } requestPeer(peer); @@ -510,10 +514,14 @@ void ApiWrap::requestPeer(PeerData *peer) { if (auto chats = Api::getChatsFromMessagesChats(result)) { auto &v = chats->v; bool badVersion = false; - if (auto chat = peer->asChat()) { - badVersion = (!v.isEmpty() && v[0].type() == mtpc_chat && v[0].c_chat().vversion.v < chat->version); - } else if (auto channel = peer->asChannel()) { - badVersion = (!v.isEmpty() && v[0].type() == mtpc_channel && v[0].c_channel().vversion.v < channel->version); + if (const auto chat = peer->asChat()) { + badVersion = !v.isEmpty() + && (v[0].type() == mtpc_chat) + && (v[0].c_chat().vversion.v < chat->version); + } else if (const auto channel = peer->asChannel()) { + badVersion = !v.isEmpty() + && (v[0].type() == mtpc_channel) + && (v[0].c_channel().vversion.v < channel->version); } auto chat = App::feedChats(*chats); if (chat == peer) { diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 1555cc3be5..6623fe95ce 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -1492,13 +1492,13 @@ void DialogsInner::itemRemoved(not_null item) { } void DialogsInner::dialogsReceived(const QVector &added) { - for_const (auto &dialog, added) { + for (const auto &dialog : added) { if (dialog.type() != mtpc_dialog) { continue; } - auto &d = dialog.c_dialog(); - auto peerId = peerFromMTP(d.vpeer); + const auto &d = dialog.c_dialog(); + const auto peerId = peerFromMTP(d.vpeer); if (!peerId) { continue; } diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index dbcc54077c..f2d1cc5381 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -352,9 +352,9 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs, mtpReque continue; } - auto &dialogData = dialog.c_dialog(); - if (auto peer = peerFromMTP(dialogData.vpeer)) { - auto history = App::history(peer); + const auto &dialogData = dialog.c_dialog(); + if (const auto peer = peerFromMTP(dialogData.vpeer)) { + const auto history = App::history(peer); history->setPinnedDialog(dialogData.is_pinned()); if (!lastDate) { @@ -417,9 +417,9 @@ void DialogsWidget::pinnedDialogsReceived(const MTPmessages_PeerDialogs &dialogs continue; } - auto &dialogData = dialog.c_dialog(); - if (auto peer = peerFromMTP(dialogData.vpeer)) { - auto history = App::history(peer); + const auto &dialogData = dialog.c_dialog(); + if (const auto peer = peerFromMTP(dialogData.vpeer)) { + const auto history = App::history(peer); history->setPinnedDialog(dialogData.is_pinned()); } } @@ -575,10 +575,22 @@ void DialogsWidget::loadDialogs() { return; } - auto firstLoad = !_dialogsOffsetDate; - auto loadCount = firstLoad ? DialogsFirstLoad : DialogsPerPage; - auto flags = MTPmessages_GetDialogs::Flag::f_exclude_pinned; - _dialogsRequestId = MTP::send(MTPmessages_GetDialogs(MTP_flags(flags), MTP_int(_dialogsOffsetDate), MTP_int(_dialogsOffsetId), _dialogsOffsetPeer ? _dialogsOffsetPeer->input : MTP_inputPeerEmpty(), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); + const auto firstLoad = !_dialogsOffsetDate; + const auto loadCount = firstLoad ? DialogsFirstLoad : DialogsPerPage; + const auto flags = MTPmessages_GetDialogs::Flag::f_exclude_pinned; + const auto feedId = 0; + _dialogsRequestId = MTP::send( + MTPmessages_GetDialogs( + MTP_flags(flags), + MTP_int(feedId), + MTP_int(_dialogsOffsetDate), + MTP_int(_dialogsOffsetId), + _dialogsOffsetPeer + ? _dialogsOffsetPeer->input + : MTP_inputPeerEmpty(), + MTP_int(loadCount)), + rpcDone(&DialogsWidget::dialogsReceived), + rpcFail(&DialogsWidget::dialogsFailed)); if (!_pinnedDialogsReceived) { loadPinnedDialogs(); } diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index a8223c30b9..48d7481a09 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -720,14 +720,17 @@ QList Histories::getPinnedOrder() const { } void Histories::savePinnedToServer() const { - auto order = getPinnedOrder(); - auto peers = QVector(); + const auto order = getPinnedOrder(); + auto peers = QVector(); peers.reserve(order.size()); - for_const (auto history, order) { - peers.push_back(history->peer->input); + for (const auto history : order) { + peers.push_back(MTP_inputDialogPeer(history->peer->input)); } auto flags = MTPmessages_ReorderPinnedDialogs::Flag::f_force; - MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(flags), MTP_vector(peers))); + MTP::send( + MTPmessages_ReorderPinnedDialogs( + MTP_flags(flags), + MTP_vector(peers))); } void Histories::selfDestructIn(not_null item, TimeMs delay) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 7abeb7efc5..5ec8968630 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -4275,8 +4275,8 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { default: LOG(("API Error: unexpected update cons %1 (MainWidget::inviteImportDone)").arg(updates.type())); break; } if (v && !v->isEmpty()) { - auto &mtpChat = v->front(); - auto peerId = [&] { + const auto &mtpChat = v->front(); + const auto peerId = [&] { if (mtpChat.type() == mtpc_chat) { return peerFromChat(mtpChat.c_chat().vid.v); } else if (mtpChat.type() == mtpc_channel) { @@ -4284,7 +4284,7 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { } return PeerId(0); }(); - if (auto peer = App::peerLoaded(peerId)) { + if (const auto peer = App::peerLoaded(peerId)) { _controller->showPeerHistory( peer, SectionShow::Way::Forward); @@ -5023,6 +5023,12 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } } break; + case mtpc_updateReadFeed: { + const auto &d = update.c_updateReadFeed(); + const auto feedId = d.vfeed_id.v; + // #TODO feeds + } break; + // Deleted messages. case mtpc_updateDeleteMessages: { auto &d = update.c_updateDeleteMessages(); @@ -5277,24 +5283,50 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } break; case mtpc_updatePinnedDialogs: { - auto &d = update.c_updatePinnedDialogs(); + const auto &d = update.c_updatePinnedDialogs(); if (d.has_order()) { - auto allLoaded = true; - auto &order = d.vorder.v; - for_const (auto &peer, order) { - auto peerId = peerFromMTP(peer); - if (!App::historyLoaded(peerId)) { - allLoaded = false; - DEBUG_LOG(("API Error: pinned chat not loaded for peer %1").arg(peerId)); - break; + const auto &order = d.vorder.v; + const auto allLoaded = [&] { + for (const auto &dialogPeer : order) { + switch (dialogPeer.type()) { + case mtpc_dialogPeer: { + const auto &peer = dialogPeer.c_dialogPeer(); + const auto peerId = peerFromMTP(peer.vpeer); + if (!App::historyLoaded(peerId)) { + DEBUG_LOG(("API Error: " + "pinned chat not loaded for peer %1" + ).arg(peerId + )); + return false; + } + } break; + case mtpc_dialogPeerFeed: { + const auto &feed = dialogPeer.c_dialogPeerFeed(); + const auto feedId = feed.vfeed_id.v; + // #TODO feeds + } break; + } } - } + return true; + }(); if (allLoaded) { App::histories().clearPinned(); for (auto i = order.size(); i != 0;) { - auto history = App::historyLoaded(peerFromMTP(order[--i])); - Assert(history != nullptr); - history->setPinnedDialog(true); + const auto &dialogPeer = order[--i]; + switch (dialogPeer.type()) { + case mtpc_dialogPeer: { + const auto &peer = dialogPeer.c_dialogPeer(); + const auto peerId = peerFromMTP(peer.vpeer); + const auto history = App::historyLoaded(peerId); + Assert(history != nullptr); + history->setPinnedDialog(true); + } break; + case mtpc_dialogPeerFeed: { + const auto &feed = dialogPeer.c_dialogPeerFeed(); + const auto feedId = feed.vfeed_id.v; + // #TODO feeds + } break; + } } } else { _dialogs->loadPinnedDialogs(); @@ -5305,13 +5337,24 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } break; case mtpc_updateDialogPinned: { - auto &d = update.c_updateDialogPinned(); - auto peerId = peerFromMTP(d.vpeer); - if (auto history = App::historyLoaded(peerId)) { - history->setPinnedDialog(d.is_pinned()); - } else { - DEBUG_LOG(("API Error: pinned chat not loaded for peer %1").arg(peerId)); - _dialogs->loadPinnedDialogs(); + const auto &d = update.c_updateDialogPinned(); + switch (d.vpeer.type()) { + case mtpc_dialogPeer: { + const auto peerId = peerFromMTP(d.vpeer.c_dialogPeer().vpeer); + if (const auto history = App::historyLoaded(peerId)) { + history->setPinnedDialog(d.is_pinned()); + } else { + DEBUG_LOG(("API Error: " + "pinned chat not loaded for peer %1" + ).arg(peerId + )); + _dialogs->loadPinnedDialogs(); + } + } break; + case mtpc_dialogPeerFeed: { + const auto feedId = d.vpeer.c_dialogPeerFeed().vfeed_id.v; + // #TODO feeds + } break; } } break; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 678bb4d48e..ae80f62ac9 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -137,7 +137,10 @@ void Filler::addPinToggle() { if (isPinned) { flags |= MTPmessages_ToggleDialogPin::Flag::f_pinned; } - MTP::send(MTPmessages_ToggleDialogPin(MTP_flags(flags), peer->input)); + MTP::send( + MTPmessages_ToggleDialogPin( + MTP_flags(flags), + MTP_inputDialogPeer(peer->input))); if (isPinned) { if (auto main = App::main()) { main->dialogsToUp();