diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 29e8a7a2f5..85ce5990a6 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -434,6 +434,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_create_public_link" = "Create public link"; "lng_profile_edit_public_link" = "Edit public link"; "lng_profile_manage_admins" = "Manage administrators"; +"lng_profile_common_groups" = "{count:_not_used_|# group|# groups} in common"; +"lng_profile_common_groups_section" = "Groups in common"; "lng_profile_participants_section" = "Members"; "lng_profile_info_section" = "Info"; "lng_profile_mobile_number" = "Mobile:"; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index f9deafa543..d6241e6e51 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -325,7 +325,10 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt } void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestId req) { - const auto &d(result.c_userFull()); + auto user = peer->asUser(); + t_assert(user != nullptr); + + auto &d = result.c_userFull(); App::feedUsers(MTP_vector(1, d.vuser)); if (d.has_profile_photo()) { App::feedPhoto(d.vprofile_photo); @@ -336,12 +339,13 @@ void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result, mtpRequestI } if (d.has_bot_info()) { - peer->asUser()->setBotInfo(d.vbot_info); + user->setBotInfo(d.vbot_info); } else { - peer->asUser()->setBotInfoVersion(-1); + user->setBotInfoVersion(-1); } - peer->asUser()->setBlockStatus(d.is_blocked() ? UserData::BlockStatus::Blocked : UserData::BlockStatus::NotBlocked); - peer->asUser()->setAbout(d.has_about() ? qs(d.vabout) : QString()); + user->setBlockStatus(d.is_blocked() ? UserData::BlockStatus::Blocked : UserData::BlockStatus::NotBlocked); + user->setAbout(d.has_about() ? qs(d.vabout) : QString()); + user->setCommonChatsCount(d.vcommon_chats_count.v); if (req) { QMap::iterator i = _fullPeerRequests.find(peer); @@ -422,15 +426,15 @@ void ApiWrap::requestBots(ChannelData *peer) { void ApiWrap::gotChat(PeerData *peer, const MTPmessages_Chats &result) { _peerRequests.remove(peer); - if (result.type() == mtpc_messages_chats) { - const auto &v(result.c_messages_chats().vchats.c_vector().v); + if (auto chats = Api::getChatsFromMessagesChats(result)) { + auto &v = chats->c_vector().v; bool badVersion = false; if (peer->isChat()) { badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_chat && v.at(0).c_chat().vversion.v < peer->asChat()->version); } else if (peer->isChannel()) { badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_channel && v.at(0).c_chat().vversion.v < peer->asChannel()->version); } - PeerData *chat = App::feedChats(result.c_messages_chats().vchats); + auto chat = App::feedChats(*chats); if (chat == peer) { if (badVersion) { if (peer->isChat()) { @@ -453,9 +457,8 @@ void ApiWrap::gotUser(PeerData *peer, const MTPVector &result) { } void ApiWrap::gotChats(const MTPmessages_Chats &result) { - if (result.type() == mtpc_messages_chats) { - auto &d = result.c_messages_chats(); - App::feedChats(d.vchats); + if (auto chats = Api::getChatsFromMessagesChats(result)) { + App::feedChats(*chats); } } diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 2d5c6529e8..74f9043a5f 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -22,6 +22,18 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "core/single_timer.h" +namespace Api { + +inline const MTPVector *getChatsFromMessagesChats(const MTPmessages_Chats &chats) { + switch (chats.type()) { + case mtpc_messages_chats: return &chats.c_messages_chats().vchats; + case mtpc_messages_chatsSlice: return &chats.c_messages_chatsSlice().vchats; + } + return nullptr; +} + +} // namespace Api + class ApiWrap : public QObject, public RPCSender { Q_OBJECT diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index ad658fd8ad..5b8d269161 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1513,6 +1513,7 @@ namespace { return page; } break; case mtpc_webPagePending: return App::feedWebPage(webpage.c_webPagePending()); + case mtpc_webPageNotModified: LOG(("API Error: webPageNotModified is unexpected in feedWebPage().")); break; } return nullptr; } diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index f88807ea97..5d7f74bcf2 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -1255,9 +1255,8 @@ void RevokePublicLinkBox::paintChat(Painter &p, const ChatRow &row, bool selecte } void RevokePublicLinkBox::getPublicDone(const MTPmessages_Chats &result) { - if (result.type() == mtpc_messages_chats) { - auto &chats = result.c_messages_chats().vchats; - for_const (auto &chat, chats.c_vector().v) { + if (auto chats = Api::getChatsFromMessagesChats(result)) { + for_const (auto &chat, chats->c_vector().v) { if (auto peer = App::feedChat(chat)) { if (!peer->isChannel() || peer->userName().isEmpty()) continue; diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index d563122ff5..cbc0c7f5d9 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -999,8 +999,8 @@ void shareGameScoreByHash(const QString &hash) { auto requestChannelIds = MTP_vector(1, MTP_inputChannel(MTP_int(channelId), MTP_long(channelAccessHash))); auto requestChannel = MTPchannels_GetChannels(requestChannelIds); MTP::send(requestChannel, rpcDone([channelId, resolveMessageAndShareScore](const MTPmessages_Chats &result) { - if (result.type() == mtpc_messages_chats) { - App::feedChats(result.c_messages_chats().vchats); + if (auto chats = Api::getChatsFromMessagesChats(result)) { + App::feedChats(*chats); } if (auto channel = App::channelLoaded(channelId)) { resolveMessageAndShareScore(channel); diff --git a/Telegram/SourceFiles/core/lambda.h b/Telegram/SourceFiles/core/lambda.h index 24f1c68eb5..21c55d0af8 100644 --- a/Telegram/SourceFiles/core/lambda.h +++ b/Telegram/SourceFiles/core/lambda.h @@ -393,18 +393,23 @@ public: namespace internal { - template - struct lambda_type_helper; +template +struct lambda_type_resolver; - template - struct lambda_type_helper { - using type = lambda; - }; +template +struct lambda_type_resolver { + using type = lambda; +}; + +template +struct lambda_type_helper { + using type = typename lambda_type_resolver::type; +}; } // namespace internal template -using lambda_type = typename internal::lambda_type_helper::type; +using lambda_type = typename internal::lambda_type_helper::type; // Guard lambda call by one or many QObject* weak pointers. @@ -489,6 +494,11 @@ struct lambda_guard_type_helper { template using lambda_guard_t = typename lambda_guard_type_helper::type; +template +struct lambda_type_helper> { + using type = typename lambda_type_helper::type; +}; + } // namespace internal template diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 3d0890c6a3..e8252e495c 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -190,12 +190,6 @@ bool History::updateSendActionNeedsAnimating(UserData *user, const MTPSendMessag if (action.type() == mtpc_sendMessageCancelAction) { unregSendAction(user); return false; - } else if (action.type() == mtpc_sendMessageGameStopAction) { - auto it = _sendActions.find(user); - if (it != _sendActions.end() && it->type == Type::PlayGame) { - unregSendAction(user); - } - return false; } auto ms = getms(); @@ -251,12 +245,6 @@ bool History::paintSendAction(Painter &p, int x, int y, int availableWidth, int availableWidth -= animationWidth; p.setPen(color); _sendActionText.drawElided(p, x, y, availableWidth); -// App::histories().sendActionAnimationUpdated().notify({ -// this, -// animationWidth, -// st::normalFont->height, -// false -// }); return true; } return false; @@ -393,8 +381,11 @@ void ChannelHistory::getRangeDifference() { void ChannelHistory::getRangeDifferenceNext(int32 pts) { if (!App::main() || _rangeDifferenceToId < _rangeDifferenceFromId) return; - int32 limit = _rangeDifferenceToId + 1 - _rangeDifferenceFromId; - _rangeDifferenceRequestId = MTP::send(MTPupdates_GetChannelDifference(peer->asChannel()->inputChannel, MTP_channelMessagesFilter(MTP_flags(MTPDchannelMessagesFilter::Flags(0)), MTP_vector(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId)))), MTP_int(pts), MTP_int(limit)), App::main()->rpcDone(&MainWidget::gotRangeDifference, peer->asChannel())); + int limit = _rangeDifferenceToId + 1 - _rangeDifferenceFromId; + + auto filter = MTP_channelMessagesFilter(MTP_flags(MTPDchannelMessagesFilter::Flags(0)), MTP_vector(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId)))); + MTPupdates_GetChannelDifference::Flags flags = MTPupdates_GetChannelDifference::Flag::f_force; + _rangeDifferenceRequestId = MTP::send(MTPupdates_GetChannelDifference(MTP_flags(flags), peer->asChannel()->inputChannel, filter, MTP_int(pts), MTP_int(limit)), App::main()->rpcDone(&MainWidget::gotRangeDifference, peer->asChannel())); } HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { @@ -788,6 +779,7 @@ HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction, case mtpc_webPage: case mtpc_webPageEmpty: case mtpc_webPagePending: break; + case mtpc_webPageNotModified: default: badMedia = 1; break; } break; diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 046342be02..b330516119 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -83,10 +83,10 @@ public: } struct SendActionAnimationUpdate { - History *history = nullptr; - int width = 0; - int height = 0; - bool textUpdated = 0; + History *history; + int width; + int height; + bool textUpdated; }; base::Observable &sendActionAnimationUpdated() { return _sendActionAnimationUpdated; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index f0ac649217..9e9b426f8c 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -687,6 +687,7 @@ void HistoryMessage::initMedia(const MTPMessageMedia *media) { case mtpc_webPage: { _media.reset(new HistoryWebPage(this, App::feedWebPage(d.c_webPage()))); } break; + case mtpc_webPageNotModified: LOG(("API Error: webPageNotModified is unexpected in message media.")); break; } } break; case mtpc_messageMediaGame: { diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 65333ecec9..fe25637c95 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -39,7 +39,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "history/history_service_layout.h" #include "history/history_media_types.h" #include "history/history_drag_area.h" -#include "profile/profile_members_widget.h" +#include "profile/profile_block_group_members.h" #include "core/click_handler_types.h" #include "stickers/emoji_pan.h" #include "lang.h" @@ -6266,7 +6266,7 @@ void HistoryWidget::setMembersShowAreaActive(bool active) { void HistoryWidget::onMembersDropdownShow() { if (!_membersDropdown) { _membersDropdown.create(this, st::membersInnerDropdown); - _membersDropdown->setOwnedWidget(new Profile::MembersWidget(_membersDropdown, _peer, Profile::MembersWidget::TitleVisibility::Hidden)); + _membersDropdown->setOwnedWidget(new Profile::GroupMembersWidget(_membersDropdown, _peer, Profile::GroupMembersWidget::TitleVisibility::Hidden)); _membersDropdown->resizeToWidth(st::membersInnerWidth); _membersDropdown->setMaxHeight(countMembersDropdownHeightMax()); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 7c9a29639e..ba9be8c6e3 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3291,12 +3291,12 @@ void MainWidget::gotState(const MTPupdates_State &state) { updateOnline(); } -void MainWidget::gotDifference(const MTPupdates_Difference &diff) { +void MainWidget::gotDifference(const MTPupdates_Difference &difference) { _failDifferenceTimeout = 1; - switch (diff.type()) { + switch (difference.type()) { case mtpc_updates_differenceEmpty: { - const auto &d(diff.c_updates_differenceEmpty()); + auto &d = difference.c_updates_differenceEmpty(); updSetState(_ptsWaiter.current(), d.vdate.v, updQts, d.vseq.v); _lastUpdateTime = getms(true); @@ -3305,10 +3305,10 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) { _ptsWaiter.setRequesting(false); } break; case mtpc_updates_differenceSlice: { - const auto &d(diff.c_updates_differenceSlice()); + auto &d = difference.c_updates_differenceSlice(); feedDifference(d.vusers, d.vchats, d.vnew_messages, d.vother_updates); - const auto &s(d.vintermediate_state.c_updates_state()); + auto &s = d.vintermediate_state.c_updates_state(); updSetState(s.vpts.v, s.vdate.v, s.vqts.v, s.vseq.v); _ptsWaiter.setRequesting(false); @@ -3317,11 +3317,15 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) { getDifference(); } break; case mtpc_updates_difference: { - const auto &d(diff.c_updates_difference()); + auto &d = difference.c_updates_difference(); feedDifference(d.vusers, d.vchats, d.vnew_messages, d.vother_updates); gotState(d.vstate); } break; + case mtpc_updates_differenceTooLong: { + auto &d = difference.c_updates_differenceTooLong(); + LOG(("API Error: updates.differenceTooLong is not supported by Telegram Desktop!")); + } break; }; } @@ -3444,7 +3448,7 @@ void MainWidget::onGetDifferenceTimeByPts() { wait = wait ? qMin(wait, i.value() - now) : (i.value() - now); ++i; } else { - getChannelDifference(i.key(), GetChannelDifferenceFromPtsGap); + getChannelDifference(i.key(), ChannelDifferenceRequest::PtsGapOrShortPoll); i = _channelGetDifferenceTimeByPts.erase(i); } } @@ -3473,7 +3477,7 @@ void MainWidget::onGetDifferenceTimeAfterFail() { wait = wait ? qMin(wait, i.value() - now) : (i.value() - now); ++i; } else { - getChannelDifference(i.key(), GetChannelDifferenceFromFail); + getChannelDifference(i.key(), ChannelDifferenceRequest::AfterFail); i = _channelGetDifferenceTimeAfterFail.erase(i); } } @@ -3498,26 +3502,34 @@ void MainWidget::getDifference() { _getDifferenceTimeAfterFail = 0; _ptsWaiter.setRequesting(true); - MTP::send(MTPupdates_GetDifference(MTP_int(_ptsWaiter.current()), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference)); + + MTPupdates_GetDifference::Flags flags = 0; + MTP::send(MTPupdates_GetDifference(MTP_flags(flags), MTP_int(_ptsWaiter.current()), MTPint(), MTP_int(updDate), MTP_int(updQts)), rpcDone(&MainWidget::gotDifference), rpcFail(&MainWidget::failDifference)); } -void MainWidget::getChannelDifference(ChannelData *channel, GetChannelDifferenceFrom from) { +void MainWidget::getChannelDifference(ChannelData *channel, ChannelDifferenceRequest from) { if (this != App::main() || !channel) return; - if (from != GetChannelDifferenceFromPtsGap) { + if (from != ChannelDifferenceRequest::PtsGapOrShortPoll) { _channelGetDifferenceTimeByPts.remove(channel); } if (!channel->ptsInited() || channel->ptsRequesting()) return; - if (from != GetChannelDifferenceFromFail) { + if (from != ChannelDifferenceRequest::AfterFail) { _channelGetDifferenceTimeAfterFail.remove(channel); } channel->ptsSetRequesting(true); auto filter = MTP_channelMessagesFilterEmpty(); - MTP::send(MTPupdates_GetChannelDifference(channel->inputChannel, filter, MTP_int(channel->pts()), MTP_int(MTPChannelGetDifferenceLimit)), rpcDone(&MainWidget::gotChannelDifference, channel), rpcFail(&MainWidget::failChannelDifference, channel)); + MTPupdates_GetChannelDifference::Flags flags = MTPupdates_GetChannelDifference::Flag::f_force; + if (from != ChannelDifferenceRequest::PtsGapOrShortPoll) { + if (!channel->ptsWaitingForSkipped()) { + flags = 0; // No force flag when requesting for short poll. + } + } + MTP::send(MTPupdates_GetChannelDifference(MTP_flags(flags), channel->inputChannel, filter, MTP_int(channel->pts()), MTP_int(MTPChannelGetDifferenceLimit)), rpcDone(&MainWidget::gotChannelDifference, channel), rpcFail(&MainWidget::failChannelDifference, channel)); } void MainWidget::mtpPing() { @@ -4897,6 +4909,29 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } } break; + case mtpc_updateChannelWebPage: { + auto &d = update.c_updateChannelWebPage(); + auto channel = App::channelLoaded(d.vchannel_id.v); + + if (channel && !_handlingChannelDifference) { + if (channel->ptsRequesting()) { // skip global updates while getting channel difference + return; + } else if (!channel->ptsUpdated(d.vpts.v, d.vpts_count.v, update)) { + return; + } + } + + + // update before applying skipped + App::feedWebPage(d.vwebpage); + _history->updatePreview(); + webPagesOrGamesUpdate(); + + if (channel && !_handlingChannelDifference) { + channel->ptsApplySkippedUpdates(); + } + } break; + case mtpc_updateDeleteChannelMessages: { auto &d = update.c_updateDeleteChannelMessages(); auto channel = App::channelLoaded(d.vchannel_id.v); diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 3e76fe95ba..c6e7a0046b 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -535,12 +535,12 @@ private: SingleTimer _updateMutedTimer; - enum GetChannelDifferenceFrom { - GetChannelDifferenceFromUnknown, - GetChannelDifferenceFromPtsGap, - GetChannelDifferenceFromFail, + enum class ChannelDifferenceRequest { + Unknown, + PtsGapOrShortPoll, + AfterFail, }; - void getChannelDifference(ChannelData *channel, GetChannelDifferenceFrom from = GetChannelDifferenceFromUnknown); + void getChannelDifference(ChannelData *channel, ChannelDifferenceRequest from = ChannelDifferenceRequest::Unknown); void gotDifference(const MTPupdates_Difference &diff); bool failDifference(const RPCError &e); void feedDifference(const MTPVector &users, const MTPVector &chats, const MTPVector &msgs, const MTPVector &other); diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index c6887c5a2f..a0fcea8c86 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -300,7 +300,7 @@ inputReportReasonViolence#1e22c78d = ReportReason; inputReportReasonPornography#2e59d922 = ReportReason; inputReportReasonOther#e1746d0a text:string = ReportReason; -userFull#5932fc03 flags:# blocked:flags.0?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo = UserFull; +userFull#f220f3f flags:# blocked:flags.0?true user:User about:flags.1?string link:contacts.Link profile_photo:flags.2?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo common_chats_count:int = UserFull; contact#f911c994 user_id:int mutual:Bool = Contact; @@ -328,6 +328,7 @@ messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; +messages.chatsSlice#78f69146 count:int chats:Vector users:Vector = messages.Chats; messages.chatFull#e5d7d19c full_chat:ChatFull chats:Vector users:Vector = messages.ChatFull; @@ -398,12 +399,14 @@ updateReadFeaturedStickers#571d2742 = Update; updateRecentStickers#9a422c20 = Update; updateConfig#a229dd06 = Update; updatePtsChanged#3354678f = Update; +updateChannelWebPage#40771900 channel_id:int webpage:WebPage pts:int pts_count:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.differenceEmpty#5d75a138 date:int seq:int = updates.Difference; updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector state:updates.State = updates.Difference; updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; +updates.differenceTooLong#4afe8f6d pts:int = updates.Difference; updatesTooLong#e317af7e = Updates; updateShortMessage#914fbf11 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:int message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int entities:flags.7?Vector = Updates; @@ -480,7 +483,6 @@ sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; -sendMessageGameStopAction#15c2c99a = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; @@ -535,7 +537,8 @@ contactLinkContact#d502c2d0 = ContactLink; webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; -webPage#ca820ed7 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document = WebPage; +webPage#5f07b4bc flags:# id:long url:string display_url:string hash:int type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document cached_page:flags.10?Page = WebPage; +webPageNotModified#85849473 = WebPage; authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; @@ -667,7 +670,7 @@ botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:str botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; -messages.botResults#256709a6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector = messages.BotResults; +messages.botResults#ccd3563d flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector cache_time:int = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; @@ -682,7 +685,7 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; -messages.botCallbackAnswer#b10df1fb flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string = messages.BotCallbackAnswer; +messages.botCallbackAnswer#36585ea4 flags:# alert:flags.1?true has_url:flags.3?true message:flags.0?string url:flags.2?string cache_time:int = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; @@ -736,6 +739,42 @@ highScore#58fffcd0 pos:int user_id:int score:int = HighScore; messages.highScores#9a3bfd99 scores:Vector users:Vector = messages.HighScores; +textEmpty#dc3d824f = RichText; +textPlain#744694e0 text:string = RichText; +textBold#6724abc4 text:RichText = RichText; +textItalic#d912a59c text:RichText = RichText; +textUnderline#c12622c4 text:RichText = RichText; +textStrike#9bf8bb95 text:RichText = RichText; +textFixed#6c3f19b9 text:RichText = RichText; +textUrl#3c2884c1 text:RichText url:string webpage_id:long = RichText; +textEmail#de5a0dd6 text:RichText email:string = RichText; +textConcat#7e6260d7 texts:Vector = RichText; + +pageBlockTitle#70abc3fd text:RichText = PageBlock; +pageBlockSubtitle#8ffa9a1f text:RichText = PageBlock; +pageBlockAuthorDate#3d5b64f2 author:string published_date:int = PageBlock; +pageBlockHeader#bfd064ec text:RichText = PageBlock; +pageBlockSubheader#f12bb6e1 text:RichText = PageBlock; +pageBlockParagraph#467a0766 text:RichText = PageBlock; +pageBlockPreformatted#c070d93e text:RichText language:string = PageBlock; +pageBlockFooter#48870999 text:RichText = PageBlock; +pageBlockDivider#db20b188 = PageBlock; +pageBlockList#3a58c7f4 ordered:Bool items:Vector = PageBlock; +pageBlockBlockquote#263d7c26 text:RichText caption:RichText = PageBlock; +pageBlockPullquote#4f4456d3 text:RichText caption:RichText = PageBlock; +pageBlockPhoto#e9c69982 photo_id:long caption:RichText = PageBlock; +pageBlockVideo#d9d71866 flags:# autoplay:flags.1?true loop:flags.2?true video_id:long caption:RichText = PageBlock; +pageBlockCover#39f23300 cover:PageBlock = PageBlock; +pageBlockEmbed#36b0816 url:string w:int h:int caption:RichText = PageBlock; +pageBlockEmbedPost#7ff81db7 flags:# author:string date:int caption:RichText url:string webpage_id:long text:flags.1?RichText medias:flags.2?Vector author_photo_id:flags.3?long = PageBlock; +pageBlockSlideshow#130c8963 items:Vector caption:RichText = PageBlock; + +embedPostPhoto#e31ee77 photo_id:long = EmbedPostMedia; +embedPostVideo#a07f2d66 video_id:long = EmbedPostMedia; + +pagePart#8dee6c44 blocks:Vector photos:Vector videos:Vector = Page; +pageFull#d7a19d69 blocks:Vector photos:Vector videos:Vector = Page; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -867,7 +906,7 @@ messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEdi messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#810a9fec flags:# game:flags.1?true peer:InputPeer msg_id:int data:flags.0?bytes = messages.BotCallbackAnswer; -messages.setBotCallbackAnswer#c927d44b flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string = Bool; +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.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; @@ -883,10 +922,13 @@ messages.setGameScore#8ef8ecc0 flags:# edit_message:flags.0?true peer:InputPeer messages.setInlineGameScore#15ad9f64 flags:# edit_message:flags.0?true id:InputBotInlineMessageID user_id:InputUser score:int = Bool; messages.getGameHighScores#e822649d peer:InputPeer id:int user_id:InputUser = messages.HighScores; messages.getInlineGameHighScores#f635e1b id:InputBotInlineMessageID user_id:InputUser = messages.HighScores; +messages.getCommonChats#d0a48c4 user_id:InputUser max_id:int limit:int = messages.Chats; +messages.getAllChats#eba80ff0 except_ids:Vector = messages.Chats; +messages.getWebPage#61203e2 id:long hash:int = WebPage; updates.getState#edd4882a = updates.State; -updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; -updates.getChannelDifference#bb32d7c0 channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; +updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; +updates.getChannelDifference#3173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; photos.updateProfilePhoto#f0bb5152 id:InputPhoto = UserProfilePhoto; photos.uploadProfilePhoto#4f32c098 file:InputFile = photos.Photo; @@ -905,6 +947,7 @@ help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#b921197a = help.AppChangelog; help.getTermsOfService#350170f3 = help.TermsOfService; +help.setBotUpdatesStatus#ec22cfcd pending_updates_count:int message:string = Bool; channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool; channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector = messages.AffectedMessages; @@ -934,4 +977,4 @@ channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; -// LAYER 57 +// LAYER 59 diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index 66dc941290..4737d7cea9 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -2062,6 +2062,7 @@ void _serialize_userFull(MTPStringLogger &to, int32 stage, int32 lev, Types &typ case 5: to.add(" profile_photo: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_profile_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; case 6: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 7: to.add(" bot_info: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_bot_info) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 8: to.add(" common_chats_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -2294,6 +2295,21 @@ void _serialize_messages_chats(MTPStringLogger &to, int32 stage, int32 lev, Type } } +void _serialize_messages_chatsSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_chatsSlice"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_messages_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -3110,6 +3126,22 @@ void _serialize_updatePtsChanged(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("{ updatePtsChanged }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_updateChannelWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateChannelWebPage"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" webpage: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_updates_state(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -3177,6 +3209,19 @@ void _serialize_updates_differenceSlice(MTPStringLogger &to, int32 stage, int32 } } +void _serialize_updates_differenceTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_differenceTooLong"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_updatesTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updatesTooLong }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } @@ -3900,10 +3945,6 @@ void _serialize_sendMessageGamePlayAction(MTPStringLogger &to, int32 stage, int3 to.add("{ sendMessageGamePlayAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageGameStopAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { - to.add("{ sendMessageGameStopAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); -} - void _serialize_contacts_found(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -4270,22 +4311,28 @@ void _serialize_webPage(MTPStringLogger &to, int32 stage, int32 lev, Types &type case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" display_url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 5: to.add(" site_name: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_site_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 6: to.add(" title: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 7: to.add(" description: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_description) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 8: to.add(" photo: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 9: to.add(" embed_url: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 10: to.add(" embed_type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 11: to.add(" embed_width: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_width) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 12: to.add(" embed_height: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_height) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 13: to.add(" duration: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; - case 14: to.add(" author: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_author) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; - case 15: to.add(" document: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_document) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 4: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" site_name: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_site_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 7: to.add(" title: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 8: to.add(" description: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_description) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 9: to.add(" photo: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 10: to.add(" embed_url: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 11: to.add(" embed_type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 12: to.add(" embed_width: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_width) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 13: to.add(" embed_height: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_height) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 14: to.add(" duration: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 15: to.add(" author: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_author) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 16: to.add(" document: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_document) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 17: to.add(" cached_page: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_cached_page) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } +void _serialize_webPageNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ webPageNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + void _serialize_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -5647,6 +5694,7 @@ void _serialize_messages_botResults(MTPStringLogger &to, int32 stage, int32 lev, case 3: to.add(" next_offset: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_next_offset) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 4: to.add(" switch_pm: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_switch_pm) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; case 5: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" cache_time: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -5762,6 +5810,7 @@ void _serialize_messages_botCallbackAnswer(MTPStringLogger &to, int32 stage, int case 2: to.add(" has_url: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_has_url) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; case 3: to.add(" message: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_message) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 4: to.add(" url: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" cache_time: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6137,6 +6186,437 @@ void _serialize_messages_highScores(MTPStringLogger &to, int32 stage, int32 lev, } } +void _serialize_textEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ textEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_textPlain(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textPlain"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textBold(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textBold"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textItalic(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textItalic"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textUnderline(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textUnderline"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textStrike(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textStrike"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textFixed(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textFixed"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textUrl"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" webpage_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textEmail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textEmail"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" email: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_textConcat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ textConcat"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" texts: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockTitle"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockSubtitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockSubtitle"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockAuthorDate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockAuthorDate"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" author: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" published_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockHeader(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockHeader"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockSubheader(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockSubheader"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockParagraph(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockParagraph"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockPreformatted(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockPreformatted"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" language: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockFooter(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockFooter"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockDivider(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ pageBlockDivider }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_pageBlockList(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockList"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" ordered: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" items: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockBlockquote(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockBlockquote"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockPullquote(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockPullquote"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockPhoto"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" photo_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDpageBlockVideo::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockVideo"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" autoplay: "); ++stages.back(); if (flag & MTPDpageBlockVideo::Flag::f_autoplay) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" loop: "); ++stages.back(); if (flag & MTPDpageBlockVideo::Flag::f_loop) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 3: to.add(" video_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockCover(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockCover"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" cover: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockEmbed(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockEmbed"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockEmbedPost(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDpageBlockEmbedPost::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockEmbedPost"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" author: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" webpage_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" text: "); ++stages.back(); if (flag & MTPDpageBlockEmbedPost::Flag::f_text) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 7: to.add(" medias: "); ++stages.back(); if (flag & MTPDpageBlockEmbedPost::Flag::f_medias) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 8: to.add(" author_photo_id: "); ++stages.back(); if (flag & MTPDpageBlockEmbedPost::Flag::f_author_photo_id) { types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageBlockSlideshow(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageBlockSlideshow"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" items: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_embedPostPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ embedPostPhoto"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" photo_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_embedPostVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ embedPostVideo"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" video_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pagePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pagePart"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" blocks: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" photos: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" videos: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_pageFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ pageFull"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" blocks: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" photos: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" videos: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_req_pq(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -6747,6 +7227,7 @@ void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage, case 2: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" message: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::Flag::f_message) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 4: to.add(" url: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" cache_time: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6881,6 +7362,20 @@ void _serialize_help_saveAppLog(MTPStringLogger &to, int32 stage, int32 lev, Typ } } +void _serialize_help_setBotUpdatesStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ help_setBotUpdatesStatus"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" pending_updates_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_channels_readHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -8175,6 +8670,34 @@ void _serialize_messages_getChats(MTPStringLogger &to, int32 stage, int32 lev, T } } +void _serialize_messages_getCommonChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_getCommonChats"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_messages_getAllChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_getAllChats"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" except_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_channels_getChannels(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -8637,11 +9160,27 @@ void _serialize_messages_getInlineGameHighScores(MTPStringLogger &to, int32 stag } } +void _serialize_messages_getWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_getWebPage"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_updates_getState(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } void _serialize_updates_getDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPupdates_getDifference::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -8649,14 +9188,18 @@ void _serialize_updates_getDifference(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_total_limit: "); ++stages.back(); if (flag & MTPupdates_getDifference::Flag::f_pts_total_limit) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } void _serialize_updates_getChannelDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPupdates_getChannelDifference::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -8664,10 +9207,12 @@ void _serialize_updates_getChannelDifference(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" force: "); ++stages.back(); if (flag & MTPupdates_getChannelDifference::Flag::f_force) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -9031,6 +9576,7 @@ namespace { _serializers.insert(mtpc_messages_messagesSlice, _serialize_messages_messagesSlice); _serializers.insert(mtpc_messages_channelMessages, _serialize_messages_channelMessages); _serializers.insert(mtpc_messages_chats, _serialize_messages_chats); + _serializers.insert(mtpc_messages_chatsSlice, _serialize_messages_chatsSlice); _serializers.insert(mtpc_messages_chatFull, _serialize_messages_chatFull); _serializers.insert(mtpc_messages_affectedHistory, _serialize_messages_affectedHistory); _serializers.insert(mtpc_inputMessagesFilterEmpty, _serialize_inputMessagesFilterEmpty); @@ -9097,10 +9643,12 @@ namespace { _serializers.insert(mtpc_updateRecentStickers, _serialize_updateRecentStickers); _serializers.insert(mtpc_updateConfig, _serialize_updateConfig); _serializers.insert(mtpc_updatePtsChanged, _serialize_updatePtsChanged); + _serializers.insert(mtpc_updateChannelWebPage, _serialize_updateChannelWebPage); _serializers.insert(mtpc_updates_state, _serialize_updates_state); _serializers.insert(mtpc_updates_differenceEmpty, _serialize_updates_differenceEmpty); _serializers.insert(mtpc_updates_difference, _serialize_updates_difference); _serializers.insert(mtpc_updates_differenceSlice, _serialize_updates_differenceSlice); + _serializers.insert(mtpc_updates_differenceTooLong, _serialize_updates_differenceTooLong); _serializers.insert(mtpc_updatesTooLong, _serialize_updatesTooLong); _serializers.insert(mtpc_updateShortMessage, _serialize_updateShortMessage); _serializers.insert(mtpc_updateShortChatMessage, _serialize_updateShortChatMessage); @@ -9156,7 +9704,6 @@ namespace { _serializers.insert(mtpc_sendMessageGeoLocationAction, _serialize_sendMessageGeoLocationAction); _serializers.insert(mtpc_sendMessageChooseContactAction, _serialize_sendMessageChooseContactAction); _serializers.insert(mtpc_sendMessageGamePlayAction, _serialize_sendMessageGamePlayAction); - _serializers.insert(mtpc_sendMessageGameStopAction, _serialize_sendMessageGameStopAction); _serializers.insert(mtpc_contacts_found, _serialize_contacts_found); _serializers.insert(mtpc_inputPrivacyKeyStatusTimestamp, _serialize_inputPrivacyKeyStatusTimestamp); _serializers.insert(mtpc_inputPrivacyKeyChatInvite, _serialize_inputPrivacyKeyChatInvite); @@ -9197,6 +9744,7 @@ namespace { _serializers.insert(mtpc_webPageEmpty, _serialize_webPageEmpty); _serializers.insert(mtpc_webPagePending, _serialize_webPagePending); _serializers.insert(mtpc_webPage, _serialize_webPage); + _serializers.insert(mtpc_webPageNotModified, _serialize_webPageNotModified); _serializers.insert(mtpc_authorization, _serialize_authorization); _serializers.insert(mtpc_account_authorizations, _serialize_account_authorizations); _serializers.insert(mtpc_account_noPassword, _serialize_account_noPassword); @@ -9333,6 +9881,38 @@ namespace { _serializers.insert(mtpc_inputGameShortName, _serialize_inputGameShortName); _serializers.insert(mtpc_highScore, _serialize_highScore); _serializers.insert(mtpc_messages_highScores, _serialize_messages_highScores); + _serializers.insert(mtpc_textEmpty, _serialize_textEmpty); + _serializers.insert(mtpc_textPlain, _serialize_textPlain); + _serializers.insert(mtpc_textBold, _serialize_textBold); + _serializers.insert(mtpc_textItalic, _serialize_textItalic); + _serializers.insert(mtpc_textUnderline, _serialize_textUnderline); + _serializers.insert(mtpc_textStrike, _serialize_textStrike); + _serializers.insert(mtpc_textFixed, _serialize_textFixed); + _serializers.insert(mtpc_textUrl, _serialize_textUrl); + _serializers.insert(mtpc_textEmail, _serialize_textEmail); + _serializers.insert(mtpc_textConcat, _serialize_textConcat); + _serializers.insert(mtpc_pageBlockTitle, _serialize_pageBlockTitle); + _serializers.insert(mtpc_pageBlockSubtitle, _serialize_pageBlockSubtitle); + _serializers.insert(mtpc_pageBlockAuthorDate, _serialize_pageBlockAuthorDate); + _serializers.insert(mtpc_pageBlockHeader, _serialize_pageBlockHeader); + _serializers.insert(mtpc_pageBlockSubheader, _serialize_pageBlockSubheader); + _serializers.insert(mtpc_pageBlockParagraph, _serialize_pageBlockParagraph); + _serializers.insert(mtpc_pageBlockPreformatted, _serialize_pageBlockPreformatted); + _serializers.insert(mtpc_pageBlockFooter, _serialize_pageBlockFooter); + _serializers.insert(mtpc_pageBlockDivider, _serialize_pageBlockDivider); + _serializers.insert(mtpc_pageBlockList, _serialize_pageBlockList); + _serializers.insert(mtpc_pageBlockBlockquote, _serialize_pageBlockBlockquote); + _serializers.insert(mtpc_pageBlockPullquote, _serialize_pageBlockPullquote); + _serializers.insert(mtpc_pageBlockPhoto, _serialize_pageBlockPhoto); + _serializers.insert(mtpc_pageBlockVideo, _serialize_pageBlockVideo); + _serializers.insert(mtpc_pageBlockCover, _serialize_pageBlockCover); + _serializers.insert(mtpc_pageBlockEmbed, _serialize_pageBlockEmbed); + _serializers.insert(mtpc_pageBlockEmbedPost, _serialize_pageBlockEmbedPost); + _serializers.insert(mtpc_pageBlockSlideshow, _serialize_pageBlockSlideshow); + _serializers.insert(mtpc_embedPostPhoto, _serialize_embedPostPhoto); + _serializers.insert(mtpc_embedPostVideo, _serialize_embedPostVideo); + _serializers.insert(mtpc_pagePart, _serialize_pagePart); + _serializers.insert(mtpc_pageFull, _serialize_pageFull); _serializers.insert(mtpc_req_pq, _serialize_req_pq); _serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params); @@ -9387,6 +9967,7 @@ namespace { _serializers.insert(mtpc_upload_saveFilePart, _serialize_upload_saveFilePart); _serializers.insert(mtpc_upload_saveBigFilePart, _serialize_upload_saveBigFilePart); _serializers.insert(mtpc_help_saveAppLog, _serialize_help_saveAppLog); + _serializers.insert(mtpc_help_setBotUpdatesStatus, _serialize_help_setBotUpdatesStatus); _serializers.insert(mtpc_channels_readHistory, _serialize_channels_readHistory); _serializers.insert(mtpc_channels_reportSpam, _serialize_channels_reportSpam); _serializers.insert(mtpc_channels_editAbout, _serialize_channels_editAbout); @@ -9478,6 +10059,8 @@ namespace { _serializers.insert(mtpc_channels_updatePinnedMessage, _serialize_channels_updatePinnedMessage); _serializers.insert(mtpc_messages_getPeerSettings, _serialize_messages_getPeerSettings); _serializers.insert(mtpc_messages_getChats, _serialize_messages_getChats); + _serializers.insert(mtpc_messages_getCommonChats, _serialize_messages_getCommonChats); + _serializers.insert(mtpc_messages_getAllChats, _serialize_messages_getAllChats); _serializers.insert(mtpc_channels_getChannels, _serialize_channels_getChannels); _serializers.insert(mtpc_channels_getAdminedPublicChannels, _serialize_channels_getAdminedPublicChannels); _serializers.insert(mtpc_messages_getFullChat, _serialize_messages_getFullChat); @@ -9511,6 +10094,7 @@ namespace { _serializers.insert(mtpc_messages_getAttachedStickers, _serialize_messages_getAttachedStickers); _serializers.insert(mtpc_messages_getGameHighScores, _serialize_messages_getGameHighScores); _serializers.insert(mtpc_messages_getInlineGameHighScores, _serialize_messages_getInlineGameHighScores); + _serializers.insert(mtpc_messages_getWebPage, _serialize_messages_getWebPage); _serializers.insert(mtpc_updates_getState, _serialize_updates_getState); _serializers.insert(mtpc_updates_getDifference, _serialize_updates_getDifference); _serializers.insert(mtpc_updates_getChannelDifference, _serialize_updates_getChannelDifference); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index 5926b39975..4006985fc1 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org namespace MTP { namespace internal { -static constexpr mtpPrime CurrentLayer = 57; +static constexpr mtpPrime CurrentLayer = 59; class TypeCreator; @@ -212,7 +212,7 @@ enum { mtpc_inputReportReasonViolence = 0x1e22c78d, mtpc_inputReportReasonPornography = 0x2e59d922, mtpc_inputReportReasonOther = 0xe1746d0a, - mtpc_userFull = 0x5932fc03, + mtpc_userFull = 0xf220f3f, mtpc_contact = 0xf911c994, mtpc_importedContact = 0xd0028438, mtpc_contactBlocked = 0x561bc879, @@ -229,6 +229,7 @@ enum { mtpc_messages_messagesSlice = 0xb446ae3, mtpc_messages_channelMessages = 0x99262e37, mtpc_messages_chats = 0x64ff9fd5, + mtpc_messages_chatsSlice = 0x78f69146, mtpc_messages_chatFull = 0xe5d7d19c, mtpc_messages_affectedHistory = 0xb45c69d1, mtpc_inputMessagesFilterEmpty = 0x57e2f66c, @@ -295,10 +296,12 @@ enum { mtpc_updateRecentStickers = 0x9a422c20, mtpc_updateConfig = 0xa229dd06, mtpc_updatePtsChanged = 0x3354678f, + mtpc_updateChannelWebPage = 0x40771900, mtpc_updates_state = 0xa56c2a3e, mtpc_updates_differenceEmpty = 0x5d75a138, mtpc_updates_difference = 0xf49ca0, mtpc_updates_differenceSlice = 0xa8fb1981, + mtpc_updates_differenceTooLong = 0x4afe8f6d, mtpc_updatesTooLong = 0xe317af7e, mtpc_updateShortMessage = 0x914fbf11, mtpc_updateShortChatMessage = 0x16812688, @@ -354,7 +357,6 @@ enum { mtpc_sendMessageGeoLocationAction = 0x176f8ba1, mtpc_sendMessageChooseContactAction = 0x628cbc6f, mtpc_sendMessageGamePlayAction = 0xdd6a8f48, - mtpc_sendMessageGameStopAction = 0x15c2c99a, mtpc_contacts_found = 0x1aa1f784, mtpc_inputPrivacyKeyStatusTimestamp = 0x4f96cb18, mtpc_inputPrivacyKeyChatInvite = 0xbdfb0426, @@ -394,7 +396,8 @@ enum { mtpc_contactLinkContact = 0xd502c2d0, mtpc_webPageEmpty = 0xeb1477e8, mtpc_webPagePending = 0xc586da1c, - mtpc_webPage = 0xca820ed7, + mtpc_webPage = 0x5f07b4bc, + mtpc_webPageNotModified = 0x85849473, mtpc_authorization = 0x7bf2e6f6, mtpc_account_authorizations = 0x1250abde, mtpc_account_noPassword = 0x96dabc18, @@ -488,7 +491,7 @@ enum { mtpc_botInlineMessageMediaContact = 0x35edb4d4, mtpc_botInlineResult = 0x9bebaeb9, mtpc_botInlineMediaResult = 0x17db940b, - mtpc_messages_botResults = 0x256709a6, + mtpc_messages_botResults = 0xccd3563d, mtpc_exportedMessageLink = 0x1f486803, mtpc_messageFwdHeader = 0xc786ddcb, mtpc_auth_codeTypeSms = 0x72a3158c, @@ -498,7 +501,7 @@ enum { mtpc_auth_sentCodeTypeSms = 0xc000bba2, mtpc_auth_sentCodeTypeCall = 0x5353e5a7, mtpc_auth_sentCodeTypeFlashCall = 0xab03c6d9, - mtpc_messages_botCallbackAnswer = 0xb10df1fb, + mtpc_messages_botCallbackAnswer = 0x36585ea4, mtpc_messages_messageEditData = 0x26b5dde6, mtpc_inputBotInlineMessageID = 0x890c3d89, mtpc_inlineBotSwitchPM = 0x3c20629f, @@ -531,6 +534,38 @@ enum { mtpc_inputGameShortName = 0xc331e80a, mtpc_highScore = 0x58fffcd0, mtpc_messages_highScores = 0x9a3bfd99, + mtpc_textEmpty = 0xdc3d824f, + mtpc_textPlain = 0x744694e0, + mtpc_textBold = 0x6724abc4, + mtpc_textItalic = 0xd912a59c, + mtpc_textUnderline = 0xc12622c4, + mtpc_textStrike = 0x9bf8bb95, + mtpc_textFixed = 0x6c3f19b9, + mtpc_textUrl = 0x3c2884c1, + mtpc_textEmail = 0xde5a0dd6, + mtpc_textConcat = 0x7e6260d7, + mtpc_pageBlockTitle = 0x70abc3fd, + mtpc_pageBlockSubtitle = 0x8ffa9a1f, + mtpc_pageBlockAuthorDate = 0x3d5b64f2, + mtpc_pageBlockHeader = 0xbfd064ec, + mtpc_pageBlockSubheader = 0xf12bb6e1, + mtpc_pageBlockParagraph = 0x467a0766, + mtpc_pageBlockPreformatted = 0xc070d93e, + mtpc_pageBlockFooter = 0x48870999, + mtpc_pageBlockDivider = 0xdb20b188, + mtpc_pageBlockList = 0x3a58c7f4, + mtpc_pageBlockBlockquote = 0x263d7c26, + mtpc_pageBlockPullquote = 0x4f4456d3, + mtpc_pageBlockPhoto = 0xe9c69982, + mtpc_pageBlockVideo = 0xd9d71866, + mtpc_pageBlockCover = 0x39f23300, + mtpc_pageBlockEmbed = 0x36b0816, + mtpc_pageBlockEmbedPost = 0x7ff81db7, + mtpc_pageBlockSlideshow = 0x130c8963, + mtpc_embedPostPhoto = 0xe31ee77, + mtpc_embedPostVideo = 0xa07f2d66, + mtpc_pagePart = 0x8dee6c44, + mtpc_pageFull = 0xd7a19d69, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_initConnection = 0x69796de9, @@ -655,7 +690,7 @@ enum { mtpc_messages_editMessage = 0xce91e4ca, mtpc_messages_editInlineBotMessage = 0x130c2c85, mtpc_messages_getBotCallbackAnswer = 0x810a9fec, - mtpc_messages_setBotCallbackAnswer = 0xc927d44b, + mtpc_messages_setBotCallbackAnswer = 0xd58f130a, mtpc_messages_getPeerDialogs = 0x2d9776b9, mtpc_messages_saveDraft = 0xbc39e14b, mtpc_messages_getAllDrafts = 0x6a3f8d65, @@ -671,9 +706,12 @@ enum { mtpc_messages_setInlineGameScore = 0x15ad9f64, mtpc_messages_getGameHighScores = 0xe822649d, mtpc_messages_getInlineGameHighScores = 0xf635e1b, + mtpc_messages_getCommonChats = 0xd0a48c4, + mtpc_messages_getAllChats = 0xeba80ff0, + mtpc_messages_getWebPage = 0x61203e2, mtpc_updates_getState = 0xedd4882a, - mtpc_updates_getDifference = 0xa041495, - mtpc_updates_getChannelDifference = 0xbb32d7c0, + mtpc_updates_getDifference = 0x25939651, + mtpc_updates_getChannelDifference = 0x3173d78, mtpc_photos_updateProfilePhoto = 0xf0bb5152, mtpc_photos_uploadProfilePhoto = 0x4f32c098, mtpc_photos_deletePhotos = 0x87cf7f2f, @@ -689,6 +727,7 @@ enum { mtpc_help_getSupport = 0x9cdf08cd, mtpc_help_getAppChangelog = 0xb921197a, mtpc_help_getTermsOfService = 0x350170f3, + mtpc_help_setBotUpdatesStatus = 0xec22cfcd, mtpc_channels_readHistory = 0xcc104937, mtpc_channels_deleteMessages = 0x84c1fd4e, mtpc_channels_deleteUserHistory = 0xd10dd71b, @@ -1004,6 +1043,7 @@ class MTPDmessages_channelMessages; class MTPmessages_chats; class MTPDmessages_chats; +class MTPDmessages_chatsSlice; class MTPmessages_chatFull; class MTPDmessages_chatFull; @@ -1061,6 +1101,7 @@ class MTPDupdateEditMessage; class MTPDupdateInlineBotCallbackQuery; class MTPDupdateReadChannelOutbox; class MTPDupdateDraftMessage; +class MTPDupdateChannelWebPage; class MTPupdates_state; class MTPDupdates_state; @@ -1069,6 +1110,7 @@ class MTPupdates_difference; class MTPDupdates_differenceEmpty; class MTPDupdates_difference; class MTPDupdates_differenceSlice; +class MTPDupdates_differenceTooLong; class MTPupdates; class MTPDupdateShortMessage; @@ -1438,6 +1480,44 @@ class MTPDhighScore; class MTPmessages_highScores; class MTPDmessages_highScores; +class MTPrichText; +class MTPDtextPlain; +class MTPDtextBold; +class MTPDtextItalic; +class MTPDtextUnderline; +class MTPDtextStrike; +class MTPDtextFixed; +class MTPDtextUrl; +class MTPDtextEmail; +class MTPDtextConcat; + +class MTPpageBlock; +class MTPDpageBlockTitle; +class MTPDpageBlockSubtitle; +class MTPDpageBlockAuthorDate; +class MTPDpageBlockHeader; +class MTPDpageBlockSubheader; +class MTPDpageBlockParagraph; +class MTPDpageBlockPreformatted; +class MTPDpageBlockFooter; +class MTPDpageBlockList; +class MTPDpageBlockBlockquote; +class MTPDpageBlockPullquote; +class MTPDpageBlockPhoto; +class MTPDpageBlockVideo; +class MTPDpageBlockCover; +class MTPDpageBlockEmbed; +class MTPDpageBlockEmbedPost; +class MTPDpageBlockSlideshow; + +class MTPembedPostMedia; +class MTPDembedPostPhoto; +class MTPDembedPostVideo; + +class MTPpage; +class MTPDpagePart; +class MTPDpageFull; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1622,6 +1702,10 @@ typedef MTPBoxed MTPGame; typedef MTPBoxed MTPInputGame; typedef MTPBoxed MTPHighScore; typedef MTPBoxed MTPmessages_HighScores; +typedef MTPBoxed MTPRichText; +typedef MTPBoxed MTPPageBlock; +typedef MTPBoxed MTPEmbedPostMedia; +typedef MTPBoxed MTPPage; // Type classes definitions @@ -4758,32 +4842,47 @@ typedef MTPBoxed MTPmessages_Messages; class MTPmessages_chats : private mtpDataOwner { public: - MTPmessages_chats(); - MTPmessages_chats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_chats) : mtpDataOwner(0) { + MTPmessages_chats() : mtpDataOwner(0), _type(0) { + } + MTPmessages_chats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { read(from, end, cons); } MTPDmessages_chats &_messages_chats() { - t_assert(data != nullptr); + t_assert(data != nullptr && _type == mtpc_messages_chats); split(); return *(MTPDmessages_chats*)data; } const MTPDmessages_chats &c_messages_chats() const { - t_assert(data != nullptr); + t_assert(data != nullptr && _type == mtpc_messages_chats); return *(const MTPDmessages_chats*)data; } + MTPDmessages_chatsSlice &_messages_chatsSlice() { + t_assert(data != nullptr && _type == mtpc_messages_chatsSlice); + split(); + return *(MTPDmessages_chatsSlice*)data; + } + const MTPDmessages_chatsSlice &c_messages_chatsSlice() const { + t_assert(data != nullptr && _type == mtpc_messages_chatsSlice); + return *(const MTPDmessages_chatsSlice*)data; + } + uint32 innerLength() const; mtpTypeId type() const; - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_chats); + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); void write(mtpBuffer &to) const; typedef void ResponseType; private: + explicit MTPmessages_chats(mtpTypeId type); explicit MTPmessages_chats(MTPDmessages_chats *_data); + explicit MTPmessages_chats(MTPDmessages_chatsSlice *_data); friend class MTP::internal::TypeCreator; + + mtpTypeId _type; }; typedef MTPBoxed MTPmessages_Chats; @@ -5351,6 +5450,16 @@ public: return *(const MTPDupdateDraftMessage*)data; } + MTPDupdateChannelWebPage &_updateChannelWebPage() { + t_assert(data != nullptr && _type == mtpc_updateChannelWebPage); + split(); + return *(MTPDupdateChannelWebPage*)data; + } + const MTPDupdateChannelWebPage &c_updateChannelWebPage() const { + t_assert(data != nullptr && _type == mtpc_updateChannelWebPage); + return *(const MTPDupdateChannelWebPage*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5407,6 +5516,7 @@ private: explicit MTPupdate(MTPDupdateInlineBotCallbackQuery *_data); explicit MTPupdate(MTPDupdateReadChannelOutbox *_data); explicit MTPupdate(MTPDupdateDraftMessage *_data); + explicit MTPupdate(MTPDupdateChannelWebPage *_data); friend class MTP::internal::TypeCreator; @@ -5483,6 +5593,16 @@ public: return *(const MTPDupdates_differenceSlice*)data; } + MTPDupdates_differenceTooLong &_updates_differenceTooLong() { + t_assert(data != nullptr && _type == mtpc_updates_differenceTooLong); + split(); + return *(MTPDupdates_differenceTooLong*)data; + } + const MTPDupdates_differenceTooLong &c_updates_differenceTooLong() const { + t_assert(data != nullptr && _type == mtpc_updates_differenceTooLong); + return *(const MTPDupdates_differenceTooLong*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5495,6 +5615,7 @@ private: explicit MTPupdates_difference(MTPDupdates_differenceEmpty *_data); explicit MTPupdates_difference(MTPDupdates_difference *_data); explicit MTPupdates_difference(MTPDupdates_differenceSlice *_data); + explicit MTPupdates_difference(MTPDupdates_differenceTooLong *_data); friend class MTP::internal::TypeCreator; @@ -9564,6 +9685,432 @@ private: }; typedef MTPBoxed MTPmessages_HighScores; +class MTPrichText : private mtpDataOwner { +public: + MTPrichText() : mtpDataOwner(0), _type(0) { + } + MTPrichText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDtextPlain &_textPlain() { + t_assert(data != nullptr && _type == mtpc_textPlain); + split(); + return *(MTPDtextPlain*)data; + } + const MTPDtextPlain &c_textPlain() const { + t_assert(data != nullptr && _type == mtpc_textPlain); + return *(const MTPDtextPlain*)data; + } + + MTPDtextBold &_textBold() { + t_assert(data != nullptr && _type == mtpc_textBold); + split(); + return *(MTPDtextBold*)data; + } + const MTPDtextBold &c_textBold() const { + t_assert(data != nullptr && _type == mtpc_textBold); + return *(const MTPDtextBold*)data; + } + + MTPDtextItalic &_textItalic() { + t_assert(data != nullptr && _type == mtpc_textItalic); + split(); + return *(MTPDtextItalic*)data; + } + const MTPDtextItalic &c_textItalic() const { + t_assert(data != nullptr && _type == mtpc_textItalic); + return *(const MTPDtextItalic*)data; + } + + MTPDtextUnderline &_textUnderline() { + t_assert(data != nullptr && _type == mtpc_textUnderline); + split(); + return *(MTPDtextUnderline*)data; + } + const MTPDtextUnderline &c_textUnderline() const { + t_assert(data != nullptr && _type == mtpc_textUnderline); + return *(const MTPDtextUnderline*)data; + } + + MTPDtextStrike &_textStrike() { + t_assert(data != nullptr && _type == mtpc_textStrike); + split(); + return *(MTPDtextStrike*)data; + } + const MTPDtextStrike &c_textStrike() const { + t_assert(data != nullptr && _type == mtpc_textStrike); + return *(const MTPDtextStrike*)data; + } + + MTPDtextFixed &_textFixed() { + t_assert(data != nullptr && _type == mtpc_textFixed); + split(); + return *(MTPDtextFixed*)data; + } + const MTPDtextFixed &c_textFixed() const { + t_assert(data != nullptr && _type == mtpc_textFixed); + return *(const MTPDtextFixed*)data; + } + + MTPDtextUrl &_textUrl() { + t_assert(data != nullptr && _type == mtpc_textUrl); + split(); + return *(MTPDtextUrl*)data; + } + const MTPDtextUrl &c_textUrl() const { + t_assert(data != nullptr && _type == mtpc_textUrl); + return *(const MTPDtextUrl*)data; + } + + MTPDtextEmail &_textEmail() { + t_assert(data != nullptr && _type == mtpc_textEmail); + split(); + return *(MTPDtextEmail*)data; + } + const MTPDtextEmail &c_textEmail() const { + t_assert(data != nullptr && _type == mtpc_textEmail); + return *(const MTPDtextEmail*)data; + } + + MTPDtextConcat &_textConcat() { + t_assert(data != nullptr && _type == mtpc_textConcat); + split(); + return *(MTPDtextConcat*)data; + } + const MTPDtextConcat &c_textConcat() const { + t_assert(data != nullptr && _type == mtpc_textConcat); + return *(const MTPDtextConcat*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPrichText(mtpTypeId type); + explicit MTPrichText(MTPDtextPlain *_data); + explicit MTPrichText(MTPDtextBold *_data); + explicit MTPrichText(MTPDtextItalic *_data); + explicit MTPrichText(MTPDtextUnderline *_data); + explicit MTPrichText(MTPDtextStrike *_data); + explicit MTPrichText(MTPDtextFixed *_data); + explicit MTPrichText(MTPDtextUrl *_data); + explicit MTPrichText(MTPDtextEmail *_data); + explicit MTPrichText(MTPDtextConcat *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPRichText; + +class MTPpageBlock : private mtpDataOwner { +public: + MTPpageBlock() : mtpDataOwner(0), _type(0) { + } + MTPpageBlock(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDpageBlockTitle &_pageBlockTitle() { + t_assert(data != nullptr && _type == mtpc_pageBlockTitle); + split(); + return *(MTPDpageBlockTitle*)data; + } + const MTPDpageBlockTitle &c_pageBlockTitle() const { + t_assert(data != nullptr && _type == mtpc_pageBlockTitle); + return *(const MTPDpageBlockTitle*)data; + } + + MTPDpageBlockSubtitle &_pageBlockSubtitle() { + t_assert(data != nullptr && _type == mtpc_pageBlockSubtitle); + split(); + return *(MTPDpageBlockSubtitle*)data; + } + const MTPDpageBlockSubtitle &c_pageBlockSubtitle() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSubtitle); + return *(const MTPDpageBlockSubtitle*)data; + } + + MTPDpageBlockAuthorDate &_pageBlockAuthorDate() { + t_assert(data != nullptr && _type == mtpc_pageBlockAuthorDate); + split(); + return *(MTPDpageBlockAuthorDate*)data; + } + const MTPDpageBlockAuthorDate &c_pageBlockAuthorDate() const { + t_assert(data != nullptr && _type == mtpc_pageBlockAuthorDate); + return *(const MTPDpageBlockAuthorDate*)data; + } + + MTPDpageBlockHeader &_pageBlockHeader() { + t_assert(data != nullptr && _type == mtpc_pageBlockHeader); + split(); + return *(MTPDpageBlockHeader*)data; + } + const MTPDpageBlockHeader &c_pageBlockHeader() const { + t_assert(data != nullptr && _type == mtpc_pageBlockHeader); + return *(const MTPDpageBlockHeader*)data; + } + + MTPDpageBlockSubheader &_pageBlockSubheader() { + t_assert(data != nullptr && _type == mtpc_pageBlockSubheader); + split(); + return *(MTPDpageBlockSubheader*)data; + } + const MTPDpageBlockSubheader &c_pageBlockSubheader() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSubheader); + return *(const MTPDpageBlockSubheader*)data; + } + + MTPDpageBlockParagraph &_pageBlockParagraph() { + t_assert(data != nullptr && _type == mtpc_pageBlockParagraph); + split(); + return *(MTPDpageBlockParagraph*)data; + } + const MTPDpageBlockParagraph &c_pageBlockParagraph() const { + t_assert(data != nullptr && _type == mtpc_pageBlockParagraph); + return *(const MTPDpageBlockParagraph*)data; + } + + MTPDpageBlockPreformatted &_pageBlockPreformatted() { + t_assert(data != nullptr && _type == mtpc_pageBlockPreformatted); + split(); + return *(MTPDpageBlockPreformatted*)data; + } + const MTPDpageBlockPreformatted &c_pageBlockPreformatted() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPreformatted); + return *(const MTPDpageBlockPreformatted*)data; + } + + MTPDpageBlockFooter &_pageBlockFooter() { + t_assert(data != nullptr && _type == mtpc_pageBlockFooter); + split(); + return *(MTPDpageBlockFooter*)data; + } + const MTPDpageBlockFooter &c_pageBlockFooter() const { + t_assert(data != nullptr && _type == mtpc_pageBlockFooter); + return *(const MTPDpageBlockFooter*)data; + } + + MTPDpageBlockList &_pageBlockList() { + t_assert(data != nullptr && _type == mtpc_pageBlockList); + split(); + return *(MTPDpageBlockList*)data; + } + const MTPDpageBlockList &c_pageBlockList() const { + t_assert(data != nullptr && _type == mtpc_pageBlockList); + return *(const MTPDpageBlockList*)data; + } + + MTPDpageBlockBlockquote &_pageBlockBlockquote() { + t_assert(data != nullptr && _type == mtpc_pageBlockBlockquote); + split(); + return *(MTPDpageBlockBlockquote*)data; + } + const MTPDpageBlockBlockquote &c_pageBlockBlockquote() const { + t_assert(data != nullptr && _type == mtpc_pageBlockBlockquote); + return *(const MTPDpageBlockBlockquote*)data; + } + + MTPDpageBlockPullquote &_pageBlockPullquote() { + t_assert(data != nullptr && _type == mtpc_pageBlockPullquote); + split(); + return *(MTPDpageBlockPullquote*)data; + } + const MTPDpageBlockPullquote &c_pageBlockPullquote() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPullquote); + return *(const MTPDpageBlockPullquote*)data; + } + + MTPDpageBlockPhoto &_pageBlockPhoto() { + t_assert(data != nullptr && _type == mtpc_pageBlockPhoto); + split(); + return *(MTPDpageBlockPhoto*)data; + } + const MTPDpageBlockPhoto &c_pageBlockPhoto() const { + t_assert(data != nullptr && _type == mtpc_pageBlockPhoto); + return *(const MTPDpageBlockPhoto*)data; + } + + MTPDpageBlockVideo &_pageBlockVideo() { + t_assert(data != nullptr && _type == mtpc_pageBlockVideo); + split(); + return *(MTPDpageBlockVideo*)data; + } + const MTPDpageBlockVideo &c_pageBlockVideo() const { + t_assert(data != nullptr && _type == mtpc_pageBlockVideo); + return *(const MTPDpageBlockVideo*)data; + } + + MTPDpageBlockCover &_pageBlockCover() { + t_assert(data != nullptr && _type == mtpc_pageBlockCover); + split(); + return *(MTPDpageBlockCover*)data; + } + const MTPDpageBlockCover &c_pageBlockCover() const { + t_assert(data != nullptr && _type == mtpc_pageBlockCover); + return *(const MTPDpageBlockCover*)data; + } + + MTPDpageBlockEmbed &_pageBlockEmbed() { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbed); + split(); + return *(MTPDpageBlockEmbed*)data; + } + const MTPDpageBlockEmbed &c_pageBlockEmbed() const { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbed); + return *(const MTPDpageBlockEmbed*)data; + } + + MTPDpageBlockEmbedPost &_pageBlockEmbedPost() { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbedPost); + split(); + return *(MTPDpageBlockEmbedPost*)data; + } + const MTPDpageBlockEmbedPost &c_pageBlockEmbedPost() const { + t_assert(data != nullptr && _type == mtpc_pageBlockEmbedPost); + return *(const MTPDpageBlockEmbedPost*)data; + } + + MTPDpageBlockSlideshow &_pageBlockSlideshow() { + t_assert(data != nullptr && _type == mtpc_pageBlockSlideshow); + split(); + return *(MTPDpageBlockSlideshow*)data; + } + const MTPDpageBlockSlideshow &c_pageBlockSlideshow() const { + t_assert(data != nullptr && _type == mtpc_pageBlockSlideshow); + return *(const MTPDpageBlockSlideshow*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPpageBlock(mtpTypeId type); + explicit MTPpageBlock(MTPDpageBlockTitle *_data); + explicit MTPpageBlock(MTPDpageBlockSubtitle *_data); + explicit MTPpageBlock(MTPDpageBlockAuthorDate *_data); + explicit MTPpageBlock(MTPDpageBlockHeader *_data); + explicit MTPpageBlock(MTPDpageBlockSubheader *_data); + explicit MTPpageBlock(MTPDpageBlockParagraph *_data); + explicit MTPpageBlock(MTPDpageBlockPreformatted *_data); + explicit MTPpageBlock(MTPDpageBlockFooter *_data); + explicit MTPpageBlock(MTPDpageBlockList *_data); + explicit MTPpageBlock(MTPDpageBlockBlockquote *_data); + explicit MTPpageBlock(MTPDpageBlockPullquote *_data); + explicit MTPpageBlock(MTPDpageBlockPhoto *_data); + explicit MTPpageBlock(MTPDpageBlockVideo *_data); + explicit MTPpageBlock(MTPDpageBlockCover *_data); + explicit MTPpageBlock(MTPDpageBlockEmbed *_data); + explicit MTPpageBlock(MTPDpageBlockEmbedPost *_data); + explicit MTPpageBlock(MTPDpageBlockSlideshow *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPPageBlock; + +class MTPembedPostMedia : private mtpDataOwner { +public: + MTPembedPostMedia() : mtpDataOwner(0), _type(0) { + } + MTPembedPostMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDembedPostPhoto &_embedPostPhoto() { + t_assert(data != nullptr && _type == mtpc_embedPostPhoto); + split(); + return *(MTPDembedPostPhoto*)data; + } + const MTPDembedPostPhoto &c_embedPostPhoto() const { + t_assert(data != nullptr && _type == mtpc_embedPostPhoto); + return *(const MTPDembedPostPhoto*)data; + } + + MTPDembedPostVideo &_embedPostVideo() { + t_assert(data != nullptr && _type == mtpc_embedPostVideo); + split(); + return *(MTPDembedPostVideo*)data; + } + const MTPDembedPostVideo &c_embedPostVideo() const { + t_assert(data != nullptr && _type == mtpc_embedPostVideo); + return *(const MTPDembedPostVideo*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPembedPostMedia(mtpTypeId type); + explicit MTPembedPostMedia(MTPDembedPostPhoto *_data); + explicit MTPembedPostMedia(MTPDembedPostVideo *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPEmbedPostMedia; + +class MTPpage : private mtpDataOwner { +public: + MTPpage() : mtpDataOwner(0), _type(0) { + } + MTPpage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDpagePart &_pagePart() { + t_assert(data != nullptr && _type == mtpc_pagePart); + split(); + return *(MTPDpagePart*)data; + } + const MTPDpagePart &c_pagePart() const { + t_assert(data != nullptr && _type == mtpc_pagePart); + return *(const MTPDpagePart*)data; + } + + MTPDpageFull &_pageFull() { + t_assert(data != nullptr && _type == mtpc_pageFull); + split(); + return *(MTPDpageFull*)data; + } + const MTPDpageFull &c_pageFull() const { + t_assert(data != nullptr && _type == mtpc_pageFull); + return *(const MTPDpageFull*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPpage(mtpTypeId type); + explicit MTPpage(MTPDpagePart *_data); + explicit MTPpage(MTPDpageFull *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPPage; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -11295,7 +11842,7 @@ public: MTPDuserFull() { } - MTPDuserFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) : vflags(_flags), vuser(_user), vabout(_about), vlink(_link), vprofile_photo(_profile_photo), vnotify_settings(_notify_settings), vbot_info(_bot_info) { + MTPDuserFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info, MTPint _common_chats_count) : vflags(_flags), vuser(_user), vabout(_about), vlink(_link), vprofile_photo(_profile_photo), vnotify_settings(_notify_settings), vbot_info(_bot_info), vcommon_chats_count(_common_chats_count) { } MTPflags vflags; @@ -11305,6 +11852,7 @@ public: MTPPhoto vprofile_photo; MTPPeerNotifySettings vnotify_settings; MTPBotInfo vbot_info; + MTPint vcommon_chats_count; }; class MTPDcontact : public mtpDataImpl { @@ -11492,6 +12040,18 @@ public: MTPVector vchats; }; +class MTPDmessages_chatsSlice : public mtpDataImpl { +public: + MTPDmessages_chatsSlice() { + } + MTPDmessages_chatsSlice(MTPint _count, const MTPVector &_chats, const MTPVector &_users) : vcount(_count), vchats(_chats), vusers(_users) { + } + + MTPint vcount; + MTPVector vchats; + MTPVector vusers; +}; + class MTPDmessages_chatFull : public mtpDataImpl { public: MTPDmessages_chatFull() { @@ -12143,6 +12703,19 @@ public: MTPDraftMessage vdraft; }; +class MTPDupdateChannelWebPage : public mtpDataImpl { +public: + MTPDupdateChannelWebPage() { + } + MTPDupdateChannelWebPage(MTPint _channel_id, const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) : vchannel_id(_channel_id), vwebpage(_webpage), vpts(_pts), vpts_count(_pts_count) { + } + + MTPint vchannel_id; + MTPWebPage vwebpage; + MTPint vpts; + MTPint vpts_count; +}; + class MTPDupdates_state : public mtpDataImpl { public: MTPDupdates_state() { @@ -12198,6 +12771,16 @@ public: MTPupdates_State vintermediate_state; }; +class MTPDupdates_differenceTooLong : public mtpDataImpl { +public: + MTPDupdates_differenceTooLong() { + } + MTPDupdates_differenceTooLong(MTPint _pts) : vpts(_pts) { + } + + MTPint vpts; +}; + class MTPDupdateShortMessage : public mtpDataImpl { public: enum class Flag : int32 { @@ -13056,8 +13639,9 @@ public: f_duration = (1 << 7), f_author = (1 << 8), f_document = (1 << 9), + f_cached_page = (1 << 10), - MAX_FIELD = (1 << 9), + MAX_FIELD = (1 << 10), }; Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } @@ -13074,16 +13658,18 @@ public: bool has_duration() const { return vflags.v & Flag::f_duration; } bool has_author() const { return vflags.v & Flag::f_author; } bool has_document() const { return vflags.v & Flag::f_document; } + bool has_cached_page() const { return vflags.v & Flag::f_cached_page; } MTPDwebPage() { } - MTPDwebPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) : vflags(_flags), vid(_id), vurl(_url), vdisplay_url(_display_url), vtype(_type), vsite_name(_site_name), vtitle(_title), vdescription(_description), vphoto(_photo), vembed_url(_embed_url), vembed_type(_embed_type), vembed_width(_embed_width), vembed_height(_embed_height), vduration(_duration), vauthor(_author), vdocument(_document) { + MTPDwebPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, MTPint _hash, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document, const MTPPage &_cached_page) : vflags(_flags), vid(_id), vurl(_url), vdisplay_url(_display_url), vhash(_hash), vtype(_type), vsite_name(_site_name), vtitle(_title), vdescription(_description), vphoto(_photo), vembed_url(_embed_url), vembed_type(_embed_type), vembed_width(_embed_width), vembed_height(_embed_height), vduration(_duration), vauthor(_author), vdocument(_document), vcached_page(_cached_page) { } MTPflags vflags; MTPlong vid; MTPstring vurl; MTPstring vdisplay_url; + MTPint vhash; MTPstring vtype; MTPstring vsite_name; MTPstring vtitle; @@ -13096,6 +13682,7 @@ public: MTPint vduration; MTPstring vauthor; MTPDocument vdocument; + MTPPage vcached_page; }; class MTPDauthorization : public mtpDataImpl { @@ -14435,7 +15022,7 @@ public: MTPDmessages_botResults() { } - MTPDmessages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vswitch_pm(_switch_pm), vresults(_results) { + MTPDmessages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results, MTPint _cache_time) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vswitch_pm(_switch_pm), vresults(_results), vcache_time(_cache_time) { } MTPflags vflags; @@ -14443,6 +15030,7 @@ public: MTPstring vnext_offset; MTPInlineBotSwitchPM vswitch_pm; MTPVector vresults; + MTPint vcache_time; }; class MTPDexportedMessageLink : public mtpDataImpl { @@ -14543,12 +15131,13 @@ public: MTPDmessages_botCallbackAnswer() { } - MTPDmessages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url) : vflags(_flags), vmessage(_message), vurl(_url) { + MTPDmessages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) : vflags(_flags), vmessage(_message), vurl(_url), vcache_time(_cache_time) { } MTPflags vflags; MTPstring vmessage; MTPstring vurl; + MTPint vcache_time; }; class MTPDmessages_messageEditData : public mtpDataImpl { @@ -14840,6 +15429,359 @@ public: MTPVector vusers; }; +class MTPDtextPlain : public mtpDataImpl { +public: + MTPDtextPlain() { + } + MTPDtextPlain(const MTPstring &_text) : vtext(_text) { + } + + MTPstring vtext; +}; + +class MTPDtextBold : public mtpDataImpl { +public: + MTPDtextBold() { + } + MTPDtextBold(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDtextItalic : public mtpDataImpl { +public: + MTPDtextItalic() { + } + MTPDtextItalic(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDtextUnderline : public mtpDataImpl { +public: + MTPDtextUnderline() { + } + MTPDtextUnderline(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDtextStrike : public mtpDataImpl { +public: + MTPDtextStrike() { + } + MTPDtextStrike(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDtextFixed : public mtpDataImpl { +public: + MTPDtextFixed() { + } + MTPDtextFixed(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDtextUrl : public mtpDataImpl { +public: + MTPDtextUrl() { + } + MTPDtextUrl(const MTPRichText &_text, const MTPstring &_url, const MTPlong &_webpage_id) : vtext(_text), vurl(_url), vwebpage_id(_webpage_id) { + } + + MTPRichText vtext; + MTPstring vurl; + MTPlong vwebpage_id; +}; + +class MTPDtextEmail : public mtpDataImpl { +public: + MTPDtextEmail() { + } + MTPDtextEmail(const MTPRichText &_text, const MTPstring &_email) : vtext(_text), vemail(_email) { + } + + MTPRichText vtext; + MTPstring vemail; +}; + +class MTPDtextConcat : public mtpDataImpl { +public: + MTPDtextConcat() { + } + MTPDtextConcat(const MTPVector &_texts) : vtexts(_texts) { + } + + MTPVector vtexts; +}; + +class MTPDpageBlockTitle : public mtpDataImpl { +public: + MTPDpageBlockTitle() { + } + MTPDpageBlockTitle(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockSubtitle : public mtpDataImpl { +public: + MTPDpageBlockSubtitle() { + } + MTPDpageBlockSubtitle(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockAuthorDate : public mtpDataImpl { +public: + MTPDpageBlockAuthorDate() { + } + MTPDpageBlockAuthorDate(const MTPstring &_author, MTPint _published_date) : vauthor(_author), vpublished_date(_published_date) { + } + + MTPstring vauthor; + MTPint vpublished_date; +}; + +class MTPDpageBlockHeader : public mtpDataImpl { +public: + MTPDpageBlockHeader() { + } + MTPDpageBlockHeader(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockSubheader : public mtpDataImpl { +public: + MTPDpageBlockSubheader() { + } + MTPDpageBlockSubheader(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockParagraph : public mtpDataImpl { +public: + MTPDpageBlockParagraph() { + } + MTPDpageBlockParagraph(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockPreformatted : public mtpDataImpl { +public: + MTPDpageBlockPreformatted() { + } + MTPDpageBlockPreformatted(const MTPRichText &_text, const MTPstring &_language) : vtext(_text), vlanguage(_language) { + } + + MTPRichText vtext; + MTPstring vlanguage; +}; + +class MTPDpageBlockFooter : public mtpDataImpl { +public: + MTPDpageBlockFooter() { + } + MTPDpageBlockFooter(const MTPRichText &_text) : vtext(_text) { + } + + MTPRichText vtext; +}; + +class MTPDpageBlockList : public mtpDataImpl { +public: + MTPDpageBlockList() { + } + MTPDpageBlockList(MTPBool _ordered, const MTPVector &_items) : vordered(_ordered), vitems(_items) { + } + + MTPBool vordered; + MTPVector vitems; +}; + +class MTPDpageBlockBlockquote : public mtpDataImpl { +public: + MTPDpageBlockBlockquote() { + } + MTPDpageBlockBlockquote(const MTPRichText &_text, const MTPRichText &_caption) : vtext(_text), vcaption(_caption) { + } + + MTPRichText vtext; + MTPRichText vcaption; +}; + +class MTPDpageBlockPullquote : public mtpDataImpl { +public: + MTPDpageBlockPullquote() { + } + MTPDpageBlockPullquote(const MTPRichText &_text, const MTPRichText &_caption) : vtext(_text), vcaption(_caption) { + } + + MTPRichText vtext; + MTPRichText vcaption; +}; + +class MTPDpageBlockPhoto : public mtpDataImpl { +public: + MTPDpageBlockPhoto() { + } + MTPDpageBlockPhoto(const MTPlong &_photo_id, const MTPRichText &_caption) : vphoto_id(_photo_id), vcaption(_caption) { + } + + MTPlong vphoto_id; + MTPRichText vcaption; +}; + +class MTPDpageBlockVideo : public mtpDataImpl { +public: + enum class Flag : int32 { + f_autoplay = (1 << 1), + f_loop = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_autoplay() const { return vflags.v & Flag::f_autoplay; } + bool is_loop() const { return vflags.v & Flag::f_loop; } + + MTPDpageBlockVideo() { + } + MTPDpageBlockVideo(const MTPflags &_flags, const MTPlong &_video_id, const MTPRichText &_caption) : vflags(_flags), vvideo_id(_video_id), vcaption(_caption) { + } + + MTPflags vflags; + MTPlong vvideo_id; + MTPRichText vcaption; +}; + +class MTPDpageBlockCover : public mtpDataImpl { +public: + MTPDpageBlockCover() { + } + MTPDpageBlockCover(const MTPPageBlock &_cover) : vcover(_cover) { + } + + MTPPageBlock vcover; +}; + +class MTPDpageBlockEmbed : public mtpDataImpl { +public: + MTPDpageBlockEmbed() { + } + MTPDpageBlockEmbed(const MTPstring &_url, MTPint _w, MTPint _h, const MTPRichText &_caption) : vurl(_url), vw(_w), vh(_h), vcaption(_caption) { + } + + MTPstring vurl; + MTPint vw; + MTPint vh; + MTPRichText vcaption; +}; + +class MTPDpageBlockEmbedPost : public mtpDataImpl { +public: + enum class Flag : int32 { + f_text = (1 << 1), + f_medias = (1 << 2), + f_author_photo_id = (1 << 3), + + MAX_FIELD = (1 << 3), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_text() const { return vflags.v & Flag::f_text; } + bool has_medias() const { return vflags.v & Flag::f_medias; } + bool has_author_photo_id() const { return vflags.v & Flag::f_author_photo_id; } + + MTPDpageBlockEmbedPost() { + } + MTPDpageBlockEmbedPost(const MTPflags &_flags, const MTPstring &_author, MTPint _date, const MTPRichText &_caption, const MTPstring &_url, const MTPlong &_webpage_id, const MTPRichText &_text, const MTPVector &_medias, const MTPlong &_author_photo_id) : vflags(_flags), vauthor(_author), vdate(_date), vcaption(_caption), vurl(_url), vwebpage_id(_webpage_id), vtext(_text), vmedias(_medias), vauthor_photo_id(_author_photo_id) { + } + + MTPflags vflags; + MTPstring vauthor; + MTPint vdate; + MTPRichText vcaption; + MTPstring vurl; + MTPlong vwebpage_id; + MTPRichText vtext; + MTPVector vmedias; + MTPlong vauthor_photo_id; +}; + +class MTPDpageBlockSlideshow : public mtpDataImpl { +public: + MTPDpageBlockSlideshow() { + } + MTPDpageBlockSlideshow(const MTPVector &_items, const MTPRichText &_caption) : vitems(_items), vcaption(_caption) { + } + + MTPVector vitems; + MTPRichText vcaption; +}; + +class MTPDembedPostPhoto : public mtpDataImpl { +public: + MTPDembedPostPhoto() { + } + MTPDembedPostPhoto(const MTPlong &_photo_id) : vphoto_id(_photo_id) { + } + + MTPlong vphoto_id; +}; + +class MTPDembedPostVideo : public mtpDataImpl { +public: + MTPDembedPostVideo() { + } + MTPDembedPostVideo(const MTPlong &_video_id) : vvideo_id(_video_id) { + } + + MTPlong vvideo_id; +}; + +class MTPDpagePart : public mtpDataImpl { +public: + MTPDpagePart() { + } + MTPDpagePart(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) : vblocks(_blocks), vphotos(_photos), vvideos(_videos) { + } + + MTPVector vblocks; + MTPVector vphotos; + MTPVector vvideos; +}; + +class MTPDpageFull : public mtpDataImpl { +public: + MTPDpageFull() { + } + MTPDpageFull(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) : vblocks(_blocks), vphotos(_photos), vvideos(_videos) { + } + + MTPVector vblocks; + MTPVector vphotos; + MTPVector vvideos; +}; + // RPC methods class MTPreq_pq { // RPC method 'req_pq' @@ -20730,17 +21672,18 @@ public: MTPlong vquery_id; MTPstring vmessage; MTPstring vurl; + MTPint vcache_time; MTPmessages_setBotCallbackAnswer() { } MTPmessages_setBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) { read(from, end, cons); } - MTPmessages_setBotCallbackAnswer(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url) : vflags(_flags), vquery_id(_query_id), vmessage(_message), vurl(_url) { + MTPmessages_setBotCallbackAnswer(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) : vflags(_flags), vquery_id(_query_id), vmessage(_message), vurl(_url), vcache_time(_cache_time) { } uint32 innerLength() const { - return vflags.innerLength() + vquery_id.innerLength() + (has_message() ? vmessage.innerLength() : 0) + (has_url() ? vurl.innerLength() : 0); + return vflags.innerLength() + vquery_id.innerLength() + (has_message() ? vmessage.innerLength() : 0) + (has_url() ? vurl.innerLength() : 0) + vcache_time.innerLength(); } mtpTypeId type() const { return mtpc_messages_setBotCallbackAnswer; @@ -20750,12 +21693,14 @@ public: vquery_id.read(from, end); if (has_message()) { vmessage.read(from, end); } else { vmessage = MTPstring(); } if (has_url()) { vurl.read(from, end); } else { vurl = MTPstring(); } + vcache_time.read(from, end); } void write(mtpBuffer &to) const { vflags.write(to); vquery_id.write(to); if (has_message()) vmessage.write(to); if (has_url()) vurl.write(to); + vcache_time.write(to); } typedef MTPBool ResponseType; @@ -20770,7 +21715,7 @@ public: } MTPmessages_SetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SetBotCallbackAnswer(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url) : MTPBoxed(MTPmessages_setBotCallbackAnswer(_flags, _query_id, _message, _url)) { + MTPmessages_SetBotCallbackAnswer(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) : MTPBoxed(MTPmessages_setBotCallbackAnswer(_flags, _query_id, _message, _url, _cache_time)) { } }; @@ -21490,6 +22435,132 @@ public: } }; +class MTPmessages_getCommonChats { // RPC method 'messages.getCommonChats' +public: + MTPInputUser vuser_id; + MTPint vmax_id; + MTPint vlimit; + + MTPmessages_getCommonChats() { + } + MTPmessages_getCommonChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getCommonChats) { + read(from, end, cons); + } + MTPmessages_getCommonChats(const MTPInputUser &_user_id, MTPint _max_id, MTPint _limit) : vuser_id(_user_id), vmax_id(_max_id), vlimit(_limit) { + } + + uint32 innerLength() const { + return vuser_id.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getCommonChats; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getCommonChats) { + vuser_id.read(from, end); + vmax_id.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vuser_id.write(to); + vmax_id.write(to); + vlimit.write(to); + } + + typedef MTPmessages_Chats ResponseType; +}; +class MTPmessages_GetCommonChats : public MTPBoxed { +public: + MTPmessages_GetCommonChats() { + } + MTPmessages_GetCommonChats(const MTPmessages_getCommonChats &v) : MTPBoxed(v) { + } + MTPmessages_GetCommonChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetCommonChats(const MTPInputUser &_user_id, MTPint _max_id, MTPint _limit) : MTPBoxed(MTPmessages_getCommonChats(_user_id, _max_id, _limit)) { + } +}; + +class MTPmessages_getAllChats { // RPC method 'messages.getAllChats' +public: + MTPVector vexcept_ids; + + MTPmessages_getAllChats() { + } + MTPmessages_getAllChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getAllChats) { + read(from, end, cons); + } + MTPmessages_getAllChats(const MTPVector &_except_ids) : vexcept_ids(_except_ids) { + } + + uint32 innerLength() const { + return vexcept_ids.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getAllChats; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getAllChats) { + vexcept_ids.read(from, end); + } + void write(mtpBuffer &to) const { + vexcept_ids.write(to); + } + + typedef MTPmessages_Chats ResponseType; +}; +class MTPmessages_GetAllChats : public MTPBoxed { +public: + MTPmessages_GetAllChats() { + } + MTPmessages_GetAllChats(const MTPmessages_getAllChats &v) : MTPBoxed(v) { + } + MTPmessages_GetAllChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetAllChats(const MTPVector &_except_ids) : MTPBoxed(MTPmessages_getAllChats(_except_ids)) { + } +}; + +class MTPmessages_getWebPage { // RPC method 'messages.getWebPage' +public: + MTPlong vid; + MTPint vhash; + + MTPmessages_getWebPage() { + } + MTPmessages_getWebPage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getWebPage) { + read(from, end, cons); + } + MTPmessages_getWebPage(const MTPlong &_id, MTPint _hash) : vid(_id), vhash(_hash) { + } + + uint32 innerLength() const { + return vid.innerLength() + vhash.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getWebPage; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getWebPage) { + vid.read(from, end); + vhash.read(from, end); + } + void write(mtpBuffer &to) const { + vid.write(to); + vhash.write(to); + } + + typedef MTPWebPage ResponseType; +}; +class MTPmessages_GetWebPage : public MTPBoxed { +public: + MTPmessages_GetWebPage() { + } + MTPmessages_GetWebPage(const MTPmessages_getWebPage &v) : MTPBoxed(v) { + } + MTPmessages_GetWebPage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetWebPage(const MTPlong &_id, MTPint _hash) : MTPBoxed(MTPmessages_getWebPage(_id, _hash)) { + } +}; + class MTPupdates_getState { // RPC method 'updates.getState' public: MTPupdates_getState() { @@ -21523,7 +22594,18 @@ public: class MTPupdates_getDifference { // RPC method 'updates.getDifference' public: + enum class Flag : int32 { + f_pts_total_limit = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_pts_total_limit() const { return vflags.v & Flag::f_pts_total_limit; } + + MTPflags vflags; MTPint vpts; + MTPint vpts_total_limit; MTPint vdate; MTPint vqts; @@ -21532,28 +22614,34 @@ public: MTPupdates_getDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { read(from, end, cons); } - MTPupdates_getDifference(MTPint _pts, MTPint _date, MTPint _qts) : vpts(_pts), vdate(_date), vqts(_qts) { + MTPupdates_getDifference(const MTPflags &_flags, MTPint _pts, MTPint _pts_total_limit, MTPint _date, MTPint _qts) : vflags(_flags), vpts(_pts), vpts_total_limit(_pts_total_limit), vdate(_date), vqts(_qts) { } uint32 innerLength() const { - return vpts.innerLength() + vdate.innerLength() + vqts.innerLength(); + return vflags.innerLength() + vpts.innerLength() + (has_pts_total_limit() ? vpts_total_limit.innerLength() : 0) + vdate.innerLength() + vqts.innerLength(); } mtpTypeId type() const { return mtpc_updates_getDifference; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { + vflags.read(from, end); vpts.read(from, end); + if (has_pts_total_limit()) { vpts_total_limit.read(from, end); } else { vpts_total_limit = MTPint(); } vdate.read(from, end); vqts.read(from, end); } void write(mtpBuffer &to) const { + vflags.write(to); vpts.write(to); + if (has_pts_total_limit()) vpts_total_limit.write(to); vdate.write(to); vqts.write(to); } typedef MTPupdates_Difference ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPupdates_getDifference::Flags) + class MTPupdates_GetDifference : public MTPBoxed { public: MTPupdates_GetDifference() { @@ -21562,12 +22650,22 @@ public: } MTPupdates_GetDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPupdates_GetDifference(MTPint _pts, MTPint _date, MTPint _qts) : MTPBoxed(MTPupdates_getDifference(_pts, _date, _qts)) { + MTPupdates_GetDifference(const MTPflags &_flags, MTPint _pts, MTPint _pts_total_limit, MTPint _date, MTPint _qts) : MTPBoxed(MTPupdates_getDifference(_flags, _pts, _pts_total_limit, _date, _qts)) { } }; class MTPupdates_getChannelDifference { // RPC method 'updates.getChannelDifference' public: + enum class Flag : int32 { + f_force = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_force() const { return vflags.v & Flag::f_force; } + + MTPflags vflags; MTPInputChannel vchannel; MTPChannelMessagesFilter vfilter; MTPint vpts; @@ -21578,22 +22676,24 @@ public: MTPupdates_getChannelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getChannelDifference) { read(from, end, cons); } - MTPupdates_getChannelDifference(const MTPInputChannel &_channel, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : vchannel(_channel), vfilter(_filter), vpts(_pts), vlimit(_limit) { + MTPupdates_getChannelDifference(const MTPflags &_flags, const MTPInputChannel &_channel, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : vflags(_flags), vchannel(_channel), vfilter(_filter), vpts(_pts), vlimit(_limit) { } uint32 innerLength() const { - return vchannel.innerLength() + vfilter.innerLength() + vpts.innerLength() + vlimit.innerLength(); + return vflags.innerLength() + vchannel.innerLength() + vfilter.innerLength() + vpts.innerLength() + vlimit.innerLength(); } mtpTypeId type() const { return mtpc_updates_getChannelDifference; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getChannelDifference) { + vflags.read(from, end); vchannel.read(from, end); vfilter.read(from, end); vpts.read(from, end); vlimit.read(from, end); } void write(mtpBuffer &to) const { + vflags.write(to); vchannel.write(to); vfilter.write(to); vpts.write(to); @@ -21602,6 +22702,8 @@ public: typedef MTPupdates_ChannelDifference ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPupdates_getChannelDifference::Flags) + class MTPupdates_GetChannelDifference : public MTPBoxed { public: MTPupdates_GetChannelDifference() { @@ -21610,7 +22712,7 @@ public: } MTPupdates_GetChannelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPupdates_GetChannelDifference(const MTPInputChannel &_channel, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : MTPBoxed(MTPupdates_getChannelDifference(_channel, _filter, _pts, _limit)) { + MTPupdates_GetChannelDifference(const MTPflags &_flags, const MTPInputChannel &_channel, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : MTPBoxed(MTPupdates_getChannelDifference(_flags, _channel, _filter, _pts, _limit)) { } }; @@ -22173,6 +23275,48 @@ public: } }; +class MTPhelp_setBotUpdatesStatus { // RPC method 'help.setBotUpdatesStatus' +public: + MTPint vpending_updates_count; + MTPstring vmessage; + + MTPhelp_setBotUpdatesStatus() { + } + MTPhelp_setBotUpdatesStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_setBotUpdatesStatus) { + read(from, end, cons); + } + MTPhelp_setBotUpdatesStatus(MTPint _pending_updates_count, const MTPstring &_message) : vpending_updates_count(_pending_updates_count), vmessage(_message) { + } + + uint32 innerLength() const { + return vpending_updates_count.innerLength() + vmessage.innerLength(); + } + mtpTypeId type() const { + return mtpc_help_setBotUpdatesStatus; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_setBotUpdatesStatus) { + vpending_updates_count.read(from, end); + vmessage.read(from, end); + } + void write(mtpBuffer &to) const { + vpending_updates_count.write(to); + vmessage.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPhelp_SetBotUpdatesStatus : public MTPBoxed { +public: + MTPhelp_SetBotUpdatesStatus() { + } + MTPhelp_SetBotUpdatesStatus(const MTPhelp_setBotUpdatesStatus &v) : MTPBoxed(v) { + } + MTPhelp_SetBotUpdatesStatus(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPhelp_SetBotUpdatesStatus(MTPint _pending_updates_count, const MTPstring &_message) : MTPBoxed(MTPhelp_setBotUpdatesStatus(_pending_updates_count, _message)) { + } +}; + class MTPchannels_readHistory { // RPC method 'channels.readHistory' public: MTPInputChannel vchannel; @@ -23822,8 +24966,8 @@ public: inline static MTPreportReason new_inputReportReasonOther(const MTPstring &_text) { return MTPreportReason(new MTPDinputReportReasonOther(_text)); } - inline static MTPuserFull new_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) { - return MTPuserFull(new MTPDuserFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info)); + inline static MTPuserFull new_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info, MTPint _common_chats_count) { + return MTPuserFull(new MTPDuserFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info, _common_chats_count)); } inline static MTPcontact new_contact(MTPint _user_id, MTPBool _mutual) { return MTPcontact(new MTPDcontact(_user_id, _mutual)); @@ -23873,6 +25017,9 @@ public: inline static MTPmessages_chats new_messages_chats(const MTPVector &_chats) { return MTPmessages_chats(new MTPDmessages_chats(_chats)); } + inline static MTPmessages_chats new_messages_chatsSlice(MTPint _count, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_chats(new MTPDmessages_chatsSlice(_count, _chats, _users)); + } inline static MTPmessages_chatFull new_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users) { return MTPmessages_chatFull(new MTPDmessages_chatFull(_full_chat, _chats, _users)); } @@ -24071,6 +25218,9 @@ public: inline static MTPupdate new_updatePtsChanged() { return MTPupdate(mtpc_updatePtsChanged); } + inline static MTPupdate new_updateChannelWebPage(MTPint _channel_id, const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateChannelWebPage(_channel_id, _webpage, _pts, _pts_count)); + } inline static MTPupdates_state new_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count)); } @@ -24083,6 +25233,9 @@ public: inline static MTPupdates_difference new_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state) { return MTPupdates_difference(new MTPDupdates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state)); } + inline static MTPupdates_difference new_updates_differenceTooLong(MTPint _pts) { + return MTPupdates_difference(new MTPDupdates_differenceTooLong(_pts)); + } inline static MTPupdates new_updatesTooLong() { return MTPupdates(mtpc_updatesTooLong); } @@ -24248,9 +25401,6 @@ public: inline static MTPsendMessageAction new_sendMessageGamePlayAction() { return MTPsendMessageAction(mtpc_sendMessageGamePlayAction); } - inline static MTPsendMessageAction new_sendMessageGameStopAction() { - return MTPsendMessageAction(mtpc_sendMessageGameStopAction); - } inline static MTPcontacts_found new_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); } @@ -24368,8 +25518,11 @@ public: inline static MTPwebPage new_webPagePending(const MTPlong &_id, MTPint _date) { return MTPwebPage(new MTPDwebPagePending(_id, _date)); } - inline static MTPwebPage new_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) { - return MTPwebPage(new MTPDwebPage(_flags, _id, _url, _display_url, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document)); + inline static MTPwebPage new_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, MTPint _hash, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document, const MTPPage &_cached_page) { + return MTPwebPage(new MTPDwebPage(_flags, _id, _url, _display_url, _hash, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document, _cached_page)); + } + inline static MTPwebPage new_webPageNotModified() { + return MTPwebPage(mtpc_webPageNotModified); } inline static MTPauthorization new_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region) { return MTPauthorization(new MTPDauthorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region)); @@ -24650,8 +25803,8 @@ public: inline static MTPbotInlineResult new_botInlineMediaResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPDocument &_document, const MTPstring &_title, const MTPstring &_description, const MTPBotInlineMessage &_send_message) { return MTPbotInlineResult(new MTPDbotInlineMediaResult(_flags, _id, _type, _photo, _document, _title, _description, _send_message)); } - inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) { - return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results)); + inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results, MTPint _cache_time) { + return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results, _cache_time)); } inline static MTPexportedMessageLink new_exportedMessageLink(const MTPstring &_link) { return MTPexportedMessageLink(new MTPDexportedMessageLink(_link)); @@ -24680,8 +25833,8 @@ public: inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) { return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern)); } - inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url) { - return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message, _url)); + inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) { + return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message, _url, _cache_time)); } inline static MTPmessages_messageEditData new_messages_messageEditData(const MTPflags &_flags) { return MTPmessages_messageEditData(new MTPDmessages_messageEditData(_flags)); @@ -24779,6 +25932,102 @@ public: inline static MTPmessages_highScores new_messages_highScores(const MTPVector &_scores, const MTPVector &_users) { return MTPmessages_highScores(new MTPDmessages_highScores(_scores, _users)); } + inline static MTPrichText new_textEmpty() { + return MTPrichText(mtpc_textEmpty); + } + inline static MTPrichText new_textPlain(const MTPstring &_text) { + return MTPrichText(new MTPDtextPlain(_text)); + } + inline static MTPrichText new_textBold(const MTPRichText &_text) { + return MTPrichText(new MTPDtextBold(_text)); + } + inline static MTPrichText new_textItalic(const MTPRichText &_text) { + return MTPrichText(new MTPDtextItalic(_text)); + } + inline static MTPrichText new_textUnderline(const MTPRichText &_text) { + return MTPrichText(new MTPDtextUnderline(_text)); + } + inline static MTPrichText new_textStrike(const MTPRichText &_text) { + return MTPrichText(new MTPDtextStrike(_text)); + } + inline static MTPrichText new_textFixed(const MTPRichText &_text) { + return MTPrichText(new MTPDtextFixed(_text)); + } + inline static MTPrichText new_textUrl(const MTPRichText &_text, const MTPstring &_url, const MTPlong &_webpage_id) { + return MTPrichText(new MTPDtextUrl(_text, _url, _webpage_id)); + } + inline static MTPrichText new_textEmail(const MTPRichText &_text, const MTPstring &_email) { + return MTPrichText(new MTPDtextEmail(_text, _email)); + } + inline static MTPrichText new_textConcat(const MTPVector &_texts) { + return MTPrichText(new MTPDtextConcat(_texts)); + } + inline static MTPpageBlock new_pageBlockTitle(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockTitle(_text)); + } + inline static MTPpageBlock new_pageBlockSubtitle(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockSubtitle(_text)); + } + inline static MTPpageBlock new_pageBlockAuthorDate(const MTPstring &_author, MTPint _published_date) { + return MTPpageBlock(new MTPDpageBlockAuthorDate(_author, _published_date)); + } + inline static MTPpageBlock new_pageBlockHeader(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockHeader(_text)); + } + inline static MTPpageBlock new_pageBlockSubheader(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockSubheader(_text)); + } + inline static MTPpageBlock new_pageBlockParagraph(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockParagraph(_text)); + } + inline static MTPpageBlock new_pageBlockPreformatted(const MTPRichText &_text, const MTPstring &_language) { + return MTPpageBlock(new MTPDpageBlockPreformatted(_text, _language)); + } + inline static MTPpageBlock new_pageBlockFooter(const MTPRichText &_text) { + return MTPpageBlock(new MTPDpageBlockFooter(_text)); + } + inline static MTPpageBlock new_pageBlockDivider() { + return MTPpageBlock(mtpc_pageBlockDivider); + } + inline static MTPpageBlock new_pageBlockList(MTPBool _ordered, const MTPVector &_items) { + return MTPpageBlock(new MTPDpageBlockList(_ordered, _items)); + } + inline static MTPpageBlock new_pageBlockBlockquote(const MTPRichText &_text, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockBlockquote(_text, _caption)); + } + inline static MTPpageBlock new_pageBlockPullquote(const MTPRichText &_text, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockPullquote(_text, _caption)); + } + inline static MTPpageBlock new_pageBlockPhoto(const MTPlong &_photo_id, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockPhoto(_photo_id, _caption)); + } + inline static MTPpageBlock new_pageBlockVideo(const MTPflags &_flags, const MTPlong &_video_id, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockVideo(_flags, _video_id, _caption)); + } + inline static MTPpageBlock new_pageBlockCover(const MTPPageBlock &_cover) { + return MTPpageBlock(new MTPDpageBlockCover(_cover)); + } + inline static MTPpageBlock new_pageBlockEmbed(const MTPstring &_url, MTPint _w, MTPint _h, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockEmbed(_url, _w, _h, _caption)); + } + inline static MTPpageBlock new_pageBlockEmbedPost(const MTPflags &_flags, const MTPstring &_author, MTPint _date, const MTPRichText &_caption, const MTPstring &_url, const MTPlong &_webpage_id, const MTPRichText &_text, const MTPVector &_medias, const MTPlong &_author_photo_id) { + return MTPpageBlock(new MTPDpageBlockEmbedPost(_flags, _author, _date, _caption, _url, _webpage_id, _text, _medias, _author_photo_id)); + } + inline static MTPpageBlock new_pageBlockSlideshow(const MTPVector &_items, const MTPRichText &_caption) { + return MTPpageBlock(new MTPDpageBlockSlideshow(_items, _caption)); + } + inline static MTPembedPostMedia new_embedPostPhoto(const MTPlong &_photo_id) { + return MTPembedPostMedia(new MTPDembedPostPhoto(_photo_id)); + } + inline static MTPembedPostMedia new_embedPostVideo(const MTPlong &_video_id) { + return MTPembedPostMedia(new MTPDembedPostVideo(_video_id)); + } + inline static MTPpage new_pagePart(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { + return MTPpage(new MTPDpagePart(_blocks, _photos, _videos)); + } + inline static MTPpage new_pageFull(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { + return MTPpage(new MTPDpageFull(_blocks, _photos, _videos)); + } }; } // namespace internal @@ -28865,7 +30114,7 @@ inline MTPuserFull::MTPuserFull() : mtpDataOwner(new MTPDuserFull()) { inline uint32 MTPuserFull::innerLength() const { const MTPDuserFull &v(c_userFull()); - return v.vflags.innerLength() + v.vuser.innerLength() + (v.has_about() ? v.vabout.innerLength() : 0) + v.vlink.innerLength() + (v.has_profile_photo() ? v.vprofile_photo.innerLength() : 0) + v.vnotify_settings.innerLength() + (v.has_bot_info() ? v.vbot_info.innerLength() : 0); + return v.vflags.innerLength() + v.vuser.innerLength() + (v.has_about() ? v.vabout.innerLength() : 0) + v.vlink.innerLength() + (v.has_profile_photo() ? v.vprofile_photo.innerLength() : 0) + v.vnotify_settings.innerLength() + (v.has_bot_info() ? v.vbot_info.innerLength() : 0) + v.vcommon_chats_count.innerLength(); } inline mtpTypeId MTPuserFull::type() const { return mtpc_userFull; @@ -28882,6 +30131,7 @@ inline void MTPuserFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp if (v.has_profile_photo()) { v.vprofile_photo.read(from, end); } else { v.vprofile_photo = MTPPhoto(); } v.vnotify_settings.read(from, end); if (v.has_bot_info()) { v.vbot_info.read(from, end); } else { v.vbot_info = MTPBotInfo(); } + v.vcommon_chats_count.read(from, end); } inline void MTPuserFull::write(mtpBuffer &to) const { const MTPDuserFull &v(c_userFull()); @@ -28892,12 +30142,13 @@ inline void MTPuserFull::write(mtpBuffer &to) const { if (v.has_profile_photo()) v.vprofile_photo.write(to); v.vnotify_settings.write(to); if (v.has_bot_info()) v.vbot_info.write(to); + v.vcommon_chats_count.write(to); } inline MTPuserFull::MTPuserFull(MTPDuserFull *_data) : mtpDataOwner(_data) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDuserFull::Flags) -inline MTPuserFull MTP_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) { - return MTP::internal::TypeCreator::new_userFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info); +inline MTPuserFull MTP_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info, MTPint _common_chats_count) { + return MTP::internal::TypeCreator::new_userFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info, _common_chats_count); } inline MTPcontact::MTPcontact() : mtpDataOwner(new MTPDcontact()) { @@ -29377,32 +30628,72 @@ inline MTPmessages_messages MTP_messages_channelMessages(const MTPflags &_chats) { return MTP::internal::TypeCreator::new_messages_chats(_chats); } +inline MTPmessages_chats MTP_messages_chatsSlice(MTPint _count, const MTPVector &_chats, const MTPVector &_users) { + return MTP::internal::TypeCreator::new_messages_chatsSlice(_count, _chats, _users); +} inline MTPmessages_chatFull::MTPmessages_chatFull() : mtpDataOwner(new MTPDmessages_chatFull()) { } @@ -29731,6 +31022,10 @@ inline uint32 MTPupdate::innerLength() const { const MTPDupdateDraftMessage &v(c_updateDraftMessage()); return v.vpeer.innerLength() + v.vdraft.innerLength(); } + case mtpc_updateChannelWebPage: { + const MTPDupdateChannelWebPage &v(c_updateChannelWebPage()); + return v.vchannel_id.innerLength() + v.vwebpage.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); + } } return 0; } @@ -30076,6 +31371,14 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI case mtpc_updateRecentStickers: _type = cons; break; case mtpc_updateConfig: _type = cons; break; case mtpc_updatePtsChanged: _type = cons; break; + case mtpc_updateChannelWebPage: _type = cons; { + if (!data) setData(new MTPDupdateChannelWebPage()); + MTPDupdateChannelWebPage &v(_updateChannelWebPage()); + v.vchannel_id.read(from, end); + v.vwebpage.read(from, end); + v.vpts.read(from, end); + v.vpts_count.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); } } @@ -30363,6 +31666,13 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.vpeer.write(to); v.vdraft.write(to); } break; + case mtpc_updateChannelWebPage: { + const MTPDupdateChannelWebPage &v(c_updateChannelWebPage()); + v.vchannel_id.write(to); + v.vwebpage.write(to); + v.vpts.write(to); + v.vpts_count.write(to); + } break; } } inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -30420,6 +31730,7 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_updateRecentStickers: break; case mtpc_updateConfig: break; case mtpc_updatePtsChanged: break; + case mtpc_updateChannelWebPage: setData(new MTPDupdateChannelWebPage()); break; default: throw mtpErrorBadTypeId(type, "MTPupdate"); } } @@ -30517,6 +31828,8 @@ inline MTPupdate::MTPupdate(MTPDupdateReadChannelOutbox *_data) : mtpDataOwner(_ } inline MTPupdate::MTPupdate(MTPDupdateDraftMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateDraftMessage) { } +inline MTPupdate::MTPupdate(MTPDupdateChannelWebPage *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelWebPage) { +} inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_updateNewMessage(_message, _pts, _pts_count); } @@ -30682,6 +31995,9 @@ inline MTPupdate MTP_updateConfig() { inline MTPupdate MTP_updatePtsChanged() { return MTP::internal::TypeCreator::new_updatePtsChanged(); } +inline MTPupdate MTP_updateChannelWebPage(MTPint _channel_id, const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { + return MTP::internal::TypeCreator::new_updateChannelWebPage(_channel_id, _webpage, _pts, _pts_count); +} inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { } @@ -30732,6 +32048,10 @@ inline uint32 MTPupdates_difference::innerLength() const { const MTPDupdates_differenceSlice &v(c_updates_differenceSlice()); return v.vnew_messages.innerLength() + v.vnew_encrypted_messages.innerLength() + v.vother_updates.innerLength() + v.vchats.innerLength() + v.vusers.innerLength() + v.vintermediate_state.innerLength(); } + case mtpc_updates_differenceTooLong: { + const MTPDupdates_differenceTooLong &v(c_updates_differenceTooLong()); + return v.vpts.innerLength(); + } } return 0; } @@ -30768,6 +32088,11 @@ inline void MTPupdates_difference::read(const mtpPrime *&from, const mtpPrime *e v.vusers.read(from, end); v.vintermediate_state.read(from, end); } break; + case mtpc_updates_differenceTooLong: _type = cons; { + if (!data) setData(new MTPDupdates_differenceTooLong()); + MTPDupdates_differenceTooLong &v(_updates_differenceTooLong()); + v.vpts.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPupdates_difference"); } } @@ -30796,6 +32121,10 @@ inline void MTPupdates_difference::write(mtpBuffer &to) const { v.vusers.write(to); v.vintermediate_state.write(to); } break; + case mtpc_updates_differenceTooLong: { + const MTPDupdates_differenceTooLong &v(c_updates_differenceTooLong()); + v.vpts.write(to); + } break; } } inline MTPupdates_difference::MTPupdates_difference(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -30803,6 +32132,7 @@ inline MTPupdates_difference::MTPupdates_difference(mtpTypeId type) : mtpDataOwn case mtpc_updates_differenceEmpty: setData(new MTPDupdates_differenceEmpty()); break; case mtpc_updates_difference: setData(new MTPDupdates_difference()); break; case mtpc_updates_differenceSlice: setData(new MTPDupdates_differenceSlice()); break; + case mtpc_updates_differenceTooLong: setData(new MTPDupdates_differenceTooLong()); break; default: throw mtpErrorBadTypeId(type, "MTPupdates_difference"); } } @@ -30812,6 +32142,8 @@ inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_difference *_dat } inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceSlice *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceSlice) { } +inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceTooLong) { +} inline MTPupdates_difference MTP_updates_differenceEmpty(MTPint _date, MTPint _seq) { return MTP::internal::TypeCreator::new_updates_differenceEmpty(_date, _seq); } @@ -30821,6 +32153,9 @@ inline MTPupdates_difference MTP_updates_difference(const MTPVector inline MTPupdates_difference MTP_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state) { return MTP::internal::TypeCreator::new_updates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state); } +inline MTPupdates_difference MTP_updates_differenceTooLong(MTPint _pts) { + return MTP::internal::TypeCreator::new_updates_differenceTooLong(_pts); +} inline uint32 MTPupdates::innerLength() const { switch (_type) { @@ -32212,7 +33547,6 @@ inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *en case mtpc_sendMessageGeoLocationAction: _type = cons; break; case mtpc_sendMessageChooseContactAction: _type = cons; break; case mtpc_sendMessageGamePlayAction: _type = cons; break; - case mtpc_sendMessageGameStopAction: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPsendMessageAction"); } } @@ -32249,7 +33583,6 @@ inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner case mtpc_sendMessageGeoLocationAction: break; case mtpc_sendMessageChooseContactAction: break; case mtpc_sendMessageGamePlayAction: break; - case mtpc_sendMessageGameStopAction: break; default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction"); } } @@ -32294,9 +33627,6 @@ inline MTPsendMessageAction MTP_sendMessageChooseContactAction() { inline MTPsendMessageAction MTP_sendMessageGamePlayAction() { return MTP::internal::TypeCreator::new_sendMessageGamePlayAction(); } -inline MTPsendMessageAction MTP_sendMessageGameStopAction() { - return MTP::internal::TypeCreator::new_sendMessageGameStopAction(); -} inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(new MTPDcontacts_found()) { } @@ -33004,7 +34334,7 @@ inline uint32 MTPwebPage::innerLength() const { } case mtpc_webPage: { const MTPDwebPage &v(c_webPage()); - return v.vflags.innerLength() + v.vid.innerLength() + v.vurl.innerLength() + v.vdisplay_url.innerLength() + (v.has_type() ? v.vtype.innerLength() : 0) + (v.has_site_name() ? v.vsite_name.innerLength() : 0) + (v.has_title() ? v.vtitle.innerLength() : 0) + (v.has_description() ? v.vdescription.innerLength() : 0) + (v.has_photo() ? v.vphoto.innerLength() : 0) + (v.has_embed_url() ? v.vembed_url.innerLength() : 0) + (v.has_embed_type() ? v.vembed_type.innerLength() : 0) + (v.has_embed_width() ? v.vembed_width.innerLength() : 0) + (v.has_embed_height() ? v.vembed_height.innerLength() : 0) + (v.has_duration() ? v.vduration.innerLength() : 0) + (v.has_author() ? v.vauthor.innerLength() : 0) + (v.has_document() ? v.vdocument.innerLength() : 0); + return v.vflags.innerLength() + v.vid.innerLength() + v.vurl.innerLength() + v.vdisplay_url.innerLength() + v.vhash.innerLength() + (v.has_type() ? v.vtype.innerLength() : 0) + (v.has_site_name() ? v.vsite_name.innerLength() : 0) + (v.has_title() ? v.vtitle.innerLength() : 0) + (v.has_description() ? v.vdescription.innerLength() : 0) + (v.has_photo() ? v.vphoto.innerLength() : 0) + (v.has_embed_url() ? v.vembed_url.innerLength() : 0) + (v.has_embed_type() ? v.vembed_type.innerLength() : 0) + (v.has_embed_width() ? v.vembed_width.innerLength() : 0) + (v.has_embed_height() ? v.vembed_height.innerLength() : 0) + (v.has_duration() ? v.vduration.innerLength() : 0) + (v.has_author() ? v.vauthor.innerLength() : 0) + (v.has_document() ? v.vdocument.innerLength() : 0) + (v.has_cached_page() ? v.vcached_page.innerLength() : 0); } } return 0; @@ -33034,6 +34364,7 @@ inline void MTPwebPage::read(const mtpPrime *&from, const mtpPrime *end, mtpType v.vid.read(from, end); v.vurl.read(from, end); v.vdisplay_url.read(from, end); + v.vhash.read(from, end); if (v.has_type()) { v.vtype.read(from, end); } else { v.vtype = MTPstring(); } if (v.has_site_name()) { v.vsite_name.read(from, end); } else { v.vsite_name = MTPstring(); } if (v.has_title()) { v.vtitle.read(from, end); } else { v.vtitle = MTPstring(); } @@ -33046,7 +34377,9 @@ inline void MTPwebPage::read(const mtpPrime *&from, const mtpPrime *end, mtpType if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); } if (v.has_author()) { v.vauthor.read(from, end); } else { v.vauthor = MTPstring(); } if (v.has_document()) { v.vdocument.read(from, end); } else { v.vdocument = MTPDocument(); } + if (v.has_cached_page()) { v.vcached_page.read(from, end); } else { v.vcached_page = MTPPage(); } } break; + case mtpc_webPageNotModified: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPwebPage"); } } @@ -33067,6 +34400,7 @@ inline void MTPwebPage::write(mtpBuffer &to) const { v.vid.write(to); v.vurl.write(to); v.vdisplay_url.write(to); + v.vhash.write(to); if (v.has_type()) v.vtype.write(to); if (v.has_site_name()) v.vsite_name.write(to); if (v.has_title()) v.vtitle.write(to); @@ -33079,6 +34413,7 @@ inline void MTPwebPage::write(mtpBuffer &to) const { if (v.has_duration()) v.vduration.write(to); if (v.has_author()) v.vauthor.write(to); if (v.has_document()) v.vdocument.write(to); + if (v.has_cached_page()) v.vcached_page.write(to); } break; } } @@ -33087,6 +34422,7 @@ inline MTPwebPage::MTPwebPage(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_webPageEmpty: setData(new MTPDwebPageEmpty()); break; case mtpc_webPagePending: setData(new MTPDwebPagePending()); break; case mtpc_webPage: setData(new MTPDwebPage()); break; + case mtpc_webPageNotModified: break; default: throw mtpErrorBadTypeId(type, "MTPwebPage"); } } @@ -33103,8 +34439,11 @@ inline MTPwebPage MTP_webPagePending(const MTPlong &_id, MTPint _date) { return MTP::internal::TypeCreator::new_webPagePending(_id, _date); } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDwebPage::Flags) -inline MTPwebPage MTP_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) { - return MTP::internal::TypeCreator::new_webPage(_flags, _id, _url, _display_url, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document); +inline MTPwebPage MTP_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, MTPint _hash, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document, const MTPPage &_cached_page) { + return MTP::internal::TypeCreator::new_webPage(_flags, _id, _url, _display_url, _hash, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document, _cached_page); +} +inline MTPwebPage MTP_webPageNotModified() { + return MTP::internal::TypeCreator::new_webPageNotModified(); } inline MTPauthorization::MTPauthorization() : mtpDataOwner(new MTPDauthorization()) { @@ -35709,7 +37048,7 @@ inline MTPmessages_botResults::MTPmessages_botResults() : mtpDataOwner(new MTPDm inline uint32 MTPmessages_botResults::innerLength() const { const MTPDmessages_botResults &v(c_messages_botResults()); - return v.vflags.innerLength() + v.vquery_id.innerLength() + (v.has_next_offset() ? v.vnext_offset.innerLength() : 0) + (v.has_switch_pm() ? v.vswitch_pm.innerLength() : 0) + v.vresults.innerLength(); + return v.vflags.innerLength() + v.vquery_id.innerLength() + (v.has_next_offset() ? v.vnext_offset.innerLength() : 0) + (v.has_switch_pm() ? v.vswitch_pm.innerLength() : 0) + v.vresults.innerLength() + v.vcache_time.innerLength(); } inline mtpTypeId MTPmessages_botResults::type() const { return mtpc_messages_botResults; @@ -35724,6 +37063,7 @@ inline void MTPmessages_botResults::read(const mtpPrime *&from, const mtpPrime * if (v.has_next_offset()) { v.vnext_offset.read(from, end); } else { v.vnext_offset = MTPstring(); } if (v.has_switch_pm()) { v.vswitch_pm.read(from, end); } else { v.vswitch_pm = MTPInlineBotSwitchPM(); } v.vresults.read(from, end); + v.vcache_time.read(from, end); } inline void MTPmessages_botResults::write(mtpBuffer &to) const { const MTPDmessages_botResults &v(c_messages_botResults()); @@ -35732,12 +37072,13 @@ inline void MTPmessages_botResults::write(mtpBuffer &to) const { if (v.has_next_offset()) v.vnext_offset.write(to); if (v.has_switch_pm()) v.vswitch_pm.write(to); v.vresults.write(to); + v.vcache_time.write(to); } inline MTPmessages_botResults::MTPmessages_botResults(MTPDmessages_botResults *_data) : mtpDataOwner(_data) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botResults::Flags) -inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) { - return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results); +inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results, MTPint _cache_time) { + return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results, _cache_time); } inline MTPexportedMessageLink::MTPexportedMessageLink() : mtpDataOwner(new MTPDexportedMessageLink()) { @@ -35944,7 +37285,7 @@ inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer() : mtpDataO inline uint32 MTPmessages_botCallbackAnswer::innerLength() const { const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer()); - return v.vflags.innerLength() + (v.has_message() ? v.vmessage.innerLength() : 0) + (v.has_url() ? v.vurl.innerLength() : 0); + return v.vflags.innerLength() + (v.has_message() ? v.vmessage.innerLength() : 0) + (v.has_url() ? v.vurl.innerLength() : 0) + v.vcache_time.innerLength(); } inline mtpTypeId MTPmessages_botCallbackAnswer::type() const { return mtpc_messages_botCallbackAnswer; @@ -35957,18 +37298,20 @@ inline void MTPmessages_botCallbackAnswer::read(const mtpPrime *&from, const mtp v.vflags.read(from, end); if (v.has_message()) { v.vmessage.read(from, end); } else { v.vmessage = MTPstring(); } if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); } + v.vcache_time.read(from, end); } inline void MTPmessages_botCallbackAnswer::write(mtpBuffer &to) const { const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer()); v.vflags.write(to); if (v.has_message()) v.vmessage.write(to); if (v.has_url()) v.vurl.write(to); + v.vcache_time.write(to); } inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data) : mtpDataOwner(_data) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botCallbackAnswer::Flags) -inline MTPmessages_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url) { - return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_flags, _message, _url); +inline MTPmessages_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPflags &_flags, const MTPstring &_message, const MTPstring &_url, MTPint _cache_time) { + return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_flags, _message, _url, _cache_time); } inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(new MTPDmessages_messageEditData()) { @@ -36823,6 +38166,742 @@ inline MTPmessages_highScores::MTPmessages_highScores(MTPDmessages_highScores *_ inline MTPmessages_highScores MTP_messages_highScores(const MTPVector &_scores, const MTPVector &_users) { return MTP::internal::TypeCreator::new_messages_highScores(_scores, _users); } + +inline uint32 MTPrichText::innerLength() const { + switch (_type) { + case mtpc_textPlain: { + const MTPDtextPlain &v(c_textPlain()); + return v.vtext.innerLength(); + } + case mtpc_textBold: { + const MTPDtextBold &v(c_textBold()); + return v.vtext.innerLength(); + } + case mtpc_textItalic: { + const MTPDtextItalic &v(c_textItalic()); + return v.vtext.innerLength(); + } + case mtpc_textUnderline: { + const MTPDtextUnderline &v(c_textUnderline()); + return v.vtext.innerLength(); + } + case mtpc_textStrike: { + const MTPDtextStrike &v(c_textStrike()); + return v.vtext.innerLength(); + } + case mtpc_textFixed: { + const MTPDtextFixed &v(c_textFixed()); + return v.vtext.innerLength(); + } + case mtpc_textUrl: { + const MTPDtextUrl &v(c_textUrl()); + return v.vtext.innerLength() + v.vurl.innerLength() + v.vwebpage_id.innerLength(); + } + case mtpc_textEmail: { + const MTPDtextEmail &v(c_textEmail()); + return v.vtext.innerLength() + v.vemail.innerLength(); + } + case mtpc_textConcat: { + const MTPDtextConcat &v(c_textConcat()); + return v.vtexts.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPrichText::type() const { + t_assert(_type != 0); + return _type; +} +inline void MTPrichText::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_textEmpty: _type = cons; break; + case mtpc_textPlain: _type = cons; { + if (!data) setData(new MTPDtextPlain()); + MTPDtextPlain &v(_textPlain()); + v.vtext.read(from, end); + } break; + case mtpc_textBold: _type = cons; { + if (!data) setData(new MTPDtextBold()); + MTPDtextBold &v(_textBold()); + v.vtext.read(from, end); + } break; + case mtpc_textItalic: _type = cons; { + if (!data) setData(new MTPDtextItalic()); + MTPDtextItalic &v(_textItalic()); + v.vtext.read(from, end); + } break; + case mtpc_textUnderline: _type = cons; { + if (!data) setData(new MTPDtextUnderline()); + MTPDtextUnderline &v(_textUnderline()); + v.vtext.read(from, end); + } break; + case mtpc_textStrike: _type = cons; { + if (!data) setData(new MTPDtextStrike()); + MTPDtextStrike &v(_textStrike()); + v.vtext.read(from, end); + } break; + case mtpc_textFixed: _type = cons; { + if (!data) setData(new MTPDtextFixed()); + MTPDtextFixed &v(_textFixed()); + v.vtext.read(from, end); + } break; + case mtpc_textUrl: _type = cons; { + if (!data) setData(new MTPDtextUrl()); + MTPDtextUrl &v(_textUrl()); + v.vtext.read(from, end); + v.vurl.read(from, end); + v.vwebpage_id.read(from, end); + } break; + case mtpc_textEmail: _type = cons; { + if (!data) setData(new MTPDtextEmail()); + MTPDtextEmail &v(_textEmail()); + v.vtext.read(from, end); + v.vemail.read(from, end); + } break; + case mtpc_textConcat: _type = cons; { + if (!data) setData(new MTPDtextConcat()); + MTPDtextConcat &v(_textConcat()); + v.vtexts.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPrichText"); + } +} +inline void MTPrichText::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_textPlain: { + const MTPDtextPlain &v(c_textPlain()); + v.vtext.write(to); + } break; + case mtpc_textBold: { + const MTPDtextBold &v(c_textBold()); + v.vtext.write(to); + } break; + case mtpc_textItalic: { + const MTPDtextItalic &v(c_textItalic()); + v.vtext.write(to); + } break; + case mtpc_textUnderline: { + const MTPDtextUnderline &v(c_textUnderline()); + v.vtext.write(to); + } break; + case mtpc_textStrike: { + const MTPDtextStrike &v(c_textStrike()); + v.vtext.write(to); + } break; + case mtpc_textFixed: { + const MTPDtextFixed &v(c_textFixed()); + v.vtext.write(to); + } break; + case mtpc_textUrl: { + const MTPDtextUrl &v(c_textUrl()); + v.vtext.write(to); + v.vurl.write(to); + v.vwebpage_id.write(to); + } break; + case mtpc_textEmail: { + const MTPDtextEmail &v(c_textEmail()); + v.vtext.write(to); + v.vemail.write(to); + } break; + case mtpc_textConcat: { + const MTPDtextConcat &v(c_textConcat()); + v.vtexts.write(to); + } break; + } +} +inline MTPrichText::MTPrichText(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_textEmpty: break; + case mtpc_textPlain: setData(new MTPDtextPlain()); break; + case mtpc_textBold: setData(new MTPDtextBold()); break; + case mtpc_textItalic: setData(new MTPDtextItalic()); break; + case mtpc_textUnderline: setData(new MTPDtextUnderline()); break; + case mtpc_textStrike: setData(new MTPDtextStrike()); break; + case mtpc_textFixed: setData(new MTPDtextFixed()); break; + case mtpc_textUrl: setData(new MTPDtextUrl()); break; + case mtpc_textEmail: setData(new MTPDtextEmail()); break; + case mtpc_textConcat: setData(new MTPDtextConcat()); break; + default: throw mtpErrorBadTypeId(type, "MTPrichText"); + } +} +inline MTPrichText::MTPrichText(MTPDtextPlain *_data) : mtpDataOwner(_data), _type(mtpc_textPlain) { +} +inline MTPrichText::MTPrichText(MTPDtextBold *_data) : mtpDataOwner(_data), _type(mtpc_textBold) { +} +inline MTPrichText::MTPrichText(MTPDtextItalic *_data) : mtpDataOwner(_data), _type(mtpc_textItalic) { +} +inline MTPrichText::MTPrichText(MTPDtextUnderline *_data) : mtpDataOwner(_data), _type(mtpc_textUnderline) { +} +inline MTPrichText::MTPrichText(MTPDtextStrike *_data) : mtpDataOwner(_data), _type(mtpc_textStrike) { +} +inline MTPrichText::MTPrichText(MTPDtextFixed *_data) : mtpDataOwner(_data), _type(mtpc_textFixed) { +} +inline MTPrichText::MTPrichText(MTPDtextUrl *_data) : mtpDataOwner(_data), _type(mtpc_textUrl) { +} +inline MTPrichText::MTPrichText(MTPDtextEmail *_data) : mtpDataOwner(_data), _type(mtpc_textEmail) { +} +inline MTPrichText::MTPrichText(MTPDtextConcat *_data) : mtpDataOwner(_data), _type(mtpc_textConcat) { +} +inline MTPrichText MTP_textEmpty() { + return MTP::internal::TypeCreator::new_textEmpty(); +} +inline MTPrichText MTP_textPlain(const MTPstring &_text) { + return MTP::internal::TypeCreator::new_textPlain(_text); +} +inline MTPrichText MTP_textBold(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_textBold(_text); +} +inline MTPrichText MTP_textItalic(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_textItalic(_text); +} +inline MTPrichText MTP_textUnderline(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_textUnderline(_text); +} +inline MTPrichText MTP_textStrike(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_textStrike(_text); +} +inline MTPrichText MTP_textFixed(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_textFixed(_text); +} +inline MTPrichText MTP_textUrl(const MTPRichText &_text, const MTPstring &_url, const MTPlong &_webpage_id) { + return MTP::internal::TypeCreator::new_textUrl(_text, _url, _webpage_id); +} +inline MTPrichText MTP_textEmail(const MTPRichText &_text, const MTPstring &_email) { + return MTP::internal::TypeCreator::new_textEmail(_text, _email); +} +inline MTPrichText MTP_textConcat(const MTPVector &_texts) { + return MTP::internal::TypeCreator::new_textConcat(_texts); +} + +inline uint32 MTPpageBlock::innerLength() const { + switch (_type) { + case mtpc_pageBlockTitle: { + const MTPDpageBlockTitle &v(c_pageBlockTitle()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockSubtitle: { + const MTPDpageBlockSubtitle &v(c_pageBlockSubtitle()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockAuthorDate: { + const MTPDpageBlockAuthorDate &v(c_pageBlockAuthorDate()); + return v.vauthor.innerLength() + v.vpublished_date.innerLength(); + } + case mtpc_pageBlockHeader: { + const MTPDpageBlockHeader &v(c_pageBlockHeader()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockSubheader: { + const MTPDpageBlockSubheader &v(c_pageBlockSubheader()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockParagraph: { + const MTPDpageBlockParagraph &v(c_pageBlockParagraph()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockPreformatted: { + const MTPDpageBlockPreformatted &v(c_pageBlockPreformatted()); + return v.vtext.innerLength() + v.vlanguage.innerLength(); + } + case mtpc_pageBlockFooter: { + const MTPDpageBlockFooter &v(c_pageBlockFooter()); + return v.vtext.innerLength(); + } + case mtpc_pageBlockList: { + const MTPDpageBlockList &v(c_pageBlockList()); + return v.vordered.innerLength() + v.vitems.innerLength(); + } + case mtpc_pageBlockBlockquote: { + const MTPDpageBlockBlockquote &v(c_pageBlockBlockquote()); + return v.vtext.innerLength() + v.vcaption.innerLength(); + } + case mtpc_pageBlockPullquote: { + const MTPDpageBlockPullquote &v(c_pageBlockPullquote()); + return v.vtext.innerLength() + v.vcaption.innerLength(); + } + case mtpc_pageBlockPhoto: { + const MTPDpageBlockPhoto &v(c_pageBlockPhoto()); + return v.vphoto_id.innerLength() + v.vcaption.innerLength(); + } + case mtpc_pageBlockVideo: { + const MTPDpageBlockVideo &v(c_pageBlockVideo()); + return v.vflags.innerLength() + v.vvideo_id.innerLength() + v.vcaption.innerLength(); + } + case mtpc_pageBlockCover: { + const MTPDpageBlockCover &v(c_pageBlockCover()); + return v.vcover.innerLength(); + } + case mtpc_pageBlockEmbed: { + const MTPDpageBlockEmbed &v(c_pageBlockEmbed()); + return v.vurl.innerLength() + v.vw.innerLength() + v.vh.innerLength() + v.vcaption.innerLength(); + } + case mtpc_pageBlockEmbedPost: { + const MTPDpageBlockEmbedPost &v(c_pageBlockEmbedPost()); + return v.vflags.innerLength() + v.vauthor.innerLength() + v.vdate.innerLength() + v.vcaption.innerLength() + v.vurl.innerLength() + v.vwebpage_id.innerLength() + (v.has_text() ? v.vtext.innerLength() : 0) + (v.has_medias() ? v.vmedias.innerLength() : 0) + (v.has_author_photo_id() ? v.vauthor_photo_id.innerLength() : 0); + } + case mtpc_pageBlockSlideshow: { + const MTPDpageBlockSlideshow &v(c_pageBlockSlideshow()); + return v.vitems.innerLength() + v.vcaption.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPpageBlock::type() const { + t_assert(_type != 0); + return _type; +} +inline void MTPpageBlock::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_pageBlockTitle: _type = cons; { + if (!data) setData(new MTPDpageBlockTitle()); + MTPDpageBlockTitle &v(_pageBlockTitle()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockSubtitle: _type = cons; { + if (!data) setData(new MTPDpageBlockSubtitle()); + MTPDpageBlockSubtitle &v(_pageBlockSubtitle()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockAuthorDate: _type = cons; { + if (!data) setData(new MTPDpageBlockAuthorDate()); + MTPDpageBlockAuthorDate &v(_pageBlockAuthorDate()); + v.vauthor.read(from, end); + v.vpublished_date.read(from, end); + } break; + case mtpc_pageBlockHeader: _type = cons; { + if (!data) setData(new MTPDpageBlockHeader()); + MTPDpageBlockHeader &v(_pageBlockHeader()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockSubheader: _type = cons; { + if (!data) setData(new MTPDpageBlockSubheader()); + MTPDpageBlockSubheader &v(_pageBlockSubheader()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockParagraph: _type = cons; { + if (!data) setData(new MTPDpageBlockParagraph()); + MTPDpageBlockParagraph &v(_pageBlockParagraph()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockPreformatted: _type = cons; { + if (!data) setData(new MTPDpageBlockPreformatted()); + MTPDpageBlockPreformatted &v(_pageBlockPreformatted()); + v.vtext.read(from, end); + v.vlanguage.read(from, end); + } break; + case mtpc_pageBlockFooter: _type = cons; { + if (!data) setData(new MTPDpageBlockFooter()); + MTPDpageBlockFooter &v(_pageBlockFooter()); + v.vtext.read(from, end); + } break; + case mtpc_pageBlockDivider: _type = cons; break; + case mtpc_pageBlockList: _type = cons; { + if (!data) setData(new MTPDpageBlockList()); + MTPDpageBlockList &v(_pageBlockList()); + v.vordered.read(from, end); + v.vitems.read(from, end); + } break; + case mtpc_pageBlockBlockquote: _type = cons; { + if (!data) setData(new MTPDpageBlockBlockquote()); + MTPDpageBlockBlockquote &v(_pageBlockBlockquote()); + v.vtext.read(from, end); + v.vcaption.read(from, end); + } break; + case mtpc_pageBlockPullquote: _type = cons; { + if (!data) setData(new MTPDpageBlockPullquote()); + MTPDpageBlockPullquote &v(_pageBlockPullquote()); + v.vtext.read(from, end); + v.vcaption.read(from, end); + } break; + case mtpc_pageBlockPhoto: _type = cons; { + if (!data) setData(new MTPDpageBlockPhoto()); + MTPDpageBlockPhoto &v(_pageBlockPhoto()); + v.vphoto_id.read(from, end); + v.vcaption.read(from, end); + } break; + case mtpc_pageBlockVideo: _type = cons; { + if (!data) setData(new MTPDpageBlockVideo()); + MTPDpageBlockVideo &v(_pageBlockVideo()); + v.vflags.read(from, end); + v.vvideo_id.read(from, end); + v.vcaption.read(from, end); + } break; + case mtpc_pageBlockCover: _type = cons; { + if (!data) setData(new MTPDpageBlockCover()); + MTPDpageBlockCover &v(_pageBlockCover()); + v.vcover.read(from, end); + } break; + case mtpc_pageBlockEmbed: _type = cons; { + if (!data) setData(new MTPDpageBlockEmbed()); + MTPDpageBlockEmbed &v(_pageBlockEmbed()); + v.vurl.read(from, end); + v.vw.read(from, end); + v.vh.read(from, end); + v.vcaption.read(from, end); + } break; + case mtpc_pageBlockEmbedPost: _type = cons; { + if (!data) setData(new MTPDpageBlockEmbedPost()); + MTPDpageBlockEmbedPost &v(_pageBlockEmbedPost()); + v.vflags.read(from, end); + v.vauthor.read(from, end); + v.vdate.read(from, end); + v.vcaption.read(from, end); + v.vurl.read(from, end); + v.vwebpage_id.read(from, end); + if (v.has_text()) { v.vtext.read(from, end); } else { v.vtext = MTPRichText(); } + if (v.has_medias()) { v.vmedias.read(from, end); } else { v.vmedias = MTPVector(); } + if (v.has_author_photo_id()) { v.vauthor_photo_id.read(from, end); } else { v.vauthor_photo_id = MTPlong(); } + } break; + case mtpc_pageBlockSlideshow: _type = cons; { + if (!data) setData(new MTPDpageBlockSlideshow()); + MTPDpageBlockSlideshow &v(_pageBlockSlideshow()); + v.vitems.read(from, end); + v.vcaption.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPpageBlock"); + } +} +inline void MTPpageBlock::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_pageBlockTitle: { + const MTPDpageBlockTitle &v(c_pageBlockTitle()); + v.vtext.write(to); + } break; + case mtpc_pageBlockSubtitle: { + const MTPDpageBlockSubtitle &v(c_pageBlockSubtitle()); + v.vtext.write(to); + } break; + case mtpc_pageBlockAuthorDate: { + const MTPDpageBlockAuthorDate &v(c_pageBlockAuthorDate()); + v.vauthor.write(to); + v.vpublished_date.write(to); + } break; + case mtpc_pageBlockHeader: { + const MTPDpageBlockHeader &v(c_pageBlockHeader()); + v.vtext.write(to); + } break; + case mtpc_pageBlockSubheader: { + const MTPDpageBlockSubheader &v(c_pageBlockSubheader()); + v.vtext.write(to); + } break; + case mtpc_pageBlockParagraph: { + const MTPDpageBlockParagraph &v(c_pageBlockParagraph()); + v.vtext.write(to); + } break; + case mtpc_pageBlockPreformatted: { + const MTPDpageBlockPreformatted &v(c_pageBlockPreformatted()); + v.vtext.write(to); + v.vlanguage.write(to); + } break; + case mtpc_pageBlockFooter: { + const MTPDpageBlockFooter &v(c_pageBlockFooter()); + v.vtext.write(to); + } break; + case mtpc_pageBlockList: { + const MTPDpageBlockList &v(c_pageBlockList()); + v.vordered.write(to); + v.vitems.write(to); + } break; + case mtpc_pageBlockBlockquote: { + const MTPDpageBlockBlockquote &v(c_pageBlockBlockquote()); + v.vtext.write(to); + v.vcaption.write(to); + } break; + case mtpc_pageBlockPullquote: { + const MTPDpageBlockPullquote &v(c_pageBlockPullquote()); + v.vtext.write(to); + v.vcaption.write(to); + } break; + case mtpc_pageBlockPhoto: { + const MTPDpageBlockPhoto &v(c_pageBlockPhoto()); + v.vphoto_id.write(to); + v.vcaption.write(to); + } break; + case mtpc_pageBlockVideo: { + const MTPDpageBlockVideo &v(c_pageBlockVideo()); + v.vflags.write(to); + v.vvideo_id.write(to); + v.vcaption.write(to); + } break; + case mtpc_pageBlockCover: { + const MTPDpageBlockCover &v(c_pageBlockCover()); + v.vcover.write(to); + } break; + case mtpc_pageBlockEmbed: { + const MTPDpageBlockEmbed &v(c_pageBlockEmbed()); + v.vurl.write(to); + v.vw.write(to); + v.vh.write(to); + v.vcaption.write(to); + } break; + case mtpc_pageBlockEmbedPost: { + const MTPDpageBlockEmbedPost &v(c_pageBlockEmbedPost()); + v.vflags.write(to); + v.vauthor.write(to); + v.vdate.write(to); + v.vcaption.write(to); + v.vurl.write(to); + v.vwebpage_id.write(to); + if (v.has_text()) v.vtext.write(to); + if (v.has_medias()) v.vmedias.write(to); + if (v.has_author_photo_id()) v.vauthor_photo_id.write(to); + } break; + case mtpc_pageBlockSlideshow: { + const MTPDpageBlockSlideshow &v(c_pageBlockSlideshow()); + v.vitems.write(to); + v.vcaption.write(to); + } break; + } +} +inline MTPpageBlock::MTPpageBlock(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_pageBlockTitle: setData(new MTPDpageBlockTitle()); break; + case mtpc_pageBlockSubtitle: setData(new MTPDpageBlockSubtitle()); break; + case mtpc_pageBlockAuthorDate: setData(new MTPDpageBlockAuthorDate()); break; + case mtpc_pageBlockHeader: setData(new MTPDpageBlockHeader()); break; + case mtpc_pageBlockSubheader: setData(new MTPDpageBlockSubheader()); break; + case mtpc_pageBlockParagraph: setData(new MTPDpageBlockParagraph()); break; + case mtpc_pageBlockPreformatted: setData(new MTPDpageBlockPreformatted()); break; + case mtpc_pageBlockFooter: setData(new MTPDpageBlockFooter()); break; + case mtpc_pageBlockDivider: break; + case mtpc_pageBlockList: setData(new MTPDpageBlockList()); break; + case mtpc_pageBlockBlockquote: setData(new MTPDpageBlockBlockquote()); break; + case mtpc_pageBlockPullquote: setData(new MTPDpageBlockPullquote()); break; + case mtpc_pageBlockPhoto: setData(new MTPDpageBlockPhoto()); break; + case mtpc_pageBlockVideo: setData(new MTPDpageBlockVideo()); break; + case mtpc_pageBlockCover: setData(new MTPDpageBlockCover()); break; + case mtpc_pageBlockEmbed: setData(new MTPDpageBlockEmbed()); break; + case mtpc_pageBlockEmbedPost: setData(new MTPDpageBlockEmbedPost()); break; + case mtpc_pageBlockSlideshow: setData(new MTPDpageBlockSlideshow()); break; + default: throw mtpErrorBadTypeId(type, "MTPpageBlock"); + } +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockTitle *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockTitle) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSubtitle *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSubtitle) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockAuthorDate *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockAuthorDate) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockHeader *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockHeader) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSubheader *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSubheader) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockParagraph *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockParagraph) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPreformatted *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPreformatted) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockFooter *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockFooter) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockList *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockList) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockBlockquote *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockBlockquote) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPullquote *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPullquote) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockPhoto *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockPhoto) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockVideo *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockVideo) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockCover *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockCover) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockEmbed *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockEmbed) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockEmbedPost *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockEmbedPost) { +} +inline MTPpageBlock::MTPpageBlock(MTPDpageBlockSlideshow *_data) : mtpDataOwner(_data), _type(mtpc_pageBlockSlideshow) { +} +inline MTPpageBlock MTP_pageBlockTitle(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockTitle(_text); +} +inline MTPpageBlock MTP_pageBlockSubtitle(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockSubtitle(_text); +} +inline MTPpageBlock MTP_pageBlockAuthorDate(const MTPstring &_author, MTPint _published_date) { + return MTP::internal::TypeCreator::new_pageBlockAuthorDate(_author, _published_date); +} +inline MTPpageBlock MTP_pageBlockHeader(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockHeader(_text); +} +inline MTPpageBlock MTP_pageBlockSubheader(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockSubheader(_text); +} +inline MTPpageBlock MTP_pageBlockParagraph(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockParagraph(_text); +} +inline MTPpageBlock MTP_pageBlockPreformatted(const MTPRichText &_text, const MTPstring &_language) { + return MTP::internal::TypeCreator::new_pageBlockPreformatted(_text, _language); +} +inline MTPpageBlock MTP_pageBlockFooter(const MTPRichText &_text) { + return MTP::internal::TypeCreator::new_pageBlockFooter(_text); +} +inline MTPpageBlock MTP_pageBlockDivider() { + return MTP::internal::TypeCreator::new_pageBlockDivider(); +} +inline MTPpageBlock MTP_pageBlockList(MTPBool _ordered, const MTPVector &_items) { + return MTP::internal::TypeCreator::new_pageBlockList(_ordered, _items); +} +inline MTPpageBlock MTP_pageBlockBlockquote(const MTPRichText &_text, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockBlockquote(_text, _caption); +} +inline MTPpageBlock MTP_pageBlockPullquote(const MTPRichText &_text, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockPullquote(_text, _caption); +} +inline MTPpageBlock MTP_pageBlockPhoto(const MTPlong &_photo_id, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockPhoto(_photo_id, _caption); +} +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDpageBlockVideo::Flags) +inline MTPpageBlock MTP_pageBlockVideo(const MTPflags &_flags, const MTPlong &_video_id, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockVideo(_flags, _video_id, _caption); +} +inline MTPpageBlock MTP_pageBlockCover(const MTPPageBlock &_cover) { + return MTP::internal::TypeCreator::new_pageBlockCover(_cover); +} +inline MTPpageBlock MTP_pageBlockEmbed(const MTPstring &_url, MTPint _w, MTPint _h, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockEmbed(_url, _w, _h, _caption); +} +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDpageBlockEmbedPost::Flags) +inline MTPpageBlock MTP_pageBlockEmbedPost(const MTPflags &_flags, const MTPstring &_author, MTPint _date, const MTPRichText &_caption, const MTPstring &_url, const MTPlong &_webpage_id, const MTPRichText &_text, const MTPVector &_medias, const MTPlong &_author_photo_id) { + return MTP::internal::TypeCreator::new_pageBlockEmbedPost(_flags, _author, _date, _caption, _url, _webpage_id, _text, _medias, _author_photo_id); +} +inline MTPpageBlock MTP_pageBlockSlideshow(const MTPVector &_items, const MTPRichText &_caption) { + return MTP::internal::TypeCreator::new_pageBlockSlideshow(_items, _caption); +} + +inline uint32 MTPembedPostMedia::innerLength() const { + switch (_type) { + case mtpc_embedPostPhoto: { + const MTPDembedPostPhoto &v(c_embedPostPhoto()); + return v.vphoto_id.innerLength(); + } + case mtpc_embedPostVideo: { + const MTPDembedPostVideo &v(c_embedPostVideo()); + return v.vvideo_id.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPembedPostMedia::type() const { + t_assert(_type != 0); + return _type; +} +inline void MTPembedPostMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_embedPostPhoto: _type = cons; { + if (!data) setData(new MTPDembedPostPhoto()); + MTPDembedPostPhoto &v(_embedPostPhoto()); + v.vphoto_id.read(from, end); + } break; + case mtpc_embedPostVideo: _type = cons; { + if (!data) setData(new MTPDembedPostVideo()); + MTPDembedPostVideo &v(_embedPostVideo()); + v.vvideo_id.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPembedPostMedia"); + } +} +inline void MTPembedPostMedia::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_embedPostPhoto: { + const MTPDembedPostPhoto &v(c_embedPostPhoto()); + v.vphoto_id.write(to); + } break; + case mtpc_embedPostVideo: { + const MTPDembedPostVideo &v(c_embedPostVideo()); + v.vvideo_id.write(to); + } break; + } +} +inline MTPembedPostMedia::MTPembedPostMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_embedPostPhoto: setData(new MTPDembedPostPhoto()); break; + case mtpc_embedPostVideo: setData(new MTPDembedPostVideo()); break; + default: throw mtpErrorBadTypeId(type, "MTPembedPostMedia"); + } +} +inline MTPembedPostMedia::MTPembedPostMedia(MTPDembedPostPhoto *_data) : mtpDataOwner(_data), _type(mtpc_embedPostPhoto) { +} +inline MTPembedPostMedia::MTPembedPostMedia(MTPDembedPostVideo *_data) : mtpDataOwner(_data), _type(mtpc_embedPostVideo) { +} +inline MTPembedPostMedia MTP_embedPostPhoto(const MTPlong &_photo_id) { + return MTP::internal::TypeCreator::new_embedPostPhoto(_photo_id); +} +inline MTPembedPostMedia MTP_embedPostVideo(const MTPlong &_video_id) { + return MTP::internal::TypeCreator::new_embedPostVideo(_video_id); +} + +inline uint32 MTPpage::innerLength() const { + switch (_type) { + case mtpc_pagePart: { + const MTPDpagePart &v(c_pagePart()); + return v.vblocks.innerLength() + v.vphotos.innerLength() + v.vvideos.innerLength(); + } + case mtpc_pageFull: { + const MTPDpageFull &v(c_pageFull()); + return v.vblocks.innerLength() + v.vphotos.innerLength() + v.vvideos.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPpage::type() const { + t_assert(_type != 0); + return _type; +} +inline void MTPpage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_pagePart: _type = cons; { + if (!data) setData(new MTPDpagePart()); + MTPDpagePart &v(_pagePart()); + v.vblocks.read(from, end); + v.vphotos.read(from, end); + v.vvideos.read(from, end); + } break; + case mtpc_pageFull: _type = cons; { + if (!data) setData(new MTPDpageFull()); + MTPDpageFull &v(_pageFull()); + v.vblocks.read(from, end); + v.vphotos.read(from, end); + v.vvideos.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPpage"); + } +} +inline void MTPpage::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_pagePart: { + const MTPDpagePart &v(c_pagePart()); + v.vblocks.write(to); + v.vphotos.write(to); + v.vvideos.write(to); + } break; + case mtpc_pageFull: { + const MTPDpageFull &v(c_pageFull()); + v.vblocks.write(to); + v.vphotos.write(to); + v.vvideos.write(to); + } break; + } +} +inline MTPpage::MTPpage(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_pagePart: setData(new MTPDpagePart()); break; + case mtpc_pageFull: setData(new MTPDpageFull()); break; + default: throw mtpErrorBadTypeId(type, "MTPpage"); + } +} +inline MTPpage::MTPpage(MTPDpagePart *_data) : mtpDataOwner(_data), _type(mtpc_pagePart) { +} +inline MTPpage::MTPpage(MTPDpageFull *_data) : mtpDataOwner(_data), _type(mtpc_pageFull) { +} +inline MTPpage MTP_pagePart(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { + return MTP::internal::TypeCreator::new_pagePart(_blocks, _photos, _videos); +} +inline MTPpage MTP_pageFull(const MTPVector &_blocks, const MTPVector &_photos, const MTPVector &_videos) { + return MTP::internal::TypeCreator::new_pageFull(_blocks, _photos, _videos); +} inline MTPDmessage::Flags mtpCastFlags(MTPDmessageService::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } inline MTPDmessage::Flags mtpCastFlags(MTPflags flags) { return mtpCastFlags(flags.v); } inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } diff --git a/Telegram/SourceFiles/observer_peer.h b/Telegram/SourceFiles/observer_peer.h index 3d301ac773..ebf57e71be 100644 --- a/Telegram/SourceFiles/observer_peer.h +++ b/Telegram/SourceFiles/observer_peer.h @@ -35,38 +35,39 @@ struct PeerUpdate { enum class Flag { // Common flags - NameChanged = 0x00000001U, - UsernameChanged = 0x00000002U, - PhotoChanged = 0x00000004U, - AboutChanged = 0x00000008U, - NotificationsEnabled = 0x00000010U, - SharedMediaChanged = 0x00000020U, - MigrationChanged = 0x00000040U, + NameChanged = 0x00000001U, + UsernameChanged = 0x00000002U, + PhotoChanged = 0x00000004U, + AboutChanged = 0x00000008U, + NotificationsEnabled = 0x00000010U, + SharedMediaChanged = 0x00000020U, + MigrationChanged = 0x00000040U, // For chats and channels - InviteLinkChanged = 0x00000020U, - MembersChanged = 0x00000040U, - AdminsChanged = 0x00000080U, + InviteLinkChanged = 0x00000020U, + MembersChanged = 0x00000040U, + AdminsChanged = 0x00000080U, // For users - UserCanShareContact = 0x00010000U, - UserIsContact = 0x00020000U, - UserPhoneChanged = 0x00040000U, - UserIsBlocked = 0x00080000U, - BotCommandsChanged = 0x00100000U, - UserOnlineChanged = 0x00200000U, - BotCanAddToGroups = 0x00400000U, + UserCanShareContact = 0x00010000U, + UserIsContact = 0x00020000U, + UserPhoneChanged = 0x00040000U, + UserIsBlocked = 0x00080000U, + BotCommandsChanged = 0x00100000U, + UserOnlineChanged = 0x00200000U, + BotCanAddToGroups = 0x00400000U, + UserCommonChatsChanged = 0x00800000U, // For chats - ChatCanEdit = 0x00010000U, + ChatCanEdit = 0x00010000U, // For channels - ChannelAmIn = 0x00010000U, - ChannelAmEditor = 0x00020000U, - ChannelCanEditPhoto = 0x00040000U, - ChannelCanAddMembers = 0x00080000U, - ChannelCanViewAdmins = 0x00100000U, - ChannelCanViewMembers = 0x00200000U, + ChannelAmIn = 0x00010000U, + ChannelAmEditor = 0x00020000U, + ChannelCanEditPhoto = 0x00040000U, + ChannelCanAddMembers = 0x00080000U, + ChannelCanViewAdmins = 0x00100000U, + ChannelCanViewMembers = 0x00200000U, }; Q_DECLARE_FLAGS(Flags, Flag); Flags flags = 0; diff --git a/Telegram/SourceFiles/profile/profile_actions_widget.cpp b/Telegram/SourceFiles/profile/profile_block_actions.cpp similarity index 99% rename from Telegram/SourceFiles/profile/profile_actions_widget.cpp rename to Telegram/SourceFiles/profile/profile_block_actions.cpp index 0c1c84babc..2337068786 100644 --- a/Telegram/SourceFiles/profile/profile_actions_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_actions.cpp @@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "profile/profile_actions_widget.h" +#include "profile/profile_block_actions.h" #include "styles/style_profile.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/profile/profile_actions_widget.h b/Telegram/SourceFiles/profile/profile_block_actions.h similarity index 100% rename from Telegram/SourceFiles/profile/profile_actions_widget.h rename to Telegram/SourceFiles/profile/profile_block_actions.h diff --git a/Telegram/SourceFiles/profile/profile_block_channel_members.cpp b/Telegram/SourceFiles/profile/profile_block_channel_members.cpp new file mode 100644 index 0000000000..b51c33f93d --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_channel_members.cpp @@ -0,0 +1,145 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" +#include "profile/profile_block_channel_members.h" + +#include "styles/style_profile.h" +#include "ui/widgets/buttons.h" +#include "boxes/members_box.h" +#include "observer_peer.h" +#include "lang.h" + +namespace Profile { + +using UpdateFlag = Notify::PeerUpdate::Flag; + +ChannelMembersWidget::ChannelMembersWidget(QWidget *parent, PeerData *peer) : BlockWidget(parent, peer, lang(lng_profile_participants_section)) { + auto observeEvents = UpdateFlag::ChannelCanViewAdmins + | UpdateFlag::ChannelCanViewMembers + | UpdateFlag::AdminsChanged + | UpdateFlag::MembersChanged; + subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { + notifyPeerUpdated(update); + })); + + refreshButtons(); +} + +void ChannelMembersWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { + if (update.peer != peer()) { + return; + } + + if (update.flags & (UpdateFlag::ChannelCanViewAdmins | UpdateFlag::AdminsChanged)) { + refreshAdmins(); + } + if (update.flags & (UpdateFlag::ChannelCanViewMembers | UpdateFlag::MembersChanged)) { + refreshMembers(); + } + refreshVisibility(); + + contentSizeUpdated(); +} + +void ChannelMembersWidget::addButton(const QString &text, ChildWidget *button, const char *slot) { + if (text.isEmpty()) { + button->destroy(); + } else if (*button) { + (*button)->setText(text); + } else { + (*button) = new Ui::LeftOutlineButton(this, text, st::defaultLeftOutlineButton); + (*button)->show(); + connect(*button, SIGNAL(clicked()), this, slot); + } +} + +void ChannelMembersWidget::refreshButtons() { + refreshAdmins(); + refreshMembers(); + + refreshVisibility(); +} + +void ChannelMembersWidget::refreshAdmins() { + auto getAdminsText = [this]() -> QString { + if (auto channel = peer()->asChannel()) { + if (!channel->isMegagroup() && channel->canViewAdmins()) { + int adminsCount = qMax(channel->adminsCount(), 1); + return lng_channel_admins_link(lt_count, adminsCount); + } + } + return QString(); + }; + addButton(getAdminsText(), &_admins, SLOT(onAdmins())); +} + +void ChannelMembersWidget::refreshMembers() { + auto getMembersText = [this]() -> QString { + if (auto channel = peer()->asChannel()) { + if (!channel->isMegagroup() && channel->canViewMembers()) { + int membersCount = qMax(channel->membersCount(), 1); + return lng_channel_members_link(lt_count, membersCount); + } + } + return QString(); + }; + addButton(getMembersText(), &_members, SLOT(onMembers())); +} + +void ChannelMembersWidget::refreshVisibility() { + setVisible(_admins || _members); +} + +int ChannelMembersWidget::resizeGetHeight(int newWidth) { + int newHeight = contentTop(); + + auto resizeButton = [this, &newHeight, newWidth](ChildWidget &button) { + if (!button) { + return; + } + + int left = defaultOutlineButtonLeft(); + int availableWidth = newWidth - left - st::profileBlockMarginRight; + accumulate_min(availableWidth, st::profileBlockOneLineWidthMax); + button->resizeToWidth(availableWidth); + button->moveToLeft(left, newHeight); + newHeight += button->height(); + }; + + resizeButton(_admins); + resizeButton(_members); + + return newHeight; +} + +void ChannelMembersWidget::onAdmins() { + if (auto channel = peer()->asChannel()) { + Ui::showLayer(new MembersBox(channel, MembersFilter::Admins)); + } +} + +void ChannelMembersWidget::onMembers() { + if (auto channel = peer()->asChannel()) { + Ui::showLayer(new MembersBox(channel, MembersFilter::Recent)); + } +} + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_channel_members.h b/Telegram/SourceFiles/profile/profile_block_channel_members.h new file mode 100644 index 0000000000..ae3cddef44 --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_channel_members.h @@ -0,0 +1,65 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "profile/profile_block_widget.h" + +namespace Ui { +class LeftOutlineButton; +} // namespace Ui + +namespace Notify { +struct PeerUpdate; +} // namespace Notify + +namespace Profile { + +class ChannelMembersWidget : public BlockWidget { + Q_OBJECT + +public: + ChannelMembersWidget(QWidget *parent, PeerData *peer); + +protected: + // Resizes content and counts natural widget height for the desired width. + int resizeGetHeight(int newWidth) override; + + private slots: + void onAdmins(); + void onMembers(); + +private: + // Observed notifications. + void notifyPeerUpdated(const Notify::PeerUpdate &update); + + void refreshButtons(); + void refreshAdmins(); + void refreshMembers(); + void refreshVisibility(); + + void addButton(const QString &text, ChildWidget *button, const char *slot); + + ChildWidget _admins = { nullptr }; + ChildWidget _members = { nullptr }; + +}; + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_common_groups.cpp b/Telegram/SourceFiles/profile/profile_block_common_groups.cpp new file mode 100644 index 0000000000..c694d0cb19 --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_common_groups.cpp @@ -0,0 +1,175 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" +#include "profile/profile_block_common_groups.h" + +#include "profile/profile_section_memento.h" +#include "styles/style_widgets.h" +#include "observer_peer.h" +#include "apiwrap.h" +#include "lang.h" + +namespace Profile { +namespace { + +constexpr int kCommonGroupsPerPage = 20; + +} // namespace + +CommonGroupsWidget::CommonGroupsWidget(QWidget *parent, PeerData *peer) +: PeerListWidget(parent, peer, lang(lng_profile_common_groups_section)) { + refreshVisibility(); + + auto observeEvents = Notify::PeerUpdate::Flag::MembersChanged; + subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { + notifyPeerUpdated(update); + })); + + setSelectedCallback([this](PeerData *selectedPeer) { + Ui::showPeerHistory(selectedPeer, ShowAtUnreadMsgId, Ui::ShowWay::Forward); + }); + setPreloadMoreCallback([this] { + preloadMore(); + }); +} + +void CommonGroupsWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { + for_const (auto item, items()) { + if (item->peer == update.peer) { + updateStatusText(item); + this->update(); + return; + } + } +} + +int CommonGroupsWidget::resizeGetHeight(int newWidth) { + auto result = PeerListWidget::resizeGetHeight(newWidth); + return _height.animating() ? _height.current() : result; +} + +void CommonGroupsWidget::paintContents(Painter &p) { + _height.animating(getms()); + return PeerListWidget::paintContents(p); +} + +void CommonGroupsWidget::saveState(SectionMemento *memento) const { + if (auto count = itemsCount()) { + QList groups; + groups.reserve(count); + for_const (auto item, items()) { + groups.push_back(item->peer); + } + memento->setCommonGroups(groups); + } +} + +void CommonGroupsWidget::restoreState(const SectionMemento *memento) { + CommonGroupsEvent event; + event.groups = memento->getCommonGroups(); + if (!event.groups.empty()) { + onShowCommonGroups(event); + } +} + +void CommonGroupsWidget::onShowCommonGroups(const CommonGroupsEvent &event) { + for_const (auto group, event.groups) { + addItem(computeItem(group)); + _preloadGroupId = group->bareId(); + } + refreshVisibility(); + if (event.initialHeight >= 0) { + _height.start([this] { contentSizeUpdated(); }, event.initialHeight, resizeGetHeight(width()), st::widgetSlideDuration); + } + contentSizeUpdated(); + update(); +} + +void CommonGroupsWidget::preloadMore() { + if (_preloadRequestId || !_preloadGroupId) { + return; + } + auto user = peer()->asUser(); + t_assert(user != nullptr); + auto request = MTPmessages_GetCommonChats(user->inputUser, MTP_int(_preloadGroupId), MTP_int(kCommonGroupsPerPage)); + _preloadRequestId = MTP::send(request, ::rpcDone(base::lambda_guarded(this, [this](const MTPmessages_Chats &result) { + _preloadRequestId = 0; + _preloadGroupId = 0; + + if (auto chats = Api::getChatsFromMessagesChats(result)) { + auto &list = chats->c_vector().v; + if (!list.empty()) { + reserveItemsForSize(itemsCount() + list.size()); + for_const (auto &chatData, list) { + if (auto chat = App::feedChat(chatData)) { + addItem(computeItem(chat)); + _preloadGroupId = chat->bareId(); + } + } + contentSizeUpdated(); + } + } + }))); +} + +void CommonGroupsWidget::updateStatusText(Item *item) { + auto group = item->peer; + if (auto chat = group->asChat()) { + auto count = qMax(chat->count, chat->participants.size()); + item->statusText = count ? lng_chat_status_members(lt_count, count) : lang(lng_group_status); + } else if (auto megagroup = group->asMegagroup()) { + auto count = megagroup->membersCount(); + item->statusText = (count > 0) ? lng_chat_status_members(lt_count, count) : lang(lng_group_status); + + // Request members count. + if (!megagroup->wasFullUpdated()) App::api()->requestFullPeer(megagroup); + } else if (auto channel = group->asChannel()) { + auto count = channel->membersCount(); + item->statusText = (count > 0) ? lng_chat_status_members(lt_count, count) : lang(lng_channel_status); + + // Request members count. + if (!channel->wasFullUpdated()) App::api()->requestFullPeer(channel); + } else { + t_assert(!"Users should not get to CommonGroupsWidget::updateStatusText()"); + } +} + +CommonGroupsWidget::Item *CommonGroupsWidget::computeItem(PeerData *group) { + // Skip groups that migrated to supergroups. + if (group->migrateTo()) { + return nullptr; + } + + auto it = _dataMap.constFind(group); + if (it == _dataMap.cend()) { + it = _dataMap.insert(group, new Item(group)); + updateStatusText(it.value()); + } + return it.value(); +} + +CommonGroupsWidget::~CommonGroupsWidget() { + for (auto item : base::take(_dataMap)) { + delete item; + } +} + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_common_groups.h b/Telegram/SourceFiles/profile/profile_block_common_groups.h new file mode 100644 index 0000000000..1524e935a3 --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_common_groups.h @@ -0,0 +1,75 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "profile/profile_block_peer_list.h" + +namespace Notify { +struct PeerUpdate; +} // namespace Notify + +namespace Profile { + +struct CommonGroupsEvent { + QList groups; + + // If initialHeight >= 0 the common groups widget will + // slide down starting from height() == initialHeight. + // Otherwise it will just show instantly. + int initialHeight = -1; +}; + +class CommonGroupsWidget : public PeerListWidget { +public: + CommonGroupsWidget(QWidget *parent, PeerData *peer); + + void setShowCommonGroupsObservable(base::Observable *observable) { + subscribe(observable, [this](const CommonGroupsEvent &event) { onShowCommonGroups(event); }); + } + + void saveState(SectionMemento *memento) const override; + void restoreState(const SectionMemento *memento) override; + + ~CommonGroupsWidget(); + +protected: + int resizeGetHeight(int newWidth) override; + void paintContents(Painter &p) override; + +private: + // Observed notifications. + void notifyPeerUpdated(const Notify::PeerUpdate &update); + + void updateStatusText(Item *item); + void onShowCommonGroups(const CommonGroupsEvent &event); + void preloadMore(); + + Item *computeItem(PeerData *group); + QMap _dataMap; + + IntAnimation _height; + + int32 _preloadGroupId = 0; + mtpRequestId _preloadRequestId = 0; + +}; + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp new file mode 100644 index 0000000000..25cd4bf40f --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp @@ -0,0 +1,429 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" +#include "profile/profile_block_group_members.h" + +#include "styles/style_profile.h" +#include "ui/widgets/labels.h" +#include "boxes/confirmbox.h" +#include "apiwrap.h" +#include "observer_peer.h" +#include "lang.h" + +namespace Profile { + +using UpdateFlag = Notify::PeerUpdate::Flag; + +GroupMembersWidget::GroupMembersWidget(QWidget *parent, PeerData *peer, TitleVisibility titleVisibility) +: PeerListWidget(parent + , peer + , (titleVisibility == TitleVisibility::Visible) ? lang(lng_profile_participants_section) : QString() + , lang(lng_profile_kick)) { + _updateOnlineTimer.setSingleShot(true); + connect(&_updateOnlineTimer, SIGNAL(timeout()), this, SLOT(onUpdateOnlineDisplay())); + + auto observeEvents = UpdateFlag::AdminsChanged + | UpdateFlag::MembersChanged + | UpdateFlag::UserOnlineChanged; + subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { + notifyPeerUpdated(update); + })); + + setRemovedCallback([this, peer](PeerData *selectedPeer) { + Ui::showLayer(new KickMemberBox(peer, selectedPeer->asUser())); + }); + setSelectedCallback([this](PeerData *selectedPeer) { + Ui::showPeerProfile(selectedPeer); + }); + setUpdateItemCallback([this](Item *item) { + updateItemStatusText(item); + }); + setPreloadMoreCallback([this] { + preloadMore(); + }); + + refreshMembers(); +} + +void GroupMembersWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { + if (update.peer != peer()) { + if (update.flags & UpdateFlag::UserOnlineChanged) { + if (auto user = update.peer->asUser()) { + refreshUserOnline(user); + } + } + return; + } + + if (update.flags & UpdateFlag::MembersChanged) { + refreshMembers(); + contentSizeUpdated(); + } else if (update.flags & UpdateFlag::AdminsChanged) { + if (auto chat = peer()->asChat()) { + for_const (auto item, items()) { + setItemFlags(getMember(item), chat); + } + } else if (auto megagroup = peer()->asMegagroup()) { + for_const (auto item, items()) { + setItemFlags(getMember(item), megagroup); + } + } + } + this->update(); +} + +void GroupMembersWidget::refreshUserOnline(UserData *user) { + auto it = _membersByUser.find(user); + if (it == _membersByUser.cend()) return; + + _now = unixtime(); + + auto member = getMember(it.value()); + member->statusHasOnlineColor = !user->botInfo && App::onlineColorUse(user->onlineTill, _now); + member->onlineTill = user->onlineTill; + member->onlineForSort = user->isSelf() ? INT_MAX : App::onlineForSort(user, _now); + member->statusText = QString(); + + sortMembers(); + update(); +} + +void GroupMembersWidget::preloadMore() { + if (auto megagroup = peer()->asMegagroup()) { + auto megagroupInfo = megagroup->mgInfo; + if (!megagroupInfo->lastParticipants.isEmpty() && megagroupInfo->lastParticipants.size() < megagroup->membersCount()) { + App::api()->requestLastParticipants(megagroup, false); + } + } +} + +int GroupMembersWidget::resizeGetHeight(int newWidth) { + if (_limitReachedInfo) { + int limitReachedInfoWidth = newWidth - getListLeft(); + accumulate_min(limitReachedInfoWidth, st::profileBlockWideWidthMax); + + _limitReachedInfo->resizeToWidth(limitReachedInfoWidth); + _limitReachedInfo->moveToLeft(getListLeft(), contentTop()); + } + return PeerListWidget::resizeGetHeight(newWidth); +} + +void GroupMembersWidget::paintContents(Painter &p) { + int left = getListLeft(); + int top = getListTop(); + int memberRowWidth = width() - left; + accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); + if (_limitReachedInfo) { + int infoTop = contentTop(); + int infoHeight = top - infoTop - st::profileLimitReachedSkip; + paintOutlinedRect(p, left, infoTop, memberRowWidth, infoHeight); + } + + _now = unixtime(); + PeerListWidget::paintContents(p); +} + +void GroupMembersWidget::updateItemStatusText(Item *item) { + auto member = getMember(item); + auto user = member->user(); + if (member->statusText.isEmpty() || (member->onlineTextTill <= _now)) { + if (user->botInfo) { + bool seesAllMessages = (user->botInfo->readsAllHistory || member->hasAdminStar); + member->statusText = lang(seesAllMessages ? lng_status_bot_reads_all : lng_status_bot_not_reads_all); + member->onlineTextTill = _now + 86400; + } else { + member->statusHasOnlineColor = App::onlineColorUse(member->onlineTill, _now); + member->statusText = App::onlineText(member->onlineTill, _now); + member->onlineTextTill = _now + App::onlineWillChangeIn(member->onlineTill, _now); + } + } + if (_updateOnlineAt <= _now || _updateOnlineAt > member->onlineTextTill) { + _updateOnlineAt = member->onlineTextTill; + _updateOnlineTimer.start((_updateOnlineAt - _now + 1) * 1000); + } +} + +int GroupMembersWidget::getListTop() const { + int result = contentTop(); + if (_limitReachedInfo) { + result += _limitReachedInfo->height(); + result += st::profileLimitReachedSkip; + } + return result; +} + +void GroupMembersWidget::refreshMembers() { + _now = unixtime(); + if (auto chat = peer()->asChat()) { + checkSelfAdmin(chat); + if (chat->noParticipantInfo()) { + App::api()->requestFullPeer(chat); + } + fillChatMembers(chat); + refreshLimitReached(); + } else if (auto megagroup = peer()->asMegagroup()) { + checkSelfAdmin(megagroup); + auto megagroupInfo = megagroup->mgInfo; + if (megagroupInfo->lastParticipants.isEmpty() || megagroup->lastParticipantsCountOutdated()) { + App::api()->requestLastParticipants(megagroup); + } + fillMegagroupMembers(megagroup); + } + sortMembers(); + + refreshVisibility(); +} + +void GroupMembersWidget::refreshLimitReached() { + auto chat = peer()->asChat(); + if (!chat) return; + + bool limitReachedShown = (itemsCount() >= Global::ChatSizeMax()) && chat->amCreator() && !emptyTitle(); + if (limitReachedShown && !_limitReachedInfo) { + _limitReachedInfo.create(this, st::profileLimitReachedLabel, st::profileLimitReachedStyle); + QString title = textRichPrepare(lng_profile_migrate_reached(lt_count, Global::ChatSizeMax())); + QString body = textRichPrepare(lang(lng_profile_migrate_body)); + QString link = textRichPrepare(lang(lng_profile_migrate_learn_more)); + QString text = qsl("%1%2%3\n%4 [a href=\"https://telegram.org/blog/supergroups5k\"]%5[/a]").arg(textcmdStartSemibold()).arg(title).arg(textcmdStopSemibold()).arg(body).arg(link); + _limitReachedInfo->setRichText(text); + _limitReachedInfo->setClickHandlerHook([this](const ClickHandlerPtr &handler, Qt::MouseButton button) { + Ui::showLayer(new ConvertToSupergroupBox(peer()->asChat())); + return false; + }); + } else if (!limitReachedShown && _limitReachedInfo) { + _limitReachedInfo.destroy(); + } +} + +void GroupMembersWidget::checkSelfAdmin(ChatData *chat) { + if (chat->participants.isEmpty()) return; + + auto self = App::self(); + if (chat->amAdmin() && !chat->admins.contains(self)) { + chat->admins.insert(self); + } else if (!chat->amAdmin() && chat->admins.contains(self)) { + chat->admins.remove(self); + } +} + +void GroupMembersWidget::checkSelfAdmin(ChannelData *megagroup) { + if (megagroup->mgInfo->lastParticipants.isEmpty()) return; + + bool amAdmin = (megagroup->amCreator() || megagroup->amEditor()); + auto self = App::self(); + if (amAdmin && !megagroup->mgInfo->lastAdmins.contains(self)) { + megagroup->mgInfo->lastAdmins.insert(self); + } else if (!amAdmin && megagroup->mgInfo->lastAdmins.contains(self)) { + megagroup->mgInfo->lastAdmins.remove(self); + } +} + +void GroupMembersWidget::sortMembers() { + if (!_sortByOnline || !itemsCount()) return; + + sortItems([this](Item *a, Item *b) { + return getMember(a)->onlineForSort > getMember(b)->onlineForSort; + }); + + updateOnlineCount(); +} + +void GroupMembersWidget::updateOnlineCount() { + bool onlyMe = true; + int newOnlineCount = 0; + for_const (auto item, items()) { + auto member = getMember(item); + auto user = member->user(); + auto isOnline = !user->botInfo && App::onlineColorUse(member->onlineTill, _now); + if (member->statusHasOnlineColor != isOnline) { + member->statusHasOnlineColor = isOnline; + member->statusText = QString(); + } + if (member->statusHasOnlineColor) { + ++newOnlineCount; + if (!user->isSelf()) { + onlyMe = false; + } + } + } + if (newOnlineCount == 1 && onlyMe) { + newOnlineCount = 0; + } + if (_onlineCount != newOnlineCount) { + _onlineCount = newOnlineCount; + emit onlineCountUpdated(_onlineCount); + } +} + +GroupMembersWidget::Member *GroupMembersWidget::addUser(ChatData *chat, UserData *user) { + auto member = computeMember(user); + setItemFlags(member, chat); + addItem(member); + return member; +} + +void GroupMembersWidget::fillChatMembers(ChatData *chat) { + if (chat->participants.isEmpty()) return; + + clearItems(); + if (!chat->amIn()) return; + + _sortByOnline = true; + + reserveItemsForSize(chat->participants.size()); + addUser(chat, App::self())->onlineForSort = INT_MAX; // Put me on the first place. + for (auto i = chat->participants.cbegin(), e = chat->participants.cend(); i != e; ++i) { + auto user = i.key(); + if (!user->isSelf()) { + addUser(chat, user); + } + } +} + +void GroupMembersWidget::setItemFlags(Item *item, ChatData *chat) { + auto user = getMember(item)->user(); + auto isCreator = (peerFromUser(chat->creator) == item->peer->id); + auto isAdmin = chat->admins.contains(user); + item->hasAdminStar = isCreator || isAdmin; + if (item->peer->id == peerFromUser(MTP::authedId())) { + item->hasRemoveLink = false; + } else if (chat->amCreator() || (chat->amAdmin() && !item->hasAdminStar)) { + item->hasRemoveLink = true; + } else { + item->hasRemoveLink = chat->invitedByMe.contains(user); + } +} + +GroupMembersWidget::Member *GroupMembersWidget::addUser(ChannelData *megagroup, UserData *user) { + auto member = computeMember(user); + setItemFlags(member, megagroup); + addItem(member); + return member; +} + +void GroupMembersWidget::fillMegagroupMembers(ChannelData *megagroup) { + t_assert(megagroup->mgInfo != nullptr); + if (megagroup->mgInfo->lastParticipants.isEmpty()) return; + + if (!megagroup->canViewMembers()) { + clearItems(); + return; + } + + _sortByOnline = (megagroup->membersCount() > 0 && megagroup->membersCount() <= Global::ChatSizeMax()); + + auto &membersList = megagroup->mgInfo->lastParticipants; + if (_sortByOnline) { + clearItems(); + reserveItemsForSize(membersList.size()); + if (megagroup->amIn()) { + addUser(megagroup, App::self())->onlineForSort = INT_MAX; + } + } else if (membersList.size() >= itemsCount()) { + if (addUsersToEnd(megagroup)) { + return; + } + } + if (!_sortByOnline) { + clearItems(); + reserveItemsForSize(membersList.size()); + } + for_const (auto user, membersList) { + if (!_sortByOnline || !user->isSelf()) { + addUser(megagroup, user); + } + } +} + +bool GroupMembersWidget::addUsersToEnd(ChannelData *megagroup) { + auto &membersList = megagroup->mgInfo->lastParticipants; + auto &itemsList = items(); + for (int i = 0, count = itemsList.size(); i < count; ++i) { + if (itemsList[i]->peer != membersList.at(i)) { + return false; + } + } + reserveItemsForSize(membersList.size()); + for (int i = itemsCount(), count = membersList.size(); i < count; ++i) { + addUser(megagroup, membersList.at(i)); + } + return true; +} + +void GroupMembersWidget::setItemFlags(Item *item, ChannelData *megagroup) { + auto amCreatorOrAdmin = (peerToUser(item->peer->id) == MTP::authedId()) && (megagroup->amCreator() || megagroup->amEditor()); + auto isAdmin = megagroup->mgInfo->lastAdmins.contains(getMember(item)->user()); + item->hasAdminStar = amCreatorOrAdmin || isAdmin; + if (item->peer->isSelf()) { + item->hasRemoveLink = false; + } else if (megagroup->amCreator() || (megagroup->amEditor() && !item->hasAdminStar)) { + item->hasRemoveLink = true; + } else { + item->hasRemoveLink = false; + } +} + +GroupMembersWidget::Member *GroupMembersWidget::computeMember(UserData *user) { + auto it = _membersByUser.constFind(user); + if (it == _membersByUser.cend()) { + auto member = new Member(user); + it = _membersByUser.insert(user, member); + member->statusHasOnlineColor = !user->botInfo && App::onlineColorUse(user->onlineTill, _now); + member->onlineTill = user->onlineTill; + member->onlineForSort = App::onlineForSort(user, _now); + } + return it.value(); +} + +void GroupMembersWidget::onUpdateOnlineDisplay() { + if (_sortByOnline) { + _now = unixtime(); + + bool changed = false; + for_const (auto item, items()) { + if (!item->statusHasOnlineColor) { + if (!item->peer->isSelf()) { + continue; + } else { + break; + } + } + auto member = getMember(item); + bool isOnline = !member->user()->botInfo && App::onlineColorUse(member->onlineTill, _now); + if (!isOnline) { + changed = true; + } + } + if (changed) { + updateOnlineCount(); + } + } + update(); +} + +GroupMembersWidget::~GroupMembersWidget() { + auto members = base::take(_membersByUser); + for_const (auto member, members) { + delete member; + } +} + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_members_widget.h b/Telegram/SourceFiles/profile/profile_block_group_members.h similarity index 51% rename from Telegram/SourceFiles/profile/profile_members_widget.h rename to Telegram/SourceFiles/profile/profile_block_group_members.h index 7e8ba24ebd..9044419e41 100644 --- a/Telegram/SourceFiles/profile/profile_members_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_group_members.h @@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -#include "profile/profile_block_widget.h" +#include "profile/profile_block_peer_list.h" namespace Ui { class FlatLabel; @@ -33,7 +33,7 @@ struct PeerUpdate; namespace Profile { -class MembersWidget : public BlockWidget { +class GroupMembersWidget : public PeerListWidget { Q_OBJECT public: @@ -41,14 +41,13 @@ public: Visible, Hidden, }; - MembersWidget(QWidget *parent, PeerData *peer, TitleVisibility titleVisibility = TitleVisibility::Visible); + GroupMembersWidget(QWidget *parent, PeerData *peer, TitleVisibility titleVisibility = TitleVisibility::Visible); - void setVisibleTopBottom(int visibleTop, int visibleBottom) override; int onlineCount() const { return _onlineCount; } - ~MembersWidget(); + ~GroupMembersWidget(); protected: // Resizes content and counts natural widget height for the desired width. @@ -56,18 +55,6 @@ protected: void paintContents(Painter &p) override; - void mouseMoveEvent(QMouseEvent *e) override; - void mousePressEvent(QMouseEvent *e) override; - void mouseReleaseEvent(QMouseEvent *e) override; - void enterEvent(QEvent *e) override; - void enterFromChildEvent(QEvent *e, QWidget *child) override { - enterEvent(e); - } - void leaveEvent(QEvent *e) override; - void leaveToChildEvent(QEvent *e, QWidget *child) override { - leaveEvent(e); - } - signals: void onlineCountUpdated(int onlineCount); @@ -78,8 +65,6 @@ private: // Observed notifications. void notifyPeerUpdated(const Notify::PeerUpdate &update); - void preloadUserPhotos(); - void refreshMembers(); void fillChatMembers(ChatData *chat); void fillMegagroupMembers(ChannelData *megagroup); @@ -89,91 +74,46 @@ private: void checkSelfAdmin(ChannelData *megagroup); void refreshLimitReached(); + void preloadMore(); + bool limitReachedHook(const ClickHandlerPtr &handler, Qt::MouseButton button); - void refreshVisibility(); - void updateSelection(); - void setSelected(int selected, bool selectedKick); - void repaintSelectedRow(); void refreshUserOnline(UserData *user); - int getListLeft() const; - int getListTop() const; + int getListTop() const override; - struct Member { - Member(UserData *user) : user(user) { + struct Member : public Item { + explicit Member(UserData *user) : Item(user) { + } + UserData *user() const { + return static_cast(peer); } - UserData *user; - Text name; - QString onlineText; TimeId onlineTextTill = 0; TimeId onlineTill = 0; TimeId onlineForSort = 0; - bool online = false; - bool isAdmin = false; - bool canBeKicked = false; }; - Member *getMember(UserData *user); - void paintMember(Painter &p, int x, int y, Member *member, bool selected, bool selectedKick); - void paintOutlinedRect(Painter &p, int x, int y, int w, int h) const; - void setMemberFlags(Member *member, ChatData *chat); + Member *getMember(Item *item) { + return static_cast(item); + } + + void updateItemStatusText(Item *item); + Member *computeMember(UserData *user); Member *addUser(ChatData *chat, UserData *user); - void setMemberFlags(Member *member, ChannelData *megagroup); Member *addUser(ChannelData *megagroup, UserData *user); + void setItemFlags(Item *item, ChatData *chat); + void setItemFlags(Item *item, ChannelData *megagroup); bool addUsersToEnd(ChannelData *megagroup); ChildWidget _limitReachedInfo = { nullptr }; - QList _list; QMap _membersByUser; bool _sortByOnline = false; TimeId _now = 0; - int _visibleTop = 0; - int _visibleBottom = 0; - - int _selected = -1; - int _pressed = -1; - bool _selectedKick = false; - bool _pressedKick = false; - QPoint _mousePosition; - int _onlineCount = 0; TimeId _updateOnlineAt = 0; QTimer _updateOnlineTimer; - int _removeWidth = 0; - -}; - -class ChannelMembersWidget : public BlockWidget { - Q_OBJECT - -public: - ChannelMembersWidget(QWidget *parent, PeerData *peer); - -protected: - // Resizes content and counts natural widget height for the desired width. - int resizeGetHeight(int newWidth) override; - -private slots: - void onAdmins(); - void onMembers(); - -private: - // Observed notifications. - void notifyPeerUpdated(const Notify::PeerUpdate &update); - - void refreshButtons(); - void refreshAdmins(); - void refreshMembers(); - void refreshVisibility(); - - void addButton(const QString &text, ChildWidget *button, const char *slot); - - ChildWidget _admins = { nullptr }; - ChildWidget _members = { nullptr }; - }; } // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_info_widget.cpp b/Telegram/SourceFiles/profile/profile_block_info.cpp similarity index 66% rename from Telegram/SourceFiles/profile/profile_info_widget.cpp rename to Telegram/SourceFiles/profile/profile_block_info.cpp index a98e39475f..bbe5d72270 100644 --- a/Telegram/SourceFiles/profile/profile_info_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_info.cpp @@ -19,28 +19,56 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "profile/profile_info_widget.h" +#include "profile/profile_block_info.h" +#include "profile/profile_block_common_groups.h" +#include "profile/profile_section_memento.h" #include "styles/style_profile.h" #include "ui/widgets/labels.h" +#include "ui/widgets/buttons.h" +#include "ui/effects/widget_slide_wrap.h" #include "core/click_handler_types.h" #include "observer_peer.h" +#include "apiwrap.h" #include "lang.h" namespace Profile { +constexpr int kCommonGroupsLimit = 20; + using UpdateFlag = Notify::PeerUpdate::Flag; InfoWidget::InfoWidget(QWidget *parent, PeerData *peer) : BlockWidget(parent, peer, lang(lng_profile_info_section)) { auto observeEvents = UpdateFlag::AboutChanged | UpdateFlag::UsernameChanged | UpdateFlag::UserPhoneChanged - | UpdateFlag::UserCanShareContact; + | UpdateFlag::UserCanShareContact + | UpdateFlag::UserCommonChatsChanged; subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { notifyPeerUpdated(update); })); refreshLabels(); + if (_commonGroups && _commonGroups->isHidden()) { + _commonGroups->show(); + refreshVisibility(); + } +} + +void InfoWidget::showFinished() { + _showFinished = true; + if (_commonGroups && _commonGroups->isHidden() && getCommonGroupsCount() > 0) { + _commonGroups->show(); + refreshVisibility(); + _height.start([this] { contentSizeUpdated(); }, isHidden() ? 0 : height(), resizeGetHeight(width()), st::widgetSlideDuration); + contentSizeUpdated(); + } +} + +void InfoWidget::restoreState(const SectionMemento *memento) { + if (!memento->getCommonGroups().isEmpty()) { + onForceHideCommonGroups(); + } } void InfoWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { @@ -58,13 +86,17 @@ void InfoWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { if (update.flags & (UpdateFlag::UserPhoneChanged | UpdateFlag::UserCanShareContact)) { refreshMobileNumber(); } + if (update.flags & UpdateFlag::UserCommonChatsChanged) { + refreshCommonGroups(); + } refreshVisibility(); contentSizeUpdated(); } int InfoWidget::resizeGetHeight(int newWidth) { - int newHeight = contentTop(); + int initialHeight = contentTop(); + int newHeight = initialHeight; int marginLeft = st::profileBlockTextPart.margin.left(); int marginRight = st::profileBlockTextPart.margin.right(); @@ -109,8 +141,18 @@ int InfoWidget::resizeGetHeight(int newWidth) { moveLabeledText(_mobileNumberLabel, _mobileNumber, nullptr); moveLabeledText(_usernameLabel, _username, nullptr); + if (_commonGroups && !_commonGroups->isHidden()) { + int left = defaultOutlineButtonLeft(); + int availableWidth = newWidth - left - st::profileBlockMarginRight; + accumulate_min(availableWidth, st::profileBlockOneLineWidthMax); + + _commonGroups->resizeToWidth(availableWidth); + _commonGroups->moveToLeft(left, newHeight); + newHeight += _commonGroups->height(); + } + newHeight += st::profileBlockMarginBottom; - return newHeight; + return _height.animating() ? _height.current() : newHeight; } void InfoWidget::leaveEvent(QEvent *e) { @@ -123,12 +165,13 @@ void InfoWidget::refreshLabels() { refreshMobileNumber(); refreshUsername(); refreshChannelLink(); + refreshCommonGroups(); refreshVisibility(); } void InfoWidget::refreshVisibility() { - setVisible(_about || _mobileNumber || _username || _channelLink); + setVisible(_about || _mobileNumber || _username || _channelLink || (_commonGroups && !_commonGroups->isHidden())); } void InfoWidget::refreshAbout() { @@ -198,6 +241,84 @@ void InfoWidget::refreshChannelLink() { } } +int InfoWidget::getCommonGroupsCount() const { + if (auto user = peer()->asUser()) { + return user->commonChatsCount(); + } + return 0; +} + +void InfoWidget::refreshCommonGroups() { + if (auto count = (_forceHiddenCommonGroups ? 0 : getCommonGroupsCount())) { + auto text = lng_profile_common_groups(lt_count, count); + if (_commonGroups) { + _commonGroups->setText(text); + } else { + _commonGroups.create(this, text, st::defaultLeftOutlineButton); + _commonGroups->setClickedCallback([this] { onShowCommonGroups(); }); + _commonGroups->hide(); + if (_showFinished) { + _height.start([this] { contentSizeUpdated(); }, isHidden() ? 0 : height(), resizeGetHeight(width()), st::widgetSlideDuration); + contentSizeUpdated(); + } + } + } else if (_commonGroups) { + _commonGroups.destroyDelayed(); + } +} + +void InfoWidget::setShowCommonGroupsObservable(base::Observable *observable) { + _showCommonGroupsObservable = observable; + subscribe(_showCommonGroupsObservable, [this](const CommonGroupsEvent &event) { + onForceHideCommonGroups(); + }); +} + +void InfoWidget::onForceHideCommonGroups() { + if (_forceHiddenCommonGroups) { + return; + } + _forceHiddenCommonGroups = true; + _commonGroups.destroyDelayed(); + refreshVisibility(); + contentSizeUpdated(); +} + +void InfoWidget::onShowCommonGroups() { + auto count = getCommonGroupsCount(); + if (count <= 0) { + refreshCommonGroups(); + return; + } + if (_getCommonGroupsRequestId) { + return; + } + auto user = peer()->asUser(); + t_assert(user != nullptr); + auto request = MTPmessages_GetCommonChats(user->inputUser, MTP_int(0), MTP_int(kCommonGroupsLimit)); + _getCommonGroupsRequestId = MTP::send(request, ::rpcDone(base::lambda_guarded(this, [this](const MTPmessages_Chats &result) { + _getCommonGroupsRequestId = 0; + + CommonGroupsEvent event; + if (auto chats = Api::getChatsFromMessagesChats(result)) { + auto &list = chats->c_vector().v; + event.groups.reserve(list.size()); + for_const (auto &chatData, list) { + if (auto chat = App::feedChat(chatData)) { + event.groups.push_back(chat); + } + } + } + + auto oldHeight = height(); + onForceHideCommonGroups(); + if (!event.groups.empty() && _showCommonGroupsObservable) { + event.initialHeight = oldHeight - (isHidden() ? 0 : height()); + _showCommonGroupsObservable->notify(event, true); + } + }))); +} + void InfoWidget::setLabeledText(ChildWidget *labelWidget, const QString &label, ChildWidget *textWidget, const TextWithEntities &textWithEntities, const QString ©Text) { if (labelWidget) labelWidget->destroy(); diff --git a/Telegram/SourceFiles/profile/profile_info_widget.h b/Telegram/SourceFiles/profile/profile_block_info.h similarity index 75% rename from Telegram/SourceFiles/profile/profile_info_widget.h rename to Telegram/SourceFiles/profile/profile_block_info.h index 1abeffc950..bf15742811 100644 --- a/Telegram/SourceFiles/profile/profile_info_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_info.h @@ -30,12 +30,23 @@ namespace Notify { struct PeerUpdate; } // namespace Notify +namespace Ui { +class LeftOutlineButton; +} // namespace Ui + namespace Profile { -class InfoWidget : public BlockWidget { +struct CommonGroupsEvent; +class InfoWidget : public BlockWidget, public RPCSender { public: InfoWidget(QWidget *parent, PeerData *peer); + void setShowCommonGroupsObservable(base::Observable *observable); + + void showFinished() override; + + void restoreState(const SectionMemento *memento) override; + protected: // Resizes content and counts natural widget height for the desired width. int resizeGetHeight(int newWidth) override; @@ -51,8 +62,13 @@ private: void refreshMobileNumber(); void refreshUsername(); void refreshChannelLink(); + void refreshCommonGroups(); void refreshVisibility(); + int getCommonGroupsCount() const; + void onForceHideCommonGroups(); + void onShowCommonGroups(); + // labelWidget may be nullptr. void setLabeledText(ChildWidget *labelWidget, const QString &label, ChildWidget *textWidget, const TextWithEntities &textWithEntities, const QString ©Text); @@ -65,6 +81,15 @@ private: ChildWidget _mobileNumber = { nullptr }; ChildWidget _usernameLabel = { nullptr }; ChildWidget _username = { nullptr }; + ChildWidget _commonGroups = { nullptr }; + + IntAnimation _height; + bool _showFinished = false; + + bool _forceHiddenCommonGroups = false; + mtpRequestId _getCommonGroupsRequestId = 0; + + base::Observable *_showCommonGroupsObservable = nullptr; }; diff --git a/Telegram/SourceFiles/profile/profile_invite_link_widget.cpp b/Telegram/SourceFiles/profile/profile_block_invite_link.cpp similarity index 98% rename from Telegram/SourceFiles/profile/profile_invite_link_widget.cpp rename to Telegram/SourceFiles/profile/profile_block_invite_link.cpp index e2de75f15a..b4355e9cfb 100644 --- a/Telegram/SourceFiles/profile/profile_invite_link_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_invite_link.cpp @@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "profile/profile_invite_link_widget.h" +#include "profile/profile_block_invite_link.h" #include "styles/style_profile.h" #include "ui/widgets/labels.h" diff --git a/Telegram/SourceFiles/profile/profile_invite_link_widget.h b/Telegram/SourceFiles/profile/profile_block_invite_link.h similarity index 100% rename from Telegram/SourceFiles/profile/profile_invite_link_widget.h rename to Telegram/SourceFiles/profile/profile_block_invite_link.h diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.cpp b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp new file mode 100644 index 0000000000..5cb0392ddb --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.cpp @@ -0,0 +1,241 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" +#include "profile/profile_block_peer_list.h" + +#include "styles/style_profile.h" +#include "styles/style_widgets.h" + +namespace Profile { + +PeerListWidget::PeerListWidget(QWidget *parent, PeerData *peer, const QString &title, const QString &removeText) +: BlockWidget(parent, peer, title) +, _removeText(removeText) +, _removeWidth(st::normalFont->width(_removeText)) { + setMouseTracking(true); + subscribe(FileDownload::ImageLoaded(), [this] { update(); }); +} + +int PeerListWidget::resizeGetHeight(int newWidth) { + auto newHeight = getListTop(); + + newHeight += _items.size() * st::profileMemberHeight; + + return newHeight + st::profileBlockMarginBottom; +} + +void PeerListWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) { + _visibleTop = visibleTop; + _visibleBottom = visibleBottom; + + if (_preloadMoreCallback) { + if (_visibleTop + PreloadHeightsCount * (_visibleBottom - _visibleTop) > height()) { + _preloadMoreCallback(); + } + } +} + +void PeerListWidget::paintContents(Painter &p) { + int left = getListLeft(); + int top = getListTop(); + int memberRowWidth = width() - left; + accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); + + int from = floorclamp(_visibleTop - top, st::profileMemberHeight, 0, _items.size()); + int to = ceilclamp(_visibleBottom - top, st::profileMemberHeight, 0, _items.size()); + for (int i = from; i < to; ++i) { + int y = top + i * st::profileMemberHeight; + bool selected = (i == _selected); + bool selectedRemove = selected && _selectedRemove; + if (_pressed >= 0) { + if (_pressed != _selected) { + selected = selectedRemove = false; + } else if (!_pressedRemove) { + _selectedRemove = false; + } + } + paintItem(p, left, y, _items[i], selected, selectedRemove); + } +} + +void PeerListWidget::paintItem(Painter &p, int x, int y, Item *item, bool selected, bool selectedKick) { + if (_updateItemCallback) { + _updateItemCallback(item); + } + + int memberRowWidth = width() - x; + if (selected) { + accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); + paintOutlinedRect(p, x, y, memberRowWidth, st::profileMemberHeight); + } + int skip = st::profileMemberPhotoPosition.x(); + + item->peer->paintUserpicLeft(p, st::profileMemberPhotoSize, x + st::profileMemberPhotoPosition.x(), y + st::profileMemberPhotoPosition.y(), width()); + + if (item->name.isEmpty()) { + item->name.setText(st::semiboldFont, App::peerName(item->peer), _textNameOptions); + } + int nameLeft = x + st::profileMemberNamePosition.x(); + int nameTop = y + st::profileMemberNamePosition.y(); + int nameWidth = memberRowWidth - st::profileMemberNamePosition.x() - skip; + if (item->hasRemoveLink && selected) { + p.setFont(selectedKick ? st::normalFont->underline() : st::normalFont); + p.setPen(st::windowActiveTextFg); + p.drawTextLeft(nameLeft + nameWidth - _removeWidth, nameTop, width(), _removeText, _removeWidth); + nameWidth -= _removeWidth + skip; + } + if (item->hasAdminStar) { + nameWidth -= st::profileMemberAdminIcon.width(); + int iconLeft = nameLeft + qMin(nameWidth, item->name.maxWidth()); + st::profileMemberAdminIcon.paint(p, QPoint(iconLeft, nameTop), width()); + } + p.setPen(st::profileMemberNameFg); + item->name.drawLeftElided(p, nameLeft, nameTop, nameWidth, width()); + + if (item->statusHasOnlineColor) { + p.setPen(st::profileMemberStatusFgActive); + } else { + p.setPen(selected ? st::profileMemberStatusFgOver : st::profileMemberStatusFg); + } + p.setFont(st::normalFont); + p.drawTextLeft(x + st::profileMemberStatusPosition.x(), y + st::profileMemberStatusPosition.y(), width(), item->statusText); +} + +void PeerListWidget::paintOutlinedRect(Painter &p, int x, int y, int w, int h) const { + int outlineWidth = st::defaultLeftOutlineButton.outlineWidth; + p.fillRect(rtlrect(x, y, outlineWidth, h, width()), st::defaultLeftOutlineButton.outlineFgOver); + p.fillRect(rtlrect(x + outlineWidth, y, w - outlineWidth, h, width()), st::defaultLeftOutlineButton.textBgOver); +} + +void PeerListWidget::mouseMoveEvent(QMouseEvent *e) { + _mousePosition = e->globalPos(); + updateSelection(); +} + +void PeerListWidget::mousePressEvent(QMouseEvent *e) { + _mousePosition = e->globalPos(); + updateSelection(); + + _pressed = _selected; + _pressedRemove = _selectedRemove; +} + +void PeerListWidget::mouseReleaseEvent(QMouseEvent *e) { + _mousePosition = e->globalPos(); + updateSelection(); + + auto pressed = _pressed; + auto pressedRemove = _pressedRemove; + _pressed = -1; + _pressedRemove = false; + if (pressed >= 0 && pressed < _items.size() && pressed == _selected && pressedRemove == _selectedRemove) { + if (auto &callback = (pressedRemove ? _removedCallback : _selectedCallback)) { + callback(_items[pressed]->peer); + } + } + setCursor(_selectedRemove ? style::cur_pointer : style::cur_default); + repaintSelectedRow(); +} + +void PeerListWidget::enterEvent(QEvent *e) { + _mousePosition = QCursor::pos(); + updateSelection(); +} + +void PeerListWidget::leaveEvent(QEvent *e) { + _mousePosition = QPoint(-1, -1); + updateSelection(); +} + +void PeerListWidget::updateSelection() { + int selected = -1; + bool selectedKick = false; + + auto mouse = mapFromGlobal(_mousePosition); + if (rtl()) mouse.setX(width() - mouse.x()); + int left = getListLeft(); + int top = getListTop(); + int memberRowWidth = width() - left; + accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); + if (mouse.x() >= left && mouse.x() < left + memberRowWidth && mouse.y() >= top) { + selected = (mouse.y() - top) / st::profileMemberHeight; + if (selected >= _items.size()) { + selected = -1; + } else if (_items[selected]->hasRemoveLink) { + int skip = st::profileMemberPhotoPosition.x(); + int nameLeft = left + st::profileMemberNamePosition.x(); + int nameTop = top + _selected * st::profileMemberHeight + st::profileMemberNamePosition.y(); + int nameWidth = memberRowWidth - st::profileMemberNamePosition.x() - skip; + if (mouse.x() >= nameLeft + nameWidth - _removeWidth && mouse.x() < nameLeft + nameWidth) { + if (mouse.y() >= nameTop && mouse.y() < nameTop + st::normalFont->height) { + selectedKick = true; + } + } + } + } + + setSelected(selected, selectedKick); +} + +void PeerListWidget::setSelected(int selected, bool selectedRemove) { + if (_selected == selected && _selectedRemove == selectedRemove) { + return; + } + + repaintSelectedRow(); + if (_selectedRemove != selectedRemove) { + _selectedRemove = selectedRemove; + if (_pressed < 0) { + setCursor(_selectedRemove ? style::cur_pointer : style::cur_default); + } + } + if (_selected != selected) { + _selected = selected; + repaintSelectedRow(); + } +} + +void PeerListWidget::repaintSelectedRow() { + if (_selected >= 0) { + int left = getListLeft(); + rtlupdate(left, getListTop() + _selected * st::profileMemberHeight, width() - left, st::profileMemberHeight); + } +} + +int PeerListWidget::getListLeft() const { + return st::profileBlockTitlePosition.x() - st::profileMemberPaddingLeft; +} + +void PeerListWidget::preloadPhotos() { + int top = getListTop(); + int preloadFor = (_visibleBottom - _visibleTop) * PreloadHeightsCount; + int from = floorclamp(_visibleTop - top, st::profileMemberHeight, 0, _items.size()); + int to = ceilclamp(_visibleBottom + preloadFor - top, st::profileMemberHeight, 0, _items.size()); + for (int i = from; i < to; ++i) { + _items[i]->peer->loadUserpic(); + } +} + +void PeerListWidget::refreshVisibility() { + setVisible(!_items.isEmpty()); +} + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_block_peer_list.h b/Telegram/SourceFiles/profile/profile_block_peer_list.h new file mode 100644 index 0000000000..a83a4bb79b --- /dev/null +++ b/Telegram/SourceFiles/profile/profile_block_peer_list.h @@ -0,0 +1,139 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "profile/profile_block_widget.h" + +namespace Notify { +struct PeerUpdate; +} // namespace Notify + +namespace Profile { + +class PeerListWidget : public BlockWidget { +public: + PeerListWidget(QWidget *parent, PeerData *peer, const QString &title, const QString &removeText = QString()); + + void setVisibleTopBottom(int visibleTop, int visibleBottom) override; + + struct Item { + explicit Item(PeerData *peer) : peer(peer) { + } + PeerData * const peer; + Text name; + QString statusText; + bool statusHasOnlineColor = false; + bool hasAdminStar = false; + bool hasRemoveLink = false; + }; + virtual int getListTop() const { + return contentTop(); + } + + int getListLeft() const; + + const QList &items() const { + return _items; + } + int itemsCount() const { + return _items.size(); + } + + // Does not take ownership of item. + void addItem(Item *item) { + if (!item) return; + _items.push_back(item); + } + void clearItems() { + _items.clear(); + } + void reserveItemsForSize(int size) { + _items.reserve(size); + } + template + void sortItems(Predicate predicate) { + qSort(_items.begin(), _items.end(), std_::move(predicate)); + } + + void setPreloadMoreCallback(base::lambda &&callback) { + _preloadMoreCallback = std_::move(callback); + } + void setSelectedCallback(base::lambda &&callback) { + _selectedCallback = std_::move(callback); + } + void setRemovedCallback(base::lambda &&callback) { + _removedCallback = std_::move(callback); + } + void setUpdateItemCallback(base::lambda &&callback) { + _updateItemCallback = std_::move(callback); + } + +protected: + void paintOutlinedRect(Painter &p, int x, int y, int w, int h) const; + void refreshVisibility(); + + // Resizes content and counts natural widget height for the desired width. + int resizeGetHeight(int newWidth) override; + + void paintContents(Painter &p) override; + + void mouseMoveEvent(QMouseEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; + void enterEvent(QEvent *e) override; + void enterFromChildEvent(QEvent *e, QWidget *child) override { + enterEvent(e); + } + void leaveEvent(QEvent *e) override; + void leaveToChildEvent(QEvent *e, QWidget *child) override { + leaveEvent(e); + } + +private: + void updateSelection(); + void setSelected(int selected, bool selectedRemove); + void repaintSelectedRow(); + void preloadPhotos(); + + void paintItem(Painter &p, int x, int y, Item *item, bool selected, bool selectedRemove); + + base::lambda _preloadMoreCallback; + base::lambda _selectedCallback; + base::lambda _removedCallback; + base::lambda _updateItemCallback; + + QList _items; + + int _visibleTop = 0; + int _visibleBottom = 0; + + int _selected = -1; + int _pressed = -1; + bool _selectedRemove = false; + bool _pressedRemove = false; + QPoint _mousePosition; + + QString _removeText; + int _removeWidth = 0; + +}; + +} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_settings_widget.cpp b/Telegram/SourceFiles/profile/profile_block_settings.cpp similarity index 99% rename from Telegram/SourceFiles/profile/profile_settings_widget.cpp rename to Telegram/SourceFiles/profile/profile_block_settings.cpp index b02da6f903..7a85981cd8 100644 --- a/Telegram/SourceFiles/profile/profile_settings_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_settings.cpp @@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "profile/profile_settings_widget.h" +#include "profile/profile_block_settings.h" #include "styles/style_profile.h" #include "ui/widgets/buttons.h" diff --git a/Telegram/SourceFiles/profile/profile_settings_widget.h b/Telegram/SourceFiles/profile/profile_block_settings.h similarity index 100% rename from Telegram/SourceFiles/profile/profile_settings_widget.h rename to Telegram/SourceFiles/profile/profile_block_settings.h diff --git a/Telegram/SourceFiles/profile/profile_shared_media_widget.cpp b/Telegram/SourceFiles/profile/profile_block_shared_media.cpp similarity index 98% rename from Telegram/SourceFiles/profile/profile_shared_media_widget.cpp rename to Telegram/SourceFiles/profile/profile_block_shared_media.cpp index 0054829de0..bece07ce2a 100644 --- a/Telegram/SourceFiles/profile/profile_shared_media_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_block_shared_media.cpp @@ -19,7 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "profile/profile_shared_media_widget.h" +#include "profile/profile_block_shared_media.h" #include "styles/style_profile.h" #include "observer_peer.h" diff --git a/Telegram/SourceFiles/profile/profile_shared_media_widget.h b/Telegram/SourceFiles/profile/profile_block_shared_media.h similarity index 100% rename from Telegram/SourceFiles/profile/profile_shared_media_widget.h rename to Telegram/SourceFiles/profile/profile_block_shared_media.h diff --git a/Telegram/SourceFiles/profile/profile_block_widget.h b/Telegram/SourceFiles/profile/profile_block_widget.h index a580803dfc..989f4edac9 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_widget.h @@ -24,12 +24,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org namespace Profile { +class SectionMemento; + class BlockWidget : public TWidget, protected base::Subscriber { Q_OBJECT public: BlockWidget(QWidget *parent, PeerData *peer, const QString &title); + virtual void showFinished() { + } + + virtual void saveState(SectionMemento *memento) const { + } + virtual void restoreState(const SectionMemento *memento) { + } + protected: void paintEvent(QPaintEvent *e) override; virtual void paintContents(Painter &p) { @@ -42,6 +52,7 @@ protected: int resizeGetHeight(int newWidth) override = 0; void contentSizeUpdated() { + auto oldHeight = height(); resizeToWidth(width()); emit heightUpdated(); } diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.cpp b/Telegram/SourceFiles/profile/profile_inner_widget.cpp index 87635380e0..38322712e7 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_inner_widget.cpp @@ -24,12 +24,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "styles/style_profile.h" #include "styles/style_window.h" #include "profile/profile_cover.h" -#include "profile/profile_info_widget.h" -#include "profile/profile_settings_widget.h" -#include "profile/profile_invite_link_widget.h" -#include "profile/profile_shared_media_widget.h" -#include "profile/profile_actions_widget.h" -#include "profile/profile_members_widget.h" +#include "profile/profile_block_common_groups.h" +#include "profile/profile_block_info.h" +#include "profile/profile_block_settings.h" +#include "profile/profile_block_invite_link.h" +#include "profile/profile_block_shared_media.h" +#include "profile/profile_block_actions.h" +#include "profile/profile_block_channel_members.h" +#include "profile/profile_block_group_members.h" #include "apiwrap.h" namespace Profile { @@ -48,7 +50,16 @@ void InnerWidget::createBlocks() { auto channel = _peer->asChannel(); auto megagroup = _peer->isMegagroup() ? channel : nullptr; if (user || channel || megagroup) { - _blocks.push_back({ new InfoWidget(this, _peer), BlockSide::Right }); + auto widget = new InfoWidget(this, _peer); + widget->setShowCommonGroupsObservable(&_showCommonGroupsObservable); + _blocks.push_back({ widget, BlockSide::Right }); + } + if (user) { + _commonGroupsWidget = new CommonGroupsWidget(this, _peer); + _commonGroupsWidget->setShowCommonGroupsObservable(&_showCommonGroupsObservable); + _blocks.push_back({ _commonGroupsWidget, BlockSide::Right }); + } else { + _commonGroupsWidget = nullptr; } _blocks.push_back({ new SettingsWidget(this, _peer), BlockSide::Right }); if (chat || channel || megagroup) { @@ -60,7 +71,7 @@ void InnerWidget::createBlocks() { } _blocks.push_back({ new ActionsWidget(this, _peer), BlockSide::Right }); if (chat || megagroup) { - auto membersWidget = new MembersWidget(this, _peer); + auto membersWidget = new GroupMembersWidget(this, _peer); connect(membersWidget, SIGNAL(onlineCountUpdated(int)), _cover, SLOT(onOnlineCountUpdated(int))); _cover->onOnlineCountUpdated(membersWidget->onlineCount()); _blocks.push_back({ membersWidget, BlockSide::Left }); @@ -89,8 +100,23 @@ bool InnerWidget::shareContactButtonShown() const { return _cover->shareContactButtonShown(); } +void InnerWidget::saveState(SectionMemento *memento) const { + for_const (auto &blockData, _blocks) { + blockData.block->saveState(memento); + } +} + +void InnerWidget::restoreState(const SectionMemento *memento) { + for_const (auto &blockData, _blocks) { + blockData.block->restoreState(memento); + } +} + void InnerWidget::showFinished() { _cover->showFinished(); + for_const (auto &blockData, _blocks) { + blockData.block->showFinished(); + } } void InnerWidget::decreaseAdditionalHeight(int removeHeight) { @@ -182,6 +208,8 @@ void InnerWidget::refreshBlocksPositions() { continue; } blockData.block->moveToLeft(left, top); + blockData.block->setVisibleTopBottom(_visibleTop - top, _visibleBottom - top); + top += blockData.block->height(); } }; diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.h b/Telegram/SourceFiles/profile/profile_inner_widget.h index 8a6f331802..7230ecf904 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.h +++ b/Telegram/SourceFiles/profile/profile_inner_widget.h @@ -20,10 +20,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once +#include "profile/profile_block_common_groups.h" + namespace Profile { class CoverWidget; class BlockWidget; +struct CommonGroupsEvent; +class SectionMemento; class InnerWidget final : public TWidget { Q_OBJECT @@ -48,6 +52,9 @@ public: // It should show it only if it is hidden in the cover. bool shareContactButtonShown() const; + void saveState(SectionMemento *memento) const; + void restoreState(const SectionMemento *memento); + void showFinished(); signals: @@ -110,7 +117,12 @@ private: }; QList _blocks; + // We need to save this pointer for getting common groups list for section memento. + CommonGroupsWidget *_commonGroupsWidget = nullptr; + Mode _mode = Mode::OneColumn; + + base::Observable _showCommonGroupsObservable; }; } // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_members_widget.cpp b/Telegram/SourceFiles/profile/profile_members_widget.cpp deleted file mode 100644 index 3f9b43c078..0000000000 --- a/Telegram/SourceFiles/profile/profile_members_widget.cpp +++ /dev/null @@ -1,713 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#include "stdafx.h" -#include "profile/profile_members_widget.h" - -#include "styles/style_profile.h" -#include "mtproto/file_download.h" -#include "ui/widgets/buttons.h" -#include "ui/widgets/labels.h" -#include "boxes/contactsbox.h" -#include "boxes/confirmbox.h" -#include "core/click_handler_types.h" -#include "apiwrap.h" -#include "mainwidget.h" -#include "observer_peer.h" -#include "lang.h" - -namespace Profile { - -using UpdateFlag = Notify::PeerUpdate::Flag; - -MembersWidget::MembersWidget(QWidget *parent, PeerData *peer, TitleVisibility titleVisibility) -: BlockWidget(parent, peer, (titleVisibility == TitleVisibility::Visible) ? lang(lng_profile_participants_section) : QString()) { - setMouseTracking(true); - - _removeWidth = st::normalFont->width(lang(lng_profile_kick)); - - _updateOnlineTimer.setSingleShot(true); - connect(&_updateOnlineTimer, SIGNAL(timeout()), this, SLOT(onUpdateOnlineDisplay())); - - auto observeEvents = UpdateFlag::AdminsChanged - | UpdateFlag::MembersChanged - | UpdateFlag::UserOnlineChanged; - subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { - notifyPeerUpdated(update); - })); - subscribe(FileDownload::ImageLoaded(), [this] { update(); }); - - refreshMembers(); -} - -void MembersWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { - if (update.peer != peer()) { - if (update.flags & UpdateFlag::UserOnlineChanged) { - if (auto user = update.peer->asUser()) { - refreshUserOnline(user); - } - } - return; - } - - if (update.flags & UpdateFlag::MembersChanged) { - refreshMembers(); - contentSizeUpdated(); - } else if (update.flags & UpdateFlag::AdminsChanged) { - if (auto chat = peer()->asChat()) { - for_const (auto member, _list) { - setMemberFlags(member, chat); - } - } else if (auto megagroup = peer()->asMegagroup()) { - for_const (auto member, _list) { - setMemberFlags(member, megagroup); - } - } - } - this->update(); -} - -void MembersWidget::refreshUserOnline(UserData *user) { - auto it = _membersByUser.find(user); - if (it == _membersByUser.cend()) return; - - _now = unixtime(); - - auto member = it.value(); - member->online = !user->botInfo && App::onlineColorUse(user->onlineTill, _now); - member->onlineTill = user->onlineTill; - member->onlineForSort = user->isSelf() ? INT_MAX : App::onlineForSort(user, _now); - member->onlineText = QString(); - - sortMembers(); - update(); -} - -void MembersWidget::setVisibleTopBottom(int visibleTop, int visibleBottom) { - _visibleTop = visibleTop; - _visibleBottom = visibleBottom; - - if (auto megagroup = peer()->asMegagroup()) { - auto megagroupInfo = megagroup->mgInfo; - if (!megagroupInfo->lastParticipants.isEmpty() && megagroupInfo->lastParticipants.size() < megagroup->membersCount()) { - if (_visibleTop + PreloadHeightsCount * (_visibleBottom - _visibleTop) > height()) { - App::api()->requestLastParticipants(megagroup, false); - } - } - } - - preloadUserPhotos(); -} - -int MembersWidget::resizeGetHeight(int newWidth) { - int newHeight = contentTop(); - - if (_limitReachedInfo) { - int limitReachedInfoWidth = newWidth - getListLeft(); - accumulate_min(limitReachedInfoWidth, st::profileBlockWideWidthMax); - - _limitReachedInfo->resizeToWidth(limitReachedInfoWidth); - _limitReachedInfo->moveToLeft(getListLeft(), contentTop()); - newHeight = getListTop(); - } - - newHeight += _list.size() * st::profileMemberHeight; - - return newHeight; -} - -void MembersWidget::paintContents(Painter &p) { - int left = getListLeft(); - int top = getListTop(); - int memberRowWidth = width() - left; - accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); - if (_limitReachedInfo) { - int infoTop = contentTop(); - int infoHeight = top - infoTop - st::profileLimitReachedSkip; - paintOutlinedRect(p, left, infoTop, memberRowWidth, infoHeight); - } - - _now = unixtime(); - int from = floorclamp(_visibleTop - top, st::profileMemberHeight, 0, _list.size()); - int to = ceilclamp(_visibleBottom - top, st::profileMemberHeight, 0, _list.size()); - for (int i = from; i < to; ++i) { - int y = top + i * st::profileMemberHeight; - bool selected = (i == _selected); - bool selectedKick = selected && _selectedKick; - if (_pressed >= 0) { - if (_pressed != _selected) { - selected = selectedKick = false; - } else if (!_pressedKick) { - _selectedKick = false; - } - } - paintMember(p, left, y, _list.at(i), selected, selectedKick); - } -} - -void MembersWidget::paintOutlinedRect(Painter &p, int x, int y, int w, int h) const { - int outlineWidth = st::defaultLeftOutlineButton.outlineWidth; - p.fillRect(rtlrect(x, y, outlineWidth, h, width()), st::defaultLeftOutlineButton.outlineFgOver); - p.fillRect(rtlrect(x + outlineWidth, y, w - outlineWidth, h, width()), st::defaultLeftOutlineButton.textBgOver); -} - -void MembersWidget::mouseMoveEvent(QMouseEvent *e) { - _mousePosition = e->globalPos(); - updateSelection(); -} - -void MembersWidget::mousePressEvent(QMouseEvent *e) { - _mousePosition = e->globalPos(); - updateSelection(); - - _pressed = _selected; - _pressedKick = _selectedKick; -} - -void MembersWidget::mouseReleaseEvent(QMouseEvent *e) { - _mousePosition = e->globalPos(); - updateSelection(); - - auto pressed = _pressed; - auto pressedKick = _pressedKick; - _pressed = -1; - _pressedKick = false; - if (pressed >= 0 && pressed < _list.size() && pressed == _selected && pressedKick == _selectedKick) { - auto member = _list.at(pressed); - if (pressedKick) { - Ui::showLayer(new KickMemberBox(peer(), member->user)); - } else { - Ui::showPeerProfile(member->user); - } - } - setCursor(_selectedKick ? style::cur_pointer : style::cur_default); - repaintSelectedRow(); -} - -void MembersWidget::enterEvent(QEvent *e) { - _mousePosition = QCursor::pos(); - updateSelection(); -} - -void MembersWidget::leaveEvent(QEvent *e) { - _mousePosition = QPoint(-1, -1); - updateSelection(); -} - -void MembersWidget::updateSelection() { - int selected = -1; - bool selectedKick = false; - - auto mouse = mapFromGlobal(_mousePosition); - if (rtl()) mouse.setX(width() - mouse.x()); - int left = getListLeft(); - int top = getListTop(); - int memberRowWidth = width() - left; - accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); - if (mouse.x() >= left && mouse.x() < left + memberRowWidth && mouse.y() >= top) { - selected = (mouse.y() - top) / st::profileMemberHeight; - if (selected >= _list.size()) { - selected = -1; - } else if (_list.at(selected)->canBeKicked) { - int skip = st::profileMemberPhotoPosition.x(); - int nameLeft = left + st::profileMemberNamePosition.x(); - int nameTop = top + _selected * st::profileMemberHeight + st::profileMemberNamePosition.y(); - int nameWidth = memberRowWidth - st::profileMemberNamePosition.x() - skip; - if (mouse.x() >= nameLeft + nameWidth - _removeWidth && mouse.x() < nameLeft + nameWidth) { - if (mouse.y() >= nameTop && mouse.y() < nameTop + st::normalFont->height) { - selectedKick = true; - } - } - } - } - - setSelected(selected, selectedKick); -} - -void MembersWidget::setSelected(int selected, bool selectedKick) { - if (_selected == selected && _selectedKick == selectedKick) { - return; - } - - repaintSelectedRow(); - if (_selectedKick != selectedKick) { - _selectedKick = selectedKick; - if (_pressed < 0) { - setCursor(_selectedKick ? style::cur_pointer : style::cur_default); - } - } - if (_selected != selected) { - _selected = selected; - repaintSelectedRow(); - } -} - -void MembersWidget::repaintSelectedRow() { - if (_selected >= 0) { - int left = getListLeft(); - rtlupdate(left, getListTop() + _selected * st::profileMemberHeight, width() - left, st::profileMemberHeight); - } -} - -int MembersWidget::getListLeft() const { - return st::profileBlockTitlePosition.x() - st::profileMemberPaddingLeft; -} - -int MembersWidget::getListTop() const { - int result = contentTop(); - if (_limitReachedInfo) { - result += _limitReachedInfo->height(); - result += st::profileLimitReachedSkip; - } - return result; -} - -void MembersWidget::refreshMembers() { - _now = unixtime(); - if (auto chat = peer()->asChat()) { - checkSelfAdmin(chat); - if (chat->noParticipantInfo()) { - App::api()->requestFullPeer(chat); - } - fillChatMembers(chat); - refreshLimitReached(); - } else if (auto megagroup = peer()->asMegagroup()) { - checkSelfAdmin(megagroup); - auto megagroupInfo = megagroup->mgInfo; - if (megagroupInfo->lastParticipants.isEmpty() || megagroup->lastParticipantsCountOutdated()) { - App::api()->requestLastParticipants(megagroup); - } - fillMegagroupMembers(megagroup); - } - sortMembers(); - - refreshVisibility(); -} - -void MembersWidget::refreshLimitReached() { - auto chat = peer()->asChat(); - if (!chat) return; - - bool limitReachedShown = (_list.size() >= Global::ChatSizeMax()) && chat->amCreator() && !emptyTitle(); - if (limitReachedShown && !_limitReachedInfo) { - _limitReachedInfo.create(this, st::profileLimitReachedLabel, st::profileLimitReachedStyle); - QString title = textRichPrepare(lng_profile_migrate_reached(lt_count, Global::ChatSizeMax())); - QString body = textRichPrepare(lang(lng_profile_migrate_body)); - QString link = textRichPrepare(lang(lng_profile_migrate_learn_more)); - QString text = qsl("%1%2%3\n%4 [a href=\"https://telegram.org/blog/supergroups5k\"]%5[/a]").arg(textcmdStartSemibold()).arg(title).arg(textcmdStopSemibold()).arg(body).arg(link); - _limitReachedInfo->setRichText(text); - _limitReachedInfo->setClickHandlerHook([this](const ClickHandlerPtr &handler, Qt::MouseButton button) { - Ui::showLayer(new ConvertToSupergroupBox(peer()->asChat())); - return false; - }); - } else if (!limitReachedShown && _limitReachedInfo) { - _limitReachedInfo.destroy(); - } -} - -void MembersWidget::checkSelfAdmin(ChatData *chat) { - if (chat->participants.isEmpty()) return; - - auto self = App::self(); - if (chat->amAdmin() && !chat->admins.contains(self)) { - chat->admins.insert(self); - } else if (!chat->amAdmin() && chat->admins.contains(self)) { - chat->admins.remove(self); - } -} - -void MembersWidget::checkSelfAdmin(ChannelData *megagroup) { - if (megagroup->mgInfo->lastParticipants.isEmpty()) return; - - bool amAdmin = (megagroup->amCreator() || megagroup->amEditor()); - auto self = App::self(); - if (amAdmin && !megagroup->mgInfo->lastAdmins.contains(self)) { - megagroup->mgInfo->lastAdmins.insert(self); - } else if (!amAdmin && megagroup->mgInfo->lastAdmins.contains(self)) { - megagroup->mgInfo->lastAdmins.remove(self); - } -} - -void MembersWidget::preloadUserPhotos() { - int top = getListTop(); - int preloadFor = (_visibleBottom - _visibleTop) * PreloadHeightsCount; - int from = floorclamp(_visibleTop - top, st::profileMemberHeight, 0, _list.size()); - int to = ceilclamp(_visibleBottom + preloadFor - top, st::profileMemberHeight, 0, _list.size()); - for (int i = from; i < to; ++i) { - _list.at(i)->user->loadUserpic(); - } -} - -void MembersWidget::refreshVisibility() { - setVisible(!_list.isEmpty()); -} - -void MembersWidget::sortMembers() { - if (!_sortByOnline || _list.isEmpty()) return; - - qSort(_list.begin(), _list.end(), [](Member *a, Member *b) -> bool { - return a->onlineForSort > b->onlineForSort; - }); - - updateOnlineCount(); -} - -void MembersWidget::updateOnlineCount() { - bool onlyMe = true; - int newOnlineCount = 0; - for_const (auto member, _list) { - bool isOnline = !member->user->botInfo && App::onlineColorUse(member->onlineTill, _now); - if (member->online != isOnline) { - member->online = isOnline; - member->onlineText = QString(); - } - if (member->online) { - ++newOnlineCount; - if (!member->user->isSelf()) { - onlyMe = false; - } - } - } - if (newOnlineCount == 1 && onlyMe) { - newOnlineCount = 0; - } - if (_onlineCount != newOnlineCount) { - _onlineCount = newOnlineCount; - emit onlineCountUpdated(_onlineCount); - } -} - -MembersWidget::Member *MembersWidget::addUser(ChatData *chat, UserData *user) { - auto member = getMember(user); - setMemberFlags(member, chat); - _list.push_back(member); - return member; -} - -void MembersWidget::fillChatMembers(ChatData *chat) { - if (chat->participants.isEmpty()) return; - - _list.clear(); - if (!chat->amIn()) return; - - _sortByOnline = true; - - _list.reserve(chat->participants.size()); - addUser(chat, App::self())->onlineForSort = INT_MAX; // Put me on the first place. - for (auto i = chat->participants.cbegin(), e = chat->participants.cend(); i != e; ++i) { - auto user = i.key(); - if (!user->isSelf()) { - addUser(chat, user); - } - } -} - -void MembersWidget::setMemberFlags(Member *member, ChatData *chat) { - auto isCreator = (chat->creator == peerToUser(member->user->id)); - auto isAdmin = chat->admins.contains(member->user); - member->isAdmin = isCreator || isAdmin; - if (member->user->id == peerFromUser(MTP::authedId())) { - member->canBeKicked = false; - } else if (chat->amCreator() || (chat->amAdmin() && !member->isAdmin)) { - member->canBeKicked = true; - } else { - member->canBeKicked = chat->invitedByMe.contains(member->user); - } -} - -MembersWidget::Member *MembersWidget::addUser(ChannelData *megagroup, UserData *user) { - auto member = getMember(user); - setMemberFlags(member, megagroup); - _list.push_back(member); - return member; -} - -void MembersWidget::fillMegagroupMembers(ChannelData *megagroup) { - t_assert(megagroup->mgInfo != nullptr); - if (megagroup->mgInfo->lastParticipants.isEmpty()) return; - - if (!megagroup->canViewMembers()) { - _list.clear(); - return; - } - - _sortByOnline = (megagroup->membersCount() > 0 && megagroup->membersCount() <= Global::ChatSizeMax()); - - auto &membersList = megagroup->mgInfo->lastParticipants; - if (_sortByOnline) { - _list.clear(); - _list.reserve(membersList.size()); - if (megagroup->amIn()) { - addUser(megagroup, App::self())->onlineForSort = INT_MAX; - } - } else if (membersList.size() >= _list.size()) { - if (addUsersToEnd(megagroup)) { - return; - } - } - if (!_sortByOnline) { - _list.clear(); - _list.reserve(membersList.size()); - } - for_const (auto user, membersList) { - if (!_sortByOnline || !user->isSelf()) { - addUser(megagroup, user); - } - } -} - -bool MembersWidget::addUsersToEnd(ChannelData *megagroup) { - auto &membersList = megagroup->mgInfo->lastParticipants; - for (int i = 0, count = _list.size(); i < count; ++i) { - if (_list.at(i)->user != membersList.at(i)) { - return false; - } - } - _list.reserve(membersList.size()); - for (int i = _list.size(), count = membersList.size(); i < count; ++i) { - addUser(megagroup, membersList.at(i)); - } - return true; -} - -void MembersWidget::setMemberFlags(Member *member, ChannelData *megagroup) { - auto amCreatorOrAdmin = (peerToUser(member->user->id) == MTP::authedId()) && (megagroup->amCreator() || megagroup->amEditor()); - auto isAdmin = megagroup->mgInfo->lastAdmins.contains(member->user); - member->isAdmin = amCreatorOrAdmin || isAdmin; - if (member->user->isSelf()) { - member->canBeKicked = false; - } else if (megagroup->amCreator() || (megagroup->amEditor() && !member->isAdmin)) { - member->canBeKicked = true; - } else { - member->canBeKicked = false; - } -} - -MembersWidget::Member *MembersWidget::getMember(UserData *user) { - auto it = _membersByUser.constFind(user); - if (it == _membersByUser.cend()) { - auto member = new Member(user); - it = _membersByUser.insert(user, member); - member->online = !user->botInfo && App::onlineColorUse(user->onlineTill, _now); - member->onlineTill = user->onlineTill; - member->onlineForSort = App::onlineForSort(user, _now); - } - return it.value(); -} - -void MembersWidget::paintMember(Painter &p, int x, int y, Member *member, bool selected, bool selectedKick) { - int memberRowWidth = width() - x; - if (selected) { - accumulate_min(memberRowWidth, st::profileBlockWideWidthMax); - paintOutlinedRect(p, x, y, memberRowWidth, st::profileMemberHeight); - } - int skip = st::profileMemberPhotoPosition.x(); - - member->user->paintUserpicLeft(p, st::profileMemberPhotoSize, x + st::profileMemberPhotoPosition.x(), y + st::profileMemberPhotoPosition.y(), width()); - - if (member->name.isEmpty()) { - member->name.setText(st::semiboldFont, App::peerName(member->user), _textNameOptions); - } - int nameLeft = x + st::profileMemberNamePosition.x(); - int nameTop = y + st::profileMemberNamePosition.y(); - int nameWidth = memberRowWidth - st::profileMemberNamePosition.x() - skip; - if (member->canBeKicked && selected) { - p.setFont(selectedKick ? st::normalFont->underline() : st::normalFont); - p.setPen(st::windowActiveTextFg); - p.drawTextLeft(nameLeft + nameWidth - _removeWidth, nameTop, width(), lang(lng_profile_kick), _removeWidth); - nameWidth -= _removeWidth + skip; - } - if (member->isAdmin) { - nameWidth -= st::profileMemberAdminIcon.width(); - int iconLeft = nameLeft + qMin(nameWidth, member->name.maxWidth()); - st::profileMemberAdminIcon.paint(p, QPoint(iconLeft, nameTop), width()); - } - p.setPen(st::profileMemberNameFg); - member->name.drawLeftElided(p, nameLeft, nameTop, nameWidth, width()); - - if (member->onlineText.isEmpty() || (member->onlineTextTill <= _now)) { - if (member->user->botInfo) { - bool seesAllMessages = (member->user->botInfo->readsAllHistory || member->isAdmin); - member->onlineText = lang(seesAllMessages ? lng_status_bot_reads_all : lng_status_bot_not_reads_all); - member->onlineTextTill = _now + 86400; - } else { - member->online = App::onlineColorUse(member->onlineTill, _now); - member->onlineText = App::onlineText(member->onlineTill, _now); - member->onlineTextTill = _now + App::onlineWillChangeIn(member->onlineTill, _now); - } - } - if (_updateOnlineAt <= _now || _updateOnlineAt > member->onlineTextTill) { - _updateOnlineAt = member->onlineTextTill; - _updateOnlineTimer.start((_updateOnlineAt - _now + 1) * 1000); - } - - if (member->online) { - p.setPen(st::profileMemberStatusFgActive); - } else { - p.setPen(selected ? st::profileMemberStatusFgOver : st::profileMemberStatusFg); - } - p.setFont(st::normalFont); - p.drawTextLeft(x + st::profileMemberStatusPosition.x(), y + st::profileMemberStatusPosition.y(), width(), member->onlineText); -} - -void MembersWidget::onUpdateOnlineDisplay() { - if (_sortByOnline) { - _now = unixtime(); - - bool changed = false; - for_const (auto member, _list) { - if (!member->online) { - if (!member->user->isSelf()) { - continue; - } else { - break; - } - } - bool isOnline = !member->user->botInfo && App::onlineColorUse(member->onlineTill, _now); - if (!isOnline) { - changed = true; - } - } - if (changed) { - updateOnlineCount(); - } - } - update(); -} - -MembersWidget::~MembersWidget() { - auto members = base::take(_membersByUser); - for_const (auto member, members) { - delete member; - } -} - -ChannelMembersWidget::ChannelMembersWidget(QWidget *parent, PeerData *peer) : BlockWidget(parent, peer, lang(lng_profile_participants_section)) { - auto observeEvents = UpdateFlag::ChannelCanViewAdmins - | UpdateFlag::ChannelCanViewMembers - | UpdateFlag::AdminsChanged - | UpdateFlag::MembersChanged; - subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { - notifyPeerUpdated(update); - })); - - refreshButtons(); -} - -void ChannelMembersWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) { - if (update.peer != peer()) { - return; - } - - if (update.flags & (UpdateFlag::ChannelCanViewAdmins | UpdateFlag::AdminsChanged)) { - refreshAdmins(); - } - if (update.flags & (UpdateFlag::ChannelCanViewMembers | UpdateFlag::MembersChanged)) { - refreshMembers(); - } - refreshVisibility(); - - contentSizeUpdated(); -} - -void ChannelMembersWidget::addButton(const QString &text, ChildWidget *button, const char *slot) { - if (text.isEmpty()) { - button->destroy(); - } else if (*button) { - (*button)->setText(text); - } else { - (*button) = new Ui::LeftOutlineButton(this, text, st::defaultLeftOutlineButton); - (*button)->show(); - connect(*button, SIGNAL(clicked()), this, slot); - } -} - -void ChannelMembersWidget::refreshButtons() { - refreshAdmins(); - refreshMembers(); - - refreshVisibility(); -} - -void ChannelMembersWidget::refreshAdmins() { - auto getAdminsText = [this]() -> QString { - if (auto channel = peer()->asChannel()) { - if (!channel->isMegagroup() && channel->canViewAdmins()) { - int adminsCount = qMax(channel->adminsCount(), 1); - return lng_channel_admins_link(lt_count, adminsCount); - } - } - return QString(); - }; - addButton(getAdminsText(), &_admins, SLOT(onAdmins())); -} - -void ChannelMembersWidget::refreshMembers() { - auto getMembersText = [this]() -> QString { - if (auto channel = peer()->asChannel()) { - if (!channel->isMegagroup() && channel->canViewMembers()) { - int membersCount = qMax(channel->membersCount(), 1); - return lng_channel_members_link(lt_count, membersCount); - } - } - return QString(); - }; - addButton(getMembersText(), &_members, SLOT(onMembers())); -} - -void ChannelMembersWidget::refreshVisibility() { - setVisible(_admins || _members); -} - -int ChannelMembersWidget::resizeGetHeight(int newWidth) { - int newHeight = contentTop(); - - auto resizeButton = [this, &newHeight, newWidth](ChildWidget &button) { - if (!button) { - return; - } - - int left = defaultOutlineButtonLeft(); - int availableWidth = newWidth - left - st::profileBlockMarginRight; - accumulate_min(availableWidth, st::profileBlockOneLineWidthMax); - button->resizeToWidth(availableWidth); - button->moveToLeft(left, newHeight); - newHeight += button->height(); - }; - - resizeButton(_admins); - resizeButton(_members); - - return newHeight; -} - -void ChannelMembersWidget::onAdmins() { - if (auto channel = peer()->asChannel()) { - Ui::showLayer(new MembersBox(channel, MembersFilter::Admins)); - } -} - -void ChannelMembersWidget::onMembers() { - if (auto channel = peer()->asChannel()) { - Ui::showLayer(new MembersBox(channel, MembersFilter::Recent)); - } -} - -} // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_section_memento.cpp b/Telegram/SourceFiles/profile/profile_section_memento.cpp index 34f8ab4108..e64b23a2db 100644 --- a/Telegram/SourceFiles/profile/profile_section_memento.cpp +++ b/Telegram/SourceFiles/profile/profile_section_memento.cpp @@ -27,8 +27,7 @@ namespace Profile { Window::SectionWidget *SectionMemento::createWidget(QWidget *parent, const QRect &geometry) const { auto result = new Widget(parent, _peer); - result->setGeometry(geometry); - result->setInternalState(this); + result->setInternalState(geometry, this); return result; } diff --git a/Telegram/SourceFiles/profile/profile_section_memento.h b/Telegram/SourceFiles/profile/profile_section_memento.h index b73a1a8455..680cb592b6 100644 --- a/Telegram/SourceFiles/profile/profile_section_memento.h +++ b/Telegram/SourceFiles/profile/profile_section_memento.h @@ -33,11 +33,26 @@ public: Window::SectionWidget *createWidget(QWidget *parent, const QRect &geometry) const override; -private: - friend class Widget; + PeerData *getPeer() const { + return _peer; + } + void setScrollTop(int scrollTop) { + _scrollTop = scrollTop; + } + int getScrollTop() const { + return _scrollTop; + } + void setCommonGroups(const QList &groups) { + _commonGroups = groups; + } + const QList &getCommonGroups() const { + return _commonGroups; + } +private: PeerData *_peer; int _scrollTop = 0; + QList _commonGroups; }; diff --git a/Telegram/SourceFiles/profile/profile_widget.cpp b/Telegram/SourceFiles/profile/profile_widget.cpp index a339ca3ac7..30c42d76cb 100644 --- a/Telegram/SourceFiles/profile/profile_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_widget.cpp @@ -74,28 +74,38 @@ void Widget::setInnerFocus() { bool Widget::showInternal(const Window::SectionMemento *memento) { if (auto profileMemento = dynamic_cast(memento)) { - if (profileMemento->_peer == peer()) { - // Perhaps no need to do that?.. - _scroll->scrollToY(profileMemento->_scrollTop); - + if (profileMemento->getPeer() == peer()) { + restoreState(profileMemento); return true; } } return false; } -void Widget::setInternalState(const SectionMemento *memento) { +void Widget::setInternalState(const QRect &geometry, const SectionMemento *memento) { + setGeometry(geometry); myEnsureResized(this); - _scroll->scrollToY(memento->_scrollTop); - _fixedBarShadow->setMode(memento->_scrollTop > 0 ? Ui::ToggleableShadow::Mode::ShownFast : Ui::ToggleableShadow::Mode::HiddenFast); + restoreState(memento); } std_::unique_ptr Widget::createMemento() const { auto result = std_::make_unique(peer()); - result->_scrollTop = _scroll->scrollTop(); + saveState(result.get()); return std_::move(result); } +void Widget::saveState(SectionMemento *memento) const { + memento->setScrollTop(_scroll->scrollTop()); + _inner->saveState(memento); +} + +void Widget::restoreState(const SectionMemento *memento) { + _inner->restoreState(memento); + auto scrollTop = memento->getScrollTop(); + _scroll->scrollToY(scrollTop); + _fixedBarShadow->setMode((scrollTop > 0) ? Ui::ToggleableShadow::Mode::ShownFast : Ui::ToggleableShadow::Mode::HiddenFast); +} + void Widget::resizeEvent(QResizeEvent *e) { if (!width() || !height()) { return; diff --git a/Telegram/SourceFiles/profile/profile_widget.h b/Telegram/SourceFiles/profile/profile_widget.h index c446de3754..850acbd323 100644 --- a/Telegram/SourceFiles/profile/profile_widget.h +++ b/Telegram/SourceFiles/profile/profile_widget.h @@ -54,7 +54,7 @@ public: bool showInternal(const Window::SectionMemento *memento) override; std_::unique_ptr createMemento() const override; - void setInternalState(const SectionMemento *memento); + void setInternalState(const QRect &geometry, const SectionMemento *memento); protected: void resizeEvent(QResizeEvent *e) override; @@ -67,8 +67,8 @@ private slots: private: void updateAdaptiveLayout(); - - friend class SectionMemento; + void saveState(SectionMemento *memento) const; + void restoreState(const SectionMemento *memento); ChildWidget _scroll; ChildWidget _inner; diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index b644cc9be4..87ebdb7f22 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -282,6 +282,13 @@ bool UserData::setAbout(const QString &newAbout) { return true; } +void UserData::setCommonChatsCount(int count) { + if (_commonChatsCount != count) { + _commonChatsCount = count; + Notify::peerUpdatedDelayed(this, UpdateFlag::UserCommonChatsChanged); + } +} + void UserData::setName(const QString &newFirstName, const QString &newLastName, const QString &newPhoneName, const QString &newUsername) { bool changeName = !newFirstName.isEmpty() || !newLastName.isEmpty(); diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 425a198d20..8265c26a7d 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -468,11 +468,17 @@ public: _restrictionReason = reason; } + int commonChatsCount() const { + return _commonChatsCount; + } + void setCommonChatsCount(int count); + private: QString _restrictionReason; QString _about; QString _phone; BlockStatus _blockStatus = BlockStatus::Unknown; + int _commonChatsCount = 0; }; @@ -615,14 +621,6 @@ private: }; struct MegagroupInfo { - MegagroupInfo() - : botStatus(0) - , pinnedMsgId(0) - , joinedMessageFound(false) - , lastParticipantsStatus(LastParticipantsUpToDate) - , lastParticipantsCount(0) - , migrateFromPtr(0) { - } typedef QList LastParticipants; LastParticipants lastParticipants; typedef OrderedSet LastAdmins; @@ -631,20 +629,20 @@ struct MegagroupInfo { MarkupSenders markupSenders; typedef OrderedSet Bots; Bots bots; - int32 botStatus; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other - MsgId pinnedMsgId; - bool joinedMessageFound; + int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other + MsgId pinnedMsgId = 0; + bool joinedMessageFound = false; enum LastParticipantsStatus { LastParticipantsUpToDate = 0x00, LastParticipantsAdminsOutdated = 0x01, LastParticipantsCountOutdated = 0x02, }; - mutable int32 lastParticipantsStatus; - int32 lastParticipantsCount; + mutable int lastParticipantsStatus = LastParticipantsUpToDate; + int lastParticipantsCount = 0; - ChatData *migrateFromPtr; + ChatData *migrateFromPtr = nullptr; }; class ChannelData : public PeerData { @@ -657,6 +655,9 @@ public: void updateFull(bool force = false); void fullUpdated(); + bool wasFullUpdated() const { + return (_lastFullUpdate != 0); + } uint64 access = 0; @@ -798,6 +799,12 @@ public: void ptsWaitingForShortPoll(int32 ms) { // < 0 - not waiting return _ptsWaiter.setWaitingForShortPoll(this, ms); } + bool ptsWaitingForSkipped() const { + return _ptsWaiter.waitingForSkipped(); + } + bool ptsWaitingForShortPoll() const { + return _ptsWaiter.waitingForShortPoll(); + } QString restrictionReason() const override { return _restrictionReason; diff --git a/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp b/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp index 5fb4abb3bd..af45eaf8bd 100644 --- a/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp +++ b/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp @@ -24,7 +24,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "mainwindow.h" #include "ui/widgets/scroll_area.h" #include "ui/widgets/shadow.h" -#include "profile/profile_members_widget.h" #include "ui/effects/panel_animation.h" namespace { diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index 4d9f0dde65..dd64f33476 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -390,8 +390,24 @@ '<(src_loc)/platform/platform_main_window.h', '<(src_loc)/platform/platform_notifications_manager.h', '<(src_loc)/platform/platform_window_title.h', - '<(src_loc)/profile/profile_actions_widget.cpp', - '<(src_loc)/profile/profile_actions_widget.h', + '<(src_loc)/profile/profile_block_actions.cpp', + '<(src_loc)/profile/profile_block_actions.h', + '<(src_loc)/profile/profile_block_channel_members.cpp', + '<(src_loc)/profile/profile_block_channel_members.h', + '<(src_loc)/profile/profile_block_common_groups.cpp', + '<(src_loc)/profile/profile_block_common_groups.h', + '<(src_loc)/profile/profile_block_info.cpp', + '<(src_loc)/profile/profile_block_info.h', + '<(src_loc)/profile/profile_block_invite_link.cpp', + '<(src_loc)/profile/profile_block_invite_link.h', + '<(src_loc)/profile/profile_block_group_members.cpp', + '<(src_loc)/profile/profile_block_group_members.h', + '<(src_loc)/profile/profile_block_peer_list.cpp', + '<(src_loc)/profile/profile_block_peer_list.h', + '<(src_loc)/profile/profile_block_settings.cpp', + '<(src_loc)/profile/profile_block_settings.h', + '<(src_loc)/profile/profile_block_shared_media.cpp', + '<(src_loc)/profile/profile_block_shared_media.h', '<(src_loc)/profile/profile_block_widget.cpp', '<(src_loc)/profile/profile_block_widget.h', '<(src_loc)/profile/profile_cover_drop_area.cpp', @@ -400,20 +416,10 @@ '<(src_loc)/profile/profile_cover.h', '<(src_loc)/profile/profile_fixed_bar.cpp', '<(src_loc)/profile/profile_fixed_bar.h', - '<(src_loc)/profile/profile_info_widget.cpp', - '<(src_loc)/profile/profile_info_widget.h', '<(src_loc)/profile/profile_inner_widget.cpp', '<(src_loc)/profile/profile_inner_widget.h', - '<(src_loc)/profile/profile_invite_link_widget.cpp', - '<(src_loc)/profile/profile_invite_link_widget.h', - '<(src_loc)/profile/profile_members_widget.cpp', - '<(src_loc)/profile/profile_members_widget.h', '<(src_loc)/profile/profile_section_memento.cpp', '<(src_loc)/profile/profile_section_memento.h', - '<(src_loc)/profile/profile_settings_widget.cpp', - '<(src_loc)/profile/profile_settings_widget.h', - '<(src_loc)/profile/profile_shared_media_widget.cpp', - '<(src_loc)/profile/profile_shared_media_widget.h', '<(src_loc)/profile/profile_userpic_button.cpp', '<(src_loc)/profile/profile_userpic_button.h', '<(src_loc)/profile/profile_widget.cpp',