From 533a955dda2bf532ee0eb9a10b93c23d98fc7c93 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 20 May 2016 19:01:06 +0300 Subject: [PATCH] Unread outgoing messages in supergroups supported. Looking through the history of group avatar photos added. Messages about some contact joined Telegram are never unread. --- Telegram/SourceFiles/apiwrap.cpp | 4 +- Telegram/SourceFiles/app.cpp | 6 +- Telegram/SourceFiles/app.h | 2 +- Telegram/SourceFiles/config.h | 1 - Telegram/SourceFiles/dialogswidget.cpp | 24 +- Telegram/SourceFiles/history.cpp | 101 ++++++-- Telegram/SourceFiles/history.h | 52 ++-- Telegram/SourceFiles/intro/introphone.cpp | 4 +- Telegram/SourceFiles/mainwidget.cpp | 14 +- Telegram/SourceFiles/mainwindow.cpp | 2 +- Telegram/SourceFiles/mediaview.cpp | 247 ++++++++++++------- Telegram/SourceFiles/mediaview.h | 84 ++++--- Telegram/SourceFiles/mtproto/connection.cpp | 2 +- Telegram/SourceFiles/mtproto/core_types.h | 3 + Telegram/SourceFiles/mtproto/scheme.tl | 32 +-- Telegram/SourceFiles/mtproto/scheme_auto.cpp | 227 ++++++++--------- Telegram/SourceFiles/mtproto/scheme_auto.h | 219 ++++++++-------- Telegram/SourceFiles/profilewidget.cpp | 8 + Telegram/SourceFiles/profilewidget.h | 2 +- 19 files changed, 575 insertions(+), 459 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index d49c68cc4..e4685a551 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -218,7 +218,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt LOG(("MTP Error: bad type in gotChatFull for channel: %1").arg(d.vfull_chat.type())); return; } - const auto &f(d.vfull_chat.c_channelFull()); + auto &f(d.vfull_chat.c_channelFull()); PhotoData *photo = App::feedPhoto(f.vchat_photo); ChannelData *channel = peer->asChannel(); channel->flagsFull = f.vflags.v; @@ -257,7 +257,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt App::main()->peerUpdated(cfrom); } } - const auto &v(f.vbot_info.c_vector().v); + auto &v(f.vbot_info.c_vector().v); for (QVector::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) { switch (i->type()) { case mtpc_botInfo: { diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 5c9ab777c..b608dca6e 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1734,11 +1734,11 @@ namespace { } History *history(const PeerId &peer) { - return ::histories.findOrInsert(peer, 0, 0); + return ::histories.findOrInsert(peer, 0, 0, 0); } - History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead) { - return ::histories.findOrInsert(peer, unreadCnt, maxInboxRead); + History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead, int32 maxOutboxRead) { + return ::histories.findOrInsert(peer, unreadCnt, maxInboxRead, maxOutboxRead); } History *historyLoaded(const PeerId &peer) { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 4e437b71b..fd8784147 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -158,7 +158,7 @@ namespace App { Histories &histories(); History *history(const PeerId &peer); - History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead); + History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead, int32 maxOutboxRead); History *historyLoaded(const PeerId &peer); HistoryItem *histItemById(ChannelId channelId, MsgId itemId); inline History *history(const PeerData *peer) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 30afebbf6..8c9393ce7 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -313,7 +313,6 @@ inline const char *cApiSystemVersion() { inline QString cApiAppVersion() { return QString::number(AppVersion); } -static const char *ApiLang = "en"; extern QString gKeyFile; inline const QString &cDataFile() { diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index b7f48c84e..0096dd169 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -976,22 +976,22 @@ void DialogsInner::itemRemoved(HistoryItem *item) { } void DialogsInner::dialogsReceived(const QVector &added) { - for (QVector::const_iterator i = added.cbegin(), e = added.cend(); i != e; ++i) { - History *history = 0; - switch (i->type()) { + for_const (auto &dialog, added) { + History *history = nullptr; + switch (dialog.type()) { case mtpc_dialog: { - const auto &d(i->c_dialog()); - history = App::historyFromDialog(peerFromMTP(d.vpeer), d.vunread_count.v, d.vread_inbox_max_id.v); + auto &d(dialog.c_dialog()); + history = App::historyFromDialog(peerFromMTP(d.vpeer), d.vunread_count.v, d.vread_inbox_max_id.v, d.vread_outbox_max_id.v); if (App::main()) { App::main()->applyNotifySetting(MTP_notifyPeer(d.vpeer), d.vnotify_settings, history); } } break; case mtpc_dialogChannel: { - const auto &d(i->c_dialogChannel()); + auto &d(dialog.c_dialogChannel()); PeerData *peer = App::peerLoaded(peerFromMTP(d.vpeer)); int32 unreadCount = (peer && peer->isMegagroup()) ? d.vunread_count.v : d.vunread_important_count.v; - History *history = App::historyFromDialog(peerFromMTP(d.vpeer), unreadCount, d.vread_inbox_max_id.v); + History *history = App::historyFromDialog(peerFromMTP(d.vpeer), unreadCount, d.vread_inbox_max_id.v, d.vread_outbox_max_id.v); if (history->peer->isChannel()) { history->asChannelHistory()->unreadCountAll = d.vunread_count.v; history->peer->asChannel()->ptsReceived(d.vpts.v); @@ -1927,20 +1927,21 @@ void DialogsWidget::notify_historyMuteUpdated(History *history) { } void DialogsWidget::unreadCountsReceived(const QVector &dialogs) { - for (QVector::const_iterator i = dialogs.cbegin(), e = dialogs.cend(); i != e; ++i) { - switch (i->type()) { + for_const (auto &dialog, dialogs) { + switch (dialog.type()) { case mtpc_dialog: { - const auto &d(i->c_dialog()); + auto &d(dialog.c_dialog()); if (History *h = App::historyLoaded(peerFromMTP(d.vpeer))) { App::main()->applyNotifySetting(MTP_notifyPeer(d.vpeer), d.vnotify_settings, h); if (d.vunread_count.v >= h->unreadCount()) { h->setUnreadCount(d.vunread_count.v); h->inboxReadBefore = d.vread_inbox_max_id.v + 1; } + accumulate_max(h->outboxReadBefore, d.vread_outbox_max_id.v + 1); } } break; case mtpc_dialogChannel: { - const auto &d(i->c_dialogChannel()); + auto &d(dialog.c_dialogChannel()); if (History *h = App::historyLoaded(peerFromMTP(d.vpeer))) { if (h->peer->isChannel()) { h->peer->asChannel()->ptsReceived(d.vpts.v); @@ -1955,6 +1956,7 @@ void DialogsWidget::unreadCountsReceived(const QVector &dialogs) { h->setUnreadCount(unreadCount); h->inboxReadBefore = d.vread_inbox_max_id.v + 1; } + accumulate_max(h->outboxReadBefore, d.vread_outbox_max_id.v + 1); } } break; } diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index f26c05995..d9e26804f 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -99,6 +99,27 @@ bool needReSetInlineResultDocument(const MTPMessageMedia &media, DocumentData *e return true; } +MediaOverviewType messageMediaToOverviewType(HistoryMedia *media) { + switch (media->type()) { + case MediaTypePhoto: return OverviewPhotos; + case MediaTypeVideo: return OverviewVideos; + case MediaTypeFile: return OverviewFiles; + case MediaTypeMusicFile: return media->getDocument()->isMusic() ? OverviewMusicFiles : OverviewFiles; + case MediaTypeVoiceFile: return OverviewVoiceFiles; + case MediaTypeGif: return media->getDocument()->isGifv() ? OverviewCount : OverviewFiles; + default: break; + } + return OverviewCount; +} + +MediaOverviewType serviceMediaToOverviewType(HistoryMedia *media) { + switch (media->type()) { + case MediaTypePhoto: return OverviewChatPhotos; + default: break; + } + return OverviewCount; +} + } // namespace void historyInit() { @@ -108,7 +129,7 @@ void historyInit() { History::History(const PeerId &peerId) : peer(App::peer(peerId)) , _mute(isNotifyMuted(peer->notify)) { - if (peer->isChannel() || (peer->isUser() && peer->asUser()->botInfo)) { + if (peer->isUser() && peer->asUser()->botInfo) { outboxReadBefore = INT_MAX; } for (auto &countData : overviewCountData) { @@ -418,8 +439,8 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { MTPDmessage::Flags flags = 0; if (peerToUser(inviter->id) == MTP::authedId()) { unread = false; - } else if (unread) { - flags |= MTPDmessage::Flag::f_unread; + //} else if (unread) { + // flags |= MTPDmessage::Flag::f_unread; } QDateTime inviteDate = peer->asChannel()->inviteDate; @@ -838,12 +859,13 @@ History *Histories::find(const PeerId &peerId) { return (i == map.cend()) ? 0 : i.value(); } -History *Histories::findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead) { - Map::const_iterator i = map.constFind(peerId); +History *Histories::findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead, int32 maxOutboxRead) { + auto i = map.constFind(peerId); if (i == map.cend()) { i = map.insert(peerId, peerIsChannel(peerId) ? static_cast(new ChannelHistory(peerId)) : (new History(peerId))); i.value()->setUnreadCount(unreadCount); i.value()->inboxReadBefore = maxInboxRead + 1; + i.value()->outboxReadBefore = maxOutboxRead + 1; } return i.value(); } @@ -947,7 +969,7 @@ HistoryItem *Histories::addNewMessage(const MTPMessage &msg, NewMessageType type PeerId peer = peerFromMessage(msg); if (!peer) return nullptr; - HistoryItem *result = findOrInsert(peer, 0, 0)->addNewMessage(msg, type); + HistoryItem *result = App::history(peer)->addNewMessage(msg, type); if (result && type == NewMessageUnread) { checkForSwitchInlineButton(result); } @@ -1697,7 +1719,7 @@ MsgId History::inboxRead(MsgId upTo) { } if (!upTo) upTo = msgIdForRead(); - inboxReadBefore = qMax(inboxReadBefore, upTo + 1); + accumulate_max(inboxReadBefore, upTo + 1); updateChatListEntry(); if (peer->migrateTo()) { @@ -1720,7 +1742,7 @@ MsgId History::inboxRead(HistoryItem *wasRead) { MsgId History::outboxRead(int32 upTo) { if (upTo < 0) return upTo; if (!upTo) upTo = msgIdForRead(); - if (outboxReadBefore < upTo + 1) outboxReadBefore = upTo + 1; + accumulate_max(outboxReadBefore, upTo + 1); return upTo; } @@ -3038,6 +3060,8 @@ void HistoryItem::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pres void HistoryItem::destroy() { // All this must be done for all items manually in History::clear(false)! + eraseFromOverview(); + bool wasAtBottom = history()->loadedAtBottom(); _history->removeNotification(this); detach(); @@ -3141,6 +3165,30 @@ bool HistoryItem::canEdit(const QDateTime &cur) const { return false; } +bool HistoryItem::unread() const { + // Messages from myself are always read. + if (history()->peer->isSelf()) return false; + + if (out()) { + // Outgoing messages in converted chats are always read. + if (history()->peer->migrateTo()) return false; + + if (id > 0) { + if (id < history()->outboxReadBefore) return false; + if (auto channel = history()->peer->asChannel()) { + if (!channel->isMegagroup()) return false; + } + } + return true; + } + + if (id > 0) { + if (id < history()->inboxReadBefore) return false; + return true; + } + return (_flags & MTPDmessage_ClientFlag::f_clientside_unread); +} + void HistoryItem::destroyUnreadBar() { if (Has()) { RemoveComponents(HistoryMessageUnreadBar::Bit()); @@ -7199,7 +7247,7 @@ int32 HistoryMessage::addToOverview(AddToOverviewMethod method) { int32 result = 0; if (HistoryMedia *media = getMedia()) { - MediaOverviewType type = mediaToOverviewType(media); + MediaOverviewType type = messageMediaToOverviewType(media); if (type != OverviewCount) { if (history()->addToOverview(type, id, method)) { result |= (1 << type); @@ -7216,7 +7264,7 @@ int32 HistoryMessage::addToOverview(AddToOverviewMethod method) { void HistoryMessage::eraseFromOverview() { if (HistoryMedia *media = getMedia()) { - MediaOverviewType type = mediaToOverviewType(media); + MediaOverviewType type = messageMediaToOverviewType(media); if (type != OverviewCount) { history()->eraseFromOverview(type, id); } @@ -7274,10 +7322,6 @@ QString HistoryMessage::inDialogsText() const { return emptyText() ? (_media ? _media->inDialogsText() : QString()) : _text.originalText(AllTextSelection, ExpandLinksNone); } -HistoryMedia *HistoryMessage::getMedia() const { - return _media.data(); -} - void HistoryMessage::setMedia(const MTPMessageMedia *media) { if (!_media && (!media || media->type() == mtpc_messageMediaEmpty)) return; @@ -7659,11 +7703,6 @@ void HistoryMessage::dependencyItemRemoved(HistoryItem *dependency) { } } -void HistoryMessage::destroy() { - eraseFromOverview(); - HistoryItem::destroy(); -} - int HistoryMessage::resizeGetHeight_(int width) { int result = performResizeGetHeight(width); @@ -8462,8 +8501,28 @@ QString HistoryService::notificationText() const { return msg; } -HistoryMedia *HistoryService::getMedia() const { - return _media.data(); +int32 HistoryService::addToOverview(AddToOverviewMethod method) { + if (!indexInOverview()) return 0; + + int32 result = 0; + if (auto media = getMedia()) { + MediaOverviewType type = serviceMediaToOverviewType(media); + if (type != OverviewCount) { + if (history()->addToOverview(type, id, method)) { + result |= (1 << type); + } + } + } + return result; +} + +void HistoryService::eraseFromOverview() { + if (auto media = getMedia()) { + MediaOverviewType type = serviceMediaToOverviewType(media); + if (type != OverviewCount) { + history()->eraseFromOverview(type, id); + } + } } HistoryService::~HistoryService() { diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 35695e4bc..6446bd0fb 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -48,7 +48,7 @@ public: void step_typings(uint64 ms, bool timer); History *find(const PeerId &peerId); - History *findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead); + History *findOrInsert(const PeerId &peerId, int32 unreadCount, int32 maxInboxRead, int32 maxOutboxRead); void clear(); void remove(const PeerId &peer); @@ -114,6 +114,7 @@ enum MediaOverviewType { OverviewFiles = 3, OverviewVoiceFiles = 4, OverviewLinks = 5, + OverviewChatPhotos = 6, OverviewCount }; @@ -126,6 +127,7 @@ inline MTPMessagesFilter typeToMediaFilter(MediaOverviewType &type) { case OverviewFiles: return MTP_inputMessagesFilterDocument(); case OverviewVoiceFiles: return MTP_inputMessagesFilterVoice(); case OverviewLinks: return MTP_inputMessagesFilterUrl(); + case OverviewChatPhotos: return MTP_inputMessagesFilterChatPhotos(); case OverviewCount: break; default: type = OverviewCount; break; } @@ -1149,7 +1151,7 @@ public: const HistoryBlock *block() const { return _block; } - virtual void destroy(); + void destroy(); void detach(); void detachFast(); bool detached() const { @@ -1186,16 +1188,7 @@ public: bool out() const { return _flags & MTPDmessage::Flag::f_out; } - bool unread() const { - if (out() && id > 0 && id < _history->outboxReadBefore) return false; - if (!out() && id > 0) { - if (id < _history->inboxReadBefore) return false; - if (channelId() != NoChannel) return true; // no unread flag for incoming messages in channels - } - if (history()->peer->isSelf()) return false; // messages from myself are always read - if (out() && history()->peer->migrateTo()) return false; // outgoing messages in converted chats are always read - return (_flags & MTPDmessage::Flag::f_unread); - } + bool unread() const; bool mentionsMe() const { return _flags & MTPDmessage::Flag::f_mentioned; } @@ -1288,6 +1281,8 @@ public: virtual int32 addToOverview(AddToOverviewMethod method) { return 0; } + virtual void eraseFromOverview() { + } virtual bool hasBubble() const { return false; } @@ -1363,8 +1358,8 @@ public: return FullMsgId(channelId(), id); } - virtual HistoryMedia *getMedia() const { - return nullptr; + HistoryMedia *getMedia() const { + return _media.data(); } virtual void setText(const TextWithEntities &textWithEntities) { } @@ -1772,19 +1767,6 @@ protected: }; -inline MediaOverviewType mediaToOverviewType(HistoryMedia *media) { - switch (media->type()) { - case MediaTypePhoto: return OverviewPhotos; - case MediaTypeVideo: return OverviewVideos; - case MediaTypeFile: return OverviewFiles; - case MediaTypeMusicFile: return media->getDocument()->isMusic() ? OverviewMusicFiles : OverviewFiles; - case MediaTypeVoiceFile: return OverviewVoiceFiles; - case MediaTypeGif: return media->getDocument()->isGifv() ? OverviewCount : OverviewFiles; - default: break; - } - return OverviewCount; -} - class HistoryFileMedia : public HistoryMedia { public: using HistoryMedia::HistoryMedia; @@ -2654,8 +2636,6 @@ public: void dependencyItemRemoved(HistoryItem *dependency) override; - void destroy() override; - bool hasPoint(int x, int y) const override; bool pointInTime(int32 right, int32 bottom, int x, int y, InfoDisplayType type) const override; @@ -2680,11 +2660,10 @@ public: void applyEdition(const MTPDmessage &message) override; void updateMedia(const MTPMessageMedia *media) override; int32 addToOverview(AddToOverviewMethod method) override; - void eraseFromOverview(); + void eraseFromOverview() override; TextWithEntities selectedText(TextSelection selection) const override; QString inDialogsText() const override; - HistoryMedia *getMedia() const override; void setText(const TextWithEntities &textWithEntities) override; TextWithEntities originalText() const override; bool textHasLinks() const override; @@ -2812,9 +2791,9 @@ inline MTPDmessage::Flags newMessageFlags(PeerData *p) { MTPDmessage::Flags result = 0; if (!p->isSelf()) { result |= MTPDmessage::Flag::f_out; - if (p->isChat() || (p->isUser() && !p->asUser()->botInfo)) { - result |= MTPDmessage::Flag::f_unread; - } + //if (p->isChat() || (p->isUser() && !p->asUser()->botInfo)) { + // result |= MTPDmessage::Flag::f_unread; + //} } return result; } @@ -2873,6 +2852,9 @@ public: void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const override; QString notificationText() const override; + int32 addToOverview(AddToOverviewMethod method) override; + void eraseFromOverview() override; + bool needCheck() const override { return false; } @@ -2883,8 +2865,6 @@ public: QString inDialogsText() const override; QString inReplyText() const override; - HistoryMedia *getMedia() const override; - void setServiceText(const QString &text); ~HistoryService(); diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index e5fcb4956..e75b7f4f9 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -228,7 +228,7 @@ void IntroPhone::phoneCheckDone(const MTPauth_CheckedPhone &result) { checkRequest.start(1000); MTPauth_SendCode::Flags flags = 0; - sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); + sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } else { showError(lang(lng_bad_phone_noreg), true); enableAll(true); @@ -269,7 +269,7 @@ void IntroPhone::toSignUp() { checkRequest.start(1000); MTPauth_SendCode::Flags flags = 0; - sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); + sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash)), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } bool IntroPhone::phoneSubmitFail(const RPCError &error) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 000fc8024..58ab10f88 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1707,7 +1707,7 @@ void MainWidget::dialogsCancelled() { } void MainWidget::serviceNotification(const QString &msg, const MTPMessageMedia &media) { - MTPDmessage::Flags flags = MTPDmessage::Flag::f_unread | MTPDmessage::Flag::f_entities | MTPDmessage::Flag::f_from_id; + MTPDmessage::Flags flags = MTPDmessage::Flag::f_entities | MTPDmessage::Flag::f_from_id | MTPDmessage_ClientFlag::f_clientside_unread; QString sendingText, leftText = msg; EntitiesInText sendingEntities, leftEntities; textParseEntities(leftText, _historyTextNoMonoOptions.flags, &leftEntities); @@ -4295,7 +4295,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { UserData *user = App::userLoaded(d.vuser_id.v); if (user) { if (App::history(user->id)->loadedAtBottom()) { - App::history(user->id)->addNewService(clientMsgId(), date(d.vdate), lng_action_user_registered(lt_from, user->name), MTPDmessage::Flag::f_unread); + App::history(user->id)->addNewService(clientMsgId(), date(d.vdate), lng_action_user_registered(lt_from, user->name), 0); } } } break; @@ -4486,11 +4486,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } break; case mtpc_updateReadChannelInbox: { - const auto &d(update.c_updateReadChannelInbox()); - ChannelData *channel = App::channelLoaded(d.vchannel_id.v); + auto &d(update.c_updateReadChannelInbox()); + auto channel = App::channelLoaded(d.vchannel_id.v); App::feedInboxRead(peerFromChannel(d.vchannel_id.v), d.vmax_id.v); } break; + case mtpc_updateReadChannelOutbox: { + auto &d(update.c_updateReadChannelOutbox()); + auto channel = App::channelLoaded(d.vchannel_id.v); + App::feedOutboxRead(peerFromChannel(d.vchannel_id.v), d.vmax_id.v); + } break; + case mtpc_updateDeleteChannelMessages: { const auto &d(update.c_updateDeleteChannelMessages()); ChannelData *channel = App::channelLoaded(d.vchannel_id.v); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 94277b6a3..de50efa2a 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -773,7 +773,7 @@ PasscodeWidget *MainWindow::passcodeWidget() { } void MainWindow::showPhoto(const PhotoOpenClickHandler *lnk, HistoryItem *item) { - return lnk->peer() ? showPhoto(lnk->photo(), lnk->peer()) : showPhoto(lnk->photo(), item); + return (!item && lnk->peer()) ? showPhoto(lnk->photo(), lnk->peer()) : showPhoto(lnk->photo(), item); } void MainWindow::showPhoto(PhotoData *photo, HistoryItem *item) { diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 0c8c0b804..1fdb6711a 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -57,65 +57,30 @@ namespace { 0, // maxh Qt::LayoutDirectionAuto, // dir }; + + bool typeHasMediaOverview(MediaOverviewType type) { + switch (type) { + case OverviewPhotos: + case OverviewVideos: + case OverviewMusicFiles: + case OverviewFiles: + case OverviewVoiceFiles: + case OverviewLinks: return true; + default: break; + } + return false; + } } MediaView::MediaView() : TWidget(App::wnd()) -, _photo(0) -, _doc(0) -, _overview(OverviewCount) -, _leftNavVisible(false) -, _rightNavVisible(false) -, _saveVisible(false) -, _headerHasLink(false) , _animStarted(getms()) -, _width(0) -, _x(0) -, _y(0) -, _w(0) -, _h(0) -, _xStart(0) -, _yStart(0) -, _zoom(0) -, _zoomToScreen(0) -, _pressed(false) -, _dragging(0) -, _gif(0) -, _full(-1) -, _docNameWidth(0) -, _docSizeWidth(0) -, _docThumbx(0) -, _docThumby(0) -, _docThumbw(0) , _docRadial(animation(this, &MediaView::step_radial)) , _docDownload(this, lang(lng_media_download), st::mvDocLink) , _docSaveAs(this, lang(lng_mediaview_save_as), st::mvDocLink) , _docCancel(this, lang(lng_cancel), st::mvDocLink) -, _migrated(0) -, _history(0) -, _peer(0) -, _user(0) -, _from(0) -, _index(-1) -, _msgid(0) -, _msgmigrated(false) -, _channel(NoChannel) -, _canForward(false) -, _canDelete(false) -, _loadRequest(0) -, _over(OverNone) -, _down(OverNone) , _lastAction(-st::mvDeltaFromLastAction, -st::mvDeltaFromLastAction) -, _ignoringDropdown(false) , _a_state(animation(this, &MediaView::step_state)) -, _controlsState(ControlsShown) -, _controlsAnimStarted(0) -, _menu(0) , _dropdown(this, st::mvDropdown) -, _receiveMouse(true) -, _touchPress(false) -, _touchMove(false) -, _touchRightButton(false) -, _saveMsgStarted(0) , _saveMsgOpacity(0) { TextCustomTagsMap custom; custom.insert(QChar('c'), qMakePair(textcmdStartLink(1), textcmdStopLink())); @@ -195,7 +160,7 @@ void MediaView::moveToScreen() { void MediaView::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) { if (!_photo && !_doc) return; - if (_history && (_history->peer == peer || (_migrated && _migrated->peer == peer)) && type == _overview) { + if (_history && (_history->peer == peer || (_migrated && _migrated->peer == peer)) && type == _overview && _msgid) { _index = -1; if (_msgmigrated) { for (int i = 0, l = _migrated->overview[_overview].size(); i < l; ++i) { @@ -361,15 +326,21 @@ void MediaView::updateControls() { _dateNav = myrtlrect(st::mvTextLeft, height() - st::mvTextTop, st::mvFont->width(_dateText), st::mvFont->height); } updateHeader(); - if (_photo || (_history && (_overview == OverviewPhotos || _overview == OverviewFiles))) { + if (_photo || (_history && (_overview == OverviewPhotos || _overview == OverviewChatPhotos || _overview == OverviewFiles))) { _leftNavVisible = (_index > 0) || (_index == 0 && ( (!_msgmigrated && _history && _history->overview[_overview].size() < _history->overviewCount(_overview)) || (_msgmigrated && _migrated && _migrated->overview[_overview].size() < _migrated->overviewCount(_overview)) || - (!_msgmigrated && _history && _migrated && (!_migrated->overview[_overview].isEmpty() || _migrated->overviewCount(_overview) > 0)))); + (!_msgmigrated && _history && _migrated && (!_migrated->overview[_overview].isEmpty() || _migrated->overviewCount(_overview) > 0)))) || + (_index < 0 && _photo == _additionalChatPhoto && + ((_history && !_history->overview[_overview].isEmpty()) || + (_migrated && _history->overviewLoaded(_overview) && !_migrated->overview[_overview].isEmpty())) + ); _rightNavVisible = (_index >= 0) && ( (!_msgmigrated && _history && _index + 1 < _history->overview[_overview].size()) || (_msgmigrated && _migrated && _index + 1 < _migrated->overview[_overview].size()) || (_msgmigrated && _migrated && _history && (!_history->overview[_overview].isEmpty() || _history->overviewCount(_overview) > 0)) || + (!_msgmigrated && _history && _index + 1 == _history->overview[_overview].size() && _additionalChatPhoto) || + (_msgmigrated && _migrated && _index + 1 == _migrated->overview[_overview].size() && _history->overviewCount(_overview) == 0 && _additionalChatPhoto) || (!_history && _user && (_index + 1 < _user->photos.size() || _index + 1 < _user->photosCount))); if (_msgmigrated && !_history->overviewLoaded(_overview)) { _leftNavVisible = _rightNavVisible = false; @@ -397,7 +368,7 @@ void MediaView::updateDropdown() { _btnCopy->setVisible((_doc && fileShown()) || (_photo && _photo->loaded())); _btnForward->setVisible(_canForward); _btnDelete->setVisible(_canDelete || (_photo && App::self() && _user == App::self()) || (_photo && _photo->peer && _photo->peer->photoId == _photo->id && (_photo->peer->isChat() || (_photo->peer->isChannel() && _photo->peer->asChannel()->amCreator())))); - _btnViewAll->setVisible((_overview != OverviewCount) && _history); + _btnViewAll->setVisible(_history && typeHasMediaOverview(_overview)); _btnViewAll->setText(lang(_doc ? lng_mediaview_files_all : lng_mediaview_photos_all)); _dropdown.updateButtons(); _dropdown.moveToRight(0, height() - _dropdown.height()); @@ -750,7 +721,7 @@ void MediaView::onDelete() { void MediaView::onOverview() { if (_menu) _menu->hideMenu(true); - if (!_history || _overview == OverviewCount) { + if (!_history || !typeHasMediaOverview(_overview)) { update(); return; } @@ -777,7 +748,7 @@ void MediaView::onCopy() { } void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { - _history = context ? context->history() : 0; + _history = context ? context->history() : nullptr; if (_history) { if (_history->peer->migrateFrom()) { _migrated = App::history(_history->peer->migrateFrom()->id); @@ -786,8 +757,9 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { _history = App::history(_history->peer->migrateTo()->id); } } else { - _migrated = 0; + _migrated = nullptr; } + _additionalChatPhoto = nullptr; _peer = 0; _user = 0; _saveMsgStarted = 0; @@ -810,7 +782,14 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { _canDelete = context ? context->canDelete() : false; _photo = photo; if (_history) { - _overview = OverviewPhotos; + if (context && !context->toHistoryMessage()) { + _overview = OverviewChatPhotos; + if (!_history->peer->isUser()) { + computeAdditionalChatPhoto(_history->peer, computeLastOverviewChatPhoto().photo); + } + } else { + _overview = OverviewPhotos; + } findCurrent(); } @@ -820,7 +799,8 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { } void MediaView::showPhoto(PhotoData *photo, PeerData *context) { - _history = _migrated = 0; + _history = _migrated = nullptr; + _additionalChatPhoto = nullptr; _peer = context; _user = context->asUser(); _saveMsgStarted = 0; @@ -854,6 +834,26 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) { if (_user->photosCount < 0) { loadBack(); } + } else if ((_history = App::historyLoaded(_peer))) { + if (_history->peer->migrateFrom()) { + _migrated = App::history(_history->peer->migrateFrom()->id); + } else if (_history->peer->migrateTo()) { + _migrated = _history; + _history = App::history(_history->peer->migrateTo()->id); + } + + auto lastChatPhoto = computeLastOverviewChatPhoto(); + if (_photo == lastChatPhoto.photo) { + return showPhoto(_photo, lastChatPhoto.item); + } + + computeAdditionalChatPhoto(_history->peer, lastChatPhoto.photo); + if (_additionalChatPhoto == _photo) { + _overview = OverviewChatPhotos; + } else { + _additionalChatPhoto = nullptr; + _history = _migrated = nullptr; + } } displayPhoto(photo, 0); preloadData(0); @@ -873,6 +873,7 @@ void MediaView::showDocument(DocumentData *doc, HistoryItem *context) { } else { _migrated = 0; } + _additionalChatPhoto = nullptr; _saveMsgStarted = 0; _peer = 0; _user = 0; @@ -1510,12 +1511,34 @@ void MediaView::keyPressEvent(QKeyEvent *e) { } } -void MediaView::moveToNext(int32 delta) { - if (_index < 0 || (_history && _overview != OverviewPhotos && _overview != OverviewFiles) || (_overview == OverviewCount && !_user)) { - return; +bool MediaView::moveToNext(int32 delta) { + if (_index < 0) { + if (delta == -1 && _photo == _additionalChatPhoto) { + auto lastChatPhoto = computeLastOverviewChatPhoto(); + if (lastChatPhoto.item) { + if (lastChatPhoto.item->history() == _history) { + _index = _history->overview[_overview].size() - 1; + _msgmigrated = false; + } else { + _index = _migrated->overview[_overview].size() - 1; + _msgmigrated = true; + } + _msgid = lastChatPhoto.item->id; + _channel = _history ? _history->channelId() : NoChannel; + _canForward = _msgid > 0; + _canDelete = lastChatPhoto.item->canDelete(); + stopGif(); + displayPhoto(lastChatPhoto.photo, lastChatPhoto.item); preloadData(delta); + return true; + } + } + return false; + } + if ((_history && _overview != OverviewPhotos && _overview != OverviewChatPhotos && _overview != OverviewFiles) || (_overview == OverviewCount && !_user)) { + return false; } if (_msgmigrated && !_history->overviewLoaded(_overview)) { - return; + return true; } int32 newIndex = _index + delta; @@ -1549,6 +1572,14 @@ void MediaView::moveToNext(int32 delta) { preloadData(delta); } } + } else if (!newMigrated && newIndex == _history->overview[_overview].size() && _additionalChatPhoto) { + _index = -1; + _msgid = 0; + _msgmigrated = false; + _canForward = false; + _canDelete = false; + stopGif(); + displayPhoto(_additionalChatPhoto, 0); } if (delta < 0 && _index < MediaOverviewStartPerPage) { loadBack(); @@ -1563,26 +1594,34 @@ void MediaView::moveToNext(int32 delta) { loadBack(); } } + return true; } void MediaView::preloadData(int32 delta) { - if (_index < 0 || (!_user && _overview == OverviewCount)) return; + int indexInOverview = _index; + bool indexOfMigratedItem = _msgmigrated; + if (_index < 0) { + if (_overview != OverviewChatPhotos) return; + indexInOverview = _history->overview[OverviewChatPhotos].size(); + indexOfMigratedItem = false; + } + if (!_user && _overview == OverviewCount) return; - int32 from = _index + (delta ? delta : -1), to = _index + (delta ? delta * MediaOverviewPreloadCount : 1); + int32 from = indexInOverview + (delta ? delta : -1), to = indexInOverview + (delta ? delta * MediaOverviewPreloadCount : 1); if (from > to) qSwap(from, to); if (_history && _overview != OverviewCount) { - int32 forgetIndex = _index - delta * 2; - History *forgetHistory = _msgmigrated ? _migrated : _history; + int32 forgetIndex = indexInOverview - delta * 2; + History *forgetHistory = indexOfMigratedItem ? _migrated : _history; if (_migrated) { - if (_msgmigrated && forgetIndex >= _migrated->overview[_overview].size()) { + if (indexOfMigratedItem && forgetIndex >= _migrated->overview[_overview].size()) { forgetHistory = _history; forgetIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); - } else if (!_msgmigrated && forgetIndex < 0) { + } else if (!indexOfMigratedItem && forgetIndex < 0) { forgetHistory = _migrated; forgetIndex += _migrated->overview[_overview].size(); } } - if (forgetIndex >= 0 && forgetIndex < forgetHistory->overview[_overview].size() && (forgetHistory != (_msgmigrated ? _migrated : _history) || forgetIndex != _index)) { + if (forgetIndex >= 0 && forgetIndex < forgetHistory->overview[_overview].size() && (forgetHistory != (indexOfMigratedItem ? _migrated : _history) || forgetIndex != indexInOverview)) { if (HistoryItem *item = App::histItemById(forgetHistory->channelId(), forgetHistory->overview[_overview][forgetIndex])) { if (HistoryMedia *media = item->getMedia()) { switch (media->type()) { @@ -1596,18 +1635,18 @@ void MediaView::preloadData(int32 delta) { } for (int32 i = from; i <= to; ++i) { - History *previewHistory = _msgmigrated ? _migrated : _history; + History *previewHistory = indexOfMigratedItem ? _migrated : _history; int32 previewIndex = i; if (_migrated) { - if (_msgmigrated && previewIndex >= _migrated->overview[_overview].size()) { + if (indexOfMigratedItem && previewIndex >= _migrated->overview[_overview].size()) { previewHistory = _history; previewIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); - } else if (!_msgmigrated && previewIndex < 0) { + } else if (!indexOfMigratedItem && previewIndex < 0) { previewHistory = _migrated; previewIndex += _migrated->overview[_overview].size(); } } - if (previewIndex >= 0 && previewIndex < previewHistory->overview[_overview].size() && (previewHistory != (_msgmigrated ? _migrated : _history) || previewIndex != _index)) { + if (previewIndex >= 0 && previewIndex < previewHistory->overview[_overview].size() && (previewHistory != (indexOfMigratedItem ? _migrated : _history) || previewIndex != indexInOverview)) { if (HistoryItem *item = App::histItemById(previewHistory->channelId(), previewHistory->overview[_overview][previewIndex])) { if (HistoryMedia *media = item->getMedia()) { switch (media->type()) { @@ -1626,17 +1665,17 @@ void MediaView::preloadData(int32 delta) { } } else if (_user) { for (int32 i = from; i <= to; ++i) { - if (i >= 0 && i < _user->photos.size() && i != _index) { + if (i >= 0 && i < _user->photos.size() && i != indexInOverview) { _user->photos[i]->thumb->load(); } } for (int32 i = from; i <= to; ++i) { - if (i >= 0 && i < _user->photos.size() && i != _index) { + if (i >= 0 && i < _user->photos.size() && i != indexInOverview) { _user->photos[i]->download(); } } - int32 forgetIndex = _index - delta * 2; - if (forgetIndex >= 0 && forgetIndex < _user->photos.size() && forgetIndex != _index) { + int32 forgetIndex = indexInOverview - delta * 2; + if (forgetIndex >= 0 && forgetIndex < _user->photos.size() && forgetIndex != indexInOverview) { _user->photos[forgetIndex]->forget(); } } @@ -1651,11 +1690,9 @@ void MediaView::mousePressEvent(QMouseEvent *e) { if (e->button() == Qt::LeftButton) { _down = OverNone; if (!ClickHandler::getPressed()) { - if (_over == OverLeftNav && _index >= 0) { - moveToNext(-1); + if (_over == OverLeftNav && moveToNext(-1)) { _lastAction = e->pos(); - } else if (_over == OverRightNav && _index >= 0) { - moveToNext(1); + } else if (_over == OverRightNav && moveToNext(1)) { _lastAction = e->pos(); } else if (_over == OverName) { _down = OverName; @@ -2062,7 +2099,7 @@ void MediaView::loadBack() { App::main()->loadMediaBack(_migrated->peer, _overview); } else { App::main()->loadMediaBack(_history->peer, _overview); - if (_migrated && _index == 0 && _migrated->overview[_overview].isEmpty() && !_migrated->overviewLoaded(_overview)) { + if (_migrated && _index == 0 && (_migrated->overviewCount(_overview) < 0 || _migrated->overview[_overview].isEmpty()) && !_migrated->overviewLoaded(_overview)) { App::main()->loadMediaBack(_migrated->peer, _overview); } } @@ -2076,6 +2113,43 @@ void MediaView::loadBack() { } } +MediaView::LastChatPhoto MediaView::computeLastOverviewChatPhoto() { + LastChatPhoto emptyResult = { nullptr, nullptr }; + auto lastPhotoInOverview = [&emptyResult](auto history, auto list) -> LastChatPhoto { + if (auto item = App::histItemById(history->channelId(), list.back())) { + if (auto media = item->getMedia()) { + if (media->type() == MediaTypePhoto && !item->toHistoryMessage()) { + return { item, static_cast(media)->photo() }; + } + } + } + return emptyResult; + }; + + if (!_history) return emptyResult; + auto &list = _history->overview[OverviewChatPhotos]; + if (!list.isEmpty()) { + return lastPhotoInOverview(_history, list); + } + + if (!_migrated || !_history->overviewLoaded(OverviewChatPhotos)) return emptyResult; + auto &migratedList = _migrated->overview[OverviewChatPhotos]; + if (!migratedList.isEmpty()) { + return lastPhotoInOverview(_migrated, migratedList); + } + return emptyResult; +} + +void MediaView::computeAdditionalChatPhoto(PeerData *peer, PhotoData *lastOverviewPhoto) { + if (!peer->photoId || peer->photoId == UnknownPeerPhotoId) { + _additionalChatPhoto = nullptr; + } else if (lastOverviewPhoto && lastOverviewPhoto->id == peer->photoId) { + _additionalChatPhoto = nullptr; + } else { + _additionalChatPhoto = App::photo(peer->photoId); + } +} + void MediaView::userPhotosLoaded(UserData *u, const MTPphotos_Photos &photos, mtpRequestId req) { if (req == _loadRequest) { _loadRequest = 0; @@ -2135,6 +2209,13 @@ void MediaView::updateHeader() { } else { index += count - _history->overview[_overview].size(); } + if (_additionalChatPhoto) { + ++count; + } + } else if (index < 0 && _additionalChatPhoto && _photo == _additionalChatPhoto) { + // Additional chat photo (not in the list => place it at the end of the list). + index = count; + ++count; } else { count = 0; // unknown yet } @@ -2142,7 +2223,7 @@ void MediaView::updateHeader() { } else if (_user) { count = _user->photosCount ? _user->photosCount : _user->photos.size(); } - if (_index >= 0 && _index < count && count > 1) { + if (index >= 0 && index < count && count > 1) { if (_doc) { _headerText = lng_mediaview_file_n_of_count(lt_file, _doc->name.isEmpty() ? lang(lng_mediaview_doc_image) : _doc->name, lt_n, QString::number(index + 1), lt_count, QString::number(count)); } else { @@ -2161,7 +2242,7 @@ void MediaView::updateHeader() { _headerText = lang(lng_mediaview_single_photo); } } - _headerHasLink = (_overview != OverviewCount) && _history; + _headerHasLink = _history && typeHasMediaOverview(_overview); int32 hwidth = st::mvThickFont->width(_headerText); if (hwidth > width() / 3) { hwidth = width() / 3; diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index 18bfcf386..8045e7a22 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -48,7 +48,7 @@ public: void showPhoto(PhotoData *photo, PeerData *context); void showDocument(DocumentData *doc, HistoryItem *context); void moveToScreen(); - void moveToNext(int32 delta); + bool moveToNext(int32 delta); void preloadData(int32 delta); void leaveToChildEvent(QEvent *e) override { // e -- from enterEvent() of child TWidget @@ -111,6 +111,14 @@ private: void findCurrent(); void loadBack(); + // Computes the last OverviewChatPhotos PhotoData* from _history or _migrated. + struct LastChatPhoto { + HistoryItem *item; + PhotoData *photo; + }; + LastChatPhoto computeLastOverviewChatPhoto(); + void computeAdditionalChatPhoto(PeerData *peer, PhotoData *lastOverviewPhoto); + void userPhotosLoaded(UserData *u, const MTPphotos_Photos &photos, mtpRequestId req); void deletePhotosDone(const MTPVector &result); @@ -124,14 +132,17 @@ private: QBrush _transparentBrush; - PhotoData *_photo; - DocumentData *_doc; - MediaOverviewType _overview; + PhotoData *_photo = nullptr; + DocumentData *_doc = nullptr; + MediaOverviewType _overview = OverviewCount; QRect _closeNav, _closeNavIcon; QRect _leftNav, _leftNavIcon, _rightNav, _rightNavIcon; QRect _headerNav, _nameNav, _dateNav; QRect _saveNav, _saveNavIcon, _moreNav, _moreNavIcon; - bool _leftNavVisible, _rightNavVisible, _saveVisible, _headerHasLink; + bool _leftNavVisible = false; + bool _rightNavVisible = false; + bool _saveVisible = false; + bool _headerHasLink = false; QString _dateText; QString _headerText; @@ -140,15 +151,17 @@ private: uint64 _animStarted; - int32 _width, _x, _y, _w, _h, _xStart, _yStart; - int32 _zoom; // < 0 - out, 0 - none, > 0 - in - float64 _zoomToScreen; // for documents + int _width = 0; + int _x = 0, _y = 0, _w = 0, _h = 0; + int _xStart = 0, _yStart = 0; + int _zoom = 0; // < 0 - out, 0 - none, > 0 - in + float64 _zoomToScreen = 0.; // for documents QPoint _mStart; - bool _pressed; - int32 _dragging; + bool _pressed = false; + int32 _dragging = 0; QPixmap _current; - ClipReader *_gif; - int32 _full; // -1 - thumb, 0 - medium, 1 - full + ClipReader *_gif = nullptr; + int32 _full = -1; // -1 - thumb, 0 - medium, 1 - full bool fileShown() const; bool gifShown() const; @@ -157,26 +170,32 @@ private: style::sprite _docIcon; style::color _docIconColor; QString _docName, _docSize, _docExt; - int32 _docNameWidth, _docSizeWidth, _docExtWidth; + int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0; QRect _docRect, _docIconRect; - int32 _docThumbx, _docThumby, _docThumbw; + int _docThumbx = 0, _docThumby = 0, _docThumbw = 0; RadialAnimation _docRadial; LinkButton _docDownload, _docSaveAs, _docCancel; - History *_migrated, *_history; // if conversation photos or files overview - PeerData *_peer; - UserData *_user; // if user profile photos overview + History *_migrated = nullptr; + History *_history = nullptr; // if conversation photos or files overview + PeerData *_peer = nullptr; + UserData *_user = nullptr; // if user profile photos overview - PeerData *_from; + // There can be additional first photo in chat photos overview, that is not + // in the _history->overview[OverviewChatPhotos] (if the item was deleted). + PhotoData *_additionalChatPhoto = nullptr; + + PeerData *_from = nullptr; Text _fromName; - int32 _index; // index in photos or files array, -1 if just photo - MsgId _msgid; // msgId of current photo or file - bool _msgmigrated; // msgId is from _migrated history - ChannelId _channel; - bool _canForward, _canDelete; + int _index = -1; // index in photos or files array, -1 if just photo + MsgId _msgid = 0; // msgId of current photo or file + bool _msgmigrated = false; // msgId is from _migrated history + ChannelId _channel = NoChannel; + bool _canForward = false; + bool _canDelete = false; - mtpRequestId _loadRequest; + mtpRequestId _loadRequest = 0; enum OverState { OverNone, @@ -190,9 +209,10 @@ private: OverMore, OverIcon, }; - OverState _over, _down; + OverState _over = OverNone; + OverState _down = OverNone; QPoint _lastAction, _lastMouseMovePos; - bool _ignoringDropdown; + bool _ignoringDropdown = false; Animation _a_state; @@ -202,25 +222,25 @@ private: ControlsHiding, ControlsHidden, }; - ControlsState _controlsState; - uint64 _controlsAnimStarted; + ControlsState _controlsState = ControlsShown; + uint64 _controlsAnimStarted = 0; QTimer _controlsHideTimer; anim::fvalue a_cOpacity; - PopupMenu *_menu; + PopupMenu *_menu = nullptr; Dropdown _dropdown; IconedButton *_btnSaveCancel, *_btnToMessage, *_btnShowInFolder, *_btnSaveAs, *_btnCopy, *_btnForward, *_btnDelete, *_btnViewAll; QList _btns; - bool _receiveMouse; + bool _receiveMouse = true; - bool _touchPress, _touchMove, _touchRightButton; + bool _touchPress = false, _touchMove = false, _touchRightButton = false; QTimer _touchTimer; QPoint _touchStart; QPoint _accumScroll; QString _saveMsgFilename; - uint64 _saveMsgStarted; + uint64 _saveMsgStarted = 0; anim::fvalue _saveMsgOpacity; QRect _saveMsg; QTimer _saveMsgUpdater; diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp index da2ecfbd5..79e787e94 100644 --- a/Telegram/SourceFiles/mtproto/connection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -855,7 +855,7 @@ void ConnectionPrivate::tryToSend() { MTPInitConnection initWrapperImpl, *initWrapper = &initWrapperImpl; int32 initSize = 0, initSizeInInts = 0; if (needsLayer) { - initWrapperImpl = MTPInitConnection(MTP_int(ApiId), MTP_string(cApiDeviceModel()), MTP_string(cApiSystemVersion()), MTP_string(cApiAppVersion()), MTP_string(ApiLang), mtpRequest()); + initWrapperImpl = MTPInitConnection(MTP_int(ApiId), MTP_string(cApiDeviceModel()), MTP_string(cApiSystemVersion()), MTP_string(cApiAppVersion()), MTP_string(Sandbox::LangSystemISO()), mtpRequest()); initSizeInInts = (initWrapper->innerLength() >> 2) + 2; initSize = initSizeInInts * sizeof(mtpPrime); } diff --git a/Telegram/SourceFiles/mtproto/core_types.h b/Telegram/SourceFiles/mtproto/core_types.h index 924b93ba2..2e921512a 100644 --- a/Telegram/SourceFiles/mtproto/core_types.h +++ b/Telegram/SourceFiles/mtproto/core_types.h @@ -1027,6 +1027,9 @@ enum class MTPDmessage_ClientFlag : int32 { // message has a switch inline keyboard button, need to return to inline f_has_switch_inline_button = (1 << 23), + // message is generated on the client side and should be unread + f_clientside_unread = (1 << 22), + // update this when adding new client side flags MIN_FIELD = (1 << 23), }; diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 6eefd52d8..f25a596ee 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -226,8 +226,8 @@ chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; -message#c09be45f flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int = Message; -messageService#9e19a1f6 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; +message#c09be45f flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector views:flags.10?int edit_date:flags.15?int = Message; +messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; @@ -251,8 +251,8 @@ messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; -dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog; -dialogChannel#5b8496b2 peer:Peer top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int notify_settings:PeerNotifySettings pts:int = Dialog; +dialog#202de501 peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog; +dialogChannel#db17c25 peer:Peer top_message:int top_important_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_important_count:int notify_settings:PeerNotifySettings pts:int = Dialog; photoEmpty#2331b22d id:long = Photo; photo#cded42fe id:long access_hash:long date:int sizes:Vector = Photo; @@ -341,6 +341,7 @@ inputMessagesFilterUrl#7ef0dd87 = MessagesFilter; inputMessagesFilterGif#ffc86587 = MessagesFilter; inputMessagesFilterVoice#50f5c392 = MessagesFilter; inputMessagesFilterMusic#3751b49e = MessagesFilter; +inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; @@ -390,6 +391,7 @@ updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateBotCallbackQuery#a68c688c query_id:long user_id:int peer:Peer msg_id:int data:bytes = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; updateInlineBotCallbackQuery#2cbd95af query_id:long user_id:int msg_id:InputBotInlineMessageID data:bytes = Update; +updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -398,12 +400,12 @@ updates.difference#f49ca0 new_messages:Vector new_encrypted_messages:Ve updates.differenceSlice#a8fb1981 new_messages:Vector new_encrypted_messages:Vector other_updates:Vector chats:Vector users:Vector intermediate_state:updates.State = updates.Difference; updatesTooLong#e317af7e = Updates; -updateShortMessage#914fbf11 flags:# unread:flags.0?true 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; -updateShortChatMessage#16812688 flags:# unread:flags.0?true out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_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; +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; +updateShortChatMessage#16812688 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:int chat_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; updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; -updateShortSentMessage#11f1331c flags:# unread:flags.0?true out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; +updateShortSentMessage#11f1331c flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; @@ -703,7 +705,7 @@ invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; -auth.sendCode#ccfd70cf flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string lang_code:string = auth.SentCode; +auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; @@ -719,7 +721,7 @@ auth.recoverPassword#4ea56e92 code:string = auth.Authorization; auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; -account.registerDevice#446c712c token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool; +account.registerDevice#637ea878 token_type:int token:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; account.updateNotifySettings#84be5b93 peer:InputNotifyPeer settings:InputPeerNotifySettings = Bool; account.getNotifySettings#12b3ad31 peer:InputNotifyPeer = PeerNotifySettings; @@ -825,7 +827,7 @@ messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id: 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#a6e94f04 peer:InputPeer msg_id:int data:bytes = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#481c591a flags:# alert:flags.1?true query_id:long message:flags.0?string = Bool; -messages.getPeerDialogs#19250887 peer:Vector = messages.PeerDialogs; +messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; @@ -842,12 +844,12 @@ upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int help.getConfig#c4f9186b = Config; help.getNearestDc#1fb33026 = NearestDc; -help.getAppUpdate#c812ac7e device_model:string system_version:string app_version:string lang_code:string = help.AppUpdate; +help.getAppUpdate#ae2de196 = help.AppUpdate; help.saveAppLog#6f02f748 events:Vector = Bool; -help.getInviteText#a4a95186 lang_code:string = help.InviteText; +help.getInviteText#4d392343 = help.InviteText; help.getSupport#9cdf08cd = help.Support; -help.getAppChangelog#5bab7fb2 device_model:string system_version:string app_version:string lang_code:string = help.AppChangelog; -help.getTermsOfService#37d78f83 lang_code:string = help.TermsOfService; +help.getAppChangelog#b921197a = help.AppChangelog; +help.getTermsOfService#350170f3 = help.TermsOfService; channels.getDialogs#a9d3d249 offset:int limit:int = messages.Dialogs; channels.getImportantHistory#8f494bb2 channel:InputChannel offset_id:int offset_date:int add_offset:int limit:int max_id:int min_id:int = messages.Messages; @@ -879,4 +881,4 @@ channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessag channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; -// LAYER 52 +// LAYER 53 diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index a92355752..7ffb2fa08 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -1360,25 +1360,24 @@ void _serialize_message(MTPStringLogger &to, int32 stage, int32 lev, Types &type } 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(" unread: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_from_id) { types.push_back(mtpc_int+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 9: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_fwd_from) { 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 11: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 12: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 13: 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 14: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 15: to.add(" media: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media) { 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 16: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_markup) { types.push_back(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 17: to.add(" entities: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; - case 18: to.add(" views: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_views) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; - case 19: to.add(" edit_date: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_edit_date) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; + case 1: to.add(" out: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 3: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 4: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 5: to.add(" post: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_from_id) { types.push_back(mtpc_int+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 8: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_fwd_from) { 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 10: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 11: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 12: 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 13: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 14: to.add(" media: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media) { 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 15: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_markup) { types.push_back(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 16: to.add(" entities: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 17: to.add(" views: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_views) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 18: to.add(" edit_date: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_edit_date) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -1394,18 +1393,17 @@ void _serialize_messageService(MTPStringLogger &to, int32 stage, int32 lev, Type } 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(" unread: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_from_id) { types.push_back(mtpc_int+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 9: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 11: 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 12: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" out: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 3: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 4: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 5: to.add(" post: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_from_id) { types.push_back(mtpc_int+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 8: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 10: 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 11: to.add(" action: "); ++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; } } @@ -1647,8 +1645,9 @@ void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" top_message: "); ++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(" read_inbox_max_id: "); ++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(" unread_count: "); ++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(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" read_outbox_max_id: "); ++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(" unread_count: "); ++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(" notify_settings: "); ++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; } } @@ -1665,10 +1664,11 @@ void _serialize_dialogChannel(MTPStringLogger &to, int32 stage, int32 lev, Types case 1: to.add(" top_message: "); ++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(" top_important_message: "); ++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(" read_inbox_max_id: "); ++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(" unread_count: "); ++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(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); 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(" pts: "); ++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(" read_outbox_max_id: "); ++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(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: 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; } } @@ -2306,6 +2306,10 @@ void _serialize_inputMessagesFilterMusic(MTPStringLogger &to, int32 stage, int32 to.add("{ inputMessagesFilterMusic }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_inputMessagesFilterChatPhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ inputMessagesFilterChatPhotos }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + void _serialize_updateNewMessage(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); @@ -3004,6 +3008,20 @@ void _serialize_updateInlineBotCallbackQuery(MTPStringLogger &to, int32 stage, i } } +void _serialize_updateReadChannelOutbox(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("{ updateReadChannelOutbox"); + 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(" max_id: "); ++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); @@ -3086,21 +3104,20 @@ void _serialize_updateShortMessage(MTPStringLogger &to, int32 stage, int32 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(" unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: 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 10: 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; - case 11: 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 12: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_fwd_from) { 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 13: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 14: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 15: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 1: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 3: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 4: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 5: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: 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 9: 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; + case 10: 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 11: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_fwd_from) { 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 12: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 13: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 14: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -3116,22 +3133,21 @@ void _serialize_updateShortChatMessage(MTPStringLogger &to, int32 stage, int32 l } 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(" unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: 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 11: 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; - case 12: 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 13: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_fwd_from) { 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 14: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 15: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 16: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 1: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 3: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 4: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 5: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: 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 10: 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; + case 11: 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 12: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_fwd_from) { 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 13: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 14: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+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 15: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -3196,14 +3212,13 @@ void _serialize_updateShortSentMessage(MTPStringLogger &to, int32 stage, int32 l } 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(" unread: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" id: "); ++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(" 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(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: 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 7: to.add(" media: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_media) { 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 8: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 1: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" id: "); ++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: "); ++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(" pts_count: "); ++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(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" media: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_media) { 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 7: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -5929,11 +5944,6 @@ void _serialize_account_registerDevice(MTPStringLogger &to, int32 stage, int32 l switch (stage) { case 0: to.add(" token_type: "); ++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(" token: "); ++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(" device_model: "); ++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(" system_version: "); ++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(" app_version: "); ++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(" app_sandbox: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" lang_code: "); ++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; } } @@ -6556,7 +6566,6 @@ void _serialize_auth_sendCode(MTPStringLogger &to, int32 stage, int32 lev, Types case 3: to.add(" current_number: "); ++stages.back(); if (flag & MTPauth_sendCode::Flag::f_current_number) { types.push_back(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(" api_id: "); ++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(" api_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" lang_code: "); ++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; } } @@ -8044,7 +8053,7 @@ void _serialize_messages_getPeerDialogs(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" peer: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" peers: "); ++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; } } @@ -8154,32 +8163,11 @@ void _serialize_help_getNearestDc(MTPStringLogger &to, int32 stage, int32 lev, T } void _serialize_help_getAppUpdate(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_getAppUpdate"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" device_model: "); ++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(" system_version: "); ++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(" app_version: "); ++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(" lang_code: "); ++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; - } + to.add("{ help_getAppUpdate }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } void _serialize_help_getInviteText(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_getInviteText"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" lang_code: "); ++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; - } + to.add("{ help_getInviteText }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } void _serialize_help_getSupport(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { @@ -8187,32 +8175,11 @@ void _serialize_help_getSupport(MTPStringLogger &to, int32 stage, int32 lev, Typ } void _serialize_help_getAppChangelog(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_getAppChangelog"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" device_model: "); ++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(" system_version: "); ++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(" app_version: "); ++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(" lang_code: "); ++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; - } + to.add("{ help_getAppChangelog }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } void _serialize_help_getTermsOfService(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_getTermsOfService"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" lang_code: "); ++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; - } + to.add("{ help_getTermsOfService }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } void _serialize_channels_getParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { @@ -8498,6 +8465,7 @@ namespace { _serializers.insert(mtpc_inputMessagesFilterGif, _serialize_inputMessagesFilterGif); _serializers.insert(mtpc_inputMessagesFilterVoice, _serialize_inputMessagesFilterVoice); _serializers.insert(mtpc_inputMessagesFilterMusic, _serialize_inputMessagesFilterMusic); + _serializers.insert(mtpc_inputMessagesFilterChatPhotos, _serialize_inputMessagesFilterChatPhotos); _serializers.insert(mtpc_updateNewMessage, _serialize_updateNewMessage); _serializers.insert(mtpc_updateMessageID, _serialize_updateMessageID); _serializers.insert(mtpc_updateDeleteMessages, _serialize_updateDeleteMessages); @@ -8546,6 +8514,7 @@ namespace { _serializers.insert(mtpc_updateBotCallbackQuery, _serialize_updateBotCallbackQuery); _serializers.insert(mtpc_updateEditMessage, _serialize_updateEditMessage); _serializers.insert(mtpc_updateInlineBotCallbackQuery, _serialize_updateInlineBotCallbackQuery); + _serializers.insert(mtpc_updateReadChannelOutbox, _serialize_updateReadChannelOutbox); _serializers.insert(mtpc_updates_state, _serialize_updates_state); _serializers.insert(mtpc_updates_differenceEmpty, _serialize_updates_differenceEmpty); _serializers.insert(mtpc_updates_difference, _serialize_updates_difference); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index 43b12621f..1886233df 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 = 52; +static constexpr mtpPrime CurrentLayer = 53; class TypeCreator; @@ -178,8 +178,8 @@ enum { mtpc_messageActionChatMigrateTo = 0x51bdb021, mtpc_messageActionChannelMigrateFrom = 0xb055eaee, mtpc_messageActionPinMessage = 0x94bd38ed, - mtpc_dialog = 0xc1dd804a, - mtpc_dialogChannel = 0x5b8496b2, + mtpc_dialog = 0x202de501, + mtpc_dialogChannel = 0xdb17c25, mtpc_photoEmpty = 0x2331b22d, mtpc_photo = 0xcded42fe, mtpc_photoSizeEmpty = 0xe17e23c, @@ -238,6 +238,7 @@ enum { mtpc_inputMessagesFilterGif = 0xffc86587, mtpc_inputMessagesFilterVoice = 0x50f5c392, mtpc_inputMessagesFilterMusic = 0x3751b49e, + mtpc_inputMessagesFilterChatPhotos = 0x3a20ecb8, mtpc_updateNewMessage = 0x1f2b0afd, mtpc_updateMessageID = 0x4e90bfd6, mtpc_updateDeleteMessages = 0xa20db0e5, @@ -286,6 +287,7 @@ enum { mtpc_updateBotCallbackQuery = 0xa68c688c, mtpc_updateEditMessage = 0xe40370a3, mtpc_updateInlineBotCallbackQuery = 0x2cbd95af, + mtpc_updateReadChannelOutbox = 0x25d6c9c7, mtpc_updates_state = 0xa56c2a3e, mtpc_updates_differenceEmpty = 0x5d75a138, mtpc_updates_difference = 0xf49ca0, @@ -505,7 +507,7 @@ enum { mtpc_invokeWithLayer = 0xda9b0d0d, mtpc_invokeWithoutUpdates = 0xbf9459b7, mtpc_auth_checkPhone = 0x6fe51dfb, - mtpc_auth_sendCode = 0xccfd70cf, + mtpc_auth_sendCode = 0x86aef0ec, mtpc_auth_signUp = 0x1b067634, mtpc_auth_signIn = 0xbcd51581, mtpc_auth_logOut = 0x5717da40, @@ -520,7 +522,7 @@ enum { mtpc_auth_recoverPassword = 0x4ea56e92, mtpc_auth_resendCode = 0x3ef1a9bf, mtpc_auth_cancelCode = 0x1f040578, - mtpc_account_registerDevice = 0x446c712c, + mtpc_account_registerDevice = 0x637ea878, mtpc_account_unregisterDevice = 0x65c55b40, mtpc_account_updateNotifySettings = 0x84be5b93, mtpc_account_getNotifySettings = 0x12b3ad31, @@ -623,7 +625,7 @@ enum { mtpc_messages_editInlineBotMessage = 0x130c2c85, mtpc_messages_getBotCallbackAnswer = 0xa6e94f04, mtpc_messages_setBotCallbackAnswer = 0x481c591a, - mtpc_messages_getPeerDialogs = 0x19250887, + mtpc_messages_getPeerDialogs = 0x2d9776b9, mtpc_updates_getState = 0xedd4882a, mtpc_updates_getDifference = 0xa041495, mtpc_updates_getChannelDifference = 0xbb32d7c0, @@ -636,12 +638,12 @@ enum { mtpc_upload_saveBigFilePart = 0xde7b673d, mtpc_help_getConfig = 0xc4f9186b, mtpc_help_getNearestDc = 0x1fb33026, - mtpc_help_getAppUpdate = 0xc812ac7e, + mtpc_help_getAppUpdate = 0xae2de196, mtpc_help_saveAppLog = 0x6f02f748, - mtpc_help_getInviteText = 0xa4a95186, + mtpc_help_getInviteText = 0x4d392343, mtpc_help_getSupport = 0x9cdf08cd, - mtpc_help_getAppChangelog = 0x5bab7fb2, - mtpc_help_getTermsOfService = 0x37d78f83, + mtpc_help_getAppChangelog = 0xb921197a, + mtpc_help_getTermsOfService = 0x350170f3, mtpc_channels_getDialogs = 0xa9d3d249, mtpc_channels_getImportantHistory = 0x8f494bb2, mtpc_channels_readHistory = 0xcc104937, @@ -1014,6 +1016,7 @@ class MTPDupdateChannelPinnedMessage; class MTPDupdateBotCallbackQuery; class MTPDupdateEditMessage; class MTPDupdateInlineBotCallbackQuery; +class MTPDupdateReadChannelOutbox; class MTPupdates_state; class MTPDupdates_state; @@ -5526,6 +5529,18 @@ public: return *(const MTPDupdateInlineBotCallbackQuery*)data; } + MTPDupdateReadChannelOutbox &_updateReadChannelOutbox() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadChannelOutbox) throw mtpErrorWrongTypeId(_type, mtpc_updateReadChannelOutbox); + split(); + return *(MTPDupdateReadChannelOutbox*)data; + } + const MTPDupdateReadChannelOutbox &c_updateReadChannelOutbox() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadChannelOutbox) throw mtpErrorWrongTypeId(_type, mtpc_updateReadChannelOutbox); + return *(const MTPDupdateReadChannelOutbox*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5581,6 +5596,7 @@ private: explicit MTPupdate(MTPDupdateBotCallbackQuery *_data); explicit MTPupdate(MTPDupdateEditMessage *_data); explicit MTPupdate(MTPDupdateInlineBotCallbackQuery *_data); + explicit MTPupdate(MTPDupdateReadChannelOutbox *_data); friend class MTP::internal::TypeCreator; @@ -10606,7 +10622,6 @@ public: class MTPDmessage : public mtpDataImpl { public: enum class Flag : int32 { - f_unread = (1 << 0), f_out = (1 << 1), f_mentioned = (1 << 4), f_media_unread = (1 << 5), @@ -10627,7 +10642,6 @@ public: Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - bool is_unread() const { return vflags.v & Flag::f_unread; } bool is_out() const { return vflags.v & Flag::f_out; } bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } @@ -10667,7 +10681,6 @@ public: class MTPDmessageService : public mtpDataImpl { public: enum class Flag : int32 { - f_unread = (1 << 0), f_out = (1 << 1), f_mentioned = (1 << 4), f_media_unread = (1 << 5), @@ -10681,7 +10694,6 @@ public: Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - bool is_unread() const { return vflags.v & Flag::f_unread; } bool is_out() const { return vflags.v & Flag::f_out; } bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } @@ -10869,12 +10881,13 @@ class MTPDdialog : public mtpDataImpl { public: MTPDdialog() { } - MTPDdialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) : vpeer(_peer), vtop_message(_top_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vnotify_settings(_notify_settings) { + MTPDdialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) : vpeer(_peer), vtop_message(_top_message), vread_inbox_max_id(_read_inbox_max_id), vread_outbox_max_id(_read_outbox_max_id), vunread_count(_unread_count), vnotify_settings(_notify_settings) { } MTPPeer vpeer; MTPint vtop_message; MTPint vread_inbox_max_id; + MTPint vread_outbox_max_id; MTPint vunread_count; MTPPeerNotifySettings vnotify_settings; }; @@ -10883,13 +10896,14 @@ class MTPDdialogChannel : public mtpDataImpl { public: MTPDdialogChannel() { } - MTPDdialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) : vpeer(_peer), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vnotify_settings(_notify_settings), vpts(_pts) { + MTPDdialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) : vpeer(_peer), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vread_outbox_max_id(_read_outbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vnotify_settings(_notify_settings), vpts(_pts) { } MTPPeer vpeer; MTPint vtop_message; MTPint vtop_important_message; MTPint vread_inbox_max_id; + MTPint vread_outbox_max_id; MTPint vunread_count; MTPint vunread_important_count; MTPPeerNotifySettings vnotify_settings; @@ -11961,6 +11975,17 @@ public: MTPbytes vdata; }; +class MTPDupdateReadChannelOutbox : public mtpDataImpl { +public: + MTPDupdateReadChannelOutbox() { + } + MTPDupdateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) : vchannel_id(_channel_id), vmax_id(_max_id) { + } + + MTPint vchannel_id; + MTPint vmax_id; +}; + class MTPDupdates_state : public mtpDataImpl { public: MTPDupdates_state() { @@ -12019,7 +12044,6 @@ public: class MTPDupdateShortMessage : public mtpDataImpl { public: enum class Flag : int32 { - f_unread = (1 << 0), f_out = (1 << 1), f_mentioned = (1 << 4), f_media_unread = (1 << 5), @@ -12034,7 +12058,6 @@ public: Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - bool is_unread() const { return vflags.v & Flag::f_unread; } bool is_out() const { return vflags.v & Flag::f_out; } bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } @@ -12065,7 +12088,6 @@ public: class MTPDupdateShortChatMessage : public mtpDataImpl { public: enum class Flag : int32 { - f_unread = (1 << 0), f_out = (1 << 1), f_mentioned = (1 << 4), f_media_unread = (1 << 5), @@ -12080,7 +12102,6 @@ public: Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - bool is_unread() const { return vflags.v & Flag::f_unread; } bool is_out() const { return vflags.v & Flag::f_out; } bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } @@ -12152,7 +12173,6 @@ public: class MTPDupdateShortSentMessage : public mtpDataImpl { public: enum class Flag : int32 { - f_unread = (1 << 0), f_out = (1 << 1), f_media = (1 << 9), f_entities = (1 << 7), @@ -12162,7 +12182,6 @@ public: Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - bool is_unread() const { return vflags.v & Flag::f_unread; } bool is_out() const { return vflags.v & Flag::f_out; } bool has_media() const { return vflags.v & Flag::f_media; } bool has_entities() const { return vflags.v & Flag::f_entities; } @@ -15056,18 +15075,17 @@ public: MTPBool vcurrent_number; MTPint vapi_id; MTPstring vapi_hash; - MTPstring vlang_code; MTPauth_sendCode() { } MTPauth_sendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendCode) { read(from, end, cons); } - MTPauth_sendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : vflags(_flags), vphone_number(_phone_number), vcurrent_number(_current_number), vapi_id(_api_id), vapi_hash(_api_hash), vlang_code(_lang_code) { + MTPauth_sendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash) : vflags(_flags), vphone_number(_phone_number), vcurrent_number(_current_number), vapi_id(_api_id), vapi_hash(_api_hash) { } uint32 innerLength() const { - return vflags.innerLength() + vphone_number.innerLength() + (has_current_number() ? vcurrent_number.innerLength() : 0) + vapi_id.innerLength() + vapi_hash.innerLength() + vlang_code.innerLength(); + return vflags.innerLength() + vphone_number.innerLength() + (has_current_number() ? vcurrent_number.innerLength() : 0) + vapi_id.innerLength() + vapi_hash.innerLength(); } mtpTypeId type() const { return mtpc_auth_sendCode; @@ -15078,7 +15096,6 @@ public: if (has_current_number()) { vcurrent_number.read(from, end); } else { vcurrent_number = MTPBool(); } vapi_id.read(from, end); vapi_hash.read(from, end); - vlang_code.read(from, end); } void write(mtpBuffer &to) const { vflags.write(to); @@ -15086,7 +15103,6 @@ public: if (has_current_number()) vcurrent_number.write(to); vapi_id.write(to); vapi_hash.write(to); - vlang_code.write(to); } typedef MTPauth_SentCode ResponseType; @@ -15101,7 +15117,7 @@ public: } MTPauth_SendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPauth_SendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : MTPBoxed(MTPauth_sendCode(_flags, _phone_number, _current_number, _api_id, _api_hash, _lang_code)) { + MTPauth_SendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash) : MTPBoxed(MTPauth_sendCode(_flags, _phone_number, _current_number, _api_id, _api_hash)) { } }; @@ -15679,22 +15695,17 @@ class MTPaccount_registerDevice { // RPC method 'account.registerDevice' public: MTPint vtoken_type; MTPstring vtoken; - MTPstring vdevice_model; - MTPstring vsystem_version; - MTPstring vapp_version; - MTPBool vapp_sandbox; - MTPstring vlang_code; MTPaccount_registerDevice() { } MTPaccount_registerDevice(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_registerDevice) { read(from, end, cons); } - MTPaccount_registerDevice(MTPint _token_type, const MTPstring &_token, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, MTPBool _app_sandbox, const MTPstring &_lang_code) : vtoken_type(_token_type), vtoken(_token), vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vapp_sandbox(_app_sandbox), vlang_code(_lang_code) { + MTPaccount_registerDevice(MTPint _token_type, const MTPstring &_token) : vtoken_type(_token_type), vtoken(_token) { } uint32 innerLength() const { - return vtoken_type.innerLength() + vtoken.innerLength() + vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vapp_sandbox.innerLength() + vlang_code.innerLength(); + return vtoken_type.innerLength() + vtoken.innerLength(); } mtpTypeId type() const { return mtpc_account_registerDevice; @@ -15702,20 +15713,10 @@ public: void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_registerDevice) { vtoken_type.read(from, end); vtoken.read(from, end); - vdevice_model.read(from, end); - vsystem_version.read(from, end); - vapp_version.read(from, end); - vapp_sandbox.read(from, end); - vlang_code.read(from, end); } void write(mtpBuffer &to) const { vtoken_type.write(to); vtoken.write(to); - vdevice_model.write(to); - vsystem_version.write(to); - vapp_version.write(to); - vapp_sandbox.write(to); - vlang_code.write(to); } typedef MTPBool ResponseType; @@ -15728,7 +15729,7 @@ public: } MTPaccount_RegisterDevice(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPaccount_RegisterDevice(MTPint _token_type, const MTPstring &_token, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, MTPBool _app_sandbox, const MTPstring &_lang_code) : MTPBoxed(MTPaccount_registerDevice(_token_type, _token, _device_model, _system_version, _app_version, _app_sandbox, _lang_code)) { + MTPaccount_RegisterDevice(MTPint _token_type, const MTPstring &_token) : MTPBoxed(MTPaccount_registerDevice(_token_type, _token)) { } }; @@ -20264,27 +20265,27 @@ public: class MTPmessages_getPeerDialogs { // RPC method 'messages.getPeerDialogs' public: - MTPVector vpeer; + MTPVector vpeers; MTPmessages_getPeerDialogs() { } MTPmessages_getPeerDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getPeerDialogs) { read(from, end, cons); } - MTPmessages_getPeerDialogs(const MTPVector &_peer) : vpeer(_peer) { + MTPmessages_getPeerDialogs(const MTPVector &_peers) : vpeers(_peers) { } uint32 innerLength() const { - return vpeer.innerLength(); + return vpeers.innerLength(); } mtpTypeId type() const { return mtpc_messages_getPeerDialogs; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getPeerDialogs) { - vpeer.read(from, end); + vpeers.read(from, end); } void write(mtpBuffer &to) const { - vpeer.write(to); + vpeers.write(to); } typedef MTPmessages_PeerDialogs ResponseType; @@ -20297,7 +20298,7 @@ public: } MTPmessages_GetPeerDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetPeerDialogs(const MTPVector &_peer) : MTPBoxed(MTPmessages_getPeerDialogs(_peer)) { + MTPmessages_GetPeerDialogs(const MTPVector &_peers) : MTPBoxed(MTPmessages_getPeerDialogs(_peers)) { } }; @@ -20804,36 +20805,21 @@ public: class MTPhelp_getAppUpdate { // RPC method 'help.getAppUpdate' public: - MTPstring vdevice_model; - MTPstring vsystem_version; - MTPstring vapp_version; - MTPstring vlang_code; - MTPhelp_getAppUpdate() { } MTPhelp_getAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { read(from, end, cons); } - MTPhelp_getAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code) { - } uint32 innerLength() const { - return vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength(); + return 0; } mtpTypeId type() const { return mtpc_help_getAppUpdate; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { - vdevice_model.read(from, end); - vsystem_version.read(from, end); - vapp_version.read(from, end); - vlang_code.read(from, end); } void write(mtpBuffer &to) const { - vdevice_model.write(to); - vsystem_version.write(to); - vapp_version.write(to); - vlang_code.write(to); } typedef MTPhelp_AppUpdate ResponseType; @@ -20846,8 +20832,6 @@ public: } MTPhelp_GetAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPhelp_GetAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getAppUpdate(_device_model, _system_version, _app_version, _lang_code)) { - } }; class MTPhelp_saveAppLog { // RPC method 'help.saveAppLog' @@ -20891,27 +20875,21 @@ public: class MTPhelp_getInviteText { // RPC method 'help.getInviteText' public: - MTPstring vlang_code; - MTPhelp_getInviteText() { } MTPhelp_getInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { read(from, end, cons); } - MTPhelp_getInviteText(const MTPstring &_lang_code) : vlang_code(_lang_code) { - } uint32 innerLength() const { - return vlang_code.innerLength(); + return 0; } mtpTypeId type() const { return mtpc_help_getInviteText; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { - vlang_code.read(from, end); } void write(mtpBuffer &to) const { - vlang_code.write(to); } typedef MTPhelp_InviteText ResponseType; @@ -20924,8 +20902,6 @@ public: } MTPhelp_GetInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPhelp_GetInviteText(const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getInviteText(_lang_code)) { - } }; class MTPhelp_getSupport { // RPC method 'help.getSupport' @@ -20961,36 +20937,21 @@ public: class MTPhelp_getAppChangelog { // RPC method 'help.getAppChangelog' public: - MTPstring vdevice_model; - MTPstring vsystem_version; - MTPstring vapp_version; - MTPstring vlang_code; - MTPhelp_getAppChangelog() { } MTPhelp_getAppChangelog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppChangelog) { read(from, end, cons); } - MTPhelp_getAppChangelog(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code) { - } uint32 innerLength() const { - return vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength(); + return 0; } mtpTypeId type() const { return mtpc_help_getAppChangelog; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppChangelog) { - vdevice_model.read(from, end); - vsystem_version.read(from, end); - vapp_version.read(from, end); - vlang_code.read(from, end); } void write(mtpBuffer &to) const { - vdevice_model.write(to); - vsystem_version.write(to); - vapp_version.write(to); - vlang_code.write(to); } typedef MTPhelp_AppChangelog ResponseType; @@ -21003,33 +20964,25 @@ public: } MTPhelp_GetAppChangelog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPhelp_GetAppChangelog(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getAppChangelog(_device_model, _system_version, _app_version, _lang_code)) { - } }; class MTPhelp_getTermsOfService { // RPC method 'help.getTermsOfService' public: - MTPstring vlang_code; - MTPhelp_getTermsOfService() { } MTPhelp_getTermsOfService(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getTermsOfService) { read(from, end, cons); } - MTPhelp_getTermsOfService(const MTPstring &_lang_code) : vlang_code(_lang_code) { - } uint32 innerLength() const { - return vlang_code.innerLength(); + return 0; } mtpTypeId type() const { return mtpc_help_getTermsOfService; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getTermsOfService) { - vlang_code.read(from, end); } void write(mtpBuffer &to) const { - vlang_code.write(to); } typedef MTPhelp_TermsOfService ResponseType; @@ -21042,8 +20995,6 @@ public: } MTPhelp_GetTermsOfService(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPhelp_GetTermsOfService(const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getTermsOfService(_lang_code)) { - } }; class MTPchannels_getDialogs { // RPC method 'channels.getDialogs' @@ -22705,11 +22656,11 @@ public: inline static MTPmessageAction new_messageActionPinMessage() { return MTPmessageAction(mtpc_messageActionPinMessage); } - inline static MTPdialog new_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { - return MTPdialog(new MTPDdialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings)); + inline static MTPdialog new_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { + return MTPdialog(new MTPDdialog(_peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings)); } - inline static MTPdialog new_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { - return MTPdialog(new MTPDdialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts)); + inline static MTPdialog new_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { + return MTPdialog(new MTPDdialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts)); } inline static MTPphoto new_photoEmpty(const MTPlong &_id) { return MTPphoto(new MTPDphotoEmpty(_id)); @@ -22885,6 +22836,9 @@ public: inline static MTPmessagesFilter new_inputMessagesFilterMusic() { return MTPmessagesFilter(mtpc_inputMessagesFilterMusic); } + inline static MTPmessagesFilter new_inputMessagesFilterChatPhotos() { + return MTPmessagesFilter(mtpc_inputMessagesFilterChatPhotos); + } inline static MTPupdate new_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); } @@ -23029,6 +22983,9 @@ public: inline static MTPupdate new_updateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { return MTPupdate(new MTPDupdateInlineBotCallbackQuery(_query_id, _user_id, _msg_id, _data)); } + inline static MTPupdate new_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) { + return MTPupdate(new MTPDupdateReadChannelOutbox(_channel_id, _max_id)); + } 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)); } @@ -26928,11 +26885,11 @@ inline uint32 MTPdialog::innerLength() const { switch (_type) { case mtpc_dialog: { const MTPDdialog &v(c_dialog()); - return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vnotify_settings.innerLength(); + return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vread_outbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vnotify_settings.innerLength(); } case mtpc_dialogChannel: { const MTPDdialogChannel &v(c_dialogChannel()); - return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vtop_important_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vunread_important_count.innerLength() + v.vnotify_settings.innerLength() + v.vpts.innerLength(); + return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vtop_important_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vread_outbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vunread_important_count.innerLength() + v.vnotify_settings.innerLength() + v.vpts.innerLength(); } } return 0; @@ -26950,6 +26907,7 @@ inline void MTPdialog::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vpeer.read(from, end); v.vtop_message.read(from, end); v.vread_inbox_max_id.read(from, end); + v.vread_outbox_max_id.read(from, end); v.vunread_count.read(from, end); v.vnotify_settings.read(from, end); } break; @@ -26960,6 +26918,7 @@ inline void MTPdialog::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vtop_message.read(from, end); v.vtop_important_message.read(from, end); v.vread_inbox_max_id.read(from, end); + v.vread_outbox_max_id.read(from, end); v.vunread_count.read(from, end); v.vunread_important_count.read(from, end); v.vnotify_settings.read(from, end); @@ -26975,6 +26934,7 @@ inline void MTPdialog::write(mtpBuffer &to) const { v.vpeer.write(to); v.vtop_message.write(to); v.vread_inbox_max_id.write(to); + v.vread_outbox_max_id.write(to); v.vunread_count.write(to); v.vnotify_settings.write(to); } break; @@ -26984,6 +26944,7 @@ inline void MTPdialog::write(mtpBuffer &to) const { v.vtop_message.write(to); v.vtop_important_message.write(to); v.vread_inbox_max_id.write(to); + v.vread_outbox_max_id.write(to); v.vunread_count.write(to); v.vunread_important_count.write(to); v.vnotify_settings.write(to); @@ -27002,11 +26963,11 @@ inline MTPdialog::MTPdialog(MTPDdialog *_data) : mtpDataOwner(_data), _type(mtpc } inline MTPdialog::MTPdialog(MTPDdialogChannel *_data) : mtpDataOwner(_data), _type(mtpc_dialogChannel) { } -inline MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { - return MTP::internal::TypeCreator::new_dialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings); +inline MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { + return MTP::internal::TypeCreator::new_dialog(_peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings); } -inline MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { - return MTP::internal::TypeCreator::new_dialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts); +inline MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { + return MTP::internal::TypeCreator::new_dialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts); } inline uint32 MTPphoto::innerLength() const { @@ -28341,6 +28302,7 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, case mtpc_inputMessagesFilterGif: _type = cons; break; case mtpc_inputMessagesFilterVoice: _type = cons; break; case mtpc_inputMessagesFilterMusic: _type = cons; break; + case mtpc_inputMessagesFilterChatPhotos: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPmessagesFilter"); } } @@ -28358,6 +28320,7 @@ inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) { case mtpc_inputMessagesFilterGif: break; case mtpc_inputMessagesFilterVoice: break; case mtpc_inputMessagesFilterMusic: break; + case mtpc_inputMessagesFilterChatPhotos: break; default: throw mtpErrorBadTypeId(type, "MTPmessagesFilter"); } } @@ -28391,6 +28354,9 @@ inline MTPmessagesFilter MTP_inputMessagesFilterVoice() { inline MTPmessagesFilter MTP_inputMessagesFilterMusic() { return MTP::internal::TypeCreator::new_inputMessagesFilterMusic(); } +inline MTPmessagesFilter MTP_inputMessagesFilterChatPhotos() { + return MTP::internal::TypeCreator::new_inputMessagesFilterChatPhotos(); +} inline uint32 MTPupdate::innerLength() const { switch (_type) { @@ -28578,6 +28544,10 @@ inline uint32 MTPupdate::innerLength() const { const MTPDupdateInlineBotCallbackQuery &v(c_updateInlineBotCallbackQuery()); return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vmsg_id.innerLength() + v.vdata.innerLength(); } + case mtpc_updateReadChannelOutbox: { + const MTPDupdateReadChannelOutbox &v(c_updateReadChannelOutbox()); + return v.vchannel_id.innerLength() + v.vmax_id.innerLength(); + } } return 0; } @@ -28906,6 +28876,12 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vmsg_id.read(from, end); v.vdata.read(from, end); } break; + case mtpc_updateReadChannelOutbox: _type = cons; { + if (!data) setData(new MTPDupdateReadChannelOutbox()); + MTPDupdateReadChannelOutbox &v(_updateReadChannelOutbox()); + v.vchannel_id.read(from, end); + v.vmax_id.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); } } @@ -29181,6 +29157,11 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.vmsg_id.write(to); v.vdata.write(to); } break; + case mtpc_updateReadChannelOutbox: { + const MTPDupdateReadChannelOutbox &v(c_updateReadChannelOutbox()); + v.vchannel_id.write(to); + v.vmax_id.write(to); + } break; } } inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -29233,6 +29214,7 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_updateBotCallbackQuery: setData(new MTPDupdateBotCallbackQuery()); break; case mtpc_updateEditMessage: setData(new MTPDupdateEditMessage()); break; case mtpc_updateInlineBotCallbackQuery: setData(new MTPDupdateInlineBotCallbackQuery()); break; + case mtpc_updateReadChannelOutbox: setData(new MTPDupdateReadChannelOutbox()); break; default: throw mtpErrorBadTypeId(type, "MTPupdate"); } } @@ -29328,6 +29310,8 @@ inline MTPupdate::MTPupdate(MTPDupdateEditMessage *_data) : mtpDataOwner(_data), } inline MTPupdate::MTPupdate(MTPDupdateInlineBotCallbackQuery *_data) : mtpDataOwner(_data), _type(mtpc_updateInlineBotCallbackQuery) { } +inline MTPupdate::MTPupdate(MTPDupdateReadChannelOutbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadChannelOutbox) { +} inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_updateNewMessage(_message, _pts, _pts_count); } @@ -29475,6 +29459,9 @@ inline MTPupdate MTP_updateEditMessage(const MTPMessage &_message, MTPint _pts, inline MTPupdate MTP_updateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { return MTP::internal::TypeCreator::new_updateInlineBotCallbackQuery(_query_id, _user_id, _msg_id, _data); } +inline MTPupdate MTP_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) { + return MTP::internal::TypeCreator::new_updateReadChannelOutbox(_channel_id, _max_id); +} inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { } diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index adfc156a3..1e6af9a2b 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -954,6 +954,8 @@ void ProfileInner::paintEvent(QPaintEvent *e) { p.setPen(st::black->p); bool mediaFound = false; for (int i = 0; i < OverviewCount; ++i) { + if (!_mediaButtons[i]) continue; + if (!_mediaButtons[i]->isHidden()) { mediaFound = true; top += _mediaButtons[i]->height() + st::setLittleSkip; @@ -1258,6 +1260,8 @@ bool ProfileInner::updateMediaLinks(int32 *addToScroll) { QPoint p(addToScroll ? mapFromGlobal(QCursor::pos()) : QPoint(0, 0)); bool oneWasShown = false; for (int i = 0; i < OverviewCount; ++i) { + if (!_mediaButtons[i]) continue; + if (!_mediaButtons[i]->isHidden()) { oneWasShown = true; break; @@ -1271,6 +1275,8 @@ bool ProfileInner::updateMediaLinks(int32 *addToScroll) { int32 y = _mediaButtons[OverviewPhotos]->y(); if (addToScroll) *addToScroll = 0; for (int i = 0; i < OverviewCount; ++i) { + if (!_mediaButtons[i]) continue; + int32 addToY = _mediaButtons[i]->height() + st::setLittleSkip; int32 count = _history->overviewCount(i), additional = _migrated ? _migrated->overviewCount(i) : 0; @@ -1465,6 +1471,8 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { bool mediaFound = false; for (int i = 0; i < OverviewCount; ++i) { + if (!_mediaButtons[i]) continue; + _mediaButtons[i]->move(_left, top); if (!_mediaButtons[i]->isHidden()) { mediaFound = true; diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index a98b09707..c5ba60c24 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -188,7 +188,7 @@ private: // shared media bool _notAllMediaLoaded; - LinkButton *_mediaButtons[OverviewCount]; + LinkButton *_mediaButtons[OverviewCount] = { nullptr }; QString overviewLinkText(int32 type, int32 count); // actions