From fb32c5bcd1d70f90529b5b22ea6bbcdc2ae83a30 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 30 Apr 2015 16:53:36 +0300 Subject: [PATCH] version 0.8.8.dev - audio listened status, photo caption display, map places name-address display, gray muted badges, invite links support, some fixes --- Telegram/PrepareWin.bat | 10 +- Telegram/Resources/lang.strings | 16 +- Telegram/Resources/style.txt | 7 + Telegram/SourceFiles/apiwrap.cpp | 16 +- Telegram/SourceFiles/app.cpp | 48 +- Telegram/SourceFiles/app.h | 9 +- Telegram/SourceFiles/application.cpp | 2 +- Telegram/SourceFiles/audio.cpp | 4 - Telegram/SourceFiles/config.h | 6 +- Telegram/SourceFiles/gui/text.cpp | 9 +- Telegram/SourceFiles/history.cpp | 481 +++++-- Telegram/SourceFiles/history.h | 23 +- Telegram/SourceFiles/historywidget.cpp | 6 +- Telegram/SourceFiles/localimageloader.cpp | 2 +- Telegram/SourceFiles/mainwidget.cpp | 187 ++- Telegram/SourceFiles/mainwidget.h | 20 +- Telegram/SourceFiles/mtproto/mtpConnection.h | 1 + Telegram/SourceFiles/mtproto/mtpCoreTypes.h | 2 +- Telegram/SourceFiles/mtproto/mtpScheme.cpp | 289 ++++- Telegram/SourceFiles/mtproto/mtpScheme.h | 1179 +++++++++++++++--- Telegram/SourceFiles/mtproto/scheme.tl | 57 +- Telegram/SourceFiles/profilewidget.cpp | 129 +- Telegram/SourceFiles/profilewidget.h | 17 +- Telegram/SourceFiles/structs.cpp | 3 + Telegram/SourceFiles/structs.h | 14 +- Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | Bin 5532 -> 5532 bytes Telegram/Telegram.xcodeproj/project.pbxproj | 12 +- Telegram/Version.sh | 2 +- 29 files changed, 2076 insertions(+), 477 deletions(-) diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat index 65198f6d8..427884b27 100644 --- a/Telegram/PrepareWin.bat +++ b/Telegram/PrepareWin.bat @@ -1,10 +1,10 @@ @echo OFF -set "AppVersion=8007" -set "AppVersionStrSmall=0.8.7" -set "AppVersionStr=0.8.7" -set "AppVersionStrFull=0.8.7.0" -set "DevChannel=0" +set "AppVersion=8008" +set "AppVersionStrSmall=0.8.8" +set "AppVersionStr=0.8.8" +set "AppVersionStrFull=0.8.8.0" +set "DevChannel=1" if %DevChannel% neq 0 goto preparedev diff --git a/Telegram/Resources/lang.strings b/Telegram/Resources/lang.strings index 3175d7f71..4a756c752 100644 --- a/Telegram/Resources/lang.strings +++ b/Telegram/Resources/lang.strings @@ -382,12 +382,26 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org "lng_action_kick_user" = "{from} kicked {user}"; "lng_action_user_left" = "{from} left the group"; "lng_action_user_joined" = "{from} joined the group"; +"lng_action_user_joined_by_link" = "{from} joined the group via invite link"; "lng_action_user_registered" = "{from} just joined Telegram"; "lng_action_removed_photo" = "{from} removed group photo"; "lng_action_changed_photo" = "{from} changed group photo"; "lng_action_changed_title" = "{from} changed group name to «{title}»"; "lng_action_created_chat" = "{from} created group «{title}»"; +"lng_group_invite_bad_link" = "This invite link is broken\nor it has expired."; +"lng_group_invite_want_join" = "Do you want to join the group «{title}»?"; +"lng_group_invite_full" = "Sorry, this group is already full."; +"lng_group_invite_join" = "Join"; + +"lng_group_invite_link" = "Invite link"; +"lng_group_invite_create" = "Create an invite link"; +"lng_group_invite_about" = "You can create a link for joining this group.\nAnyone who has that link can join."; +"lng_group_invite_create_new" = "Create new link"; +"lng_group_invite_about_new" = "Current invite link will stop working\nwhen you create a new one."; +"lng_group_invite_copied" = "Invite link was copied to clipboard."; +"lng_group_invite_no_room" = "Unable to join this group because there are\ntoo many members in it already."; + "lng_forwarded_from" = "Forwarded from"; "lng_in_reply_to" = "In reply to"; @@ -550,7 +564,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org "lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}"; "lng_new_version_minor" = "— Bug fixes and other minor improvements"; -"lng_new_version_text" = "— New photo viewer design\n— Switch between files in the photo viewer\n— Grouped notifications when several messages are forwarded\n— New default chat background image (you can change it in Settings)"; +"lng_new_version_text" = "— Invite links for group chats\n— Gray unread badge for muted conversations"; "lng_menu_insert_unicode" = "Insert Unicode control character"; diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt index 18ce6aba0..b3b13e12b 100644 --- a/Telegram/Resources/style.txt +++ b/Telegram/Resources/style.txt @@ -699,6 +699,7 @@ dlgDateSkip: 5px; dlgUnreadColor: #FFF; dlgUnreadBG: #6fc766; +dlgUnreadMutedBG: #bbb; dlgUnreadFont: font(12px bold); dlgUnreadPaddingHor: 5px; dlgUnreadPaddingVer: 1px; @@ -919,6 +920,12 @@ mediaInColor: msgInDateColor; mediaOutColor: msgOutDateColor; mediaInSelectColor: msgInSelectDateColor; mediaOutSelectColor: msgOutSelectDateColor; +mediaOutUnreadColor: #6aad60; +mediaOutUnreadSelectColor: #5aa382; +mediaInUnreadColor: #999; +mediaInUnreadSelectColor: #7b95aa; +mediaUnreadSize: 4px; +mediaUnreadSkip: 5px; mediaSaveDelta: 14px; // between bubble and download mediaSaveButton: flatButton(btnDefFlat) { color: #507da2; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 9640de333..f961d789f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -116,18 +116,21 @@ void ApiWrap::clearWebPageRequests() { void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) { const MTPDmessages_chatFull &d(result.c_messages_chatFull()); + const MTPDchatFull &f(d.vfull_chat.c_chatFull()); App::feedUsers(d.vusers); App::feedChats(d.vchats); - App::feedParticipants(d.vfull_chat.c_chatFull().vparticipants); - PhotoData *photo = App::feedPhoto(d.vfull_chat.c_chatFull().vchat_photo); - if (photo) { - ChatData *chat = peer->asChat(); - if (chat) { + App::feedParticipants(f.vparticipants); + PhotoData *photo = App::feedPhoto(f.vchat_photo); + ChatData *chat = peer->asChat(); + if (chat) { + if (photo) { chat->photoId = photo->id; photo->chat = chat; } + chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString(); } - App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vfull_chat.c_chatFull().vnotify_settings); + + App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings); _fullRequests.remove(peer); emit fullPeerLoaded(peer); @@ -136,6 +139,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result) { void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result) { const MTPDuserFull &d(result.c_userFull()); App::feedUsers(MTP_vector(1, d.vuser)); + App::feedPhoto(d.vprofile_photo); App::feedUserLink(MTP_int(App::userFromPeer(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link); App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 5b978c39b..0b6ba19d0 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -34,6 +34,9 @@ namespace { typedef QHash PeersData; PeersData peersData; + typedef QMap MutedPeers; + MutedPeers mutedPeers; + typedef QHash PhotosData; PhotosData photosData; @@ -441,11 +444,12 @@ namespace App { return data; } - void feedChats(const MTPVector &chats) { + ChatData *feedChats(const MTPVector &chats) { + ChatData *data = 0; const QVector &v(chats.c_vector().v); for (QVector::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { const MTPchat &chat(*i); - ChatData *data = 0; + data = 0; QString title; switch (chat.type()) { case mtpc_chat: { @@ -458,7 +462,7 @@ namespace App { data->setPhoto(d.vphoto); data->date = d.vdate.v; data->count = d.vparticipants_count.v; - data->left = false; + data->left = d.vleft.v; data->forbidden = false; data->access = 0; if (data->version < d.vversion.v) { @@ -507,6 +511,7 @@ namespace App { if (App::main()) App::main()->peerUpdated(data); } + return data; } void feedParticipants(const MTPChatParticipants &p) { @@ -1288,7 +1293,7 @@ namespace App { photoSizes.push_back(MTP_photoSize(MTP_string("a"), uphoto.vphoto_small, MTP_int(160), MTP_int(160), MTP_int(0))); photoSizes.push_back(MTP_photoSize(MTP_string("c"), uphoto.vphoto_big, MTP_int(640), MTP_int(640), MTP_int(0))); - return MTP_photo(uphoto.vphoto_id, MTP_long(0), userId, date, MTP_string(""), MTP_geoPointEmpty(), MTP_vector(photoSizes)); + return MTP_photo(uphoto.vphoto_id, MTP_long(0), userId, date, MTP_geoPointEmpty(), MTP_vector(photoSizes)); } return MTP_photoEmpty(MTP_long(0)); } @@ -1431,6 +1436,7 @@ namespace App { void historyClearItems() { historyClearMsgs(); randomData.clear(); + mutedPeers.clear(); for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) { delete *i; } @@ -1772,6 +1778,34 @@ namespace App { return ::webPageItems; } + void regMuted(PeerData *peer, int32 changeIn) { + ::mutedPeers.insert(peer, true); + if (App::main()) App::main()->updateMutedIn(changeIn); + } + + void unregMuted(PeerData *peer) { + ::mutedPeers.remove(peer); + } + + void updateMuted() { + int32 changeInMin = 0; + for (MutedPeers::iterator i = ::mutedPeers.begin(); i != ::mutedPeers.end();) { + int32 changeIn = 0; + History *h = App::history(i.key()->id); + if (isNotifyMuted(i.key()->notify, &changeIn)) { + h->setMute(true); + if (changeIn && (!changeInMin || changeIn < changeInMin)) { + changeInMin = changeIn; + } + ++i; + } else { + h->setMute(false); + i = ::mutedPeers.erase(i); + } + } + if (changeInMin) App::main()->updateMutedIn(changeInMin); + } + void setProxySettings(QNetworkAccessManager &manager) { if (cConnectionType() == dbictHttpProxy) { const ConnectionProxy &p(cConnectionProxy()); @@ -1802,6 +1836,12 @@ namespace App { } } + void joinGroupByHash(const QString &hash) { + if (App::main()) { + App::main()->joinGroupByHash(hash); + } + } + void openLocalUrl(const QString &url) { if (App::main()) { App::main()->openLocalUrl(url); diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 1f32f206f..eb596e582 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -72,8 +72,8 @@ namespace App { QString onlineText(UserData *user, int32 nowOnServer, bool precise = false); bool onlineColorUse(int32 online, int32 now); - UserData *feedUsers(const MTPVector &users); // returnes last user - void feedChats(const MTPVector &chats); + UserData *feedUsers(const MTPVector &users); // returns last user + ChatData *feedChats(const MTPVector &chats); // returns last chat void feedParticipants(const MTPChatParticipants &p); void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d); void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d); @@ -189,11 +189,16 @@ namespace App { void unregWebPageItem(WebPageData *data, HistoryItem *item); const WebPageItems &webPageItems(); + void regMuted(PeerData *peer, int32 changeIn); + void unregMuted(PeerData *peer); + void updateMuted(); + void setProxySettings(QNetworkAccessManager &manager); void setProxySettings(QTcpSocket &socket); void searchByHashtag(const QString &tag); void openUserByName(const QString &username, bool toProfile = false); + void joinGroupByHash(const QString &hash); void openLocalUrl(const QString &url); void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 5cd003dba..fd13c344f 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -481,7 +481,7 @@ void Application::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId) PhotoId id = MTP::nonce(); - MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(MTP::authedId()), MTP_int(unixtime()), MTP_string(""), MTP_geoPointEmpty(), MTP_vector(photoSizes))); + MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(MTP::authedId()), MTP_int(unixtime()), MTP_geoPointEmpty(), MTP_vector(photoSizes))); QString file, filename; int32 filesize = 0; diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp index 753376005..319f4637f 100644 --- a/Telegram/SourceFiles/audio.cpp +++ b/Telegram/SourceFiles/audio.cpp @@ -414,10 +414,6 @@ void VoiceMessagesFader::onTimer() { if (m.state == VoiceMessagePausing || m.state == VoiceMessageFinishing) { newGain = 1. - newGain; } - if (newGain < 0) { - int a = 0, b; - b = a; - } alSourcef(m.source, AL_GAIN, newGain); } } else if (playing && (state == AL_PLAYING || !m.loading)) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 81738044f..ee4444d4d 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -17,9 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 8007; -static const wchar_t *AppVersionStr = L"0.8.7"; -static const bool DevChannel = false; +static const int32 AppVersion = 8008; +static const wchar_t *AppVersionStr = L"0.8.8"; +static const bool DevChannel = true; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppName = L"Telegram Desktop"; diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index 2082b3732..a54a2106c 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -759,9 +759,12 @@ namespace { void TextLink::onClick(Qt::MouseButton button) const { if (button == Qt::LeftButton || button == Qt::MiddleButton) { QString url = TextLink::encoded(); - QRegularExpressionMatch telegramMe = QRegularExpression(qsl("^https?://telegram\\.me/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url); - if (telegramMe.hasMatch()) { - App::openUserByName(telegramMe.captured(1)); + QRegularExpressionMatch telegramMeUser = QRegularExpression(qsl("^https?://telegram\\.me/([a-zA-Z0-9\\.\\_]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url); + QRegularExpressionMatch telegramMeGroup = QRegularExpression(qsl("^https?://telegram\\.me/joinchat/([a-zA-Z0-9\\.\\_\\-]+)(\\?|$)"), QRegularExpression::CaseInsensitiveOption).match(url); + if (telegramMeUser.hasMatch()) { + App::openUserByName(telegramMeUser.captured(1)); + } else if (telegramMeGroup.hasMatch()) { + App::joinGroupByHash(telegramMeGroup.captured(1)); } else if (QRegularExpression(qsl("^tg://[a-zA-Z0-9]+"), QRegularExpression::CaseInsensitiveOption).match(url).hasMatch()) { App::openLocalUrl(url); } else { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 888a0a468..889266f0c 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -202,7 +202,7 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const { int32 unreadRectLeft = w - st::dlgPaddingHor - unreadRectWidth; int32 unreadRectTop = st::dlgHeight - st::dlgPaddingVer - unreadRectHeight; lastWidth -= unreadRectWidth + st::dlgUnreadPaddingHor; - p.setBrush((act ? st::dlgActiveUnreadBG : st::dlgUnreadBG)->b); + p.setBrush((act ? st::dlgActiveUnreadBG : (history->mute ? st::dlgUnreadMutedBG : st::dlgUnreadBG))->b); p.setPen(Qt::NoPen); p.drawRoundedRect(unreadRectLeft, unreadRectTop, unreadRectWidth, unreadRectHeight, st::dlgUnreadRadius, st::dlgUnreadRadius); p.setFont(st::dlgUnreadFont->f); @@ -540,6 +540,25 @@ HistoryItem *Histories::addToBack(const MTPmessage &msg, int msgState) { HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, bool newMsg, bool returnExisting) { HistoryItem *result = 0; + MsgId msgId = 0; + switch (msg.type()) { + case mtpc_messageEmpty: msgId = msg.c_messageEmpty().vid.v; break; + case mtpc_message: msgId = msg.c_message().vid.v; break; + case mtpc_messageService: msgId = msg.c_messageService().vid.v; break; + } + + HistoryItem *existing = App::histItemById(msgId); + if (existing) { + const MTPMessageMedia *media = 0; + switch (msg.type()) { + case mtpc_message: media = &msg.c_message().vmedia; break; + } + if (media) { + existing->updateMedia(*media); + } + return returnExisting ? existing : 0; + } + switch (msg.type()) { case mtpc_messageEmpty: result = new HistoryServiceMsg(this, block, msg.c_messageEmpty().vid.v, date(), lang(lng_message_empty)); @@ -567,6 +586,11 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo // App::user(App::peerFromUser(d.vuser_id)); added } break; + case mtpc_messageActionChatJoinedByLink: { + const MTPDmessageActionChatJoinedByLink &d(action.c_messageActionChatJoinedByLink()); + // App::user(App::peerFromUser(d.vuser_id)); added + } break; + case mtpc_messageActionChatDeletePhoto: { ChatData *chat = peer->asChat(); if (chat) chat->setPhoto(MTP_chatPhotoEmpty()); @@ -615,17 +639,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo } break; } - HistoryItem *existing = regItem(result, true); - if (existing && result != existing) { - const MTPMessageMedia *media = 0; - switch (msg.type()) { - case mtpc_message: media = &msg.c_message().vmedia; break; - } - if (media) { - existing->updateMedia(*media); - } - } - return (returnExisting || existing == result) ? existing : 0; + return regItem(result, returnExisting); } HistoryItem *History::createItemForwarded(HistoryBlock *block, MsgId id, HistoryMessage *msg) { @@ -1037,7 +1051,8 @@ void History::setMsgCount(int32 newMsgCount) { if (mute != newMute) { App::histories().unreadMuted += newMute ? unreadCount : (-unreadCount); mute = newMute; - App::wnd()->updateCounter(); + if (App::wnd()) App::wnd()->updateCounter(); + if (App::main()) App::main()->dlgUpdated(this); } } @@ -1522,10 +1537,14 @@ HistoryItem *regItem(HistoryItem *item, bool returnExisting) { return item; } -HistoryPhoto::HistoryPhoto(const MTPDphoto &photo) : HistoryMedia() +HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, const QString &caption, HistoryItem *parent) : HistoryMedia() , pixw(1), pixh(1) , data(App::feedPhoto(photo)) +, _caption(st::minPhotoSize) , openl(new PhotoLink(data)) { + if (!caption.isEmpty()) { + _caption.setText(st::msgFont, caption + textcmdSkipBlock(parent->timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions); + } init(); } @@ -1554,20 +1573,36 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) { } _maxw = qMax(w, int32(st::minPhotoSize)); _minh = qMax(thumbh, int32(st::minPhotoSize)); - if (const HistoryReply *reply = toHistoryReply(parent)) { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = toHistoryForwarded(parent); + if (reply || !_caption.isEmpty()) { _maxw += st::mediaPadding.left() + st::mediaPadding.right(); - _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom(); + if (reply) { + _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } else { + if (parent->out() || !parent->history()->peer->chat || !fwd) { + _minh += st::msgPadding.top(); + } + if (fwd) { + _minh += st::msgServiceNameFont->height + st::msgPadding.top(); + } + } if (!parent->out() && parent->history()->peer->chat) { _minh += st::msgPadding.top() + st::msgNameFont->height; } + if (!_caption.isEmpty()) { + _minh += _caption.minHeight(); + } + _minh += st::mediaPadding.bottom(); } } int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem *parent) { const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent); pixw = qMin(width, _maxw); - if (reply) { + if (reply || !_caption.isEmpty()) { pixw -= st::mediaPadding.left() + st::mediaPadding.right(); } @@ -1594,12 +1629,25 @@ int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem if (pixh < 1) pixh = 1; w = qMax(pixw, int16(st::minPhotoSize)); _height = qMax(pixh, int16(st::minPhotoSize)); - if (reply) { - w += st::mediaPadding.left() + st::mediaPadding.right(); - _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom(); + if (reply || !_caption.isEmpty()) { + if (reply) { + _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } else { + if (parent->out() || !parent->history()->peer->chat || !fwd) { + _height += st::msgPadding.top(); + } + if (fwd) { + _height += st::msgServiceNameFont->height + st::msgPadding.top(); + } + } if (!parent->out() && parent->history()->peer->chat) { _height += st::msgPadding.top() + st::msgNameFont->height; } + if (!_caption.isEmpty()) { + _height += st::webPagePhotoSkip + _caption.countHeight(w); + } + _height += st::mediaPadding.bottom(); + w += st::mediaPadding.left() + st::mediaPadding.right(); } return _height; } @@ -1622,24 +1670,47 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, co if (width < 1) return; int skipx = 0, skipy = 0, height = _height; - if (const HistoryReply *reply = toHistoryReply(parent)) { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent); + int replyFrom = 0, fwdFrom = 0; + if (reply || !_caption.isEmpty()) { skipx = st::mediaPadding.left(); - skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top(); - height -= st::mediaPadding.bottom(); - int replyFrom = 0; + if (reply) { + skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } else if (fwd) { + skipy = st::msgServiceNameFont->height + st::msgPadding.top(); + } if (!parent->out() && parent->history()->peer->chat) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; + fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; if (x >= st::mediaPadding.left() && y >= st::msgPadding.top() && x < width - st::mediaPadding.left() - st::mediaPadding.right() && x < st::mediaPadding.left() + parent->from()->nameText.maxWidth() && y < replyFrom) { lnk = parent->from()->lnk; return; } + if (!reply && !fwd) skipy += st::msgPadding.top(); + } else if (!reply) { + fwdFrom = st::msgPadding.top(); + skipy += fwdFrom; } - if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom() - st::mediaPadding.top()) { - lnk = reply->replyToLink(); - return; + if (reply) { + if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom()) { + lnk = reply->replyToLink(); + return; + } + } else if (fwd) { + if (y >= fwdFrom && y < fwdFrom + st::msgServiceNameFont->height) { + return fwd->getForwardedState(lnk, inText, x - st::mediaPadding.left(), width - st::mediaPadding.left() - st::mediaPadding.right()); + } } + height -= st::mediaPadding.bottom(); width -= st::mediaPadding.left() + st::mediaPadding.right(); + if (!_caption.isEmpty()) { + height -= _caption.countHeight(width) + st::webPagePhotoSkip; + if (x >= skipx && y >= height + st::webPagePhotoSkip && x < skipx + width && y < _height) { + return _caption.getState(lnk, inText, x - skipx, y - height - st::webPagePhotoSkip, width); + } + } } if (x >= skipx && y >= skipy && x < skipx + width && y < height) { lnk = openl; @@ -1686,26 +1757,40 @@ void HistoryPhoto::updateFrom(const MTPMessageMedia &media) { } void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent); if (width < 0) width = w; int skipx = 0, skipy = 0, height = _height; - if (const HistoryReply *reply = toHistoryReply(parent)) { + if (reply || !_caption.isEmpty()) { skipx = st::mediaPadding.left(); - skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top(); style::color bg(selected ? (parent->out() ? st::msgOutSelectBG : st::msgInSelectBG) : (parent->out() ? st::msgOutBG : st::msgInBG)); p.fillRect(QRect(0, 0, width, _height), bg->b); - int replyFrom = 0; + int replyFrom = 0, fwdFrom = 0; if (!parent->out() && parent->history()->peer->chat) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; + fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; p.setFont(st::msgNameFont->f); p.setPen(parent->from()->color->p); parent->from()->nameText.drawElided(p, st::mediaPadding.left(), st::msgPadding.top(), width - st::mediaPadding.left() - st::mediaPadding.right()); + if (!fwd && !reply) skipy += st::msgPadding.top(); + } else if (!reply) { + fwdFrom = st::msgPadding.top(); + skipy += fwdFrom; + } + if (reply) { + skipy += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected); + } else if (fwd) { + skipy += st::msgServiceNameFont->height + st::msgPadding.top(); + fwd->drawForwardedFrom(p, st::mediaPadding.left(), fwdFrom, width - st::mediaPadding.left() - st::mediaPadding.right(), selected); } - reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected); - width -= st::mediaPadding.left() + st::mediaPadding.right(); height -= skipy + st::mediaPadding.bottom(); + if (!_caption.isEmpty()) { + height -= st::webPagePhotoSkip + _caption.countHeight(width); + } } data->full->load(false, false); bool out = parent->out(); @@ -1749,35 +1834,59 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, i // date QString time(parent->time()); - if (time.isEmpty()) return; - int32 dateX = skipx + width - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); - int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; - if (parent->out()) { - dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace; - } - int32 dateW = skipx + width - dateX - st::msgDateImgDelta; - int32 dateH = skipy + height - dateY - st::msgDateImgDelta; - - p.fillRect(dateX, dateY, dateW, dateH, st::msgDateImgBg->b); - if (selected) { - p.fillRect(dateX, dateY, dateW, dateH, textstyleCurrent()->selectOverlay->b); - } - p.setFont(st::msgDateFont->f); - p.setPen(st::msgDateImgColor->p); - p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time); - if (out) { - QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2); - const QRect *iconRect; - if (parent->id > 0) { - if (parent->unread()) { - iconRect = &st::msgImgCheckRect; - } else { - iconRect = &st::msgImgDblCheckRect; - } - } else { - iconRect = &st::msgImgSendingRect; + if (_caption.isEmpty()) { + if (time.isEmpty()) return; + int32 dateX = skipx + width - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); + int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; + if (parent->out()) { + dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace; + } + int32 dateW = skipx + width - dateX - st::msgDateImgDelta; + int32 dateH = skipy + height - dateY - st::msgDateImgDelta; + + p.fillRect(dateX, dateY, dateW, dateH, st::msgDateImgBg->b); + if (selected) { + p.fillRect(dateX, dateY, dateW, dateH, textstyleCurrent()->selectOverlay->b); + } + p.setFont(st::msgDateFont->f); + p.setPen(st::msgDateImgColor->p); + p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time); + if (out) { + QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2); + const QRect *iconRect; + if (parent->id > 0) { + if (parent->unread()) { + iconRect = &st::msgImgCheckRect; + } else { + iconRect = &st::msgImgDblCheckRect; + } + } else { + iconRect = &st::msgImgSendingRect; + } + p.drawPixmap(iconPos, App::sprite(), *iconRect); + } + } else { + p.setPen(st::black->p); + _caption.draw(p, skipx, skipy + height + st::webPagePhotoSkip, width); + + style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor)); + p.setPen(date->p); + + p.drawText(w - st::msgPadding.right() + st::msgDateDelta.x() - parent->timeWidth(true) + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time); + if (out) { + QPoint iconPos(w + st::msgCheckPos.x() - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + st::msgCheckPos.y() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); + const QRect *iconRect; + if (parent->id > 0) { + if (parent->unread()) { + iconRect = &(selected ? st::msgSelectCheckRect : st::msgCheckRect); + } else { + iconRect = &(selected ? st::msgSelectDblCheckRect : st::msgDblCheckRect); + } + } else { + iconRect = &st::msgSendingRect; + } + p.drawPixmap(iconPos, App::sprite(), *iconRect); } - p.drawPixmap(iconPos, App::sprite(), *iconRect); } } @@ -1821,11 +1930,12 @@ QString formatDurationAndSizeText(qint64 duration, qint64 size) { int32 _downloadWidth = 0, _openWithWidth = 0, _cancelWidth = 0, _buttonWidth = 0; -HistoryVideo::HistoryVideo(const MTPDvideo &video) : HistoryMedia() +HistoryVideo::HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent) : HistoryMedia() , data(App::feedVideo(video)) , _openl(new VideoOpenLink(data)) , _savel(new VideoSaveLink(data)) , _cancell(new VideoCancelLink(data)) +, _caption(st::minPhotoSize) , _dldDone(0) , _uplDone(0) { @@ -2037,7 +2147,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -2068,8 +2178,18 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i statusText = _size; } } - p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText); - + int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height; + p.drawText(tleft, texty + st::mediaFont->ascent, statusText); + if (parent->isMediaUnread()) { + int32 w = st::mediaFont->m.width(statusText); + if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) { + p.setRenderHint(QPainter::HighQualityAntialiasing, true); + p.setPen(Qt::NoPen); + p.setBrush((out ? (selected ? st::mediaOutUnreadSelectColor : st::mediaOutUnreadColor) : (selected ? st::mediaInUnreadSelectColor : st::mediaInUnreadColor))->b); + p.drawEllipse(QRect(tleft + w + st::mediaUnreadSkip, texty + ((st::mediaFont->height - st::mediaUnreadSize) / 2), st::mediaUnreadSize, st::mediaUnreadSize)); + p.setRenderHint(QPainter::HighQualityAntialiasing, false); + } + } p.setFont(st::msgDateFont->f); style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor)); @@ -2233,7 +2353,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -2271,7 +2391,18 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i } } } - p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->descent, statusText); + int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height; + p.drawText(tleft, texty + st::mediaFont->ascent, statusText); + if (parent->isMediaUnread()) { + int32 w = st::mediaFont->m.width(statusText); + if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) { + p.setRenderHint(QPainter::HighQualityAntialiasing, true); + p.setPen(Qt::NoPen); + p.setBrush((out ? (selected ? st::mediaOutUnreadSelectColor : st::mediaOutUnreadColor) : (selected ? st::mediaInUnreadSelectColor : st::mediaInUnreadColor))->b); + p.drawEllipse(QRect(tleft + w + st::mediaUnreadSkip, texty + ((st::mediaFont->height - st::mediaUnreadSize) / 2), st::mediaUnreadSize, st::mediaUnreadSize)); + p.setRenderHint(QPainter::HighQualityAntialiasing, false); + } + } p.setFont(st::msgDateFont->f); style::color date(selected ? (out ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out ? st::msgOutDateColor : st::msgInDateColor)); @@ -2543,7 +2674,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -2835,7 +2966,7 @@ void HistorySticker::draw(QPainter &p, const HistoryItem *parent, bool selected, // date QString time(parent->time()); if (time.isEmpty()) return; - int32 dateX = usex + usew - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); + int32 dateX = usex + usew - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); int32 dateY = _height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; if (parent->out()) { dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace; @@ -2965,7 +3096,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &first, const QString void HistoryContact::initDimensions(const HistoryItem *parent) { int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); - int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); if (name.maxWidth() + tleft + fullTimeWidth > _maxw) { _maxw = name.maxWidth() + tleft + fullTimeWidth; } @@ -3101,7 +3232,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right(); int32 twidth = width - tleft - st::mediaPadding.right(); - int32 fullTimeWidth = parent->timeWidth() + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x(); + int32 fullTimeWidth = parent->timeWidth(true) + st::msgPadding.right(); int32 secondwidth = width - tleft - fullTimeWidth; p.setFont(st::mediaFont->f); @@ -3211,7 +3342,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { w = thumbw; - _maxw = st::webPageLeft + qMax(w, int32(st::minPhotoSize)) + parent->timeWidth(); + _maxw = st::webPageLeft + qMax(w, int32(st::minPhotoSize)) + parent->timeWidth(true); _minh = qMax(thumbh, int32(st::minPhotoSize)); _minh += st::webPagePhotoSkip; } else { @@ -3224,7 +3355,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { if (_asArticle) { _maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + st::webPagePhotoDelta + st::webPagePhotoSize)); } else { - _maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + parent->timeWidth())); + _maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + parent->timeWidth(true))); _minh += st::webPageTitleFont->height; } } @@ -3234,13 +3365,13 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { if (_asArticle) { _maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + st::webPagePhotoDelta + st::webPagePhotoSize)); } else { - _maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + parent->timeWidth())); + _maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth() + (data->photo ? parent->timeWidth(true) : 0))); _minh += qMin(_title.minHeight(), 2 * st::webPageTitleFont->height); } } if (!data->description.isEmpty()) { QString text = textClean(data->description); - if (!_asArticle) text += textcmdSkipBlock(parent->timeWidth(), st::msgDateFont->height - st::msgDateDelta.y()); + if (!_asArticle && !data->photo) text += textcmdSkipBlock(parent->timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y()); const TextParseOptions *opts = &_webpageDescriptionOptions; if (data->siteName == QLatin1String("Twitter")) { opts = &_twitterDescriptionOptions; @@ -3273,7 +3404,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, if (!data->pendingTill) { if (data->photo) { bottomSkip += st::webPagePhotoSkip; - if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth() > width)) { + if (_asArticle || (st::webPageLeft + qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width)) { bottomSkip += (st::msgDateFont->height - st::msgDateDelta.y()); } } @@ -3324,7 +3455,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, if (_asArticle) { availw -= st::webPagePhotoSize + st::webPagePhotoDelta; } else if (_title.isEmpty() && _description.isEmpty() && !data->photo) { - availw -= parent->timeWidth(); + availw -= parent->timeWidth(true); } p.setFont(st::webPageTitleFont->f); p.setPen(semibold->p); @@ -3338,7 +3469,7 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, if (_asArticle) { availw -= st::webPagePhotoSize + st::webPagePhotoDelta; } else if (_description.isEmpty() && !data->photo) { - endskip = parent->timeWidth(); + endskip = parent->timeWidth(true); } _title.drawElided(p, 0, 0, availw, 2, style::al_left, 0, -1, endskip); int32 h = _title.countHeight(availw); @@ -3356,8 +3487,8 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, if (_asArticle) { availw -= st::webPagePhotoSize + st::webPagePhotoDelta; if (articleLines > 3) articleLines = 3; - } else if (!data->photo) { - endskip = parent->timeWidth(); + } else { + if (!data->photo) endskip = parent->timeWidth(true); articleLines = 3; } _description.drawElided(p, 0, 0, availw, articleLines, style::al_left, 0, -1, endskip); @@ -3487,7 +3618,7 @@ int32 HistoryWebPage::resize(int32 width, bool dontRecountText, const HistoryIte if (_pixh < 1) _pixh = 1; _height = qMax(_pixh, int16(st::minPhotoSize)); _height += st::webPagePhotoSkip; - if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth() > width) { + if (qMax(_pixw, int16(st::minPhotoSize)) + parent->timeWidth(true) > width) { _height += (st::msgDateFont->height - st::msgDateDelta.y()); } } else { @@ -3953,7 +4084,16 @@ void ImageLinkData::load() { manager.getData(this); } -HistoryImageLink::HistoryImageLink(const QString &url) : HistoryMedia() { +HistoryImageLink::HistoryImageLink(const QString &url, const QString &title, const QString &description) : HistoryMedia(), +_title(st::msgMinWidth), +_description(st::msgMinWidth) { + if (!title.isEmpty()) { + _title.setText(st::webPageTitleFont, textClean(title), _webpageTitleOptions); + } + if (!description.isEmpty()) { + _description.setText(st::webPageDescriptionFont, textClean(description), _webpageDescriptionOptions); + } + if (url.startsWith(qsl("location:"))) { QString lnk = qsl("https://maps.google.com/maps?q=") + url.mid(9) + qsl("&ll=") + url.mid(9) + qsl("&z=17"); link.reset(new TextLink(lnk)); @@ -4030,12 +4170,35 @@ void HistoryImageLink::initDimensions(const HistoryItem *parent) { } _maxw = w; _minh = thumbh; - if (const HistoryReply *reply = toHistoryReply(parent)) { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = toHistoryForwarded(parent); + if (reply || !_title.isEmpty() || !_description.isEmpty()) { _maxw += st::mediaPadding.left() + st::mediaPadding.right(); - _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom(); + if (reply) { + _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } else { + if (parent->out() || !parent->history()->peer->chat || !fwd) { + _minh += st::msgPadding.top(); + } + if (fwd) { + _minh += st::msgServiceNameFont->height + st::msgPadding.top(); + } + } if (!parent->out() && parent->history()->peer->chat) { _minh += st::msgPadding.top() + st::msgNameFont->height; } + if (!_title.isEmpty()) { + _maxw = qMax(_maxw, int32(st::webPageLeft + _title.maxWidth())); + _minh += qMin(_title.minHeight(), 2 * st::webPageTitleFont->height); + } + if (!_description.isEmpty()) { + _maxw = qMax(_maxw, int32(st::webPageLeft + _description.maxWidth())); + _minh += qMin(_description.minHeight(), 3 * st::webPageTitleFont->height); + } + if (!_title.isEmpty() || !_description.isEmpty()) { + _minh += st::webPagePhotoSkip; + } + _minh += st::mediaPadding.bottom(); } _height = _minh; } @@ -4043,23 +4206,48 @@ void HistoryImageLink::initDimensions(const HistoryItem *parent) { void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width) const { if (width < 0) width = w; int skipx = 0, skipy = 0, height = _height; - if (const HistoryReply *reply = toHistoryReply(parent)) { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = toHistoryForwarded(parent); + if (reply || !_title.isEmpty() || !_description.isEmpty()) { skipx = st::mediaPadding.left(); - skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top(); style::color bg(selected ? (parent->out() ? st::msgOutSelectBG : st::msgInSelectBG) : (parent->out() ? st::msgOutBG : st::msgInBG)); p.fillRect(QRect(0, 0, width, _height), bg->b); - int replyFrom = 0; + int replyFrom = 0, fwdFrom = 0; if (!parent->out() && parent->history()->peer->chat) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; + fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; p.setFont(st::msgNameFont->f); p.setPen(parent->from()->color->p); parent->from()->nameText.drawElided(p, st::mediaPadding.left(), st::msgPadding.top(), width - st::mediaPadding.left() - st::mediaPadding.right()); + if (!fwd && !reply) skipy += st::msgPadding.top(); + } else if (!reply) { + fwdFrom = st::msgPadding.top(); + skipy += fwdFrom; + } + if (reply) { + skipy += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected); + } else if (fwd) { + skipy += st::msgServiceNameFont->height + st::msgPadding.top(); + fwd->drawForwardedFrom(p, st::mediaPadding.left(), fwdFrom, width - st::mediaPadding.left() - st::mediaPadding.right(), selected); } - reply->drawReplyTo(p, st::msgReplyPadding.left(), replyFrom, width - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected); - width -= st::mediaPadding.left() + st::mediaPadding.right(); + + if (!_title.isEmpty()) { + p.setPen(st::black->p); + _title.drawElided(p, st::mediaPadding.left(), skipy, width, 2); + skipy += qMin(_title.countHeight(width), 2 * st::webPageTitleFont->height); + } + if (!_description.isEmpty()) { + p.setPen(st::black->p); + _description.drawElided(p, st::mediaPadding.left(), skipy, width, 3); + skipy += qMin(_description.countHeight(width), 3 * st::webPageDescriptionFont->height); + } + if (!_title.isEmpty() || !_description.isEmpty()) { + skipy += st::webPagePhotoSkip; + } height -= skipy + st::mediaPadding.bottom(); } @@ -4112,7 +4300,7 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte // date QString time(parent->time()); if (time.isEmpty()) return; - int32 dateX = skipx + width - parent->timeWidth() - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); + int32 dateX = skipx + width - parent->timeWidth(false) - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); int32 dateY = skipy + height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; if (parent->out()) { dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace; @@ -4145,9 +4333,10 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryItem *parent) { const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = toHistoryForwarded(parent); w = qMin(width, _maxw); - if (reply) { + if (reply || !_title.isEmpty() || !_description.isEmpty()) { w -= st::mediaPadding.left() + st::mediaPadding.right(); } @@ -4172,12 +4361,31 @@ int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryI if (_height < st::minPhotoSize) { _height = st::minPhotoSize; } - if (reply) { - w += st::mediaPadding.left() + st::mediaPadding.right(); - _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top() + st::mediaPadding.bottom(); + if (reply || !_title.isEmpty() || !_description.isEmpty()) { if (!parent->out() && parent->history()->peer->chat) { _height += st::msgPadding.top() + st::msgNameFont->height; } + if (reply) { + _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } else { + if (parent->out() || !parent->history()->peer->chat || !fwd) { + _height += st::msgPadding.top(); + } + if (fwd) { + _height += st::msgServiceNameFont->height + st::msgPadding.top(); + } + } + if (!_title.isEmpty()) { + _height += qMin(_title.countHeight(w), st::webPageTitleFont->height * 2); + } + if (!_description.isEmpty()) { + _height += qMin(_description.countHeight(w), st::webPageDescriptionFont->height * 3); + } + if (!_title.isEmpty() || !_description.isEmpty()) { + _height += st::webPagePhotoSkip; + } + _height += st::mediaPadding.bottom(); + w += st::mediaPadding.left() + st::mediaPadding.right(); } return _height; } @@ -4214,23 +4422,40 @@ bool HistoryImageLink::hasPoint(int32 x, int32 y, const HistoryItem *parent, int void HistoryImageLink::getState(TextLinkPtr &lnk, bool &inText, int32 x, int32 y, const HistoryItem *parent, int32 width) const { if (width < 0) width = w; int skipx = 0, skipy = 0, height = _height; - if (const HistoryReply *reply = toHistoryReply(parent)) { + const HistoryReply *reply = toHistoryReply(parent); + const HistoryForwarded *fwd = reply ? 0 : toHistoryForwarded(parent); + int replyFrom = 0, fwdFrom = 0; + if (reply || !_title.isEmpty() || !_description.isEmpty()) { skipx = st::mediaPadding.left(); - skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaPadding.top(); - height -= st::mediaPadding.bottom(); - int replyFrom = 0; + if (reply) { + skipy = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } if (fwd) { + skipy = st::msgServiceNameFont->height + st::msgPadding.top(); + } if (!parent->out() && parent->history()->peer->chat) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; + fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; if (x >= st::mediaPadding.left() && y >= st::msgPadding.top() && x < width - st::mediaPadding.left() - st::mediaPadding.right() && x < st::mediaPadding.left() + parent->from()->nameText.maxWidth() && y < replyFrom) { lnk = parent->from()->lnk; return; } + if (!fwd && !reply) skipy += st::msgPadding.top(); + } else if (!reply) { + fwdFrom = st::msgPadding.top(); + skipy += fwdFrom; } - if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom() - st::mediaPadding.top()) { - lnk = reply->replyToLink(); - return; + if (reply) { + if (x >= 0 && y >= replyFrom + st::msgReplyPadding.top() && x < width && y < skipy - st::msgReplyPadding.bottom()) { + lnk = reply->replyToLink(); + return; + } + } else if (fwd) { + if (y >= fwdFrom && y < fwdFrom + st::msgServiceNameFont->height) { + return fwd->getForwardedState(lnk, inText, x - st::mediaPadding.left(), width - st::mediaPadding.left() - st::mediaPadding.right()); + } } + height -= st::mediaPadding.bottom(); width -= st::mediaPadding.left() + st::mediaPadding.right(); } if (x >= skipx && y >= skipy && x < skipx + width && y < height && data) { @@ -4251,6 +4476,7 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD , _media(0) { QString text(textClean(qs(msg.vmessage))); + initTime(); initMedia(msg.vmedia, text); initDimensions(text); } @@ -4263,6 +4489,7 @@ HistoryItem(history, block, msgId, flags, date, from) , _media(0) { QString text(msg); + initTime(); initMedia(media, text); initDimensions(text); } @@ -4274,6 +4501,7 @@ HistoryItem(history, block, msgId, flags, date, from) , _textHeight(0) , _media(0) { + initTime(); if (fromMedia) { _media = fromMedia->clone(); _media->regItem(this); @@ -4288,10 +4516,16 @@ HistoryItem(history, block, msgId, flags, date, from) , _textHeight(0) , _media(0) { + initTime(); initMediaFromDocument(doc); initDimensions(QString()); } +void HistoryMessage::initTime() { + _time = date.toString(cTimeFormat()); + _timeWidth = st::msgDateFont->m.width(_time); +} + void HistoryMessage::initMedia(const MTPMessageMedia &media, QString ¤tText) { switch (media.type()) { case mtpc_messageMediaEmpty: initMediaFromText(currentText); break; @@ -4306,16 +4540,23 @@ void HistoryMessage::initMedia(const MTPMessageMedia &media, QString ¤tTex _media = new HistoryImageLink(qsl("location:%1,%2").arg(d.vlat.v).arg(d.vlong.v)); } } break; + case mtpc_messageMediaVenue: { + const MTPDmessageMediaVenue &d(media.c_messageMediaVenue()); + if (d.vgeo.type() == mtpc_geoPoint) { + const MTPDgeoPoint &g(d.vgeo.c_geoPoint()); + _media = new HistoryImageLink(qsl("location:%1,%2").arg(g.vlat.v).arg(g.vlong.v), qs(d.vtitle), qs(d.vaddress)); + } + } break; case mtpc_messageMediaPhoto: { - const MTPPhoto &photo(media.c_messageMediaPhoto().vphoto); - if (photo.type() == mtpc_photo) { - _media = new HistoryPhoto(photo.c_photo()); + const MTPDmessageMediaPhoto &photo(media.c_messageMediaPhoto()); + if (photo.vphoto.type() == mtpc_photo) { + _media = new HistoryPhoto(photo.vphoto.c_photo(), qs(photo.vcaption), this); } } break; case mtpc_messageMediaVideo: { - const MTPVideo &video(media.c_messageMediaVideo().vvideo); - if (video.type() == mtpc_video) { - _media = new HistoryVideo(video.c_video()); + const MTPDmessageMediaVideo &video(media.c_messageMediaVideo()); + if (video.vvideo.type() == mtpc_video) { + _media = new HistoryVideo(video.vvideo.c_video(), qs(video.vcaption), this); } } break; case mtpc_messageMediaAudio: { @@ -4368,14 +4609,11 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc) { } void HistoryMessage::initDimensions(const QString &text) { - _time = date.toString(cTimeFormat()); - _timeWidth = st::msgDateFont->m.width(_time); if (!_media || !text.isEmpty()) { // !justMedia() - _timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x(); if (_media) { _text.setText(st::msgFont, text, _historyTextOptions); } else { - _text.setText(st::msgFont, text + textcmdSkipBlock(_timeWidth, st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions); + _text.setText(st::msgFont, text + textcmdSkipBlock(timeWidth(true), st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions); } } } @@ -4430,17 +4668,17 @@ HistoryMedia *HistoryMessage::getMedia(bool inOverview) const { void HistoryMessage::setMedia(const MTPmessageMedia &media) { if ((!_media || _media->isImageLink()) && media.type() == mtpc_messageMediaEmpty) return; + bool wasMedia = false; if (_media) { + wasMedia = true; delete _media; _media = 0; } QString t; initMedia(media, t); - if (_media) { + if (_media && !wasMedia) { QString was = HistoryMessage::selectedText(FullItemSel); - if (was.isEmpty()) { - _timeWidth -= st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x(); - } else { + if (!was.isEmpty()) { _text.setText(st::msgFont, was, _historyTextOptions); // without date skip _textWidth = 0; _textHeight = 0; @@ -4528,7 +4766,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const { style::color date(selected ? (out() ? st::msgOutSelectDateColor : st::msgInSelectDateColor) : (out() ? st::msgOutDateColor : st::msgInDateColor)); p.setPen(date->p); - p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - _timeWidth + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, _time); + p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - timeWidth(true) + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, _time); if (out()) { QPoint iconPos(r.right() + st::msgCheckPos.x() - st::msgPadding.right() - st::msgCheckRect.pxWidth(), r.bottom() + st::msgCheckPos.y() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight()); const QRect *iconRect; @@ -4758,7 +4996,7 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const fwdNameUpdated(); } -HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, (history->peer->input.type() != mtpc_inputPeerSelf) ? (MTPDmessage_flag_out | MTPDmessage_flag_unread) : 0, ::date(unixtime()), MTP::authedId(), msg->justMedia() ? QString() : msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()) +HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, ((history->peer->input.type() != mtpc_inputPeerSelf) ? (MTPDmessage_flag_out | MTPDmessage_flag_unread) : 0) | (msg->getMedia() && (msg->getMedia()->type() == MediaTypeAudio/* || msg->getMedia()->type() == MediaTypeVideo*/) ? MTPDmessage_flag_media_unread : 0), ::date(unixtime()), MTP::authedId(), msg->justMedia() ? QString() : msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()) , fwdDate(msg->dateForwarded()) , fwdFrom(msg->fromForwarded()) , fwdFromVersion(fwdFrom->nameVersion) @@ -5264,6 +5502,17 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { } } break; + case mtpc_messageActionChatJoinedByLink: { + const MTPDmessageActionChatJoinedByLink &d(action.c_messageActionChatJoinedByLink()); + if (true || App::peerFromUser(d.vinviter_id) == _from->id) { + text = lng_action_user_joined_by_link(lt_from, from); + //} else { + //UserData *u = App::user(App::peerFromUser(d.vinviter_id)); + //second = TextLinkPtr(new PeerLink(u)); + //text = lng_action_user_joined_by_link_from(lt_from, from, lt_inviter, textcmdLink(2, u->name)); + } + } break; + case mtpc_messageActionChatCreate: { const MTPDmessageActionChatCreate &d(action.c_messageActionChatCreate()); text = lng_action_created_chat(lt_from, from, lt_title, textClean(qs(d.vtitle))); diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index afc05c5be..bf2e7ad89 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -670,6 +670,12 @@ public: bool notifyByFrom() const { return _flags & MTPDmessage_flag_notify_by_from; } + bool isMediaUnread() const { + return _flags & MTPDmessage_flag_media_unread; + } + void markMediaRead() { + _flags &= ~MTPDmessage_flag_media_unread; + } virtual bool needCheck() const { return true; } @@ -727,7 +733,7 @@ public: virtual QString time() const { return QString(); } - virtual int32 timeWidth() const { + virtual int32 timeWidth(bool forText) const { return 0; } virtual bool animating() const { @@ -851,7 +857,7 @@ protected: class HistoryPhoto : public HistoryMedia { public: - HistoryPhoto(const MTPDphoto &photo); + HistoryPhoto(const MTPDphoto &photo, const QString &caption, HistoryItem *parent); HistoryPhoto(PeerData *chat, const MTPDphoto &photo, int32 width = 0); void init(); @@ -891,6 +897,7 @@ public: private: int16 pixw, pixh; PhotoData *data; + Text _caption; TextLinkPtr openl; }; @@ -900,7 +907,7 @@ QString formatSizeText(qint64 size); class HistoryVideo : public HistoryMedia { public: - HistoryVideo(const MTPDvideo &video); + HistoryVideo(const MTPDvideo &video, const QString &caption, HistoryItem *parent); void initDimensions(const HistoryItem *parent); void draw(QPainter &p, const HistoryItem *parent, bool selected, int32 width = -1) const; @@ -928,6 +935,8 @@ private: VideoData *data; TextLinkPtr _openl, _savel, _cancell; + Text _caption; + QString _size; int32 _thumbw, _thumbx, _thumby; @@ -1172,7 +1181,7 @@ private: class HistoryImageLink : public HistoryMedia { public: - HistoryImageLink(const QString &url); + HistoryImageLink(const QString &url, const QString &title = QString(), const QString &description = QString()); int32 fullWidth() const; int32 fullHeight() const; void initDimensions(const HistoryItem *parent); @@ -1194,6 +1203,7 @@ public: private: ImageLinkData *data; + Text _title, _description; TextLinkPtr link; }; @@ -1206,6 +1216,7 @@ public: HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, const QString &msg, HistoryMedia *media); HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, DocumentData *doc); + void initTime(); void initMedia(const MTPMessageMedia &media, QString ¤tText); void initMediaFromText(QString ¤tText); void initMediaFromDocument(DocumentData *doc); @@ -1247,8 +1258,8 @@ public: QString time() const { return _time; } - int32 timeWidth() const { - return _timeWidth; + int32 timeWidth(bool forText) const { + return _timeWidth + (forText ? (st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x()) : 0); } virtual bool animating() const { return _media ? _media->animating() : false; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 6e57dce46..3419feecc 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3214,7 +3214,7 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { h->loadAround(0); int32 flags = (h->peer->input.type() == mtpc_inputPeerSelf) ? 0 : (MTPDmessage_flag_unread | MTPDmessage_flag_out); // unread, out if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id; - h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo))); + h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string("")))); } else if (img.type == ToPrepareDocument) { h->loadAround(0); int32 flags = (h->peer->input.type() == mtpc_inputPeerSelf) ? 0 : (MTPDmessage_flag_unread | MTPDmessage_flag_out); // unread, out @@ -3250,7 +3250,7 @@ void HistoryWidget::onPhotoUploaded(MsgId newId, const MTPInputFile &file) { if (replyTo) { sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; } - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFailed, randomId), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string("")), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFailed, randomId), 0, 0, hist->sendRequestId); } } @@ -3424,6 +3424,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, if (!isVisible()) { if (initial) _histInited = false; + if (resizedItem) _list->recountHeight(true); return; // scrollTopMax etc are not working after recountHeight() } @@ -3745,6 +3746,7 @@ void HistoryWidget::gotPreview(QString links, const MTPMessageMedia &result, mtp _previewData = (data->id && data->pendingTill >= 0) ? data : 0; updatePreview(); } + if (App::main()) App::main()->webPagesUpdate(); } else if (result.type() == mtpc_messageMediaEmpty) { _previewCache.insert(links, 0); if (links == _previewLinks && !_previewCancelled) { diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index bb5cb4590..4ec0a26d9 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -178,7 +178,7 @@ void LocalImageLoaderPrivate::prepareImages() { } if (!filesize) filesize = jpeg.size(); - photo = MTP_photo(MTP_long(id), MTP_long(0), MTP_int(user), MTP_int(unixtime()), MTP_string(""), MTP_geoPointEmpty(), MTP_vector(photoSizes)); + photo = MTP_photo(MTP_long(id), MTP_long(0), MTP_int(user), MTP_int(unixtime()), MTP_geoPointEmpty(), MTP_vector(photoSizes)); thumbId = id; } else if ((type == ToPrepareVideo || type == ToPrepareDocument) && !img.isNull()) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index d1101163b..795859904 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -376,6 +376,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _cachedX(0), _cachedY(0), _backgr connect(audioVoice(), SIGNAL(updated(AudioData*)), this, SLOT(audioPlayProgress(AudioData*))); connect(audioVoice(), SIGNAL(stopped(AudioData*)), this, SLOT(audioPlayProgress(AudioData*))); } + connect(&_updateMutedTimer, SIGNAL(timeout()), this, SLOT(onUpdateMuted())); _webPageUpdater.setSingleShot(true); connect(&_webPageUpdater, SIGNAL(timeout()), this, SLOT(webPagesUpdate())); @@ -525,6 +526,9 @@ void MainWidget::webPageUpdated(WebPageData *data) { } void MainWidget::webPagesUpdate() { + if (_webPagesUpdated.isEmpty()) return; + + _webPageUpdater.stop(); const WebPageItems &items(App::webPageItems()); for (QMap::const_iterator i = _webPagesUpdated.cbegin(), e = _webPagesUpdated.cend(); i != e; ++i) { WebPageItems::const_iterator j = items.constFind(App::webPage(i.key())); @@ -538,6 +542,17 @@ void MainWidget::webPagesUpdate() { _webPagesUpdated.clear(); } +void MainWidget::updateMutedIn(int32 seconds) { + if (seconds > 86400) seconds = 86400; + int32 ms = seconds * 1000; + if (_updateMutedTimer.isActive() && _updateMutedTimer.remainingTime() <= ms) return; + _updateMutedTimer.start(ms); +} + +void MainWidget::onUpdateMuted() { + App::updateMuted(); +} + void MainWidget::onShareContact(const PeerId &peer, UserData *contact) { history.onShareContact(peer, contact); } @@ -705,7 +720,7 @@ void MainWidget::deleteHistoryPart(PeerData *peer, const MTPmessages_AffectedHis } void MainWidget::deleteMessages(const QVector &ids) { - MTP::send(MTPmessages_DeleteMessages(MTP_vector(ids)), rpcDone(&MainWidget::msgsWereDeleted)); + MTP::send(MTPmessages_DeleteMessages(MTP_vector(ids)), rpcDone(&MainWidget::messagesAffected)); } void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) { @@ -1277,7 +1292,7 @@ void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory & } } -void MainWidget::msgsWereDeleted(const MTPmessages_AffectedMessages &result) { +void MainWidget::messagesAffected(const MTPmessages_AffectedMessages &result) { const MTPDmessages_affectedMessages &d(result.c_messages_affectedMessages()); updPtsUpdated(d.vpts.v, d.vpts_count.v); } @@ -1449,6 +1464,38 @@ void MainWidget::documentLoadRetry() { if (document) document->save(failedFileName); } +void MainWidget::audioMarkRead(AudioData *data) { + const AudioItems &items(App::audioItems()); + AudioItems::const_iterator i = items.constFind(data); + if (i != items.cend()) { + mediaMarkRead(i.value()); + } +} + +void MainWidget::videoMarkRead(VideoData *data) { + const VideoItems &items(App::videoItems()); + VideoItems::const_iterator i = items.constFind(data); + if (i != items.cend()) { + mediaMarkRead(i.value()); + } +} + +void MainWidget::mediaMarkRead(const HistoryItemsMap &items) { + QVector markedIds; + markedIds.reserve(items.size()); + for (HistoryItemsMap::const_iterator j = items.cbegin(), e = items.cend(); j != e; ++j) { + if (!j.key()->out() && j.key()->isMediaUnread()) { + j.key()->markMediaRead(); + if (j.key()->id > 0) { + markedIds.push_back(MTP_int(j.key()->id)); + } + } + } + if (!markedIds.isEmpty()) { + MTP::send(MTPmessages_ReadMessageContents(MTP_vector(markedIds)), rpcDone(&MainWidget::messagesAffected)); + } +} + void MainWidget::onParentResize(const QSize &newSize) { resize(newSize); } @@ -2300,7 +2347,7 @@ void MainWidget::gotDifference(const MTPupdates_Difference &diff) { updInited = true; - MTP_LOG(0, ("getDifference { good - after a slice of difference was received }")); + MTP_LOG(0, ("getDifference { good - after a slice of difference was received }%1").arg(cTestMode() ? " TESTMODE" : "")); getDifference(); } break; case mtpc_updates_difference: { @@ -2378,7 +2425,7 @@ bool MainWidget::failDifference(const RPCError &error) { void MainWidget::getDifferenceForce() { if (MTP::authedId()) { updInited = true; - MTP_LOG(0, ("getDifference { force - after get difference failed }")); + MTP_LOG(0, ("getDifference { force - after get difference failed }%1").arg(cTestMode() ? " TESTMODE" : "")); getDifference(); } } @@ -2444,6 +2491,7 @@ void MainWidget::openLocalUrl(const QString &url) { } else if (u.startsWith(QLatin1String("tg://join"), Qt::CaseInsensitive)) { QRegularExpressionMatch m = QRegularExpression(qsl("^tg://join/?\\?invite=([a-zA-Z0-9\\.\\_]+)$"), QRegularExpression::CaseInsensitiveOption).match(u); if (m.hasMatch()) { + joinGroupByHash(m.captured(1)); } } } @@ -2461,6 +2509,10 @@ void MainWidget::openUserByName(const QString &username, bool toProfile) { } } +void MainWidget::joinGroupByHash(const QString &hash) { + MTP::send(MTPmessages_CheckChatInvite(MTP_string(hash)), rpcDone(&MainWidget::inviteCheckDone, hash), rpcFail(&MainWidget::inviteCheckFail)); +} + void MainWidget::usernameResolveDone(bool toProfile, const MTPUser &user) { App::wnd()->hideLayer(); UserData *u = App::feedUsers(MTP_vector(1, user)); @@ -2480,6 +2532,83 @@ bool MainWidget::usernameResolveFail(QString name, const RPCError &error) { return true; } +void MainWidget::inviteCheckDone(QString hash, const MTPChatInvite &invite) { + switch (invite.type()) { + case mtpc_chatInvite: { + const MTPDchatInvite &d(invite.c_chatInvite()); + ConfirmBox *box = new ConfirmBox(lng_group_invite_want_join(lt_title, qs(d.vtitle)), lang(lng_group_invite_join)); + _inviteHash = hash; + connect(box, SIGNAL(confirmed()), this, SLOT(onInviteImport())); + App::wnd()->showLayer(box); + } break; + + case mtpc_chatInviteAlready: { + const MTPDchatInviteAlready &d(invite.c_chatInviteAlready()); + ChatData *chat = App::feedChats(MTP_vector(1, d.vchat)); + if (chat) { + if (chat->left) { + ConfirmBox *box = new ConfirmBox(lng_group_invite_want_join(lt_title, chat->name), lang(lng_group_invite_join)); + _inviteHash = '/' + QString::number(chat->id); + connect(box, SIGNAL(confirmed()), this, SLOT(onInviteImport())); + App::wnd()->showLayer(box); + } else { + showPeer(chat->id, 0, false, true); + } + } + } break; + } +} + +bool MainWidget::inviteCheckFail(const RPCError &error) { + if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; + + if (error.code() == 400) { + App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_bad_link), true)); + } + return true; +} + +void MainWidget::onInviteImport() { + if (_inviteHash.isEmpty()) return; + if (_inviteHash.at(0) == '/') { + PeerId peer = _inviteHash.midRef(1).toULongLong(); + MTP::send(MTPmessages_AddChatUser(MTP_int(peer & 0xFFFFFFFF), App::self()->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail), 0, 5); + } else { + MTP::send(MTPmessages_ImportChatInvite(MTP_string(_inviteHash)), rpcDone(&MainWidget::inviteImportDone), rpcFail(&MainWidget::inviteImportFail)); + } +} + +void MainWidget::inviteImportDone(const MTPUpdates &updates) { + App::main()->sentUpdatesReceived(updates); + + App::wnd()->hideLayer(); + const QVector *v = 0; + switch (updates.type()) { + case mtpc_updates: v = &updates.c_updates().vchats.c_vector().v; break; + case mtpc_updatesCombined: v = &updates.c_updatesCombined().vchats.c_vector().v; break; + case mtpc_updateShort: { + } break; + case mtpc_updateShortMessage: { + } break; + case mtpc_updateShortChatMessage: { + } break; + case mtpc_updatesTooLong: { + } break; + } + if (v && !v->isEmpty() && v->front().type() == mtpc_chat) { + App::main()->showPeer(App::peerFromChat(v->front().c_chat().vid.v)); + } +} + +bool MainWidget::inviteImportFail(const RPCError &error) { + if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; + + if (error.code() == 400) { + App::wnd()->showLayer(new ConfirmBox(lang(error.type() == qsl("USERS_TOO_MUCH") ? lng_group_invite_no_room : lng_group_invite_bad_link), true), App::wnd()->layerShown()); + } + return true; +} + void MainWidget::startFull(const MTPVector &users) { const QVector &v(users.c_vector().v); if (v.isEmpty() || v[0].type() != mtpc_userSelf) { // wtf?.. @@ -2502,7 +2631,9 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti delete data->notify; } data->notify = EmptyNotifySettings; - App::history(data->id)->setMute(false); + App::unregMuted(data); + History *h = App::history(data->id); + h->setMute(false); } } break; } @@ -2510,16 +2641,15 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti case mtpc_peerNotifySettings: { const MTPDpeerNotifySettings &d(settings.c_peerNotifySettings()); NotifySettingsPtr setTo = UnknownNotifySettings; - PeerId peerId = 0; + PeerData *data = 0; switch (peer.type()) { case mtpc_notifyAll: setTo = globalNotifyAllPtr = &globalNotifyAll; break; case mtpc_notifyUsers: setTo = globalNotifyUsersPtr = &globalNotifyUsers; break; case mtpc_notifyChats: setTo = globalNotifyChatsPtr = &globalNotifyChats; break; case mtpc_notifyPeer: { - PeerData *data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer)); + data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer)); if (!data) break; - peerId = data->id; if (data->notify == UnknownNotifySettings || data->notify == EmptyNotifySettings) { data->notify = new NotifySettings(); } @@ -2532,11 +2662,13 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti setTo->sound = d.vsound.c_string().v; setTo->previews = d.vshow_previews.v; setTo->events = d.vevents_mask.v; - if (peerId) { - if (!history) history = App::history(peerId); - if (isNotifyMuted(setTo)) { + if (data) { + if (!history) history = App::history(data->id); + int32 changeIn = 0; + if (isNotifyMuted(setTo, &changeIn)) { App::wnd()->notifyClear(history); history->setMute(true); + App::regMuted(data, changeIn); } else { history->setMute(false); } @@ -2577,18 +2709,24 @@ bool MainWidget::failNotifySetting(MTPInputNotifyPeer peer, const RPCError &erro void MainWidget::updateNotifySetting(PeerData *peer, bool enabled) { updateNotifySettingPeers.insert(peer); + int32 muteFor = 86400 * 365; if (peer->notify == EmptyNotifySettings) { if (!enabled) { peer->notify = new NotifySettings(); peer->notify->sound = ""; - peer->notify->mute = unixtime() + 86400 * 365; + peer->notify->mute = unixtime() + muteFor; } } else { if (peer->notify == UnknownNotifySettings) { peer->notify = new NotifySettings(); } peer->notify->sound = enabled ? "default" : ""; - peer->notify->mute = enabled ? 0 : (unixtime() + 86400 * 365); + peer->notify->mute = enabled ? 0 : (unixtime() + muteFor); + } + if (!enabled) { + App::regMuted(peer, muteFor + 1); + } else { + App::unregMuted(peer); } App::history(peer->id)->setMute(!enabled); updateNotifySettingTimer.start(NotifySettingSaveTimeout); @@ -2760,7 +2898,7 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) { if (mtpTypeId(*from) == mtpc_new_session_created) { MTPNewSession newSession(from, end); updSeq = 0; - MTP_LOG(0, ("getDifference { after new_session_created }")); + MTP_LOG(0, ("getDifference { after new_session_created }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } else { try { @@ -2823,7 +2961,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { case mtpc_updateShortMessage: { const MTPDupdateShortMessage &d(updates.c_updateShortMessage()); if (!App::userLoaded(d.vuser_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { - MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }")); + MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { @@ -2842,7 +2980,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { case mtpc_updateShortChatMessage: { const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage()); if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { - MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }")); + MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { @@ -2858,7 +2996,7 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { } break; case mtpc_updatesTooLong: { - MTP_LOG(0, ("getDifference { good - updatesTooLong received }")); + MTP_LOG(0, ("getDifference { good - updatesTooLong received }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } break; } @@ -2916,13 +3054,21 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } } break; - case mtpc_updateReadMessages: { - const MTPDupdateReadMessages &d(update.c_updateReadMessages()); + case mtpc_updateReadMessagesContents: { + const MTPDupdateReadMessagesContents &d(update.c_updateReadMessagesContents()); if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { _byPtsUpdate.insert(ptsKey(SkippedUpdate), update); return; } - App::feedWereRead(d.vmessages.c_vector().v); + const QVector &v(d.vmessages.c_vector().v); + for (int32 i = 0, l = v.size(); i < l; ++i) { + if (HistoryItem *item = App::histItemById(v.at(i).v)) { + if (item->isMediaUnread()) { + item->markMediaRead(); + msgUpdated(item->history()->peer->id, item); + } + } + } } break; case mtpc_updateReadHistoryInbox: { @@ -2949,6 +3095,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { const MTPDupdateWebPage &d(update.c_updateWebPage()); App::feedWebPage(d.vwebpage); history.updatePreview(); + webPagesUpdate(); } break; case mtpc_updateDeleteMessages: { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index f3d8e888b..305e1fa62 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -187,6 +187,7 @@ public: void start(const MTPUser &user); void openLocalUrl(const QString &str); void openUserByName(const QString &name, bool toProfile = false); + void joinGroupByHash(const QString &hash); void startFull(const MTPVector &users); bool started(); void applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNotifySettings &settings, History *history = 0); @@ -333,7 +334,12 @@ public: void cancelForwarding(); void finishForwarding(History *hist); // send them + void audioMarkRead(AudioData *data); + void videoMarkRead(VideoData *data); + void mediaMarkRead(const HistoryItemsMap &items); + void webPageUpdated(WebPageData *page); + void updateMutedIn(int32 seconds); ~MainWidget(); @@ -392,10 +398,14 @@ public slots: void onCacheBackground(); + void onInviteImport(); + + void onUpdateMuted(); + private: void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result); - void msgsWereDeleted(const MTPmessages_AffectedMessages &result); + void messagesAffected(const MTPmessages_AffectedMessages &result); void photosLoaded(History *h, const MTPmessages_Messages &msgs, mtpRequestId req); bool _started; @@ -413,6 +423,8 @@ private: QMap _webPagesUpdated; QTimer _webPageUpdater; + SingleTimer _updateMutedTimer; + void gotDifference(const MTPupdates_Difference &diff); bool failDifference(const RPCError &e); void feedDifference(const MTPVector &users, const MTPVector &chats, const MTPVector &msgs, const MTPVector &other); @@ -430,6 +442,12 @@ private: void usernameResolveDone(bool toProfile, const MTPUser &user); bool usernameResolveFail(QString name, const RPCError &error); + void inviteCheckDone(QString hash, const MTPChatInvite &invite); + bool inviteCheckFail(const RPCError &error); + QString _inviteHash; + void inviteImportDone(const MTPUpdates &result); + bool inviteImportFail(const RPCError &error); + void hideAll(); void showAll(); diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.h b/Telegram/SourceFiles/mtproto/mtpConnection.h index ba97afea5..6402277b0 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.h +++ b/Telegram/SourceFiles/mtproto/mtpConnection.h @@ -24,6 +24,7 @@ enum { MTPDmessage_flag_unread = (1 << 0), MTPDmessage_flag_out = (1 << 1), MTPDmessage_flag_notify_by_from = (1 << 4), + MTPDmessage_flag_media_unread = (1 << 5), MTPmessages_SendMessage_flag_skipWebPage = (1 << 1), }; diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h b/Telegram/SourceFiles/mtproto/mtpCoreTypes.h index 26422f231..aeea76a60 100644 --- a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h +++ b/Telegram/SourceFiles/mtproto/mtpCoreTypes.h @@ -366,7 +366,7 @@ static const mtpTypeId mtpLayers[] = { mtpc_invokeWithLayer17, mtpc_invokeWithLayer18, }, mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]); -static const mtpPrime mtpCurrentLayer = 27; +static const mtpPrime mtpCurrentLayer = 28; template class MTPBoxed : public bareT { diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.cpp b/Telegram/SourceFiles/mtproto/mtpScheme.cpp index 380e38776..bdad46e48 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.cpp +++ b/Telegram/SourceFiles/mtproto/mtpScheme.cpp @@ -622,6 +622,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -635,6 +636,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -679,7 +681,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 1: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -697,7 +699,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 2: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -711,6 +713,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -787,6 +790,23 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_inputMediaVenue: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ inputMediaVenue"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + case mtpc_inputChatPhotoEmpty: to.add("{ inputChatPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; @@ -1326,6 +1346,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 1: to.add(" participants: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" chat_photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" exported_invite: "); ++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; } break; @@ -1458,6 +1479,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -1471,6 +1493,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" video: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); 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; } break; @@ -1547,6 +1570,23 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messageMediaVenue: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageMediaVenue"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + case mtpc_messageActionEmpty: to.add("{ messageActionEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; @@ -1639,6 +1679,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP to.add("{ messageActionGeoChatCheckin }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + case mtpc_messageActionChatJoinedByLink: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageActionChatJoinedByLink"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); 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; + } + break; + case mtpc_dialog: if (stage) { to.add(",\n").addSpaces(lev); @@ -1681,9 +1734,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" sizes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" sizes: "); ++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; } break; @@ -1760,14 +1812,12 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); 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; } break; @@ -2383,21 +2433,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_updateReadMessages: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ updateReadMessages"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); 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; - } - break; - case mtpc_updateDeleteMessages: if (stage) { to.add(",\n").addSpaces(lev); @@ -2776,6 +2811,21 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_updateReadMessagesContents: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateReadMessagesContents"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); 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; + } + break; + case mtpc_updates_state: if (stage) { to.add(",\n").addSpaces(lev); @@ -3038,7 +3088,9 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 12: to.add(" notify_cloud_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 13: to.add(" notify_default_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 14: to.add(" chat_big_size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 15: to.add(" disabled_features: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 15: to.add(" push_chat_period_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 16: to.add(" push_chat_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 17: to.add(" disabled_features: "); ++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; } break; @@ -3624,7 +3676,16 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP break; case mtpc_sendMessageUploadVideoAction: - to.add("{ sendMessageUploadVideoAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ sendMessageUploadVideoAction"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); 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; + } break; case mtpc_sendMessageRecordAudioAction: @@ -3632,15 +3693,42 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP break; case mtpc_sendMessageUploadAudioAction: - to.add("{ sendMessageUploadAudioAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ sendMessageUploadAudioAction"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); 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; + } break; case mtpc_sendMessageUploadPhotoAction: - to.add("{ sendMessageUploadPhotoAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ sendMessageUploadPhotoAction"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); 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; + } break; case mtpc_sendMessageUploadDocumentAction: - to.add("{ sendMessageUploadDocumentAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ sendMessageUploadDocumentAction"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); 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; + } break; case mtpc_sendMessageGeoLocationAction: @@ -4144,6 +4232,63 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_receivedNotifyMessage: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ receivedNotifyMessage"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); 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; + } + break; + + case mtpc_chatInviteEmpty: + to.add("{ chatInviteEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_chatInviteExported: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ chatInviteExported"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + + case mtpc_chatInviteAlready: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ chatInviteAlready"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" chat: "); ++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; + } + break; + + case mtpc_chatInvite: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ chatInvite"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + case mtpc_req_pq: if (stage) { to.add(",\n").addSpaces(lev); @@ -4694,6 +4839,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_invokeWithoutUpdates: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ invokeWithoutUpdates"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" query: "); ++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; + } + break; + case mtpc_auth_checkPhone: if (stage) { to.add(",\n").addSpaces(lev); @@ -4995,19 +5153,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP to.add("{ contacts_exportCard }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - case mtpc_messages_receivedMessages: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_receivedMessages"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); 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; - } - break; - case mtpc_messages_getMessages: if (stage) { to.add(",\n").addSpaces(lev); @@ -5127,6 +5272,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_receivedMessages: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_receivedMessages"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); 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; + } + break; + case mtpc_messages_sendMessage: if (stage) { to.add(",\n").addSpaces(lev); @@ -5278,6 +5436,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_importChatInvite: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_importChatInvite"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + case mtpc_messages_getChats: if (stage) { to.add(",\n").addSpaces(lev); @@ -5830,6 +6001,32 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP to.add("{ auth_requestPasswordRecovery }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + case mtpc_messages_exportChatInvite: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_exportChatInvite"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); 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; + } + break; + + case mtpc_messages_checkChatInvite: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_checkChatInvite"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); 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; + } + break; + case mtpc_rpc_result: if (stage) { to.add(",\n").addSpaces(lev); diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.h b/Telegram/SourceFiles/mtproto/mtpScheme.h index 691d27264..5a0183128 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.h +++ b/Telegram/SourceFiles/mtproto/mtpScheme.h @@ -77,13 +77,13 @@ enum { mtpc_inputPhoneContact = 0xf392b7f4, mtpc_inputFile = 0xf52ff27f, mtpc_inputMediaEmpty = 0x9664f57f, - mtpc_inputMediaUploadedPhoto = 0x2dc53a7d, - mtpc_inputMediaPhoto = 0x8f2ab2ec, + mtpc_inputMediaUploadedPhoto = 0xf7aff1c0, + mtpc_inputMediaPhoto = 0xe9bfb4f3, mtpc_inputMediaGeoPoint = 0xf9c44144, mtpc_inputMediaContact = 0xa6e45987, - mtpc_inputMediaUploadedVideo = 0x133ad6f6, - mtpc_inputMediaUploadedThumbVideo = 0x9912dabf, - mtpc_inputMediaVideo = 0x7f023ae6, + mtpc_inputMediaUploadedVideo = 0xe13fd4bc, + mtpc_inputMediaUploadedThumbVideo = 0x96fb97dc, + mtpc_inputMediaVideo = 0x936a4ebd, mtpc_inputChatPhotoEmpty = 0x1ca48f57, mtpc_inputChatUploadedPhoto = 0x94254732, mtpc_inputChatPhoto = 0xb2e1bf08, @@ -126,7 +126,7 @@ enum { mtpc_chatEmpty = 0x9ba2d800, mtpc_chat = 0x6e9c9bc7, mtpc_chatForbidden = 0xfb0ccc41, - mtpc_chatFull = 0x630e61be, + mtpc_chatFull = 0xcade0791, mtpc_chatParticipant = 0xc8d7493e, mtpc_chatParticipantsForbidden = 0xfd2bb8a, mtpc_chatParticipants = 0x7841b415, @@ -136,8 +136,8 @@ enum { mtpc_message = 0xa7ab1991, mtpc_messageService = 0x1d86f70e, mtpc_messageMediaEmpty = 0x3ded6320, - mtpc_messageMediaPhoto = 0xc8c45a2a, - mtpc_messageMediaVideo = 0xa2d24290, + mtpc_messageMediaPhoto = 0x3d8ce53d, + mtpc_messageMediaVideo = 0x5bcf1675, mtpc_messageMediaGeo = 0x56e0d474, mtpc_messageMediaContact = 0x5e7d2f39, mtpc_messageMediaUnsupported = 0x9f84f49e, @@ -150,12 +150,12 @@ enum { mtpc_messageActionChatDeleteUser = 0xb2ae9b0c, mtpc_dialog = 0xc1dd804a, mtpc_photoEmpty = 0x2331b22d, - mtpc_photo = 0x22b56751, + mtpc_photo = 0xc3838076, mtpc_photoSizeEmpty = 0xe17e23c, mtpc_photoSize = 0x77bfb61b, mtpc_photoCachedSize = 0xe9a734fa, mtpc_videoEmpty = 0xc10658a8, - mtpc_video = 0x388fa391, + mtpc_video = 0xee9f4a4d, mtpc_geoPointEmpty = 0x1117dd5f, mtpc_geoPoint = 0x2049d70c, mtpc_auth_checkedPhone = 0x811ea28e, @@ -206,7 +206,6 @@ enum { mtpc_inputMessagesFilterAudio = 0xcfc87522, mtpc_updateNewMessage = 0x1f2b0afd, mtpc_updateMessageID = 0x4e90bfd6, - mtpc_updateReadMessages = 0x2e5ab668, mtpc_updateDeleteMessages = 0xa20db0e5, mtpc_updateUserTyping = 0x5c486927, mtpc_updateChatUserTyping = 0x9a65ea1f, @@ -232,7 +231,7 @@ enum { mtpc_photos_photo = 0x20212ca8, mtpc_upload_file = 0x96a18d5, mtpc_dcOption = 0x2ec2a43c, - mtpc_config = 0x68bac247, + mtpc_config = 0x4e32b894, mtpc_nearestDc = 0x8e1a1775, mtpc_help_appUpdate = 0x8987f311, mtpc_help_noAppUpdate = 0xc45a6536, @@ -307,11 +306,11 @@ enum { mtpc_sendMessageTypingAction = 0x16bf744e, mtpc_sendMessageCancelAction = 0xfd5ec8f5, mtpc_sendMessageRecordVideoAction = 0xa187d66f, - mtpc_sendMessageUploadVideoAction = 0x92042ff7, + mtpc_sendMessageUploadVideoAction = 0xe9763aec, mtpc_sendMessageRecordAudioAction = 0xd52f73f7, - mtpc_sendMessageUploadAudioAction = 0xe6ac8a6f, - mtpc_sendMessageUploadPhotoAction = 0x990a3c1a, - mtpc_sendMessageUploadDocumentAction = 0x8faee98e, + mtpc_sendMessageUploadAudioAction = 0xf351d7ab, + mtpc_sendMessageUploadPhotoAction = 0xd1d34a26, + mtpc_sendMessageUploadDocumentAction = 0xaa0cd9e4, mtpc_sendMessageGeoLocationAction = 0x176f8ba1, mtpc_sendMessageChooseContactAction = 0x628cbc6f, mtpc_contactFound = 0xea879f95, @@ -370,6 +369,15 @@ enum { mtpc_account_passwordSettings = 0xb7b72ab3, mtpc_account_passwordInputSettings = 0xbcfc532c, mtpc_auth_passwordRecovery = 0x137948a5, + mtpc_inputMediaVenue = 0x2827a81a, + mtpc_messageMediaVenue = 0x7912b71f, + mtpc_receivedNotifyMessage = 0xa384b779, + mtpc_chatInviteEmpty = 0x69df3769, + mtpc_chatInviteExported = 0xfc2e05bc, + mtpc_chatInviteAlready = 0x5a686d7c, + mtpc_chatInvite = 0xce917dcd, + mtpc_messageActionChatJoinedByLink = 0xf89cf5e8, + mtpc_updateReadMessagesContents = 0x68c13933, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_auth_checkPhone = 0x6fe51dfb, @@ -411,7 +419,7 @@ enum { mtpc_messages_readHistory = 0xb04f2510, mtpc_messages_deleteHistory = 0xf4f8fb61, mtpc_messages_deleteMessages = 0xa5f18925, - mtpc_messages_receivedMessages = 0x28abcb68, + mtpc_messages_receivedMessages = 0x5a954c0, mtpc_messages_setTyping = 0xa3825e50, mtpc_messages_sendMessage = 0x9add8f26, mtpc_messages_sendMedia = 0x2d7923b1, @@ -488,7 +496,11 @@ enum { mtpc_account_updatePasswordSettings = 0xfa7c4b86, mtpc_auth_checkPassword = 0xa63011e, mtpc_auth_requestPasswordRecovery = 0xd897bc66, - mtpc_auth_recoverPassword = 0x4ea56e92 + mtpc_auth_recoverPassword = 0x4ea56e92, + mtpc_invokeWithoutUpdates = 0xbf9459b7, + mtpc_messages_exportChatInvite = 0x7d885289, + mtpc_messages_checkChatInvite = 0x3eadb1bb, + mtpc_messages_importChatInvite = 0x6c50051c }; // Type forward declarations @@ -595,6 +607,7 @@ class MTPDinputMediaAudio; class MTPDinputMediaUploadedDocument; class MTPDinputMediaUploadedThumbDocument; class MTPDinputMediaDocument; +class MTPDinputMediaVenue; class MTPinputChatPhoto; class MTPDinputChatUploadedPhoto; @@ -679,6 +692,7 @@ class MTPDmessageMediaContact; class MTPDmessageMediaDocument; class MTPDmessageMediaAudio; class MTPDmessageMediaWebPage; +class MTPDmessageMediaVenue; class MTPmessageAction; class MTPDmessageActionChatCreate; @@ -687,6 +701,7 @@ class MTPDmessageActionChatEditPhoto; class MTPDmessageActionChatAddUser; class MTPDmessageActionChatDeleteUser; class MTPDmessageActionGeoChatCreate; +class MTPDmessageActionChatJoinedByLink; class MTPdialog; class MTPDdialog; @@ -803,7 +818,6 @@ class MTPmessagesFilter; class MTPupdate; class MTPDupdateNewMessage; class MTPDupdateMessageID; -class MTPDupdateReadMessages; class MTPDupdateDeleteMessages; class MTPDupdateUserTyping; class MTPDupdateChatUserTyping; @@ -830,6 +844,7 @@ class MTPDupdateUserPhone; class MTPDupdateReadHistoryInbox; class MTPDupdateReadHistoryOutbox; class MTPDupdateWebPage; +class MTPDupdateReadMessagesContents; class MTPupdates_state; class MTPDupdates_state; @@ -940,6 +955,10 @@ class MTPnotifyPeer; class MTPDnotifyPeer; class MTPsendMessageAction; +class MTPDsendMessageUploadVideoAction; +class MTPDsendMessageUploadAudioAction; +class MTPDsendMessageUploadPhotoAction; +class MTPDsendMessageUploadDocumentAction; class MTPcontactFound; class MTPDcontactFound; @@ -1016,6 +1035,16 @@ class MTPDaccount_passwordInputSettings; class MTPauth_passwordRecovery; class MTPDauth_passwordRecovery; +class MTPreceivedNotifyMessage; +class MTPDreceivedNotifyMessage; + +class MTPexportedChatInvite; +class MTPDchatInviteExported; + +class MTPchatInvite; +class MTPDchatInviteAlready; +class MTPDchatInvite; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1156,6 +1185,9 @@ typedef MTPBoxed MTPaccount_Password; typedef MTPBoxed MTPaccount_PasswordSettings; typedef MTPBoxed MTPaccount_PasswordInputSettings; typedef MTPBoxed MTPauth_PasswordRecovery; +typedef MTPBoxed MTPReceivedNotifyMessage; +typedef MTPBoxed MTPExportedChatInvite; +typedef MTPBoxed MTPChatInvite; // Type classes definitions @@ -2338,6 +2370,18 @@ public: return *(const MTPDinputMediaDocument*)data; } + MTPDinputMediaVenue &_inputMediaVenue() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputMediaVenue) throw mtpErrorWrongTypeId(_type, mtpc_inputMediaVenue); + split(); + return *(MTPDinputMediaVenue*)data; + } + const MTPDinputMediaVenue &c_inputMediaVenue() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputMediaVenue) throw mtpErrorWrongTypeId(_type, mtpc_inputMediaVenue); + return *(const MTPDinputMediaVenue*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -2359,20 +2403,22 @@ private: explicit MTPinputMedia(MTPDinputMediaUploadedDocument *_data); explicit MTPinputMedia(MTPDinputMediaUploadedThumbDocument *_data); explicit MTPinputMedia(MTPDinputMediaDocument *_data); + explicit MTPinputMedia(MTPDinputMediaVenue *_data); friend MTPinputMedia MTP_inputMediaEmpty(); - friend MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file); - friend MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id); + friend MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file, const MTPstring &_caption); + friend MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption); friend MTPinputMedia MTP_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point); friend MTPinputMedia MTP_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name); - friend MTPinputMedia MTP_inputMediaUploadedVideo(const MTPInputFile &_file, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_mime_type); - friend MTPinputMedia MTP_inputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_mime_type); - friend MTPinputMedia MTP_inputMediaVideo(const MTPInputVideo &_id); + friend MTPinputMedia MTP_inputMediaUploadedVideo(const MTPInputFile &_file, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_caption); + friend MTPinputMedia MTP_inputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_caption); + friend MTPinputMedia MTP_inputMediaVideo(const MTPInputVideo &_id, const MTPstring &_caption); friend MTPinputMedia MTP_inputMediaUploadedAudio(const MTPInputFile &_file, MTPint _duration, const MTPstring &_mime_type); friend MTPinputMedia MTP_inputMediaAudio(const MTPInputAudio &_id); friend MTPinputMedia MTP_inputMediaUploadedDocument(const MTPInputFile &_file, const MTPstring &_mime_type, const MTPVector &_attributes); friend MTPinputMedia MTP_inputMediaUploadedThumbDocument(const MTPInputFile &_file, const MTPInputFile &_thumb, const MTPstring &_mime_type, const MTPVector &_attributes); friend MTPinputMedia MTP_inputMediaDocument(const MTPInputDocument &_id); + friend MTPinputMedia MTP_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id); mtpTypeId _type; }; @@ -3147,7 +3193,7 @@ public: private: explicit MTPchatFull(MTPDchatFull *_data); - friend MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings); + friend MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite); }; typedef MTPBoxed MTPChatFull; @@ -3428,6 +3474,18 @@ public: return *(const MTPDmessageMediaWebPage*)data; } + MTPDmessageMediaVenue &_messageMediaVenue() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageMediaVenue) throw mtpErrorWrongTypeId(_type, mtpc_messageMediaVenue); + split(); + return *(MTPDmessageMediaVenue*)data; + } + const MTPDmessageMediaVenue &c_messageMediaVenue() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageMediaVenue) throw mtpErrorWrongTypeId(_type, mtpc_messageMediaVenue); + return *(const MTPDmessageMediaVenue*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3444,16 +3502,18 @@ private: explicit MTPmessageMedia(MTPDmessageMediaDocument *_data); explicit MTPmessageMedia(MTPDmessageMediaAudio *_data); explicit MTPmessageMedia(MTPDmessageMediaWebPage *_data); + explicit MTPmessageMedia(MTPDmessageMediaVenue *_data); friend MTPmessageMedia MTP_messageMediaEmpty(); - friend MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo); - friend MTPmessageMedia MTP_messageMediaVideo(const MTPVideo &_video); + friend MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption); + friend MTPmessageMedia MTP_messageMediaVideo(const MTPVideo &_video, const MTPstring &_caption); friend MTPmessageMedia MTP_messageMediaGeo(const MTPGeoPoint &_geo); friend MTPmessageMedia MTP_messageMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, MTPint _user_id); friend MTPmessageMedia MTP_messageMediaUnsupported(); friend MTPmessageMedia MTP_messageMediaDocument(const MTPDocument &_document); friend MTPmessageMedia MTP_messageMediaAudio(const MTPAudio &_audio); friend MTPmessageMedia MTP_messageMediaWebPage(const MTPWebPage &_webpage); + friend MTPmessageMedia MTP_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id); mtpTypeId _type; }; @@ -3539,6 +3599,18 @@ public: return *(const MTPDmessageActionGeoChatCreate*)data; } + MTPDmessageActionChatJoinedByLink &_messageActionChatJoinedByLink() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionChatJoinedByLink) throw mtpErrorWrongTypeId(_type, mtpc_messageActionChatJoinedByLink); + split(); + return *(MTPDmessageActionChatJoinedByLink*)data; + } + const MTPDmessageActionChatJoinedByLink &c_messageActionChatJoinedByLink() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionChatJoinedByLink) throw mtpErrorWrongTypeId(_type, mtpc_messageActionChatJoinedByLink); + return *(const MTPDmessageActionChatJoinedByLink*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3554,6 +3626,7 @@ private: explicit MTPmessageAction(MTPDmessageActionChatAddUser *_data); explicit MTPmessageAction(MTPDmessageActionChatDeleteUser *_data); explicit MTPmessageAction(MTPDmessageActionGeoChatCreate *_data); + explicit MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data); friend MTPmessageAction MTP_messageActionEmpty(); friend MTPmessageAction MTP_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users); @@ -3564,6 +3637,7 @@ private: friend MTPmessageAction MTP_messageActionChatDeleteUser(MTPint _user_id); friend MTPmessageAction MTP_messageActionGeoChatCreate(const MTPstring &_title, const MTPstring &_address); friend MTPmessageAction MTP_messageActionGeoChatCheckin(); + friend MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id); mtpTypeId _type; }; @@ -3645,7 +3719,7 @@ private: explicit MTPphoto(MTPDphoto *_data); friend MTPphoto MTP_photoEmpty(const MTPlong &_id); - friend MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, const MTPGeoPoint &_geo, const MTPVector &_sizes); + friend MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPGeoPoint &_geo, const MTPVector &_sizes); mtpTypeId _type; }; @@ -3761,7 +3835,7 @@ private: explicit MTPvideo(MTPDvideo *_data); friend MTPvideo MTP_videoEmpty(const MTPlong &_id); - friend MTPvideo MTP_video(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, MTPint _duration, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h); + friend MTPvideo MTP_video(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, MTPint _duration, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h); mtpTypeId _type; }; @@ -4901,18 +4975,6 @@ public: return *(const MTPDupdateMessageID*)data; } - MTPDupdateReadMessages &_updateReadMessages() { - if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_updateReadMessages) throw mtpErrorWrongTypeId(_type, mtpc_updateReadMessages); - split(); - return *(MTPDupdateReadMessages*)data; - } - const MTPDupdateReadMessages &c_updateReadMessages() const { - if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_updateReadMessages) throw mtpErrorWrongTypeId(_type, mtpc_updateReadMessages); - return *(const MTPDupdateReadMessages*)data; - } - MTPDupdateDeleteMessages &_updateDeleteMessages() { if (!data) throw mtpErrorUninitialized(); if (_type != mtpc_updateDeleteMessages) throw mtpErrorWrongTypeId(_type, mtpc_updateDeleteMessages); @@ -5225,6 +5287,18 @@ public: return *(const MTPDupdateWebPage*)data; } + MTPDupdateReadMessagesContents &_updateReadMessagesContents() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadMessagesContents) throw mtpErrorWrongTypeId(_type, mtpc_updateReadMessagesContents); + split(); + return *(MTPDupdateReadMessagesContents*)data; + } + const MTPDupdateReadMessagesContents &c_updateReadMessagesContents() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadMessagesContents) throw mtpErrorWrongTypeId(_type, mtpc_updateReadMessagesContents); + return *(const MTPDupdateReadMessagesContents*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5236,7 +5310,6 @@ private: explicit MTPupdate(mtpTypeId type); explicit MTPupdate(MTPDupdateNewMessage *_data); explicit MTPupdate(MTPDupdateMessageID *_data); - explicit MTPupdate(MTPDupdateReadMessages *_data); explicit MTPupdate(MTPDupdateDeleteMessages *_data); explicit MTPupdate(MTPDupdateUserTyping *_data); explicit MTPupdate(MTPDupdateChatUserTyping *_data); @@ -5263,10 +5336,10 @@ private: explicit MTPupdate(MTPDupdateReadHistoryInbox *_data); explicit MTPupdate(MTPDupdateReadHistoryOutbox *_data); explicit MTPupdate(MTPDupdateWebPage *_data); + explicit MTPupdate(MTPDupdateReadMessagesContents *_data); friend MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateMessageID(MTPint _id, const MTPlong &_random_id); - friend MTPupdate MTP_updateReadMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateUserTyping(MTPint _user_id, const MTPSendMessageAction &_action); friend MTPupdate MTP_updateChatUserTyping(MTPint _chat_id, MTPint _user_id, const MTPSendMessageAction &_action); @@ -5293,6 +5366,7 @@ private: friend MTPupdate MTP_updateReadHistoryInbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage); + friend MTPupdate MTP_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count); mtpTypeId _type; }; @@ -5659,7 +5733,7 @@ public: private: explicit MTPconfig(MTPDconfig *_data); - friend MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, const MTPVector &_disabled_features); + friend MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, const MTPVector &_disabled_features); }; typedef MTPBoxed MTPConfig; @@ -6602,14 +6676,62 @@ private: }; typedef MTPBoxed MTPNotifyPeer; -class MTPsendMessageAction { +class MTPsendMessageAction : private mtpDataOwner { public: - MTPsendMessageAction() : _type(0) { + MTPsendMessageAction() : mtpDataOwner(0), _type(0) { } - MTPsendMessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + MTPsendMessageAction(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { read(from, end, cons); } + MTPDsendMessageUploadVideoAction &_sendMessageUploadVideoAction() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadVideoAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadVideoAction); + split(); + return *(MTPDsendMessageUploadVideoAction*)data; + } + const MTPDsendMessageUploadVideoAction &c_sendMessageUploadVideoAction() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadVideoAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadVideoAction); + return *(const MTPDsendMessageUploadVideoAction*)data; + } + + MTPDsendMessageUploadAudioAction &_sendMessageUploadAudioAction() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadAudioAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadAudioAction); + split(); + return *(MTPDsendMessageUploadAudioAction*)data; + } + const MTPDsendMessageUploadAudioAction &c_sendMessageUploadAudioAction() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadAudioAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadAudioAction); + return *(const MTPDsendMessageUploadAudioAction*)data; + } + + MTPDsendMessageUploadPhotoAction &_sendMessageUploadPhotoAction() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadPhotoAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadPhotoAction); + split(); + return *(MTPDsendMessageUploadPhotoAction*)data; + } + const MTPDsendMessageUploadPhotoAction &c_sendMessageUploadPhotoAction() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadPhotoAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadPhotoAction); + return *(const MTPDsendMessageUploadPhotoAction*)data; + } + + MTPDsendMessageUploadDocumentAction &_sendMessageUploadDocumentAction() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadDocumentAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadDocumentAction); + split(); + return *(MTPDsendMessageUploadDocumentAction*)data; + } + const MTPDsendMessageUploadDocumentAction &c_sendMessageUploadDocumentAction() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_sendMessageUploadDocumentAction) throw mtpErrorWrongTypeId(_type, mtpc_sendMessageUploadDocumentAction); + return *(const MTPDsendMessageUploadDocumentAction*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -6619,15 +6741,19 @@ public: private: explicit MTPsendMessageAction(mtpTypeId type); + explicit MTPsendMessageAction(MTPDsendMessageUploadVideoAction *_data); + explicit MTPsendMessageAction(MTPDsendMessageUploadAudioAction *_data); + explicit MTPsendMessageAction(MTPDsendMessageUploadPhotoAction *_data); + explicit MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data); friend MTPsendMessageAction MTP_sendMessageTypingAction(); friend MTPsendMessageAction MTP_sendMessageCancelAction(); friend MTPsendMessageAction MTP_sendMessageRecordVideoAction(); - friend MTPsendMessageAction MTP_sendMessageUploadVideoAction(); + friend MTPsendMessageAction MTP_sendMessageUploadVideoAction(MTPint _progress); friend MTPsendMessageAction MTP_sendMessageRecordAudioAction(); - friend MTPsendMessageAction MTP_sendMessageUploadAudioAction(); - friend MTPsendMessageAction MTP_sendMessageUploadPhotoAction(); - friend MTPsendMessageAction MTP_sendMessageUploadDocumentAction(); + friend MTPsendMessageAction MTP_sendMessageUploadAudioAction(MTPint _progress); + friend MTPsendMessageAction MTP_sendMessageUploadPhotoAction(MTPint _progress); + friend MTPsendMessageAction MTP_sendMessageUploadDocumentAction(MTPint _progress); friend MTPsendMessageAction MTP_sendMessageGeoLocationAction(); friend MTPsendMessageAction MTP_sendMessageChooseContactAction(); @@ -7503,6 +7629,126 @@ private: }; typedef MTPBoxed MTPauth_PasswordRecovery; +class MTPreceivedNotifyMessage : private mtpDataOwner { +public: + MTPreceivedNotifyMessage(); + MTPreceivedNotifyMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_receivedNotifyMessage) : mtpDataOwner(0) { + read(from, end, cons); + } + + MTPDreceivedNotifyMessage &_receivedNotifyMessage() { + if (!data) throw mtpErrorUninitialized(); + split(); + return *(MTPDreceivedNotifyMessage*)data; + } + const MTPDreceivedNotifyMessage &c_receivedNotifyMessage() const { + if (!data) throw mtpErrorUninitialized(); + return *(const MTPDreceivedNotifyMessage*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_receivedNotifyMessage); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data); + + friend MTPreceivedNotifyMessage MTP_receivedNotifyMessage(MTPint _id, MTPint _flags); +}; +typedef MTPBoxed MTPReceivedNotifyMessage; + +class MTPexportedChatInvite : private mtpDataOwner { +public: + MTPexportedChatInvite() : mtpDataOwner(0), _type(0) { + } + MTPexportedChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDchatInviteExported &_chatInviteExported() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInviteExported) throw mtpErrorWrongTypeId(_type, mtpc_chatInviteExported); + split(); + return *(MTPDchatInviteExported*)data; + } + const MTPDchatInviteExported &c_chatInviteExported() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInviteExported) throw mtpErrorWrongTypeId(_type, mtpc_chatInviteExported); + return *(const MTPDchatInviteExported*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPexportedChatInvite(mtpTypeId type); + explicit MTPexportedChatInvite(MTPDchatInviteExported *_data); + + friend MTPexportedChatInvite MTP_chatInviteEmpty(); + friend MTPexportedChatInvite MTP_chatInviteExported(const MTPstring &_link); + + mtpTypeId _type; +}; +typedef MTPBoxed MTPExportedChatInvite; + +class MTPchatInvite : private mtpDataOwner { +public: + MTPchatInvite() : mtpDataOwner(0), _type(0) { + } + MTPchatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDchatInviteAlready &_chatInviteAlready() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInviteAlready) throw mtpErrorWrongTypeId(_type, mtpc_chatInviteAlready); + split(); + return *(MTPDchatInviteAlready*)data; + } + const MTPDchatInviteAlready &c_chatInviteAlready() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInviteAlready) throw mtpErrorWrongTypeId(_type, mtpc_chatInviteAlready); + return *(const MTPDchatInviteAlready*)data; + } + + MTPDchatInvite &_chatInvite() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInvite) throw mtpErrorWrongTypeId(_type, mtpc_chatInvite); + split(); + return *(MTPDchatInvite*)data; + } + const MTPDchatInvite &c_chatInvite() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatInvite) throw mtpErrorWrongTypeId(_type, mtpc_chatInvite); + return *(const MTPDchatInvite*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPchatInvite(mtpTypeId type); + explicit MTPchatInvite(MTPDchatInviteAlready *_data); + explicit MTPchatInvite(MTPDchatInvite *_data); + + friend MTPchatInvite MTP_chatInviteAlready(const MTPChat &_chat); + friend MTPchatInvite MTP_chatInvite(const MTPstring &_title); + + mtpTypeId _type; +}; +typedef MTPBoxed MTPChatInvite; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -7930,20 +8176,22 @@ class MTPDinputMediaUploadedPhoto : public mtpDataImpl { public: MTPDinputMediaPhoto() { } - MTPDinputMediaPhoto(const MTPInputPhoto &_id) : vid(_id) { + MTPDinputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption) : vid(_id), vcaption(_caption) { } MTPInputPhoto vid; + MTPstring vcaption; }; class MTPDinputMediaGeoPoint : public mtpDataImpl { @@ -7972,21 +8220,21 @@ class MTPDinputMediaUploadedVideo : public mtpDataImpl { public: MTPDinputMediaUploadedThumbVideo() { } - MTPDinputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_mime_type) : vfile(_file), vthumb(_thumb), vduration(_duration), vw(_w), vh(_h), vmime_type(_mime_type) { + MTPDinputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_caption) : vfile(_file), vthumb(_thumb), vduration(_duration), vw(_w), vh(_h), vcaption(_caption) { } MTPInputFile vfile; @@ -7994,17 +8242,18 @@ public: MTPint vduration; MTPint vw; MTPint vh; - MTPstring vmime_type; + MTPstring vcaption; }; class MTPDinputMediaVideo : public mtpDataImpl { public: MTPDinputMediaVideo() { } - MTPDinputMediaVideo(const MTPInputVideo &_id) : vid(_id) { + MTPDinputMediaVideo(const MTPInputVideo &_id, const MTPstring &_caption) : vid(_id), vcaption(_caption) { } MTPInputVideo vid; + MTPstring vcaption; }; class MTPDinputMediaUploadedAudio : public mtpDataImpl { @@ -8064,6 +8313,20 @@ public: MTPInputDocument vid; }; +class MTPDinputMediaVenue : public mtpDataImpl { +public: + MTPDinputMediaVenue() { + } + MTPDinputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) : vgeo_point(_geo_point), vtitle(_title), vaddress(_address), vprovider(_provider), vvenue_id(_venue_id) { + } + + MTPInputGeoPoint vgeo_point; + MTPstring vtitle; + MTPstring vaddress; + MTPstring vprovider; + MTPstring vvenue_id; +}; + class MTPDinputChatUploadedPhoto : public mtpDataImpl { public: MTPDinputChatUploadedPhoto() { @@ -8428,13 +8691,14 @@ class MTPDchatFull : public mtpDataImpl { public: MTPDchatFull() { } - MTPDchatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings) : vid(_id), vparticipants(_participants), vchat_photo(_chat_photo), vnotify_settings(_notify_settings) { + MTPDchatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite) : vid(_id), vparticipants(_participants), vchat_photo(_chat_photo), vnotify_settings(_notify_settings), vexported_invite(_exported_invite) { } MTPint vid; MTPChatParticipants vparticipants; MTPPhoto vchat_photo; MTPPeerNotifySettings vnotify_settings; + MTPExportedChatInvite vexported_invite; }; class MTPDchatParticipant : public mtpDataImpl { @@ -8512,13 +8776,13 @@ public: MTPMessageMedia vmedia; enum { - flag_reply_to_msg_id = (1 << 3), flag_fwd_from_id = (1 << 2), + flag_reply_to_msg_id = (1 << 3), flag_fwd_date = (1 << 2), }; - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; } + bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_date() const { return vflags.v & flag_fwd_date; } }; @@ -8541,20 +8805,22 @@ class MTPDmessageMediaPhoto : public mtpDataImpl { public: MTPDmessageMediaPhoto() { } - MTPDmessageMediaPhoto(const MTPPhoto &_photo) : vphoto(_photo) { + MTPDmessageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption) : vphoto(_photo), vcaption(_caption) { } MTPPhoto vphoto; + MTPstring vcaption; }; class MTPDmessageMediaVideo : public mtpDataImpl { public: MTPDmessageMediaVideo() { } - MTPDmessageMediaVideo(const MTPVideo &_video) : vvideo(_video) { + MTPDmessageMediaVideo(const MTPVideo &_video, const MTPstring &_caption) : vvideo(_video), vcaption(_caption) { } MTPVideo vvideo; + MTPstring vcaption; }; class MTPDmessageMediaGeo : public mtpDataImpl { @@ -8610,6 +8876,20 @@ public: MTPWebPage vwebpage; }; +class MTPDmessageMediaVenue : public mtpDataImpl { +public: + MTPDmessageMediaVenue() { + } + MTPDmessageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) : vgeo(_geo), vtitle(_title), vaddress(_address), vprovider(_provider), vvenue_id(_venue_id) { + } + + MTPGeoPoint vgeo; + MTPstring vtitle; + MTPstring vaddress; + MTPstring vprovider; + MTPstring vvenue_id; +}; + class MTPDmessageActionChatCreate : public mtpDataImpl { public: MTPDmessageActionChatCreate() { @@ -8672,6 +8952,16 @@ public: MTPstring vaddress; }; +class MTPDmessageActionChatJoinedByLink : public mtpDataImpl { +public: + MTPDmessageActionChatJoinedByLink() { + } + MTPDmessageActionChatJoinedByLink(MTPint _inviter_id) : vinviter_id(_inviter_id) { + } + + MTPint vinviter_id; +}; + class MTPDdialog : public mtpDataImpl { public: MTPDdialog() { @@ -8700,14 +8990,13 @@ class MTPDphoto : public mtpDataImpl { public: MTPDphoto() { } - MTPDphoto(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, const MTPGeoPoint &_geo, const MTPVector &_sizes) : vid(_id), vaccess_hash(_access_hash), vuser_id(_user_id), vdate(_date), vcaption(_caption), vgeo(_geo), vsizes(_sizes) { + MTPDphoto(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPGeoPoint &_geo, const MTPVector &_sizes) : vid(_id), vaccess_hash(_access_hash), vuser_id(_user_id), vdate(_date), vgeo(_geo), vsizes(_sizes) { } MTPlong vid; MTPlong vaccess_hash; MTPint vuser_id; MTPint vdate; - MTPstring vcaption; MTPGeoPoint vgeo; MTPVector vsizes; }; @@ -8764,16 +9053,14 @@ class MTPDvideo : public mtpDataImpl { public: MTPDvideo() { } - MTPDvideo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, MTPint _duration, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h) : vid(_id), vaccess_hash(_access_hash), vuser_id(_user_id), vdate(_date), vcaption(_caption), vduration(_duration), vmime_type(_mime_type), vsize(_size), vthumb(_thumb), vdc_id(_dc_id), vw(_w), vh(_h) { + MTPDvideo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, MTPint _duration, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h) : vid(_id), vaccess_hash(_access_hash), vuser_id(_user_id), vdate(_date), vduration(_duration), vsize(_size), vthumb(_thumb), vdc_id(_dc_id), vw(_w), vh(_h) { } MTPlong vid; MTPlong vaccess_hash; MTPint vuser_id; MTPint vdate; - MTPstring vcaption; MTPint vduration; - MTPstring vmime_type; MTPint vsize; MTPPhotoSize vthumb; MTPint vdc_id; @@ -9212,18 +9499,6 @@ public: MTPlong vrandom_id; }; -class MTPDupdateReadMessages : public mtpDataImpl { -public: - MTPDupdateReadMessages() { - } - MTPDupdateReadMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) : vmessages(_messages), vpts(_pts), vpts_count(_pts_count) { - } - - MTPVector vmessages; - MTPint vpts; - MTPint vpts_count; -}; - class MTPDupdateDeleteMessages : public mtpDataImpl { public: MTPDupdateDeleteMessages() { @@ -9524,6 +9799,18 @@ public: MTPWebPage vwebpage; }; +class MTPDupdateReadMessagesContents : public mtpDataImpl { +public: + MTPDupdateReadMessagesContents() { + } + MTPDupdateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) : vmessages(_messages), vpts(_pts), vpts_count(_pts_count) { + } + + MTPVector vmessages; + MTPint vpts; + MTPint vpts_count; +}; + class MTPDupdates_state : public mtpDataImpl { public: MTPDupdates_state() { @@ -9598,13 +9885,13 @@ public: MTPint vreply_to_msg_id; enum { - flag_reply_to_msg_id = (1 << 3), flag_fwd_from_id = (1 << 2), + flag_reply_to_msg_id = (1 << 3), flag_fwd_date = (1 << 2), }; - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; } + bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_date() const { return vflags.v & flag_fwd_date; } }; @@ -9628,13 +9915,13 @@ public: MTPint vreply_to_msg_id; enum { - flag_reply_to_msg_id = (1 << 3), flag_fwd_from_id = (1 << 2), + flag_reply_to_msg_id = (1 << 3), flag_fwd_date = (1 << 2), }; - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; } + bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } bool has_fwd_date() const { return vflags.v & flag_fwd_date; } }; @@ -9741,7 +10028,7 @@ class MTPDconfig : public mtpDataImpl { public: MTPDconfig() { } - MTPDconfig(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, const MTPVector &_disabled_features) : vdate(_date), vexpires(_expires), vtest_mode(_test_mode), vthis_dc(_this_dc), vdc_options(_dc_options), vchat_size_max(_chat_size_max), vbroadcast_size_max(_broadcast_size_max), vforwarded_count_max(_forwarded_count_max), vonline_update_period_ms(_online_update_period_ms), voffline_blur_timeout_ms(_offline_blur_timeout_ms), voffline_idle_timeout_ms(_offline_idle_timeout_ms), vonline_cloud_timeout_ms(_online_cloud_timeout_ms), vnotify_cloud_delay_ms(_notify_cloud_delay_ms), vnotify_default_delay_ms(_notify_default_delay_ms), vchat_big_size(_chat_big_size), vdisabled_features(_disabled_features) { + MTPDconfig(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, const MTPVector &_disabled_features) : vdate(_date), vexpires(_expires), vtest_mode(_test_mode), vthis_dc(_this_dc), vdc_options(_dc_options), vchat_size_max(_chat_size_max), vbroadcast_size_max(_broadcast_size_max), vforwarded_count_max(_forwarded_count_max), vonline_update_period_ms(_online_update_period_ms), voffline_blur_timeout_ms(_offline_blur_timeout_ms), voffline_idle_timeout_ms(_offline_idle_timeout_ms), vonline_cloud_timeout_ms(_online_cloud_timeout_ms), vnotify_cloud_delay_ms(_notify_cloud_delay_ms), vnotify_default_delay_ms(_notify_default_delay_ms), vchat_big_size(_chat_big_size), vpush_chat_period_ms(_push_chat_period_ms), vpush_chat_limit(_push_chat_limit), vdisabled_features(_disabled_features) { } MTPint vdate; @@ -9759,6 +10046,8 @@ public: MTPint vnotify_cloud_delay_ms; MTPint vnotify_default_delay_ms; MTPint vchat_big_size; + MTPint vpush_chat_period_ms; + MTPint vpush_chat_limit; MTPVector vdisabled_features; }; @@ -10193,6 +10482,46 @@ public: MTPPeer vpeer; }; +class MTPDsendMessageUploadVideoAction : public mtpDataImpl { +public: + MTPDsendMessageUploadVideoAction() { + } + MTPDsendMessageUploadVideoAction(MTPint _progress) : vprogress(_progress) { + } + + MTPint vprogress; +}; + +class MTPDsendMessageUploadAudioAction : public mtpDataImpl { +public: + MTPDsendMessageUploadAudioAction() { + } + MTPDsendMessageUploadAudioAction(MTPint _progress) : vprogress(_progress) { + } + + MTPint vprogress; +}; + +class MTPDsendMessageUploadPhotoAction : public mtpDataImpl { +public: + MTPDsendMessageUploadPhotoAction() { + } + MTPDsendMessageUploadPhotoAction(MTPint _progress) : vprogress(_progress) { + } + + MTPint vprogress; +}; + +class MTPDsendMessageUploadDocumentAction : public mtpDataImpl { +public: + MTPDsendMessageUploadDocumentAction() { + } + MTPDsendMessageUploadDocumentAction(MTPint _progress) : vprogress(_progress) { + } + + MTPint vprogress; +}; + class MTPDcontactFound : public mtpDataImpl { public: MTPDcontactFound() { @@ -10440,30 +10769,30 @@ public: MTPstring vauthor; enum { + flag_photo = (1 << 4), + flag_embed_type = (1 << 5), + flag_author = (1 << 8), + flag_embed_width = (1 << 6), + flag_type = (1 << 0), + flag_duration = (1 << 7), + flag_embed_height = (1 << 6), flag_description = (1 << 3), flag_site_name = (1 << 1), flag_title = (1 << 2), - flag_author = (1 << 8), - flag_embed_height = (1 << 6), flag_embed_url = (1 << 5), - flag_embed_width = (1 << 6), - flag_type = (1 << 0), - flag_photo = (1 << 4), - flag_embed_type = (1 << 5), - flag_duration = (1 << 7), }; + bool has_photo() const { return vflags.v & flag_photo; } + bool has_embed_type() const { return vflags.v & flag_embed_type; } + bool has_author() const { return vflags.v & flag_author; } + bool has_embed_width() const { return vflags.v & flag_embed_width; } + bool has_type() const { return vflags.v & flag_type; } + bool has_duration() const { return vflags.v & flag_duration; } + bool has_embed_height() const { return vflags.v & flag_embed_height; } bool has_description() const { return vflags.v & flag_description; } bool has_site_name() const { return vflags.v & flag_site_name; } bool has_title() const { return vflags.v & flag_title; } - bool has_author() const { return vflags.v & flag_author; } - bool has_embed_height() const { return vflags.v & flag_embed_height; } bool has_embed_url() const { return vflags.v & flag_embed_url; } - bool has_embed_width() const { return vflags.v & flag_embed_width; } - bool has_type() const { return vflags.v & flag_type; } - bool has_photo() const { return vflags.v & flag_photo; } - bool has_embed_type() const { return vflags.v & flag_embed_type; } - bool has_duration() const { return vflags.v & flag_duration; } }; class MTPDauthorization : public mtpDataImpl { @@ -10547,16 +10876,16 @@ public: MTPstring vemail; enum { + flag_new_salt = (1 << 0), flag_email = (1 << 1), flag_new_password_hash = (1 << 0), flag_hint = (1 << 0), - flag_new_salt = (1 << 0), }; + bool has_new_salt() const { return vflags.v & flag_new_salt; } bool has_email() const { return vflags.v & flag_email; } bool has_new_password_hash() const { return vflags.v & flag_new_password_hash; } bool has_hint() const { return vflags.v & flag_hint; } - bool has_new_salt() const { return vflags.v & flag_new_salt; } }; class MTPDauth_passwordRecovery : public mtpDataImpl { @@ -10569,6 +10898,47 @@ public: MTPstring vemail_pattern; }; +class MTPDreceivedNotifyMessage : public mtpDataImpl { +public: + MTPDreceivedNotifyMessage() { + } + MTPDreceivedNotifyMessage(MTPint _id, MTPint _flags) : vid(_id), vflags(_flags) { + } + + MTPint vid; + MTPint vflags; +}; + +class MTPDchatInviteExported : public mtpDataImpl { +public: + MTPDchatInviteExported() { + } + MTPDchatInviteExported(const MTPstring &_link) : vlink(_link) { + } + + MTPstring vlink; +}; + +class MTPDchatInviteAlready : public mtpDataImpl { +public: + MTPDchatInviteAlready() { + } + MTPDchatInviteAlready(const MTPChat &_chat) : vchat(_chat) { + } + + MTPChat vchat; +}; + +class MTPDchatInvite : public mtpDataImpl { +public: + MTPDchatInvite() { + } + MTPDchatInvite(const MTPstring &_title) : vtitle(_title) { + } + + MTPstring vtitle; +}; + // RPC methods class MTPreq_pq { // RPC method 'req_pq' @@ -12666,7 +13036,7 @@ public: vmax_id.write(to); } - typedef MTPVector ResponseType; + typedef MTPVector ResponseType; }; class MTPmessages_ReceivedMessages : public MTPBoxed { public: @@ -15907,6 +16277,162 @@ public: } }; +template +class MTPinvokeWithoutUpdates { // RPC method 'invokeWithoutUpdates' +public: + TQueryType vquery; + + MTPinvokeWithoutUpdates() { + } + MTPinvokeWithoutUpdates(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithoutUpdates) { + read(from, end, cons); + } + MTPinvokeWithoutUpdates(const TQueryType &_query) : vquery(_query) { + } + + uint32 innerLength() const { + return vquery.innerLength(); + } + mtpTypeId type() const { + return mtpc_invokeWithoutUpdates; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithoutUpdates) { + vquery.read(from, end); + } + void write(mtpBuffer &to) const { + vquery.write(to); + } + + typedef typename TQueryType::ResponseType ResponseType; +}; +template +class MTPInvokeWithoutUpdates : public MTPBoxed > { +public: + MTPInvokeWithoutUpdates() { + } + MTPInvokeWithoutUpdates(const MTPinvokeWithoutUpdates &v) : MTPBoxed >(v) { + } + MTPInvokeWithoutUpdates(const TQueryType &_query) : MTPBoxed >(MTPinvokeWithoutUpdates(_query)) { + } +}; + +class MTPmessages_exportChatInvite { // RPC method 'messages.exportChatInvite' +public: + MTPint vchat_id; + + MTPmessages_exportChatInvite() { + } + MTPmessages_exportChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_exportChatInvite) { + read(from, end, cons); + } + MTPmessages_exportChatInvite(MTPint _chat_id) : vchat_id(_chat_id) { + } + + uint32 innerLength() const { + return vchat_id.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_exportChatInvite; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_exportChatInvite) { + vchat_id.read(from, end); + } + void write(mtpBuffer &to) const { + vchat_id.write(to); + } + + typedef MTPExportedChatInvite ResponseType; +}; +class MTPmessages_ExportChatInvite : public MTPBoxed { +public: + MTPmessages_ExportChatInvite() { + } + MTPmessages_ExportChatInvite(const MTPmessages_exportChatInvite &v) : MTPBoxed(v) { + } + MTPmessages_ExportChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_ExportChatInvite(MTPint _chat_id) : MTPBoxed(MTPmessages_exportChatInvite(_chat_id)) { + } +}; + +class MTPmessages_checkChatInvite { // RPC method 'messages.checkChatInvite' +public: + MTPstring vhash; + + MTPmessages_checkChatInvite() { + } + MTPmessages_checkChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_checkChatInvite) { + read(from, end, cons); + } + MTPmessages_checkChatInvite(const MTPstring &_hash) : vhash(_hash) { + } + + uint32 innerLength() const { + return vhash.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_checkChatInvite; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_checkChatInvite) { + vhash.read(from, end); + } + void write(mtpBuffer &to) const { + vhash.write(to); + } + + typedef MTPChatInvite ResponseType; +}; +class MTPmessages_CheckChatInvite : public MTPBoxed { +public: + MTPmessages_CheckChatInvite() { + } + MTPmessages_CheckChatInvite(const MTPmessages_checkChatInvite &v) : MTPBoxed(v) { + } + MTPmessages_CheckChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_CheckChatInvite(const MTPstring &_hash) : MTPBoxed(MTPmessages_checkChatInvite(_hash)) { + } +}; + +class MTPmessages_importChatInvite { // RPC method 'messages.importChatInvite' +public: + MTPstring vhash; + + MTPmessages_importChatInvite() { + } + MTPmessages_importChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_importChatInvite) { + read(from, end, cons); + } + MTPmessages_importChatInvite(const MTPstring &_hash) : vhash(_hash) { + } + + uint32 innerLength() const { + return vhash.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_importChatInvite; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_importChatInvite) { + vhash.read(from, end); + } + void write(mtpBuffer &to) const { + vhash.write(to); + } + + typedef MTPUpdates ResponseType; +}; +class MTPmessages_ImportChatInvite : public MTPBoxed { +public: + MTPmessages_ImportChatInvite() { + } + MTPmessages_ImportChatInvite(const MTPmessages_importChatInvite &v) : MTPBoxed(v) { + } + MTPmessages_ImportChatInvite(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_ImportChatInvite(const MTPstring &_hash) : MTPBoxed(MTPmessages_importChatInvite(_hash)) { + } +}; + // Inline methods definition inline MTPresPQ::MTPresPQ() : mtpDataOwner(new MTPDresPQ()) { @@ -17124,11 +17650,11 @@ inline uint32 MTPinputMedia::innerLength() const { switch (_type) { case mtpc_inputMediaUploadedPhoto: { const MTPDinputMediaUploadedPhoto &v(c_inputMediaUploadedPhoto()); - return v.vfile.innerLength(); + return v.vfile.innerLength() + v.vcaption.innerLength(); } case mtpc_inputMediaPhoto: { const MTPDinputMediaPhoto &v(c_inputMediaPhoto()); - return v.vid.innerLength(); + return v.vid.innerLength() + v.vcaption.innerLength(); } case mtpc_inputMediaGeoPoint: { const MTPDinputMediaGeoPoint &v(c_inputMediaGeoPoint()); @@ -17140,15 +17666,15 @@ inline uint32 MTPinputMedia::innerLength() const { } case mtpc_inputMediaUploadedVideo: { const MTPDinputMediaUploadedVideo &v(c_inputMediaUploadedVideo()); - return v.vfile.innerLength() + v.vduration.innerLength() + v.vw.innerLength() + v.vh.innerLength() + v.vmime_type.innerLength(); + return v.vfile.innerLength() + v.vduration.innerLength() + v.vw.innerLength() + v.vh.innerLength() + v.vcaption.innerLength(); } case mtpc_inputMediaUploadedThumbVideo: { const MTPDinputMediaUploadedThumbVideo &v(c_inputMediaUploadedThumbVideo()); - return v.vfile.innerLength() + v.vthumb.innerLength() + v.vduration.innerLength() + v.vw.innerLength() + v.vh.innerLength() + v.vmime_type.innerLength(); + return v.vfile.innerLength() + v.vthumb.innerLength() + v.vduration.innerLength() + v.vw.innerLength() + v.vh.innerLength() + v.vcaption.innerLength(); } case mtpc_inputMediaVideo: { const MTPDinputMediaVideo &v(c_inputMediaVideo()); - return v.vid.innerLength(); + return v.vid.innerLength() + v.vcaption.innerLength(); } case mtpc_inputMediaUploadedAudio: { const MTPDinputMediaUploadedAudio &v(c_inputMediaUploadedAudio()); @@ -17170,6 +17696,10 @@ inline uint32 MTPinputMedia::innerLength() const { const MTPDinputMediaDocument &v(c_inputMediaDocument()); return v.vid.innerLength(); } + case mtpc_inputMediaVenue: { + const MTPDinputMediaVenue &v(c_inputMediaVenue()); + return v.vgeo_point.innerLength() + v.vtitle.innerLength() + v.vaddress.innerLength() + v.vprovider.innerLength() + v.vvenue_id.innerLength(); + } } return 0; } @@ -17185,11 +17715,13 @@ inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpT if (!data) setData(new MTPDinputMediaUploadedPhoto()); MTPDinputMediaUploadedPhoto &v(_inputMediaUploadedPhoto()); v.vfile.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_inputMediaPhoto: _type = cons; { if (!data) setData(new MTPDinputMediaPhoto()); MTPDinputMediaPhoto &v(_inputMediaPhoto()); v.vid.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_inputMediaGeoPoint: _type = cons; { if (!data) setData(new MTPDinputMediaGeoPoint()); @@ -17210,7 +17742,7 @@ inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpT v.vduration.read(from, end); v.vw.read(from, end); v.vh.read(from, end); - v.vmime_type.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_inputMediaUploadedThumbVideo: _type = cons; { if (!data) setData(new MTPDinputMediaUploadedThumbVideo()); @@ -17220,12 +17752,13 @@ inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpT v.vduration.read(from, end); v.vw.read(from, end); v.vh.read(from, end); - v.vmime_type.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_inputMediaVideo: _type = cons; { if (!data) setData(new MTPDinputMediaVideo()); MTPDinputMediaVideo &v(_inputMediaVideo()); v.vid.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_inputMediaUploadedAudio: _type = cons; { if (!data) setData(new MTPDinputMediaUploadedAudio()); @@ -17259,6 +17792,15 @@ inline void MTPinputMedia::read(const mtpPrime *&from, const mtpPrime *end, mtpT MTPDinputMediaDocument &v(_inputMediaDocument()); v.vid.read(from, end); } break; + case mtpc_inputMediaVenue: _type = cons; { + if (!data) setData(new MTPDinputMediaVenue()); + MTPDinputMediaVenue &v(_inputMediaVenue()); + v.vgeo_point.read(from, end); + v.vtitle.read(from, end); + v.vaddress.read(from, end); + v.vprovider.read(from, end); + v.vvenue_id.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPinputMedia"); } } @@ -17267,10 +17809,12 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { case mtpc_inputMediaUploadedPhoto: { const MTPDinputMediaUploadedPhoto &v(c_inputMediaUploadedPhoto()); v.vfile.write(to); + v.vcaption.write(to); } break; case mtpc_inputMediaPhoto: { const MTPDinputMediaPhoto &v(c_inputMediaPhoto()); v.vid.write(to); + v.vcaption.write(to); } break; case mtpc_inputMediaGeoPoint: { const MTPDinputMediaGeoPoint &v(c_inputMediaGeoPoint()); @@ -17288,7 +17832,7 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { v.vduration.write(to); v.vw.write(to); v.vh.write(to); - v.vmime_type.write(to); + v.vcaption.write(to); } break; case mtpc_inputMediaUploadedThumbVideo: { const MTPDinputMediaUploadedThumbVideo &v(c_inputMediaUploadedThumbVideo()); @@ -17297,11 +17841,12 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { v.vduration.write(to); v.vw.write(to); v.vh.write(to); - v.vmime_type.write(to); + v.vcaption.write(to); } break; case mtpc_inputMediaVideo: { const MTPDinputMediaVideo &v(c_inputMediaVideo()); v.vid.write(to); + v.vcaption.write(to); } break; case mtpc_inputMediaUploadedAudio: { const MTPDinputMediaUploadedAudio &v(c_inputMediaUploadedAudio()); @@ -17330,6 +17875,14 @@ inline void MTPinputMedia::write(mtpBuffer &to) const { const MTPDinputMediaDocument &v(c_inputMediaDocument()); v.vid.write(to); } break; + case mtpc_inputMediaVenue: { + const MTPDinputMediaVenue &v(c_inputMediaVenue()); + v.vgeo_point.write(to); + v.vtitle.write(to); + v.vaddress.write(to); + v.vprovider.write(to); + v.vvenue_id.write(to); + } break; } } inline MTPinputMedia::MTPinputMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -17347,6 +17900,7 @@ inline MTPinputMedia::MTPinputMedia(mtpTypeId type) : mtpDataOwner(0), _type(typ case mtpc_inputMediaUploadedDocument: setData(new MTPDinputMediaUploadedDocument()); break; case mtpc_inputMediaUploadedThumbDocument: setData(new MTPDinputMediaUploadedThumbDocument()); break; case mtpc_inputMediaDocument: setData(new MTPDinputMediaDocument()); break; + case mtpc_inputMediaVenue: setData(new MTPDinputMediaVenue()); break; default: throw mtpErrorBadTypeId(type, "MTPinputMedia"); } } @@ -17374,14 +17928,16 @@ inline MTPinputMedia::MTPinputMedia(MTPDinputMediaUploadedThumbDocument *_data) } inline MTPinputMedia::MTPinputMedia(MTPDinputMediaDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaDocument) { } +inline MTPinputMedia::MTPinputMedia(MTPDinputMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaVenue) { +} inline MTPinputMedia MTP_inputMediaEmpty() { return MTPinputMedia(mtpc_inputMediaEmpty); } -inline MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file) { - return MTPinputMedia(new MTPDinputMediaUploadedPhoto(_file)); +inline MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedPhoto(_file, _caption)); } -inline MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id) { - return MTPinputMedia(new MTPDinputMediaPhoto(_id)); +inline MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaPhoto(_id, _caption)); } inline MTPinputMedia MTP_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point) { return MTPinputMedia(new MTPDinputMediaGeoPoint(_geo_point)); @@ -17389,14 +17945,14 @@ inline MTPinputMedia MTP_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point) inline MTPinputMedia MTP_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name) { return MTPinputMedia(new MTPDinputMediaContact(_phone_number, _first_name, _last_name)); } -inline MTPinputMedia MTP_inputMediaUploadedVideo(const MTPInputFile &_file, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_mime_type) { - return MTPinputMedia(new MTPDinputMediaUploadedVideo(_file, _duration, _w, _h, _mime_type)); +inline MTPinputMedia MTP_inputMediaUploadedVideo(const MTPInputFile &_file, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedVideo(_file, _duration, _w, _h, _caption)); } -inline MTPinputMedia MTP_inputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_mime_type) { - return MTPinputMedia(new MTPDinputMediaUploadedThumbVideo(_file, _thumb, _duration, _w, _h, _mime_type)); +inline MTPinputMedia MTP_inputMediaUploadedThumbVideo(const MTPInputFile &_file, const MTPInputFile &_thumb, MTPint _duration, MTPint _w, MTPint _h, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedThumbVideo(_file, _thumb, _duration, _w, _h, _caption)); } -inline MTPinputMedia MTP_inputMediaVideo(const MTPInputVideo &_id) { - return MTPinputMedia(new MTPDinputMediaVideo(_id)); +inline MTPinputMedia MTP_inputMediaVideo(const MTPInputVideo &_id, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaVideo(_id, _caption)); } inline MTPinputMedia MTP_inputMediaUploadedAudio(const MTPInputFile &_file, MTPint _duration, const MTPstring &_mime_type) { return MTPinputMedia(new MTPDinputMediaUploadedAudio(_file, _duration, _mime_type)); @@ -17413,6 +17969,9 @@ inline MTPinputMedia MTP_inputMediaUploadedThumbDocument(const MTPInputFile &_fi inline MTPinputMedia MTP_inputMediaDocument(const MTPInputDocument &_id) { return MTPinputMedia(new MTPDinputMediaDocument(_id)); } +inline MTPinputMedia MTP_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { + return MTPinputMedia(new MTPDinputMediaVenue(_geo_point, _title, _address, _provider, _venue_id)); +} inline uint32 MTPinputChatPhoto::innerLength() const { switch (_type) { @@ -18540,7 +19099,7 @@ inline MTPchatFull::MTPchatFull() : mtpDataOwner(new MTPDchatFull()) { inline uint32 MTPchatFull::innerLength() const { const MTPDchatFull &v(c_chatFull()); - return v.vid.innerLength() + v.vparticipants.innerLength() + v.vchat_photo.innerLength() + v.vnotify_settings.innerLength(); + return v.vid.innerLength() + v.vparticipants.innerLength() + v.vchat_photo.innerLength() + v.vnotify_settings.innerLength() + v.vexported_invite.innerLength(); } inline mtpTypeId MTPchatFull::type() const { return mtpc_chatFull; @@ -18554,6 +19113,7 @@ inline void MTPchatFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTyp v.vparticipants.read(from, end); v.vchat_photo.read(from, end); v.vnotify_settings.read(from, end); + v.vexported_invite.read(from, end); } inline void MTPchatFull::write(mtpBuffer &to) const { const MTPDchatFull &v(c_chatFull()); @@ -18561,11 +19121,12 @@ inline void MTPchatFull::write(mtpBuffer &to) const { v.vparticipants.write(to); v.vchat_photo.write(to); v.vnotify_settings.write(to); + v.vexported_invite.write(to); } inline MTPchatFull::MTPchatFull(MTPDchatFull *_data) : mtpDataOwner(_data) { } -inline MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings) { - return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings)); +inline MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite) { + return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite)); } inline MTPchatParticipant::MTPchatParticipant() : mtpDataOwner(new MTPDchatParticipant()) { @@ -18833,11 +19394,11 @@ inline uint32 MTPmessageMedia::innerLength() const { switch (_type) { case mtpc_messageMediaPhoto: { const MTPDmessageMediaPhoto &v(c_messageMediaPhoto()); - return v.vphoto.innerLength(); + return v.vphoto.innerLength() + v.vcaption.innerLength(); } case mtpc_messageMediaVideo: { const MTPDmessageMediaVideo &v(c_messageMediaVideo()); - return v.vvideo.innerLength(); + return v.vvideo.innerLength() + v.vcaption.innerLength(); } case mtpc_messageMediaGeo: { const MTPDmessageMediaGeo &v(c_messageMediaGeo()); @@ -18859,6 +19420,10 @@ inline uint32 MTPmessageMedia::innerLength() const { const MTPDmessageMediaWebPage &v(c_messageMediaWebPage()); return v.vwebpage.innerLength(); } + case mtpc_messageMediaVenue: { + const MTPDmessageMediaVenue &v(c_messageMediaVenue()); + return v.vgeo.innerLength() + v.vtitle.innerLength() + v.vaddress.innerLength() + v.vprovider.innerLength() + v.vvenue_id.innerLength(); + } } return 0; } @@ -18874,11 +19439,13 @@ inline void MTPmessageMedia::read(const mtpPrime *&from, const mtpPrime *end, mt if (!data) setData(new MTPDmessageMediaPhoto()); MTPDmessageMediaPhoto &v(_messageMediaPhoto()); v.vphoto.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_messageMediaVideo: _type = cons; { if (!data) setData(new MTPDmessageMediaVideo()); MTPDmessageMediaVideo &v(_messageMediaVideo()); v.vvideo.read(from, end); + v.vcaption.read(from, end); } break; case mtpc_messageMediaGeo: _type = cons; { if (!data) setData(new MTPDmessageMediaGeo()); @@ -18909,6 +19476,15 @@ inline void MTPmessageMedia::read(const mtpPrime *&from, const mtpPrime *end, mt MTPDmessageMediaWebPage &v(_messageMediaWebPage()); v.vwebpage.read(from, end); } break; + case mtpc_messageMediaVenue: _type = cons; { + if (!data) setData(new MTPDmessageMediaVenue()); + MTPDmessageMediaVenue &v(_messageMediaVenue()); + v.vgeo.read(from, end); + v.vtitle.read(from, end); + v.vaddress.read(from, end); + v.vprovider.read(from, end); + v.vvenue_id.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessageMedia"); } } @@ -18917,10 +19493,12 @@ inline void MTPmessageMedia::write(mtpBuffer &to) const { case mtpc_messageMediaPhoto: { const MTPDmessageMediaPhoto &v(c_messageMediaPhoto()); v.vphoto.write(to); + v.vcaption.write(to); } break; case mtpc_messageMediaVideo: { const MTPDmessageMediaVideo &v(c_messageMediaVideo()); v.vvideo.write(to); + v.vcaption.write(to); } break; case mtpc_messageMediaGeo: { const MTPDmessageMediaGeo &v(c_messageMediaGeo()); @@ -18945,6 +19523,14 @@ inline void MTPmessageMedia::write(mtpBuffer &to) const { const MTPDmessageMediaWebPage &v(c_messageMediaWebPage()); v.vwebpage.write(to); } break; + case mtpc_messageMediaVenue: { + const MTPDmessageMediaVenue &v(c_messageMediaVenue()); + v.vgeo.write(to); + v.vtitle.write(to); + v.vaddress.write(to); + v.vprovider.write(to); + v.vvenue_id.write(to); + } break; } } inline MTPmessageMedia::MTPmessageMedia(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -18958,6 +19544,7 @@ inline MTPmessageMedia::MTPmessageMedia(mtpTypeId type) : mtpDataOwner(0), _type case mtpc_messageMediaDocument: setData(new MTPDmessageMediaDocument()); break; case mtpc_messageMediaAudio: setData(new MTPDmessageMediaAudio()); break; case mtpc_messageMediaWebPage: setData(new MTPDmessageMediaWebPage()); break; + case mtpc_messageMediaVenue: setData(new MTPDmessageMediaVenue()); break; default: throw mtpErrorBadTypeId(type, "MTPmessageMedia"); } } @@ -18975,14 +19562,16 @@ inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaAudio *_data) : mtpDataO } inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaWebPage *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaWebPage) { } +inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaVenue) { +} inline MTPmessageMedia MTP_messageMediaEmpty() { return MTPmessageMedia(mtpc_messageMediaEmpty); } -inline MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo) { - return MTPmessageMedia(new MTPDmessageMediaPhoto(_photo)); +inline MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption) { + return MTPmessageMedia(new MTPDmessageMediaPhoto(_photo, _caption)); } -inline MTPmessageMedia MTP_messageMediaVideo(const MTPVideo &_video) { - return MTPmessageMedia(new MTPDmessageMediaVideo(_video)); +inline MTPmessageMedia MTP_messageMediaVideo(const MTPVideo &_video, const MTPstring &_caption) { + return MTPmessageMedia(new MTPDmessageMediaVideo(_video, _caption)); } inline MTPmessageMedia MTP_messageMediaGeo(const MTPGeoPoint &_geo) { return MTPmessageMedia(new MTPDmessageMediaGeo(_geo)); @@ -19002,6 +19591,9 @@ inline MTPmessageMedia MTP_messageMediaAudio(const MTPAudio &_audio) { inline MTPmessageMedia MTP_messageMediaWebPage(const MTPWebPage &_webpage) { return MTPmessageMedia(new MTPDmessageMediaWebPage(_webpage)); } +inline MTPmessageMedia MTP_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { + return MTPmessageMedia(new MTPDmessageMediaVenue(_geo, _title, _address, _provider, _venue_id)); +} inline uint32 MTPmessageAction::innerLength() const { switch (_type) { @@ -19029,6 +19621,10 @@ inline uint32 MTPmessageAction::innerLength() const { const MTPDmessageActionGeoChatCreate &v(c_messageActionGeoChatCreate()); return v.vtitle.innerLength() + v.vaddress.innerLength(); } + case mtpc_messageActionChatJoinedByLink: { + const MTPDmessageActionChatJoinedByLink &v(c_messageActionChatJoinedByLink()); + return v.vinviter_id.innerLength(); + } } return 0; } @@ -19074,6 +19670,11 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m v.vaddress.read(from, end); } break; case mtpc_messageActionGeoChatCheckin: _type = cons; break; + case mtpc_messageActionChatJoinedByLink: _type = cons; { + if (!data) setData(new MTPDmessageActionChatJoinedByLink()); + MTPDmessageActionChatJoinedByLink &v(_messageActionChatJoinedByLink()); + v.vinviter_id.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessageAction"); } } @@ -19105,6 +19706,10 @@ inline void MTPmessageAction::write(mtpBuffer &to) const { v.vtitle.write(to); v.vaddress.write(to); } break; + case mtpc_messageActionChatJoinedByLink: { + const MTPDmessageActionChatJoinedByLink &v(c_messageActionChatJoinedByLink()); + v.vinviter_id.write(to); + } break; } } inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -19118,6 +19723,7 @@ inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _ty case mtpc_messageActionChatDeleteUser: setData(new MTPDmessageActionChatDeleteUser()); break; case mtpc_messageActionGeoChatCreate: setData(new MTPDmessageActionGeoChatCreate()); break; case mtpc_messageActionGeoChatCheckin: break; + case mtpc_messageActionChatJoinedByLink: setData(new MTPDmessageActionChatJoinedByLink()); break; default: throw mtpErrorBadTypeId(type, "MTPmessageAction"); } } @@ -19133,6 +19739,8 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatDeleteUser *_data } inline MTPmessageAction::MTPmessageAction(MTPDmessageActionGeoChatCreate *_data) : mtpDataOwner(_data), _type(mtpc_messageActionGeoChatCreate) { } +inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatJoinedByLink) { +} inline MTPmessageAction MTP_messageActionEmpty() { return MTPmessageAction(mtpc_messageActionEmpty); } @@ -19160,6 +19768,9 @@ inline MTPmessageAction MTP_messageActionGeoChatCreate(const MTPstring &_title, inline MTPmessageAction MTP_messageActionGeoChatCheckin() { return MTPmessageAction(mtpc_messageActionGeoChatCheckin); } +inline MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id) { + return MTPmessageAction(new MTPDmessageActionChatJoinedByLink(_inviter_id)); +} inline MTPdialog::MTPdialog() : mtpDataOwner(new MTPDdialog()) { } @@ -19204,7 +19815,7 @@ inline uint32 MTPphoto::innerLength() const { } case mtpc_photo: { const MTPDphoto &v(c_photo()); - return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vuser_id.innerLength() + v.vdate.innerLength() + v.vcaption.innerLength() + v.vgeo.innerLength() + v.vsizes.innerLength(); + return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vuser_id.innerLength() + v.vdate.innerLength() + v.vgeo.innerLength() + v.vsizes.innerLength(); } } return 0; @@ -19228,7 +19839,6 @@ inline void MTPphoto::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId v.vaccess_hash.read(from, end); v.vuser_id.read(from, end); v.vdate.read(from, end); - v.vcaption.read(from, end); v.vgeo.read(from, end); v.vsizes.read(from, end); } break; @@ -19247,7 +19857,6 @@ inline void MTPphoto::write(mtpBuffer &to) const { v.vaccess_hash.write(to); v.vuser_id.write(to); v.vdate.write(to); - v.vcaption.write(to); v.vgeo.write(to); v.vsizes.write(to); } break; @@ -19267,8 +19876,8 @@ inline MTPphoto::MTPphoto(MTPDphoto *_data) : mtpDataOwner(_data), _type(mtpc_ph inline MTPphoto MTP_photoEmpty(const MTPlong &_id) { return MTPphoto(new MTPDphotoEmpty(_id)); } -inline MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, const MTPGeoPoint &_geo, const MTPVector &_sizes) { - return MTPphoto(new MTPDphoto(_id, _access_hash, _user_id, _date, _caption, _geo, _sizes)); +inline MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPGeoPoint &_geo, const MTPVector &_sizes) { + return MTPphoto(new MTPDphoto(_id, _access_hash, _user_id, _date, _geo, _sizes)); } inline uint32 MTPphotoSize::innerLength() const { @@ -19377,7 +19986,7 @@ inline uint32 MTPvideo::innerLength() const { } case mtpc_video: { const MTPDvideo &v(c_video()); - return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vuser_id.innerLength() + v.vdate.innerLength() + v.vcaption.innerLength() + v.vduration.innerLength() + v.vmime_type.innerLength() + v.vsize.innerLength() + v.vthumb.innerLength() + v.vdc_id.innerLength() + v.vw.innerLength() + v.vh.innerLength(); + return v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vuser_id.innerLength() + v.vdate.innerLength() + v.vduration.innerLength() + v.vsize.innerLength() + v.vthumb.innerLength() + v.vdc_id.innerLength() + v.vw.innerLength() + v.vh.innerLength(); } } return 0; @@ -19401,9 +20010,7 @@ inline void MTPvideo::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId v.vaccess_hash.read(from, end); v.vuser_id.read(from, end); v.vdate.read(from, end); - v.vcaption.read(from, end); v.vduration.read(from, end); - v.vmime_type.read(from, end); v.vsize.read(from, end); v.vthumb.read(from, end); v.vdc_id.read(from, end); @@ -19425,9 +20032,7 @@ inline void MTPvideo::write(mtpBuffer &to) const { v.vaccess_hash.write(to); v.vuser_id.write(to); v.vdate.write(to); - v.vcaption.write(to); v.vduration.write(to); - v.vmime_type.write(to); v.vsize.write(to); v.vthumb.write(to); v.vdc_id.write(to); @@ -19450,8 +20055,8 @@ inline MTPvideo::MTPvideo(MTPDvideo *_data) : mtpDataOwner(_data), _type(mtpc_vi inline MTPvideo MTP_videoEmpty(const MTPlong &_id) { return MTPvideo(new MTPDvideoEmpty(_id)); } -inline MTPvideo MTP_video(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, const MTPstring &_caption, MTPint _duration, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h) { - return MTPvideo(new MTPDvideo(_id, _access_hash, _user_id, _date, _caption, _duration, _mime_type, _size, _thumb, _dc_id, _w, _h)); +inline MTPvideo MTP_video(const MTPlong &_id, const MTPlong &_access_hash, MTPint _user_id, MTPint _date, MTPint _duration, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, MTPint _w, MTPint _h) { + return MTPvideo(new MTPDvideo(_id, _access_hash, _user_id, _date, _duration, _size, _thumb, _dc_id, _w, _h)); } inline uint32 MTPgeoPoint::innerLength() const { @@ -20797,10 +21402,6 @@ inline uint32 MTPupdate::innerLength() const { const MTPDupdateMessageID &v(c_updateMessageID()); return v.vid.innerLength() + v.vrandom_id.innerLength(); } - case mtpc_updateReadMessages: { - const MTPDupdateReadMessages &v(c_updateReadMessages()); - return v.vmessages.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); - } case mtpc_updateDeleteMessages: { const MTPDupdateDeleteMessages &v(c_updateDeleteMessages()); return v.vmessages.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); @@ -20905,6 +21506,10 @@ inline uint32 MTPupdate::innerLength() const { const MTPDupdateWebPage &v(c_updateWebPage()); return v.vwebpage.innerLength(); } + case mtpc_updateReadMessagesContents: { + const MTPDupdateReadMessagesContents &v(c_updateReadMessagesContents()); + return v.vmessages.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); + } } return 0; } @@ -20928,13 +21533,6 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vid.read(from, end); v.vrandom_id.read(from, end); } break; - case mtpc_updateReadMessages: _type = cons; { - if (!data) setData(new MTPDupdateReadMessages()); - MTPDupdateReadMessages &v(_updateReadMessages()); - v.vmessages.read(from, end); - v.vpts.read(from, end); - v.vpts_count.read(from, end); - } break; case mtpc_updateDeleteMessages: _type = cons; { if (!data) setData(new MTPDupdateDeleteMessages()); MTPDupdateDeleteMessages &v(_updateDeleteMessages()); @@ -21105,6 +21703,13 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI MTPDupdateWebPage &v(_updateWebPage()); v.vwebpage.read(from, end); } break; + case mtpc_updateReadMessagesContents: _type = cons; { + if (!data) setData(new MTPDupdateReadMessagesContents()); + MTPDupdateReadMessagesContents &v(_updateReadMessagesContents()); + v.vmessages.read(from, end); + v.vpts.read(from, end); + v.vpts_count.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); } } @@ -21121,12 +21726,6 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.vid.write(to); v.vrandom_id.write(to); } break; - case mtpc_updateReadMessages: { - const MTPDupdateReadMessages &v(c_updateReadMessages()); - v.vmessages.write(to); - v.vpts.write(to); - v.vpts_count.write(to); - } break; case mtpc_updateDeleteMessages: { const MTPDupdateDeleteMessages &v(c_updateDeleteMessages()); v.vmessages.write(to); @@ -21271,13 +21870,18 @@ inline void MTPupdate::write(mtpBuffer &to) const { const MTPDupdateWebPage &v(c_updateWebPage()); v.vwebpage.write(to); } break; + case mtpc_updateReadMessagesContents: { + const MTPDupdateReadMessagesContents &v(c_updateReadMessagesContents()); + v.vmessages.write(to); + v.vpts.write(to); + v.vpts_count.write(to); + } break; } } inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { switch (type) { case mtpc_updateNewMessage: setData(new MTPDupdateNewMessage()); break; case mtpc_updateMessageID: setData(new MTPDupdateMessageID()); break; - case mtpc_updateReadMessages: setData(new MTPDupdateReadMessages()); break; case mtpc_updateDeleteMessages: setData(new MTPDupdateDeleteMessages()); break; case mtpc_updateUserTyping: setData(new MTPDupdateUserTyping()); break; case mtpc_updateChatUserTyping: setData(new MTPDupdateChatUserTyping()); break; @@ -21304,6 +21908,7 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_updateReadHistoryInbox: setData(new MTPDupdateReadHistoryInbox()); break; case mtpc_updateReadHistoryOutbox: setData(new MTPDupdateReadHistoryOutbox()); break; case mtpc_updateWebPage: setData(new MTPDupdateWebPage()); break; + case mtpc_updateReadMessagesContents: setData(new MTPDupdateReadMessagesContents()); break; default: throw mtpErrorBadTypeId(type, "MTPupdate"); } } @@ -21311,8 +21916,6 @@ inline MTPupdate::MTPupdate(MTPDupdateNewMessage *_data) : mtpDataOwner(_data), } inline MTPupdate::MTPupdate(MTPDupdateMessageID *_data) : mtpDataOwner(_data), _type(mtpc_updateMessageID) { } -inline MTPupdate::MTPupdate(MTPDupdateReadMessages *_data) : mtpDataOwner(_data), _type(mtpc_updateReadMessages) { -} inline MTPupdate::MTPupdate(MTPDupdateDeleteMessages *_data) : mtpDataOwner(_data), _type(mtpc_updateDeleteMessages) { } inline MTPupdate::MTPupdate(MTPDupdateUserTyping *_data) : mtpDataOwner(_data), _type(mtpc_updateUserTyping) { @@ -21365,15 +21968,14 @@ inline MTPupdate::MTPupdate(MTPDupdateReadHistoryOutbox *_data) : mtpDataOwner(_ } inline MTPupdate::MTPupdate(MTPDupdateWebPage *_data) : mtpDataOwner(_data), _type(mtpc_updateWebPage) { } +inline MTPupdate::MTPupdate(MTPDupdateReadMessagesContents *_data) : mtpDataOwner(_data), _type(mtpc_updateReadMessagesContents) { +} inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); } inline MTPupdate MTP_updateMessageID(MTPint _id, const MTPlong &_random_id) { return MTPupdate(new MTPDupdateMessageID(_id, _random_id)); } -inline MTPupdate MTP_updateReadMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadMessages(_messages, _pts, _pts_count)); -} inline MTPupdate MTP_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateDeleteMessages(_messages, _pts, _pts_count)); } @@ -21452,6 +22054,9 @@ inline MTPupdate MTP_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_i inline MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage) { return MTPupdate(new MTPDupdateWebPage(_webpage)); } +inline MTPupdate MTP_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateReadMessagesContents(_messages, _pts, _pts_count)); +} inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { } @@ -21942,7 +22547,7 @@ inline MTPconfig::MTPconfig() : mtpDataOwner(new MTPDconfig()) { inline uint32 MTPconfig::innerLength() const { const MTPDconfig &v(c_config()); - return v.vdate.innerLength() + v.vexpires.innerLength() + v.vtest_mode.innerLength() + v.vthis_dc.innerLength() + v.vdc_options.innerLength() + v.vchat_size_max.innerLength() + v.vbroadcast_size_max.innerLength() + v.vforwarded_count_max.innerLength() + v.vonline_update_period_ms.innerLength() + v.voffline_blur_timeout_ms.innerLength() + v.voffline_idle_timeout_ms.innerLength() + v.vonline_cloud_timeout_ms.innerLength() + v.vnotify_cloud_delay_ms.innerLength() + v.vnotify_default_delay_ms.innerLength() + v.vchat_big_size.innerLength() + v.vdisabled_features.innerLength(); + return v.vdate.innerLength() + v.vexpires.innerLength() + v.vtest_mode.innerLength() + v.vthis_dc.innerLength() + v.vdc_options.innerLength() + v.vchat_size_max.innerLength() + v.vbroadcast_size_max.innerLength() + v.vforwarded_count_max.innerLength() + v.vonline_update_period_ms.innerLength() + v.voffline_blur_timeout_ms.innerLength() + v.voffline_idle_timeout_ms.innerLength() + v.vonline_cloud_timeout_ms.innerLength() + v.vnotify_cloud_delay_ms.innerLength() + v.vnotify_default_delay_ms.innerLength() + v.vchat_big_size.innerLength() + v.vpush_chat_period_ms.innerLength() + v.vpush_chat_limit.innerLength() + v.vdisabled_features.innerLength(); } inline mtpTypeId MTPconfig::type() const { return mtpc_config; @@ -21967,6 +22572,8 @@ inline void MTPconfig::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vnotify_cloud_delay_ms.read(from, end); v.vnotify_default_delay_ms.read(from, end); v.vchat_big_size.read(from, end); + v.vpush_chat_period_ms.read(from, end); + v.vpush_chat_limit.read(from, end); v.vdisabled_features.read(from, end); } inline void MTPconfig::write(mtpBuffer &to) const { @@ -21986,12 +22593,14 @@ inline void MTPconfig::write(mtpBuffer &to) const { v.vnotify_cloud_delay_ms.write(to); v.vnotify_default_delay_ms.write(to); v.vchat_big_size.write(to); + v.vpush_chat_period_ms.write(to); + v.vpush_chat_limit.write(to); v.vdisabled_features.write(to); } inline MTPconfig::MTPconfig(MTPDconfig *_data) : mtpDataOwner(_data) { } -inline MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, const MTPVector &_disabled_features) { - return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _broadcast_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _disabled_features)); +inline MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _broadcast_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, const MTPVector &_disabled_features) { + return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _broadcast_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _disabled_features)); } inline MTPnearestDc::MTPnearestDc() : mtpDataOwner(new MTPDnearestDc()) { @@ -23268,6 +23877,24 @@ inline MTPnotifyPeer MTP_notifyAll() { } inline uint32 MTPsendMessageAction::innerLength() const { + switch (_type) { + case mtpc_sendMessageUploadVideoAction: { + const MTPDsendMessageUploadVideoAction &v(c_sendMessageUploadVideoAction()); + return v.vprogress.innerLength(); + } + case mtpc_sendMessageUploadAudioAction: { + const MTPDsendMessageUploadAudioAction &v(c_sendMessageUploadAudioAction()); + return v.vprogress.innerLength(); + } + case mtpc_sendMessageUploadPhotoAction: { + const MTPDsendMessageUploadPhotoAction &v(c_sendMessageUploadPhotoAction()); + return v.vprogress.innerLength(); + } + case mtpc_sendMessageUploadDocumentAction: { + const MTPDsendMessageUploadDocumentAction &v(c_sendMessageUploadDocumentAction()); + return v.vprogress.innerLength(); + } + } return 0; } inline mtpTypeId MTPsendMessageAction::type() const { @@ -23275,15 +23902,32 @@ inline mtpTypeId MTPsendMessageAction::type() const { return _type; } inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); switch (cons) { case mtpc_sendMessageTypingAction: _type = cons; break; case mtpc_sendMessageCancelAction: _type = cons; break; case mtpc_sendMessageRecordVideoAction: _type = cons; break; - case mtpc_sendMessageUploadVideoAction: _type = cons; break; + case mtpc_sendMessageUploadVideoAction: _type = cons; { + if (!data) setData(new MTPDsendMessageUploadVideoAction()); + MTPDsendMessageUploadVideoAction &v(_sendMessageUploadVideoAction()); + v.vprogress.read(from, end); + } break; case mtpc_sendMessageRecordAudioAction: _type = cons; break; - case mtpc_sendMessageUploadAudioAction: _type = cons; break; - case mtpc_sendMessageUploadPhotoAction: _type = cons; break; - case mtpc_sendMessageUploadDocumentAction: _type = cons; break; + case mtpc_sendMessageUploadAudioAction: _type = cons; { + if (!data) setData(new MTPDsendMessageUploadAudioAction()); + MTPDsendMessageUploadAudioAction &v(_sendMessageUploadAudioAction()); + v.vprogress.read(from, end); + } break; + case mtpc_sendMessageUploadPhotoAction: _type = cons; { + if (!data) setData(new MTPDsendMessageUploadPhotoAction()); + MTPDsendMessageUploadPhotoAction &v(_sendMessageUploadPhotoAction()); + v.vprogress.read(from, end); + } break; + case mtpc_sendMessageUploadDocumentAction: _type = cons; { + if (!data) setData(new MTPDsendMessageUploadDocumentAction()); + MTPDsendMessageUploadDocumentAction &v(_sendMessageUploadDocumentAction()); + v.vprogress.read(from, end); + } break; case mtpc_sendMessageGeoLocationAction: _type = cons; break; case mtpc_sendMessageChooseContactAction: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPsendMessageAction"); @@ -23291,23 +23935,47 @@ inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *en } inline void MTPsendMessageAction::write(mtpBuffer &to) const { switch (_type) { + case mtpc_sendMessageUploadVideoAction: { + const MTPDsendMessageUploadVideoAction &v(c_sendMessageUploadVideoAction()); + v.vprogress.write(to); + } break; + case mtpc_sendMessageUploadAudioAction: { + const MTPDsendMessageUploadAudioAction &v(c_sendMessageUploadAudioAction()); + v.vprogress.write(to); + } break; + case mtpc_sendMessageUploadPhotoAction: { + const MTPDsendMessageUploadPhotoAction &v(c_sendMessageUploadPhotoAction()); + v.vprogress.write(to); + } break; + case mtpc_sendMessageUploadDocumentAction: { + const MTPDsendMessageUploadDocumentAction &v(c_sendMessageUploadDocumentAction()); + v.vprogress.write(to); + } break; } } -inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : _type(type) { +inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { switch (type) { case mtpc_sendMessageTypingAction: break; case mtpc_sendMessageCancelAction: break; case mtpc_sendMessageRecordVideoAction: break; - case mtpc_sendMessageUploadVideoAction: break; + case mtpc_sendMessageUploadVideoAction: setData(new MTPDsendMessageUploadVideoAction()); break; case mtpc_sendMessageRecordAudioAction: break; - case mtpc_sendMessageUploadAudioAction: break; - case mtpc_sendMessageUploadPhotoAction: break; - case mtpc_sendMessageUploadDocumentAction: break; + case mtpc_sendMessageUploadAudioAction: setData(new MTPDsendMessageUploadAudioAction()); break; + case mtpc_sendMessageUploadPhotoAction: setData(new MTPDsendMessageUploadPhotoAction()); break; + case mtpc_sendMessageUploadDocumentAction: setData(new MTPDsendMessageUploadDocumentAction()); break; case mtpc_sendMessageGeoLocationAction: break; case mtpc_sendMessageChooseContactAction: break; default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction"); } } +inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadVideoAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadVideoAction) { +} +inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadAudioAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadAudioAction) { +} +inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadPhotoAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadPhotoAction) { +} +inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadDocumentAction) { +} inline MTPsendMessageAction MTP_sendMessageTypingAction() { return MTPsendMessageAction(mtpc_sendMessageTypingAction); } @@ -23317,20 +23985,20 @@ inline MTPsendMessageAction MTP_sendMessageCancelAction() { inline MTPsendMessageAction MTP_sendMessageRecordVideoAction() { return MTPsendMessageAction(mtpc_sendMessageRecordVideoAction); } -inline MTPsendMessageAction MTP_sendMessageUploadVideoAction() { - return MTPsendMessageAction(mtpc_sendMessageUploadVideoAction); +inline MTPsendMessageAction MTP_sendMessageUploadVideoAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadVideoAction(_progress)); } inline MTPsendMessageAction MTP_sendMessageRecordAudioAction() { return MTPsendMessageAction(mtpc_sendMessageRecordAudioAction); } -inline MTPsendMessageAction MTP_sendMessageUploadAudioAction() { - return MTPsendMessageAction(mtpc_sendMessageUploadAudioAction); +inline MTPsendMessageAction MTP_sendMessageUploadAudioAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadAudioAction(_progress)); } -inline MTPsendMessageAction MTP_sendMessageUploadPhotoAction() { - return MTPsendMessageAction(mtpc_sendMessageUploadPhotoAction); +inline MTPsendMessageAction MTP_sendMessageUploadPhotoAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadPhotoAction(_progress)); } -inline MTPsendMessageAction MTP_sendMessageUploadDocumentAction() { - return MTPsendMessageAction(mtpc_sendMessageUploadDocumentAction); +inline MTPsendMessageAction MTP_sendMessageUploadDocumentAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadDocumentAction(_progress)); } inline MTPsendMessageAction MTP_sendMessageGeoLocationAction() { return MTPsendMessageAction(mtpc_sendMessageGeoLocationAction); @@ -24390,6 +25058,147 @@ inline MTPauth_passwordRecovery MTP_auth_passwordRecovery(const MTPstring &_emai return MTPauth_passwordRecovery(new MTPDauth_passwordRecovery(_email_pattern)); } +inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage() : mtpDataOwner(new MTPDreceivedNotifyMessage()) { +} + +inline uint32 MTPreceivedNotifyMessage::innerLength() const { + const MTPDreceivedNotifyMessage &v(c_receivedNotifyMessage()); + return v.vid.innerLength() + v.vflags.innerLength(); +} +inline mtpTypeId MTPreceivedNotifyMessage::type() const { + return mtpc_receivedNotifyMessage; +} +inline void MTPreceivedNotifyMessage::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != mtpc_receivedNotifyMessage) throw mtpErrorUnexpected(cons, "MTPreceivedNotifyMessage"); + + if (!data) setData(new MTPDreceivedNotifyMessage()); + MTPDreceivedNotifyMessage &v(_receivedNotifyMessage()); + v.vid.read(from, end); + v.vflags.read(from, end); +} +inline void MTPreceivedNotifyMessage::write(mtpBuffer &to) const { + const MTPDreceivedNotifyMessage &v(c_receivedNotifyMessage()); + v.vid.write(to); + v.vflags.write(to); +} +inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data) : mtpDataOwner(_data) { +} +inline MTPreceivedNotifyMessage MTP_receivedNotifyMessage(MTPint _id, MTPint _flags) { + return MTPreceivedNotifyMessage(new MTPDreceivedNotifyMessage(_id, _flags)); +} + +inline uint32 MTPexportedChatInvite::innerLength() const { + switch (_type) { + case mtpc_chatInviteExported: { + const MTPDchatInviteExported &v(c_chatInviteExported()); + return v.vlink.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPexportedChatInvite::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPexportedChatInvite::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_chatInviteEmpty: _type = cons; break; + case mtpc_chatInviteExported: _type = cons; { + if (!data) setData(new MTPDchatInviteExported()); + MTPDchatInviteExported &v(_chatInviteExported()); + v.vlink.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPexportedChatInvite"); + } +} +inline void MTPexportedChatInvite::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_chatInviteExported: { + const MTPDchatInviteExported &v(c_chatInviteExported()); + v.vlink.write(to); + } break; + } +} +inline MTPexportedChatInvite::MTPexportedChatInvite(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_chatInviteEmpty: break; + case mtpc_chatInviteExported: setData(new MTPDchatInviteExported()); break; + default: throw mtpErrorBadTypeId(type, "MTPexportedChatInvite"); + } +} +inline MTPexportedChatInvite::MTPexportedChatInvite(MTPDchatInviteExported *_data) : mtpDataOwner(_data), _type(mtpc_chatInviteExported) { +} +inline MTPexportedChatInvite MTP_chatInviteEmpty() { + return MTPexportedChatInvite(mtpc_chatInviteEmpty); +} +inline MTPexportedChatInvite MTP_chatInviteExported(const MTPstring &_link) { + return MTPexportedChatInvite(new MTPDchatInviteExported(_link)); +} + +inline uint32 MTPchatInvite::innerLength() const { + switch (_type) { + case mtpc_chatInviteAlready: { + const MTPDchatInviteAlready &v(c_chatInviteAlready()); + return v.vchat.innerLength(); + } + case mtpc_chatInvite: { + const MTPDchatInvite &v(c_chatInvite()); + return v.vtitle.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPchatInvite::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPchatInvite::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_chatInviteAlready: _type = cons; { + if (!data) setData(new MTPDchatInviteAlready()); + MTPDchatInviteAlready &v(_chatInviteAlready()); + v.vchat.read(from, end); + } break; + case mtpc_chatInvite: _type = cons; { + if (!data) setData(new MTPDchatInvite()); + MTPDchatInvite &v(_chatInvite()); + v.vtitle.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPchatInvite"); + } +} +inline void MTPchatInvite::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_chatInviteAlready: { + const MTPDchatInviteAlready &v(c_chatInviteAlready()); + v.vchat.write(to); + } break; + case mtpc_chatInvite: { + const MTPDchatInvite &v(c_chatInvite()); + v.vtitle.write(to); + } break; + } +} +inline MTPchatInvite::MTPchatInvite(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_chatInviteAlready: setData(new MTPDchatInviteAlready()); break; + case mtpc_chatInvite: setData(new MTPDchatInvite()); break; + default: throw mtpErrorBadTypeId(type, "MTPchatInvite"); + } +} +inline MTPchatInvite::MTPchatInvite(MTPDchatInviteAlready *_data) : mtpDataOwner(_data), _type(mtpc_chatInviteAlready) { +} +inline MTPchatInvite::MTPchatInvite(MTPDchatInvite *_data) : mtpDataOwner(_data), _type(mtpc_chatInvite) { +} +inline MTPchatInvite MTP_chatInviteAlready(const MTPChat &_chat) { + return MTPchatInvite(new MTPDchatInviteAlready(_chat)); +} +inline MTPchatInvite MTP_chatInvite(const MTPstring &_title) { + return MTPchatInvite(new MTPDchatInvite(_title)); +} + // Human-readable text serialization #if (defined _DEBUG || defined _WITH_DEBUG) diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 0ddd39ee6..e49beffd9 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -146,13 +146,13 @@ inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_na inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; -inputMediaUploadedPhoto#2dc53a7d file:InputFile = InputMedia; -inputMediaPhoto#8f2ab2ec id:InputPhoto = InputMedia; +inputMediaUploadedPhoto#f7aff1c0 file:InputFile caption:string = InputMedia; +inputMediaPhoto#e9bfb4f3 id:InputPhoto caption:string = InputMedia; inputMediaGeoPoint#f9c44144 geo_point:InputGeoPoint = InputMedia; inputMediaContact#a6e45987 phone_number:string first_name:string last_name:string = InputMedia; -inputMediaUploadedVideo#133ad6f6 file:InputFile duration:int w:int h:int mime_type:string = InputMedia; -inputMediaUploadedThumbVideo#9912dabf file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string = InputMedia; -inputMediaVideo#7f023ae6 id:InputVideo = InputMedia; +inputMediaUploadedVideo#e13fd4bc file:InputFile duration:int w:int h:int caption:string = InputMedia; +inputMediaUploadedThumbVideo#96fb97dc file:InputFile thumb:InputFile duration:int w:int h:int caption:string = InputMedia; +inputMediaVideo#936a4ebd id:InputVideo caption:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#94254732 file:InputFile crop:InputPhotoCrop = InputChatPhoto; @@ -210,7 +210,7 @@ chatEmpty#9ba2d800 id:int = Chat; chat#6e9c9bc7 id:int title:string photo:ChatPhoto participants_count:int date:int left:Bool version:int = Chat; chatForbidden#fb0ccc41 id:int title:string date:int = Chat; -chatFull#630e61be id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings = ChatFull; +chatFull#cade0791 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; @@ -225,8 +225,8 @@ message#a7ab1991 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int f messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; -messageMediaPhoto#c8c45a2a photo:Photo = MessageMedia; -messageMediaVideo#a2d24290 video:Video = MessageMedia; +messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; +messageMediaVideo#5bcf1675 video:Video caption:string = MessageMedia; messageMediaGeo#56e0d474 geo:GeoPoint = MessageMedia; messageMediaContact#5e7d2f39 phone_number:string first_name:string last_name:string user_id:int = MessageMedia; messageMediaUnsupported#9f84f49e = MessageMedia; @@ -242,14 +242,14 @@ messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog; photoEmpty#2331b22d id:long = Photo; -photo#22b56751 id:long access_hash:long user_id:int date:int caption:string geo:GeoPoint sizes:Vector = Photo; +photo#c3838076 id:long access_hash:long user_id:int date:int geo:GeoPoint sizes:Vector = Photo; photoSizeEmpty#e17e23c type:string = PhotoSize; photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize; photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize; videoEmpty#c10658a8 id:long = Video; -video#388fa391 id:long access_hash:long user_id:int date:int caption:string duration:int mime_type:string size:int thumb:PhotoSize dc_id:int w:int h:int = Video; +video#ee9f4a4d id:long access_hash:long user_id:int date:int duration:int size:int thumb:PhotoSize dc_id:int w:int h:int = Video; geoPointEmpty#1117dd5f = GeoPoint; geoPoint#2049d70c long:double lat:double = GeoPoint; @@ -332,7 +332,6 @@ inputMessagesFilterAudio#cfc87522 = MessagesFilter; updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update; updateMessageID#4e90bfd6 id:int random_id:long = Update; -updateReadMessages#2e5ab668 messages:Vector pts:int pts_count:int = Update; updateDeleteMessages#a20db0e5 messages:Vector pts:int pts_count:int = Update; updateUserTyping#5c486927 user_id:int action:SendMessageAction = Update; updateChatUserTyping#9a65ea1f chat_id:int user_id:int action:SendMessageAction = Update; @@ -366,7 +365,7 @@ upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; dcOption#2ec2a43c id:int hostname:string ip_address:string port:int = DcOption; -config#68bac247 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int disabled_features:Vector = Config; +config#4e32b894 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int broadcast_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -479,11 +478,11 @@ auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; -sendMessageUploadVideoAction#92042ff7 = SendMessageAction; +sendMessageUploadVideoAction#e9763aec progress:int = SendMessageAction; sendMessageRecordAudioAction#d52f73f7 = SendMessageAction; -sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction; -sendMessageUploadPhotoAction#990a3c1a = SendMessageAction; -sendMessageUploadDocumentAction#8faee98e = SendMessageAction; +sendMessageUploadAudioAction#f351d7ab progress:int = SendMessageAction; +sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; +sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; @@ -573,6 +572,22 @@ account.passwordInputSettings#bcfc532c flags:# new_salt:flags.0?bytes new_passwo auth.passwordRecovery#137948a5 email_pattern:string = auth.PasswordRecovery; +inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; + +messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; + +receivedNotifyMessage#a384b779 id:int flags:int = ReceivedNotifyMessage; + +chatInviteEmpty#69df3769 = ExportedChatInvite; +chatInviteExported#fc2e05bc link:string = ExportedChatInvite; + +chatInviteAlready#5a686d7c chat:Chat = ChatInvite; +chatInvite#ce917dcd title:string = ChatInvite; + +messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; + +updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -622,7 +637,7 @@ messages.search#7e9f2ab peer:InputPeer q:string filter:MessagesFilter min_date:i messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory; messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory; messages.deleteMessages#a5f18925 id:Vector = messages.AffectedMessages; -messages.receivedMessages#28abcb68 max_id:int = Vector; +messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#9add8f26 flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long = messages.SentMessage; messages.sendMedia#2d7923b1 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long = Updates; @@ -723,4 +738,10 @@ account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; -auth.recoverPassword#4ea56e92 code:string = auth.Authorization; \ No newline at end of file +auth.recoverPassword#4ea56e92 code:string = auth.Authorization; + +invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; + +messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; +messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; +messages.importChatInvite#6c50051c hash:string = Updates; \ No newline at end of file diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 4c1789428..8386148a9 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -40,6 +40,8 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee _sendMessage(this, lang(lng_profile_send_message), st::btnShareContact), _shareContact(this, lang(lng_profile_share_contact), st::btnShareContact), _cancelPhoto(this, lang(lng_cancel)), + _createInvitationLink(this, lang(lng_group_invite_create)), + _invitationLink(this, qsl("telegram.me/joinchat/")), a_photo(0), _photoOver(false), @@ -62,18 +64,20 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee _selectedRow(-1), _lastPreload(0), _contactId(0), _kickOver(0), _kickDown(0), _kickConfirm(0), - _loadingId(0), _menu(0) { + _menu(0) { + + connect(App::api(), SIGNAL(fullPeerLoaded(PeerData*)), this, SLOT(onFullPeerLoaded(PeerData*))); if (_peerUser) { _phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone); - _loadingId = MTP::send(MTPusers_GetFullUser(_peerUser->inputUser), rpcDone(&ProfileInner::gotFullUser)); + App::api()->requestFullPeer(_peer); } else if (_peerChat->photoId) { PhotoData *ph = App::photo(_peerChat->photoId); if (ph->date) { _photoLink = TextLinkPtr(new PhotoLink(ph, _peer)); } } else { - _loadingId = MTP::send(MTPmessages_GetFullChat(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::gotFullChat)); + App::api()->requestFullPeer(_peer); } // profile @@ -84,6 +88,10 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee connect(&_sendMessage, SIGNAL(clicked()), this, SLOT(onSendMessage())); connect(&_shareContact, SIGNAL(clicked()), this, SLOT(onShareContact())); connect(&_cancelPhoto, SIGNAL(clicked()), this, SLOT(onUpdatePhotoCancel())); + connect(&_createInvitationLink, SIGNAL(clicked()), this, SLOT(onCreateInvitationLink())); + connect(&_invitationLink, SIGNAL(clicked()), this, SLOT(onInvitationLink())); + _invitationLink.setAcceptBoth(true); + updateInvitationLink(); connect(App::app(), SIGNAL(peerPhotoDone(PeerId)), this, SLOT(onPhotoUpdateDone(PeerId))); connect(App::app(), SIGNAL(peerPhotoFail(PeerId)), this, SLOT(onPhotoUpdateFail(PeerId))); @@ -247,38 +255,43 @@ void ProfileInner::onMediaAudios() { App::main()->showMediaOverview(_peer, OverviewAudios); } -void ProfileInner::gotFullUser(const MTPUserFull &user) { - _loadingId = 0; - const MTPDuserFull &d(user.c_userFull()); - App::feedPhoto(d.vprofile_photo); - App::feedUsers(MTP_vector(1, d.vuser)); - PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0; - if (userPhoto && userPhoto->date) { - _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer)); - } else { - _photoLink = TextLinkPtr(); - } - App::main()->gotNotifySetting(MTP_inputNotifyPeer(_peer->input), d.vnotify_settings); - App::feedUserLink(MTP_int(_peerUser->id), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link); +void ProfileInner::onInvitationLink() { + QApplication::clipboard()->setText(_peerChat->invitationUrl); + App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_copied), true)); } -void ProfileInner::gotFullChat(const MTPmessages_ChatFull &res) { - _loadingId = 0; - const MTPDmessages_chatFull &d(res.c_messages_chatFull()); - PeerId peerId = App::peerFromChat(d.vfull_chat.c_chatFull().vid); - App::feedUsers(d.vusers); - App::feedChats(d.vchats); - App::feedParticipants(d.vfull_chat.c_chatFull().vparticipants); - App::main()->gotNotifySetting(MTP_inputNotifyPeer(_peer->input), d.vfull_chat.c_chatFull().vnotify_settings); - PhotoData *photo = App::feedPhoto(d.vfull_chat.c_chatFull().vchat_photo); - if (photo) { - ChatData *chat = App::peer(peerId)->asChat(); - if (chat) { - chat->photoId = photo->id; - photo->chat = chat; +void ProfileInner::onCreateInvitationLink() { + ConfirmBox *box = new ConfirmBox(lang(_peerChat->invitationUrl.isEmpty() ? lng_group_invite_about : lng_group_invite_about_new)); + connect(box, SIGNAL(confirmed()), this, SLOT(onCreateInvitationLinkSure())); + App::wnd()->showLayer(box); +} + +void ProfileInner::onCreateInvitationLinkSure() { + MTP::send(MTPmessages_ExportChatInvite(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::chatInviteDone)); +} + +void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) { + _peerChat->invitationUrl = (result.type() == mtpc_chatInviteExported) ? qs(result.c_chatInviteExported().vlink) : QString(); + updateInvitationLink(); + showAll(); + resizeEvent(0); + App::wnd()->hideLayer(); +} + +void ProfileInner::onFullPeerLoaded(PeerData *peer) { + if (peer != _peer) return; + if (_peerUser) { + PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0; + if (userPhoto && userPhoto->date) { + _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer)); + } else { + _photoLink = TextLinkPtr(); } + } else if (_peerChat) { + updateInvitationLink(); + showAll(); + resizeEvent(0); } - emit App::main()->peerUpdated(_peer); } void ProfileInner::peerUpdated(PeerData *data) { @@ -356,8 +369,8 @@ void ProfileInner::reorderParticipants() { ++onlineCount; } } - if (_peerChat->count > 0 && _participants.isEmpty() && !_loadingId) { - _loadingId = MTP::send(MTPmessages_GetFullChat(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::gotFullChat)); + if (_peerChat->count > 0 && _participants.isEmpty()) { + App::api()->requestFullPeer(_peer); if (_onlineText.isEmpty()) _onlineText = lng_chat_status_members(lt_count, _peerChat->count); } else if (onlineCount && !onlyMe) { _onlineText = lng_chat_status_members_online(lt_count, _participants.size(), lt_count_online, onlineCount); @@ -420,7 +433,12 @@ void ProfileInner::paintEvent(QPaintEvent *e) { } p.setPen((_peerUser && App::onlineColorUse(_peerUser->onlineTill, l_time) ? st::profileOnlineColor : st::profileOfflineColor)->p); p.drawText(_left + st::profilePhotoSize + st::profileStatusLeft, top + addbyname + st::profileStatusTop + st::linkFont->ascent, _onlineText); + if (_chatAdmin && !_peerChat->invitationUrl.isEmpty()) { + p.setPen(st::black->p); + p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _createInvitationLink.y() + st::linkFont->ascent, lang(lng_group_invite_link)); + } if (!_cancelPhoto.isHidden()) { + p.setPen(st::profileOfflineColor->p); p.drawText(_left + st::profilePhotoSize + st::profilePhoneLeft, _cancelPhoto.y() + addbyname + st::linkFont->ascent, lang(lng_settings_uploading_photo)); } @@ -665,7 +683,20 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { // profile top += st::profilePadding.top(); - _cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhoneTop); + if (_chatAdmin) { + if (_peerChat->invitationUrl.isEmpty()) { + _createInvitationLink.move(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop); + } else { + _createInvitationLink.move(_left + _width - _createInvitationLink.width(), top + st::profilePhoneTop); + } + if (!_invitationText.isEmpty()) { + _invitationLink.setText(st::linkFont->m.elidedText(_invitationText, Qt::ElideRight, _width - st::profilePhotoSize - st::profilePhoneLeft)); + } + _invitationLink.move(_left + st::profilePhotoSize + st::profilePhoneLeft, top + st::profilePhoneTop + st::linkFont->height * 1.2); + _cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhotoSize - st::linkFont->height); + } else { + _cancelPhoto.move(_left + _width - _cancelPhoto.width(), top + st::profilePhoneTop); + } top += st::profilePhotoSize; top += st::profileButtonTop; @@ -799,6 +830,8 @@ void ProfileInner::showAll() { _uploadPhoto.hide(); _cancelPhoto.hide(); _addParticipant.hide(); + _createInvitationLink.hide(); + _invitationLink.hide(); } else { if (App::app()->isPhotoUpdating(_peer->id)) { _uploadPhoto.hide(); @@ -807,6 +840,17 @@ void ProfileInner::showAll() { _uploadPhoto.show(); _cancelPhoto.hide(); } + if (_chatAdmin) { + _createInvitationLink.show(); + if (_peerChat->invitationUrl.isEmpty()) { + _invitationLink.hide(); + } else { + _invitationLink.show(); + } + } else { + _createInvitationLink.hide(); + _invitationLink.hide(); + } if (_peerChat->count < cMaxGroupCount()) { _addParticipant.show(); } else { @@ -819,6 +863,8 @@ void ProfileInner::showAll() { _uploadPhoto.hide(); _cancelPhoto.hide(); _addParticipant.hide(); + _createInvitationLink.hide(); + _invitationLink.hide(); _sendMessage.show(); if (_peerUser->phone.isEmpty()) { _shareContact.hide(); @@ -880,6 +926,21 @@ void ProfileInner::showAll() { resize(width(), h); } +void ProfileInner::updateInvitationLink() { + if (!_peerChat) return; + if (_peerChat->invitationUrl.isEmpty()) { + _createInvitationLink.setText(lang(lng_group_invite_create)); + } else { + _createInvitationLink.setText(lang(lng_group_invite_create_new)); + _invitationText = _peerChat->invitationUrl; + if (_invitationText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive)) { + _invitationText = _invitationText.mid(7); + } else if (_invitationText.startsWith(QLatin1String("https://"), Qt::CaseInsensitive)) { + _invitationText = _invitationText.mid(8); + } + } +} + QString ProfileInner::overviewLinkText(int32 type, int32 count) { switch (type) { case OverviewPhotos: return lng_profile_photos(lt_count, count); diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index ee96bafe5..915934416 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -42,9 +42,6 @@ public: PeerData *peer() const; bool allMediaShown() const; - void gotFullUser(const MTPUserFull &user); - void gotFullChat(const MTPmessages_ChatFull &res); - void updateOnlineDisplay(); void updateOnlineDisplayTimer(); void reorderParticipants(); @@ -93,9 +90,18 @@ public slots: void onCopyPhone(); void onCopyUsername(); + void onInvitationLink(); + void onCreateInvitationLink(); + void onCreateInvitationLinkSure(); + + void onFullPeerLoaded(PeerData *peer); + private: void showAll(); + void updateInvitationLink(); + + void chatInviteDone(const MTPExportedChatInvite &result); ProfileWidget *_profile; ScrollArea *_scroll; @@ -115,7 +121,8 @@ private: TextLinkPtr _photoLink; FlatButton _uploadPhoto, _addParticipant; FlatButton _sendMessage, _shareContact; - LinkButton _cancelPhoto; + LinkButton _cancelPhoto, _createInvitationLink, _invitationLink; + QString _invitationText; anim::fvalue a_photo; bool _photoOver; @@ -148,8 +155,6 @@ private: typedef QVector ParticipantsData; ParticipantsData _participantsData; - mtpRequestId _loadingId; - QPoint _lastPos; QString _onlineText; diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index cdcf7b5d4..751f0e1f5 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -294,6 +294,7 @@ void VideoOpenLink::onClick(Qt::MouseButton button) const { QString already = data->already(true); if (!already.isEmpty()) { psOpenFile(already); + if (App::main()) App::main()->videoMarkRead(data); return; } @@ -381,9 +382,11 @@ void AudioOpenLink::onClick(Qt::MouseButton button) const { audioVoice()->pauseresume(); } else { audioVoice()->play(data); + if (App::main()) App::main()->audioMarkRead(data); } } else { psOpenFile(already); + if (App::main()) App::main()->audioMarkRead(data); } return; } diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 8ba6657a9..7fe568711 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -40,11 +40,16 @@ static const NotifySettingsPtr EmptyNotifySettings = NotifySettingsPtr(1); extern NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; extern NotifySettingsPtr globalNotifyAllPtr, globalNotifyUsersPtr, globalNotifyChatsPtr; -inline bool isNotifyMuted(NotifySettingsPtr settings) { - if (settings == UnknownNotifySettings || settings == EmptyNotifySettings) { - return false; +inline bool isNotifyMuted(NotifySettingsPtr settings, int32 *changeIn = 0) { + if (settings != UnknownNotifySettings && settings != EmptyNotifySettings) { + int32 t = unixtime(); + if (settings->mute > t) { + if (changeIn) *changeIn = settings->mute - t + 1; + return true; + } } - return (settings->mute > unixtime()); + if (changeIn) *changeIn = 0; + return false; } style::color peerColor(int32 index); @@ -155,6 +160,7 @@ struct ChatData : public PeerData { LastAuthors lastAuthors; ImagePtr photoFull; PhotoId photoId; + QString invitationUrl; // geo }; diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 3589dc1dc..b02cad3b0 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.8.7 + 0.8.8 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index 1bd38866b0b6e0d6ceb6c2e378a20c7eddef7d41..d05fb6f44eea46e0f5fd293c7aad094fb35ea0f2 100644 GIT binary patch delta 50 zcmbQEJx6;(0WYJ)