diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index a0fe57772..172ad12e8 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -38,7 +38,7 @@ void ApiWrap::init() { void ApiWrap::itemRemoved(HistoryItem *item) { if (HistoryReply *reply = item->toHistoryReply()) { - ReplyToRequests::iterator i = _replyToRequests.find(reply->replyToId()); + ReplyToRequests::iterator i = _replyToRequests.find(FullMsgId(reply->channelId(), reply->replyToId())); if (i != _replyToRequests.cend()) { for (QList::iterator j = i->replies.begin(); j != i->replies.end();) { if ((*j) == reply) { @@ -56,7 +56,7 @@ void ApiWrap::itemRemoved(HistoryItem *item) { void ApiWrap::itemReplaced(HistoryItem *oldItem, HistoryItem *newItem) { if (HistoryReply *reply = oldItem->toHistoryReply()) { - ReplyToRequests::iterator i = _replyToRequests.find(reply->replyToId()); + ReplyToRequests::iterator i = _replyToRequests.find(FullMsgId(reply->channelId(), reply->replyToId())); if (i != _replyToRequests.cend()) { for (QList::iterator j = i->replies.begin(); j != i->replies.end();) { if ((*j) == reply) { @@ -77,7 +77,7 @@ void ApiWrap::itemReplaced(HistoryItem *oldItem, HistoryItem *newItem) { } } -void ApiWrap::requestReplyTo(HistoryReply *reply, MsgId to) { +void ApiWrap::requestReplyTo(HistoryReply *reply, const FullMsgId &to) { ReplyToRequest &req(_replyToRequests[to]); req.replies.append(reply); if (!req.req) _replyToTimer.start(1); @@ -90,7 +90,7 @@ void ApiWrap::resolveReplyTo() { ids.reserve(_replyToRequests.size()); for (ReplyToRequests::const_iterator i = _replyToRequests.cbegin(), e = _replyToRequests.cend(); i != e; ++i) { if (!i.value().req) { - ids.push_back(MTP_int(i.key())); + ids.push_back(MTP_int(i.key().msg)); // CHANNELS_TODO } } if (!ids.isEmpty()) { @@ -134,56 +134,88 @@ void ApiWrap::gotReplyTo(const MTPmessages_Messages &msgs, mtpRequestId req) { void ApiWrap::requestFullPeer(PeerData *peer) { if (!peer || _fullPeerRequests.contains(peer)) return; - mtpRequestId req; - if (peer->chat) { - req = MTP::send(MTPmessages_GetFullChat(MTP_int(App::chatFromPeer(peer->id))), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); - } else { + mtpRequestId req = 0; + if (peer->isUser()) { req = MTP::send(MTPusers_GetFullUser(peer->asUser()->inputUser), rpcDone(&ApiWrap::gotUserFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); + } else if (peer->isChat()) { + req = MTP::send(MTPmessages_GetFullChat(peer->asChat()->inputChat), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); + } else if (peer->isChannel()) { + req = MTP::send(MTPmessages_GetFullChat(peer->asChannel()->inputChat), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFullFailed, peer)); } - _fullPeerRequests.insert(peer, req); + if (req) _fullPeerRequests.insert(peer, req); } 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()); - const QVector &vc(d.vchats.c_vector().v); - bool badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version); + bool badVersion = false; + if (peer->isChat()) { + badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_chat && vc.at(0).c_chat().vversion.v < peer->asChat()->version); + } else if (peer->isChannel()) { + badVersion = (!vc.isEmpty() && vc.at(0).type() == mtpc_channel && vc.at(0).c_channel().vversion.v < peer->asChannel()->version); + } App::feedUsers(d.vusers, false); App::feedChats(d.vchats, false); - App::feedParticipants(f.vparticipants, false, false); - const QVector &v(f.vbot_info.c_vector().v); - for (QVector::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) { - switch (i->type()) { - case mtpc_botInfo: { - const MTPDbotInfo &b(i->c_botInfo()); - UserData *user = App::userLoaded(b.vuser_id.v); - if (user) { - user->setBotInfo(*i); - App::clearPeerUpdated(user); - emit fullPeerUpdated(user); - } - } break; + + if (peer->isChat()) { + if (d.vfull_chat.type() != mtpc_chatFull) { + LOG(("MTP Error: bad type in gotChatFull for chat: %1").arg(d.vfull_chat.type())); + return; } - } - PhotoData *photo = App::feedPhoto(f.vchat_photo); - ChatData *chat = peer->asChat(); - if (chat) { + const MTPDchatFull &f(d.vfull_chat.c_chatFull()); + App::feedParticipants(f.vparticipants, false, false); + const QVector &v(f.vbot_info.c_vector().v); + for (QVector::const_iterator i = v.cbegin(), e = v.cend(); i < e; ++i) { + switch (i->type()) { + case mtpc_botInfo: { + const MTPDbotInfo &b(i->c_botInfo()); + UserData *user = App::userLoaded(b.vuser_id.v); + if (user) { + user->setBotInfo(*i); + App::clearPeerUpdated(user); + emit fullPeerUpdated(user); + } + } break; + } + } + PhotoData *photo = App::feedPhoto(f.vchat_photo); + ChatData *chat = peer->asChat(); if (photo) { chat->photoId = photo->id; - photo->chat = chat; + photo->peer = chat; } else { chat->photoId = 0; } chat->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString(); - } - App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings); + App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings); + } else if (peer->isChannel()) { + if (d.vfull_chat.type() != mtpc_channelFull) { + LOG(("MTP Error: bad type in gotChatFull for channel: %1").arg(d.vfull_chat.type())); + return; + } + const MTPDchannelFull &f(d.vfull_chat.c_channelFull()); + PhotoData *photo = App::feedPhoto(f.vchat_photo); + ChannelData *channel = peer->asChannel(); + if (photo) { + channel->photoId = photo->id; + photo->peer = channel; + } else { + channel->photoId = 0; + } + channel->invitationUrl = (f.vexported_invite.type() == mtpc_chatInviteExported) ? qs(f.vexported_invite.c_chatInviteExported().vlink) : QString(); + + App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), f.vnotify_settings); + } _fullPeerRequests.remove(peer); if (badVersion) { - peer->asChat()->version = vc.at(0).c_chat().vversion.v; + if (peer->isChat()) { + peer->asChat()->version = vc.at(0).c_chat().vversion.v; + } else if (peer->isChannel()) { + peer->asChannel()->version = vc.at(0).c_channel().vversion.v; + } requestPeer(peer); } App::clearPeerUpdated(peer); @@ -195,7 +227,7 @@ void ApiWrap::gotUserFull(PeerData *peer, const MTPUserFull &result) { const MTPDuserFull &d(result.c_userFull()); App::feedUsers(MTP_vector(1, d.vuser), false); 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, false); + App::feedUserLink(MTP_int(peerToUser(peer->id)), d.vlink.c_contacts_link().vmy_link, d.vlink.c_contacts_link().vforeign_link, false); App::main()->gotNotifySetting(MTP_inputNotifyPeer(peer->input), d.vnotify_settings); peer->asUser()->setBotInfo(d.vbot_info); @@ -217,29 +249,33 @@ bool ApiWrap::gotPeerFullFailed(PeerData *peer, const RPCError &error) { void ApiWrap::requestPeer(PeerData *peer) { if (!peer || _fullPeerRequests.contains(peer) || _peerRequests.contains(peer)) return; - mtpRequestId req; - if (peer->chat) { - req = MTP::send(MTPmessages_GetChats(MTP_vector(1, MTP_int(App::chatFromPeer(peer->id)))), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); - } else { + mtpRequestId req = 0; + if (peer->isUser()) { req = MTP::send(MTPusers_GetUsers(MTP_vector(1, peer->asUser()->inputUser)), rpcDone(&ApiWrap::gotUser, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); + } else if (peer->isChat()) { + req = MTP::send(MTPmessages_GetChats(MTP_vector(1, peer->asChat()->inputChat)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); + } else if (peer->isChannel()) { + req = MTP::send(MTPmessages_GetChats(MTP_vector(1, peer->asChannel()->inputChat)), rpcDone(&ApiWrap::gotChat, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); } - _peerRequests.insert(peer, req); + if (req) _peerRequests.insert(peer, req); } void ApiWrap::requestPeers(const QList &peers) { - QVector chats; + QVector chats; QVector users; chats.reserve(peers.size()); users.reserve(peers.size()); for (QList::const_iterator i = peers.cbegin(), e = peers.cend(); i != e; ++i) { if (!*i || _fullPeerRequests.contains(*i) || _peerRequests.contains(*i)) continue; - if ((*i)->chat) { - chats.push_back(MTP_int(App::chatFromPeer((*i)->id))); - } else { + if ((*i)->isUser()) { users.push_back((*i)->asUser()->inputUser); + } else if ((*i)->isChat()) { + chats.push_back((*i)->asChat()->inputChat); + } else if ((*i)->isChannel()) { + chats.push_back((*i)->asChannel()->inputChat); } } - if (!chats.isEmpty()) MTP::send(MTPmessages_GetChats(MTP_vector(chats)), rpcDone(&ApiWrap::gotChats)); + if (!chats.isEmpty()) MTP::send(MTPmessages_GetChats(MTP_vector(chats)), rpcDone(&ApiWrap::gotChats)); if (!users.isEmpty()) MTP::send(MTPusers_GetUsers(MTP_vector(users)), rpcDone(&ApiWrap::gotUsers)); } @@ -248,11 +284,20 @@ void ApiWrap::gotChat(PeerData *peer, const MTPmessages_Chats &result) { if (result.type() == mtpc_messages_chats) { const QVector &v(result.c_messages_chats().vchats.c_vector().v); - bool badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_chat && v.at(0).c_chat().vversion.v < peer->asChat()->version); - ChatData *chat = App::feedChats(result.c_messages_chats().vchats); + bool badVersion = false; + if (peer->isChat()) { + badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_chat && v.at(0).c_chat().vversion.v < peer->asChat()->version); + } else if (peer->isChannel()) { + badVersion = (!v.isEmpty() && v.at(0).type() == mtpc_channel && v.at(0).c_chat().vversion.v < peer->asChannel()->version); + } + PeerData *chat = App::feedChats(result.c_messages_chats().vchats); if (chat == peer) { if (badVersion) { - peer->asChat()->version = v.at(0).c_chat().vversion.v; + if (peer->isChat()) { + peer->asChat()->version = v.at(0).c_chat().vversion.v; + } else if (peer->isChannel()) { + peer->asChannel()->version = v.at(0).c_chat().vversion.v; + } requestPeer(peer); } } diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index a57eb6bd9..ca40ea6ae 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -28,7 +28,7 @@ public: void itemRemoved(HistoryItem *item); void itemReplaced(HistoryItem *oldItem, HistoryItem *newItem); - void requestReplyTo(HistoryReply *reply, MsgId to); + void requestReplyTo(HistoryReply *reply, const FullMsgId &to); void requestFullPeer(PeerData *peer); void requestPeer(PeerData *peer); @@ -61,7 +61,7 @@ private: mtpRequestId req; QList replies; }; - typedef QMap ReplyToRequests; + typedef QMap ReplyToRequests; ReplyToRequests _replyToRequests; SingleTimer _replyToTimer; diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 3c0016f48..65feace60 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -62,6 +62,9 @@ namespace { typedef QMap ReplyMarkups; ReplyMarkups replyMarkups; + ReplyMarkup zeroMarkup(MTPDreplyKeyboardMarkup_flag_ZERO); + typedef QMap ChannelReplyMarkups; + ChannelReplyMarkups channelReplyMarkups; VideoItems videoItems; AudioItems audioItems; @@ -77,13 +80,14 @@ namespace { typedef QHash MsgsData; MsgsData msgsData; - int32 maxMsgId = 0; + typedef QMap ChannelMsgsData; + ChannelMsgsData channelMsgsData; - typedef QMap RandomData; + typedef QMap RandomData; RandomData randomData; - typedef QMap SentTextData; - SentTextData sentTextData; + typedef QMap > SentData; + SentData sentData; HistoryItem *hoveredItem = 0, *pressedItem = 0, *hoveredLinkItem = 0, *pressedLinkItem = 0, *contextItem = 0, *mousedItem = 0; @@ -213,33 +217,6 @@ namespace App { } } - PeerId peerFromMTP(const MTPPeer &peer_id) { - switch (peer_id.type()) { - case mtpc_peerChat: return peerFromChat(peer_id.c_peerChat().vchat_id); - case mtpc_peerUser: return peerFromUser(peer_id.c_peerUser().vuser_id); - } - return 0; - } - - PeerId peerFromChat(int32 chat_id) { - return 0x100000000L | uint64(uint32(chat_id)); - } - - PeerId peerFromUser(int32 user_id) { - return uint64(uint32(user_id)); - } - - MTPpeer peerToMTP(const PeerId &peer_id) { - return (peer_id & 0x100000000L) ? MTP_peerChat(MTP_int(int32(peer_id & 0xFFFFFFFFL))) : MTP_peerUser(MTP_int(int32(peer_id & 0xFFFFFFFFL))); - } - - int32 userFromPeer(const PeerId &peer_id) { - return (peer_id & 0x100000000L) ? 0 : int32(peer_id & 0xFFFFFFFFL); - } - int32 chatFromPeer(const PeerId &peer_id) { - return (peer_id & 0x100000000L) ? int32(peer_id & 0xFFFFFFFFL) : 0; - } - int32 onlineForSort(UserData *user, int32 now) { if (isServiceUser(user->id) || user->botInfo) { return -1; @@ -469,12 +446,12 @@ namespace App { case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break; } - if (data->contact < 0 && !data->phone.isEmpty() && int32(data->id & 0xFFFFFFFF) != MTP::authedId()) { + if (data->contact < 0 && !data->phone.isEmpty() && peerToUser(data->id) != MTP::authedId()) { data->contact = 0; } if (App::main()) { if (data->contact > 0 && !wasContact) { - App::main()->addNewContact(data->id & 0xFFFFFFFF, false); + App::main()->addNewContact(peerToUser(data->id), false); } else if (wasContact && data->contact <= 0) { App::main()->removeContact(data); } @@ -490,8 +467,8 @@ namespace App { return data; } - ChatData *feedChats(const MTPVector &chats, bool emitPeerUpdated) { - ChatData *data = 0; + PeerData *feedChats(const MTPVector &chats, bool emitPeerUpdated) { + PeerData *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); @@ -502,32 +479,53 @@ namespace App { const MTPDchat &d(chat.c_chat()); title = qs(d.vtitle); - PeerId peer(peerFromChat(d.vid.v)); - data = App::chat(peer); + data = App::chat(peerFromChat(d.vid.v)); data->input = MTP_inputPeerChat(d.vid); - data->setPhoto(d.vphoto); - data->date = d.vdate.v; - data->count = d.vparticipants_count.v; - data->left = d.vleft.v; - data->forbidden = false; - if (data->version < d.vversion.v) { - data->version = d.vversion.v; - data->participants = ChatData::Participants(); - data->botStatus = 0; + + ChatData *cdata = data->asChat(); + cdata->setPhoto(d.vphoto); + cdata->date = d.vdate.v; + cdata->count = d.vparticipants_count.v; + cdata->left = d.vleft.v; + cdata->forbidden = false; + if (cdata->version < d.vversion.v) { + cdata->version = d.vversion.v; + cdata->participants = ChatData::Participants(); + cdata->botStatus = 0; } } break; case mtpc_chatForbidden: { const MTPDchatForbidden &d(chat.c_chatForbidden()); title = qs(d.vtitle); - PeerId peer(peerFromChat(d.vid.v)); - data = App::chat(peer); + data = App::chat(peerFromChat(d.vid.v)); data->input = MTP_inputPeerChat(d.vid); - data->setPhoto(MTP_chatPhotoEmpty()); - data->date = 0; - data->count = -1; - data->left = false; - data->forbidden = true; + + ChatData *cdata = data->asChat(); + cdata->setPhoto(MTP_chatPhotoEmpty()); + cdata->date = 0; + cdata->count = -1; + cdata->left = false; + cdata->forbidden = true; + } break; + case mtpc_channel: { + const MTPDchannel &d(chat.c_channel()); + title = qs(d.vtitle); + + PeerId peer(peerFromChannel(d.vid.v)); + data = App::channel(peer); + data->input = MTP_inputPeerChannel(d.vid, d.vaccess_hash); + + ChannelData *cdata = data->asChannel(); + cdata->inputChat = MTP_inputChannel(d.vid, d.vaccess_hash); + cdata->access = d.vaccess_hash.v; + cdata->setPhoto(d.vphoto); + cdata->date = d.vdate.v; + cdata->left = false; + cdata->forbidden = false; + if (cdata->version < d.vversion.v) { + cdata->version = d.vversion.v; + } } break; } if (!data) continue; @@ -703,7 +701,11 @@ namespace App { } void checkEntitiesUpdate(const MTPDmessage &m) { - if (HistoryItem *existing = App::histItemById(m.vid.v)) { + PeerId peerId = peerFromMTP(m.vto_id); + if (m.has_from_id() && peerToUser(peerId) == MTP::authedId()) { + peerId = peerFromUser(m.vfrom_id); + } + if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) { bool hasLinks = m.has_entities() && !m.ventities.c_vector().v.isEmpty(); if ((hasLinks && !existing->hasTextLinks()) || (!hasLinks && existing->textHasLinks())) { existing->setText(qs(m.vmessage), m.has_entities() ? linksFromMTP(m.ventities.c_vector().v) : LinksInText()); @@ -738,10 +740,6 @@ namespace App { } } - int32 maxMsgId() { - return ::maxMsgId; - } - ImagePtr image(const MTPPhotoSize &size) { switch (size.type()) { case mtpc_photoSize: { @@ -789,38 +787,45 @@ namespace App { } return StorageImageLocation(); } - - void feedWereRead(const QVector &msgsIds) { - for (QVector::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) { - MsgsData::const_iterator j = msgsData.constFind(i->v); - if (j != msgsData.cend()) { - (*j)->markRead(); - } - } - } - void feedInboxRead(const PeerId &peer, int32 upTo) { + void feedInboxRead(const PeerId &peer, MsgId upTo) { History *h = App::historyLoaded(peer); if (h) { h->inboxRead(upTo); } } - void feedOutboxRead(const PeerId &peer, int32 upTo) { + void feedOutboxRead(const PeerId &peer, MsgId upTo) { History *h = App::historyLoaded(peer); if (h) { h->outboxRead(upTo); - if (!h->peer->chat) { + if (h->peer->isUser()) { h->peer->asUser()->madeAction(); } } } - void feedWereDeleted(const QVector &msgsIds) { + inline MsgsData *fetchMsgsData(ChannelId channelId, bool insert = true) { + if (channelId == NoChannel) return &msgsData; + ChannelMsgsData::iterator i = channelMsgsData.find(channelId); + if (i == channelMsgsData.cend()) { + if (insert) { + i = channelMsgsData.insert(channelId, MsgsData()); + } else { + return 0; + } + } + return &(*i); + } + + void feedWereDeleted(ChannelId channelId, const QVector &msgsIds) { bool resized = false; + MsgsData *data = fetchMsgsData(channelId, false); + if (!data) return; + for (QVector::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) { - MsgsData::const_iterator j = msgsData.constFind(i->v); - if (j != msgsData.cend()) { + MsgsData::const_iterator j = data->constFind(i->v); + if (j != data->cend()) { History *h = (*j)->history(); (*j)->destroy(); if (App::main() && h->peer == App::main()->peer()) { @@ -875,10 +880,10 @@ namespace App { } if (user->contact > 0) { if (!wasContact) { - App::main()->addNewContact(App::userFromPeer(user->id), false); + App::main()->addNewContact(peerToUser(user->id), false); } } else { - if (user->contact < 0 && !user->phone.isEmpty() && App::userFromPeer(user->id) != MTP::authedId()) { + if (user->contact < 0 && !user->phone.isEmpty() && peerToUser(user->id) != MTP::authedId()) { user->contact = 0; } if (wasContact) { @@ -1098,50 +1103,73 @@ namespace App { return 0; } - UserData *userLoaded(const PeerId &user) { - PeerData *peer = peerLoaded(user); - return (peer && peer->loaded) ? peer->asUser() : 0; - } - - ChatData *chatLoaded(const PeerId &chat) { - PeerData *peer = peerLoaded(chat); - return (peer && peer->loaded) ? peer->asChat() : 0; - } - PeerData *peerLoaded(const PeerId &peer) { PeersData::const_iterator i = peersData.constFind(peer); return (i != peersData.cend()) ? i.value() : 0; } - UserData *userLoaded(int32 user) { - return userLoaded(App::peerFromUser(user)); + UserData *userLoaded(const PeerId &id) { + PeerData *peer = peerLoaded(id); + return (peer && peer->loaded) ? peer->asUser() : 0; } - - ChatData *chatLoaded(int32 chat) { - return chatLoaded(App::peerFromChat(chat)); + ChatData *chatLoaded(const PeerId &id) { + PeerData *peer = peerLoaded(id); + return (peer && peer->loaded) ? peer->asChat() : 0; + } + ChannelData *channelLoaded(const PeerId &id) { + PeerData *peer = peerLoaded(id); + return (peer && peer->loaded) ? peer->asChannel() : 0; + } + UserData *userLoaded(int32 user_id) { + return userLoaded(peerFromUser(user_id)); + } + ChatData *chatLoaded(int32 chat_id) { + return chatLoaded(peerFromChat(chat_id)); + } + ChannelData *channelLoaded(int32 channel_id) { + return channelLoaded(peerFromChannel(channel_id)); } UserData *curUser() { return user(MTP::authedId()); } - PeerData *peer(const PeerId &peer) { - PeersData::const_iterator i = peersData.constFind(peer); + PeerData *peer(const PeerId &id) { + PeersData::const_iterator i = peersData.constFind(id); if (i == peersData.cend()) { - PeerData *newData = App::isChat(peer) ? (PeerData*)(new ChatData(peer)) : (PeerData*)(new UserData(peer)); + PeerData *newData = 0; + if (peerIsUser(id)) { + newData = new UserData(id); + } else if (peerIsChat(id)) { + newData = new ChatData(id); + } else if (peerIsChannel(id)) { + newData = new ChannelData(id); + } + if (!newData) return 0; + newData->input = MTPinputPeer(MTP_inputPeerEmpty()); - i = peersData.insert(peer, newData); + i = peersData.insert(id, newData); } return i.value(); } - UserData *user(const PeerId &peer) { - PeerData *d = App::peer(peer); - return d->asUser(); + UserData *user(const PeerId &id) { + return peer(id)->asUser(); } - - UserData *user(int32 user) { - return App::peer(App::peerFromUser(user))->asUser(); + ChatData *chat(const PeerId &id) { + return peer(id)->asChat(); + } + ChannelData *channel(const PeerId &id) { + return peer(id)->asChannel(); + } + UserData *user(int32 user_id) { + return user(peerFromUser(user_id)); + } + ChatData *chat(int32 chat_id) { + return chat(peerFromChat(chat_id)); + } + ChannelData *channel(int32 channel_id) { + return channel(peerFromChannel(channel_id)); } UserData *self() { @@ -1150,22 +1178,13 @@ namespace App { UserData *userByName(const QString &username) { for (PeersData::const_iterator i = peersData.cbegin(), e = peersData.cend(); i != e; ++i) { - if (!i.value()->chat && !i.value()->asUser()->username.compare(username.trimmed(), Qt::CaseInsensitive)) { + if (i.value()->isUser() && !i.value()->asUser()->username.compare(username.trimmed(), Qt::CaseInsensitive)) { return i.value()->asUser(); } } return 0; } - ChatData *chat(const PeerId &peer) { - PeerData *d = App::peer(peer); - return d->asChat(); - } - - ChatData *chat(int32 chat) { - return App::peer(App::peerFromChat(chat))->asChat(); - } - PhotoData *photo(const PhotoId &photo) { PhotosData::const_iterator i = photosData.constFind(photo); if (i == photosData.cend()) { @@ -1575,9 +1594,12 @@ namespace App { return (i == ::histories.cend()) ? 0 : i.value(); } - HistoryItem *histItemById(MsgId itemId) { - MsgsData::const_iterator i = msgsData.constFind(itemId); - if (i != msgsData.cend()) { + HistoryItem *histItemById(ChannelId channelId, MsgId itemId) { + MsgsData *data = fetchMsgsData(channelId, false); + if (!data) return 0; + + MsgsData::const_iterator i = data->constFind(itemId); + if (i != data->cend()) { return i.value(); } return 0; @@ -1611,16 +1633,16 @@ namespace App { } HistoryItem *historyRegItem(HistoryItem *item) { - MsgsData::const_iterator i = msgsData.constFind(item->id); - if (i == msgsData.cend()) { - msgsData.insert(item->id, item); - if (item->id > ::maxMsgId) ::maxMsgId = item->id; + MsgsData *data = fetchMsgsData(item->channelId()); + MsgsData::const_iterator i = data->constFind(item->id); + if (i == data->cend()) { + data->insert(item->id, item); return 0; } if (i.value() != item && !i.value()->block() && item->block()) { // replace search item itemReplaced(i.value(), item); delete i.value(); - msgsData.insert(item->id, item); + data->insert(item->id, item); return 0; } return (i.value() == item) ? 0 : i.value(); @@ -1651,10 +1673,13 @@ namespace App { } void historyUnregItem(HistoryItem *item) { - MsgsData::iterator i = msgsData.find(item->id); - if (i != msgsData.cend()) { + MsgsData *data = fetchMsgsData(item->channelId(), false); + if (!data) return; + + MsgsData::iterator i = data->find(item->id); + if (i != data->cend()) { if (i.value() == item) { - msgsData.erase(i); + data->erase(i); } } historyItemDetached(item); @@ -1677,19 +1702,26 @@ namespace App { toDelete.push_back(*i); } } + for (ChannelMsgsData::const_iterator j = channelMsgsData.cbegin(), end = channelMsgsData.cend(); j != end; ++j) { + for (MsgsData::const_iterator i = j->cbegin(), e = j->cend(); i != e; ++i) { + toDelete.push_back(*i); + } + } msgsData.clear(); - for (int i = 0, l = toDelete.size(); i < l; ++i) { + channelMsgsData.clear(); + for (int32 i = 0, l = toDelete.size(); i < l; ++i) { delete toDelete[i]; } - ::maxMsgId = 0; + ::hoveredItem = ::pressedItem = ::hoveredLinkItem = ::pressedLinkItem = ::contextItem = 0; replyMarkups.clear(); + channelReplyMarkups.clear(); } void historyClearItems() { historyClearMsgs(); randomData.clear(); - sentTextData.clear(); + sentData.clear(); mutedPeers.clear(); updatedPeers.clear(); cSetSavedPeers(SavedPeers()); @@ -1750,7 +1782,7 @@ namespace App { } } - void historyRegRandom(uint64 randomId, MsgId itemId) { + void historyRegRandom(uint64 randomId, const FullMsgId &itemId) { randomData.insert(randomId, itemId); } @@ -1758,24 +1790,26 @@ namespace App { randomData.remove(randomId); } - MsgId histItemByRandom(uint64 randomId) { + FullMsgId histItemByRandom(uint64 randomId) { RandomData::const_iterator i = randomData.constFind(randomId); if (i != randomData.cend()) { return i.value(); } - return 0; + return FullMsgId(); } - void historyRegSentText(uint64 randomId, const QString &text) { - sentTextData.insert(randomId, text); + void historyRegSentData(uint64 randomId, const PeerId &peerId, const QString &text) { + sentData.insert(randomId, qMakePair(peerId, text)); } - void historyUnregSentText(uint64 randomId) { - sentTextData.remove(randomId); + void historyUnregSentData(uint64 randomId) { + sentData.remove(randomId); } - QString histSentTextByItem(uint64 randomId) { - return sentTextData.value(randomId); + void histSentDataByItem(uint64 randomId, PeerId &peerId, QString &text) { + QPair d = sentData.value(randomId); + peerId = d.first; + text = d.second; } void prepareCorners(RoundCorners index, int32 radius, const style::color &color, const style::color *shadow = 0, QImage *cors = 0) { @@ -2157,7 +2191,15 @@ namespace App { if (changeInMin) App::main()->updateMutedIn(changeInMin); } - void feedReplyMarkup(MsgId msgId, const MTPReplyMarkup &markup) { + inline void insertReplyMarkup(ChannelId channelId, MsgId msgId, const ReplyMarkup &markup) { + if (channelId == NoChannel) { + replyMarkups.insert(msgId, markup); + } else { + channelReplyMarkups[channelId].insert(msgId, markup); + } + } + + void feedReplyMarkup(ChannelId channelId, MsgId msgId, const MTPReplyMarkup &markup) { ReplyMarkup data; ReplyMarkup::Commands &commands(data.commands); switch (markup.type()) { @@ -2189,7 +2231,7 @@ namespace App { } } if (!commands.isEmpty()) { - replyMarkups.insert(msgId, data); + insertReplyMarkup(channelId, msgId, data); } } } break; @@ -2197,27 +2239,44 @@ namespace App { case mtpc_replyKeyboardHide: { const MTPDreplyKeyboardHide &d(markup.c_replyKeyboardHide()); if (d.vflags.v) { - replyMarkups.insert(msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_ZERO)); + insertReplyMarkup(channelId, msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_ZERO)); } } break; case mtpc_replyKeyboardForceReply: { const MTPDreplyKeyboardForceReply &d(markup.c_replyKeyboardForceReply()); - replyMarkups.insert(msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_FORCE_REPLY)); + insertReplyMarkup(channelId, msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_FORCE_REPLY)); } break; } } - void clearReplyMarkup(MsgId msgId) { - replyMarkups.remove(msgId); + void clearReplyMarkup(ChannelId channelId, MsgId msgId) { + if (channelId == NoChannel) { + replyMarkups.remove(msgId); + } else { + ChannelReplyMarkups::iterator i = channelReplyMarkups.find(channelId); + if (i != channelReplyMarkups.cend()) { + i->remove(msgId); + } + if (i->isEmpty()) { + channelReplyMarkups.erase(i); + } + } } - const ReplyMarkup &replyMarkup(MsgId msgId) { - static ReplyMarkup zeroMarkup(MTPDreplyKeyboardMarkup_flag_ZERO); + inline const ReplyMarkup &replyMarkup(const ReplyMarkups &markups, MsgId msgId) { ReplyMarkups::const_iterator i = replyMarkups.constFind(msgId); - if (i == replyMarkups.cend()) return zeroMarkup; + if (i == replyMarkups.cend()) return zeroMarkup; return i.value(); } + const ReplyMarkup &replyMarkup(ChannelId channelId, MsgId msgId) { + if (channelId == NoChannel) { + return replyMarkup(replyMarkups, msgId); + } + ChannelReplyMarkups::const_iterator j = channelReplyMarkups.constFind(channelId); + if (j == channelReplyMarkups.cend()) return zeroMarkup; + return replyMarkup(*j, msgId); + } void setProxySettings(QNetworkAccessManager &manager) { if (cConnectionType() == dbictHttpProxy) { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index f14f280eb..2458cdf08 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -92,38 +92,21 @@ namespace App { QString formatPhone(QString phone); - inline bool isChat(const PeerId &peer) { - return peer & 0x100000000L; - } - PeerId peerFromMTP(const MTPPeer &peer_id); - PeerId peerFromChat(int32 chat_id); - inline PeerId peerFromChat(const MTPint &chat_id) { - return peerFromChat(chat_id.v); - } - PeerId peerFromUser(int32 user_id); - inline PeerId peerFromUser(const MTPint &user_id) { - return peerFromUser(user_id.v); - } - MTPpeer peerToMTP(const PeerId &peer_id); - int32 userFromPeer(const PeerId &peer_id); - int32 chatFromPeer(const PeerId &peer_id); - int32 onlineForSort(UserData *user, int32 now); int32 onlineWillChangeIn(UserData *user, int32 nowOnServer); QString onlineText(UserData *user, int32 nowOnServer, bool precise = false); bool onlineColorUse(UserData *user, int32 now); UserData *feedUsers(const MTPVector &users, bool emitPeerUpdated = true); // returns last user - ChatData *feedChats(const MTPVector &chats, bool emitPeerUpdated = true); // returns last chat + PeerData *feedChats(const MTPVector &chats, bool emitPeerUpdated = true); // returns last chat void feedParticipants(const MTPChatParticipants &p, bool requestBotInfos, bool emitPeerUpdated = true); void feedParticipantAdd(const MTPDupdateChatParticipantAdd &d, bool emitPeerUpdated = true); void feedParticipantDelete(const MTPDupdateChatParticipantDelete &d, bool emitPeerUpdated = true); void checkEntitiesUpdate(const MTPDmessage &m); void feedMsgs(const MTPVector &msgs, int msgsState = 0); // 2 - new read message, 1 - new unread message, 0 - not new message, -1 - searched message - void feedWereRead(const QVector &msgsIds); - void feedInboxRead(const PeerId &peer, int32 upTo); - void feedOutboxRead(const PeerId &peer, int32 upTo); - void feedWereDeleted(const QVector &msgsIds); + void feedInboxRead(const PeerId &peer, MsgId upTo); + void feedOutboxRead(const PeerId &peer, MsgId upTo); + void feedWereDeleted(ChannelId channelId, const QVector &msgsIds); void feedUserLinks(const MTPVector &links, bool emitPeerUpdated = true); void feedUserLink(MTPint userId, const MTPContactLink &myLink, const MTPContactLink &foreignLink, bool emitPeerUpdated = true); @@ -131,8 +114,6 @@ namespace App { void clearPeerUpdated(PeerData *data); void emitPeerUpdated(); - int32 maxMsgId(); - ImagePtr image(const MTPPhotoSize &size); StorageImageLocation imageLocation(int32 w, int32 h, const MTPFileLocation &loc); StorageImageLocation imageLocation(const MTPPhotoSize &size); @@ -150,19 +131,23 @@ namespace App { WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert = 0); WebPageData *feedWebPage(const MTPWebPage &webpage); - UserData *userLoaded(const PeerId &user); - ChatData *chatLoaded(const PeerId &chat); - PeerData *peerLoaded(const PeerId &peer); + PeerData *peerLoaded(const PeerId &id); + UserData *userLoaded(const PeerId &id); + ChatData *chatLoaded(const PeerId &id); + ChannelData *channelLoaded(const PeerId &id); UserData *userLoaded(int32 user); ChatData *chatLoaded(int32 chat); + ChannelData *channelLoaded(int32 channel); - PeerData *peer(const PeerId &peer); - UserData *user(const PeerId &peer); - UserData *user(int32 user); + PeerData *peer(const PeerId &id); + UserData *user(const PeerId &id); + ChatData *chat(const PeerId &id); + ChannelData *channel(const PeerId &id); + UserData *user(int32 user_id); + ChatData *chat(int32 chat_id); + ChannelData *channel(int32 channel_id); UserData *self(); UserData *userByName(const QString &username); - ChatData *chat(const PeerId &peer); - ChatData *chat(int32 chat); QString peerName(const PeerData *peer, bool forDialogs = false); PhotoData *photo(const PhotoId &photo); PhotoData *photoSet(const PhotoId &photo, PhotoData *convert, const uint64 &access, int32 date, const ImagePtr &thumb, const ImagePtr &medium, const ImagePtr &full); @@ -183,7 +168,10 @@ namespace App { Histories &histories(); History *history(const PeerId &peer, int32 unreadCnt = 0, int32 maxInboxRead = 0); History *historyLoaded(const PeerId &peer); - HistoryItem *histItemById(MsgId itemId); + HistoryItem *histItemById(ChannelId channelId, MsgId itemId); + inline HistoryItem *histItemById(const FullMsgId &msgId) { + return histItemById(msgId.channel, msgId.msg); + } HistoryItem *historyRegItem(HistoryItem *item); void historyItemDetached(HistoryItem *item); void historyUnregItem(HistoryItem *item); @@ -192,12 +180,12 @@ namespace App { void historyRegReply(HistoryReply *reply, HistoryItem *to); void historyUnregReply(HistoryReply *reply, HistoryItem *to); - void historyRegRandom(uint64 randomId, MsgId itemId); + void historyRegRandom(uint64 randomId, const FullMsgId &itemId); void historyUnregRandom(uint64 randomId); - MsgId histItemByRandom(uint64 randomId); - void historyRegSentText(uint64 itemId, const QString &text); - void historyUnregSentText(uint64 itemId); - QString histSentTextByItem(uint64 itemId); + FullMsgId histItemByRandom(uint64 randomId); + void historyRegSentData(uint64 randomId, const PeerId &peerId, const QString &text); + void historyUnregSentData(uint64 randomId); + void histSentDataByItem(uint64 randomId, PeerId &peerId, QString &text); void hoveredItem(HistoryItem *item); HistoryItem *hoveredItem(); @@ -255,9 +243,9 @@ namespace App { void unregMuted(PeerData *peer); void updateMuted(); - void feedReplyMarkup(MsgId msgId, const MTPReplyMarkup &markup); - void clearReplyMarkup(MsgId msgId); - const ReplyMarkup &replyMarkup(MsgId msgId); + void feedReplyMarkup(ChannelId channelId, MsgId msgId, const MTPReplyMarkup &markup); + void clearReplyMarkup(ChannelId channelId, MsgId msgId); + const ReplyMarkup &replyMarkup(ChannelId channelId, MsgId msgId); void setProxySettings(QNetworkAccessManager &manager); void setProxySettings(QTcpSocket &socket); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index efb917d1d..6e92bb2be 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -266,7 +266,7 @@ void Application::onUpdateFailed() { } #endif -void Application::regPhotoUpdate(const PeerId &peer, MsgId msgId) { +void Application::regPhotoUpdate(const PeerId &peer, const FullMsgId &msgId) { photoUpdates.insert(msgId, peer); } @@ -275,7 +275,7 @@ void Application::clearPhotoUpdates() { } bool Application::isPhotoUpdating(const PeerId &peer) { - for (QMap::iterator i = photoUpdates.begin(), e = photoUpdates.end(); i != e; ++i) { + for (QMap::iterator i = photoUpdates.begin(), e = photoUpdates.end(); i != e; ++i) { if (i.value() == peer) { return true; } @@ -284,7 +284,7 @@ bool Application::isPhotoUpdating(const PeerId &peer) { } void Application::cancelPhotoUpdate(const PeerId &peer) { - for (QMap::iterator i = photoUpdates.begin(), e = photoUpdates.end(); i != e;) { + for (QMap::iterator i = photoUpdates.begin(), e = photoUpdates.end(); i != e;) { if (i.value() == peer) { i = photoUpdates.erase(i); } else { @@ -333,11 +333,15 @@ bool Application::peerPhotoFail(PeerId peer, const RPCError &error) { return true; } -void Application::peerClearPhoto(PeerId peer) { - if (App::self() && App::self()->id == peer) { - MTP::send(MTPphotos_UpdateProfilePhoto(MTP_inputPhotoEmpty(), MTP_inputPhotoCropAuto()), rpcDone(&Application::selfPhotoCleared), rpcFail(&Application::peerPhotoFail, peer)); - } else { - MTP::send(MTPmessages_EditChatPhoto(MTP_int(int32(peer & 0xFFFFFFFF)), MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, peer), rpcFail(&Application::peerPhotoFail, peer)); +void Application::peerClearPhoto(PeerId id) { + if (MTP::authedId() && peerToUser(id) == MTP::authedId()) { + MTP::send(MTPphotos_UpdateProfilePhoto(MTP_inputPhotoEmpty(), MTP_inputPhotoCropAuto()), rpcDone(&Application::selfPhotoCleared), rpcFail(&Application::peerPhotoFail, id)); + } else if (peerIsChat(id)) { + MTP::send(MTPmessages_EditChatPhoto(MTP_inputChat(peerToBareMTPInt(id)), MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); + } else if (peerIsChannel(id)) { + if (ChannelData *channel = App::channelLoaded(id)) { + MTP::send(MTPmessages_EditChatPhoto(channel->inputChat, MTP_inputChatPhotoEmpty()), rpcDone(&Application::chatPhotoCleared, id), rpcFail(&Application::peerPhotoFail, id)); + } } } @@ -386,17 +390,17 @@ void Application::killDownloadSessions() { } } -void Application::photoUpdated(MsgId msgId, const MTPInputFile &file) { +void Application::photoUpdated(const FullMsgId &msgId, const MTPInputFile &file) { if (!App::self()) return; - QMap::iterator i = photoUpdates.find(msgId); + QMap::iterator i = photoUpdates.find(msgId); if (i != photoUpdates.end()) { - PeerId peer = i.value(); - if (peer == App::self()->id) { - MTP::send(MTPphotos_UploadProfilePhoto(file, MTP_string(""), MTP_inputGeoPointEmpty(), MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100))), rpcDone(&Application::selfPhotoDone), rpcFail(&Application::peerPhotoFail, peer)); - } else { - History *hist = App::history(peer); - hist->sendRequestId = MTP::send(MTPmessages_EditChatPhoto(MTP_int(peer & 0xFFFFFFFF), MTP_inputChatUploadedPhoto(file, MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100)))), rpcDone(&Application::chatPhotoDone, peer), rpcFail(&Application::peerPhotoFail, peer), 0, 0, hist->sendRequestId); + PeerId id = i.value(); + if (MTP::authedId() && peerToUser(id) == MTP::authedId()) { + MTP::send(MTPphotos_UploadProfilePhoto(file, MTP_string(""), MTP_inputGeoPointEmpty(), MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100))), rpcDone(&Application::selfPhotoDone), rpcFail(&Application::peerPhotoFail, id)); + } else if (peerIsChat(id) || peerIsChannel(id)) { + History *hist = App::history(id); + hist->sendRequestId = MTP::send(MTPmessages_EditChatPhoto(hist->peer->isChat() ? hist->peer->asChat()->inputChat : hist->peer->asChannel()->inputChat, MTP_inputChatUploadedPhoto(file, MTP_inputPhotoCrop(MTP_double(0), MTP_double(0), MTP_double(100)))), rpcDone(&Application::chatPhotoDone, id), rpcFail(&Application::peerPhotoFail, id), 0, 0, hist->sendRequestId); } } } @@ -494,9 +498,9 @@ void Application::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId) ReadyLocalMedia ready(ToPreparePhoto, file, filename, filesize, data, id, id, qsl("jpg"), peerId, photo, MTP_audioEmpty(MTP_long(0)), photoThumbs, MTP_documentEmpty(MTP_long(0)), jpeg, false, 0); - connect(App::uploader(), SIGNAL(photoReady(MsgId, const MTPInputFile &)), App::app(), SLOT(photoUpdated(MsgId, const MTPInputFile &)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(photoReady(const FullMsgId&, const MTPInputFile&)), App::app(), SLOT(photoUpdated(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection); - MsgId newId = clientMsgId(); + FullMsgId newId(peerToChannel(peerId), clientMsgId()); App::app()->regPhotoUpdate(peerId, newId); App::uploader()->uploadMedia(newId, ready); } diff --git a/Telegram/SourceFiles/application.h b/Telegram/SourceFiles/application.h index c94ce93d9..b4e1f0eff 100644 --- a/Telegram/SourceFiles/application.h +++ b/Telegram/SourceFiles/application.h @@ -56,7 +56,7 @@ public: FileUploader *uploader(); void uploadProfilePhoto(const QImage &tosend, const PeerId &peerId); - void regPhotoUpdate(const PeerId &peer, MsgId msgId); + void regPhotoUpdate(const PeerId &peer, const FullMsgId &msgId); void clearPhotoUpdates(); bool isPhotoUpdating(const PeerId &peer); void cancelPhotoUpdate(const PeerId &peer); @@ -117,7 +117,7 @@ public slots: void onUpdateFailed(); #endif - void photoUpdated(MsgId msgId, const MTPInputFile &file); + void photoUpdated(const FullMsgId &msgId, const MTPInputFile &file); void onSwitchDebugMode(); void onSwitchTestMode(); @@ -127,7 +127,7 @@ public slots: private: - QMap photoUpdates; + QMap photoUpdates; QMap killDownloadSessionTimes; SingleTimer killDownloadSessionsTimer; diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp index cdfa4f716..3d9fda876 100644 --- a/Telegram/SourceFiles/audio.cpp +++ b/Telegram/SourceFiles/audio.cpp @@ -489,7 +489,8 @@ void AudioPlayer::play(const SongMsgId &song, int64 position) { setStoppedState(current); if (!song.song->loader) { DocumentOpenLink::doOpen(song.song); - song.song->openOnSave = song.song->openOnSaveMsgId = 0; + song.song->openOnSave = 0; + song.song->openOnSaveMsgId = FullMsgId(); if (song.song->loader) song.song->loader->start(true, true); } } else { diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index 0694a143c..068ff6ccd 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -45,8 +45,8 @@ AddContactBox::AddContactBox(PeerData *peer) : _addButton(this, lang(lng_settings_save), st::btnSelectDone), _retryButton(this, lang(lng_try_other_contact), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), - _firstInput(this, st::inpAddContact, lang(peer->chat ? lng_dlg_new_group_name : lng_signup_firstname), peer->chat ? peer->name : peer->asUser()->firstName), - _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->chat ? QString() : peer->asUser()->lastName), + _firstInput(this, st::inpAddContact, lang(peer->isUser() ? lng_signup_firstname : lng_dlg_new_group_name), peer->isUser() ? peer->asUser()->firstName : peer->name), + _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->isUser() ? peer->asUser()->lastName : QString()), _phoneInput(this, st::inpAddContact, lang(lng_contact_phone)), _contactId(0), _addRequest(0) { @@ -55,12 +55,16 @@ AddContactBox::AddContactBox(PeerData *peer) : void AddContactBox::initBox() { if (_peer) { - if (_peer->chat) { - _boxTitle = lang(lng_edit_group_title); - setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height()); - } else { + if (_peer->isUser()) { _boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title); setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 2 * _firstInput.height() + 1 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); + } else if (_peer->isChat()) { + _boxTitle = lang(lng_edit_group_title); + setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height()); + } else if (_peer->isChannel()) { + // CHANNELS_UX + _boxTitle = lang(lng_edit_group_title); + setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height()); } } else { bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty()); @@ -87,7 +91,7 @@ void AddContactBox::hideAll() { void AddContactBox::showAll() { _firstInput.show(); - if (_peer && _peer->chat) { + if (_peer && (_peer->isChat() || _peer->isChannel())) { _lastInput.hide(); } else { _lastInput.show(); @@ -112,7 +116,7 @@ void AddContactBox::showDone() { void AddContactBox::keyPressEvent(QKeyEvent *e) { if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { if (_firstInput.hasFocus()) { - if (_peer && _peer->chat) { + if (_peer && (_peer->isChat() || _peer->isChannel())) { if (_firstInput.text().trimmed().isEmpty()) { _firstInput.setFocus(); _firstInput.notaBene(); @@ -206,8 +210,10 @@ void AddContactBox::onSend() { if (_peer == App::self()) { _addRequest = MTP::send(MTPaccount_UpdateProfile(MTP_string(firstName), MTP_string(lastName)), rpcDone(&AddContactBox::onSaveSelfDone), rpcFail(&AddContactBox::onSaveSelfFail)); } else if (_peer) { - if (_peer->chat) { - _addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(App::chatFromPeer(_peer->id)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); + if (_peer->isChat()) { + _addRequest = MTP::send(MTPmessages_EditChatTitle(_peer->asChat()->inputChat, MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); + } else if (_peer->isChannel()) { + _addRequest = MTP::send(MTPmessages_EditChatTitle(_peer->asChannel()->inputChat, MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail)); } else { _contactId = MTP::nonce(); QVector v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName))); diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 00933bcb2..aa365deae 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -60,7 +60,7 @@ _byUsernameSel(-1), _addContactLnk(this, lang(lng_add_contact_button)) { DialogsIndexed &v(App::main()->dialogsList()); for (DialogRow *r = v.list.begin; r != v.list.end; r = r->next) { - if (r->history->peer->chat && !r->history->peer->asChat()->forbidden && !r->history->peer->asChat()->left) { + if (r->history->peer->isChat() && !r->history->peer->asChat()->forbidden && !r->history->peer->asChat()->left) { _contacts->addToEnd(r->history); } } @@ -93,7 +93,7 @@ void ContactsInner::onPeerNameChanged(PeerData *peer, const PeerData::Names &old void ContactsInner::onAddBot() { if (_bot->botInfo && !_bot->botInfo->startGroupToken.isEmpty()) { uint64 randomId = MTP::nonce(); - MTP::send(MTPmessages_StartBot(_bot->inputUser, MTP_int(App::chatFromPeer(_addToChat->id)), MTP_long(randomId), MTP_string(_bot->botInfo->startGroupToken)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _bot)); + MTP::send(MTPmessages_StartBot(_bot->inputUser, _addToChat->inputChat, MTP_long(randomId), MTP_string(_bot->botInfo->startGroupToken)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _bot)); App::wnd()->hideLayer(); App::main()->showPeerHistory(_addToChat->id, ShowAtUnreadMsgId); @@ -179,18 +179,20 @@ ContactsInner::ContactData *ContactsInner::contactData(DialogRow *row) { ContactsData::const_iterator i = _contactsData.constFind(peer); if (i == _contactsData.cend()) { _contactsData.insert(peer, data = new ContactData()); - data->inchat = (_chat && !peer->chat) ? _chat->participants.contains(peer->asUser()) : false; + data->inchat = (_chat && peer->isUser()) ? _chat->participants.contains(peer->asUser()) : false; data->check = _checkedContacts.contains(peer); data->name.setText(st::profileListNameFont, peer->name, _textNameOptions); - if (peer->chat) { + if (peer->isUser()) { + data->online = App::onlineText(peer->asUser(), _time); + } else if (peer->isChat()) { ChatData *chat = peer->asChat(); if (chat->forbidden || chat->left) { data->online = lang(lng_chat_status_unaccessible); } else { data->online = lng_chat_status_members(lt_count, chat->count); } - } else { - data->online = App::onlineText(peer->asUser(), _time); + } else if (peer->isChannel()) { + data->online = lang(lng_chat_status_unaccessible); // CHANNELS_UX } } else { data = i.value(); @@ -203,7 +205,7 @@ ContactsInner::ContactData *ContactsInner::contactData(DialogRow *row) { void ContactsInner::paintDialog(QPainter &p, PeerData *peer, ContactData *data, bool sel) { int32 left = st::profileListPadding.width(); - UserData *user = peer->chat ? 0 : peer->asUser(); + UserData *user = peer->asUser(); if (data->inchat || data->check || _selCount + (_chat ? _chat->count : 0) >= cMaxGroupCount()) { sel = false; @@ -454,7 +456,7 @@ void ContactsInner::chooseParticipant() { } } if (peer) { - if (bot() && peer->chat) { + if (bot() && peer->isChat()) { _addToChat = peer->asChat(); ConfirmBox *box = new ConfirmBox(lng_bot_sure_invite(lt_group, peer->name)); connect(box, SIGNAL(confirmed()), this, SLOT(onAddBot())); @@ -686,7 +688,7 @@ void ContactsInner::peopleReceived(const QString &query, const QVector::const_iterator i = people.cbegin(), e = people.cend(); i != e; ++i) { int32 uid = i->c_contactFound().vuser_id.v, j = 0; for (; j < already; ++j) { - if (_byUsernameFiltered[j]->id == App::peerFromUser(uid)) break; + if (_byUsernameFiltered[j]->id == peerFromUser(uid)) break; } if (j == already) { UserData *u = App::user(uid); @@ -889,7 +891,7 @@ QVector ContactsInner::selected() { } result.reserve(_contactsData.size()); for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) { - if (i.value()->check && !i.key()->chat) { + if (i.value()->check && i.key()->isUser()) { result.push_back(i.key()->asUser()); } } @@ -910,7 +912,7 @@ QVector ContactsInner::selectedInputs() { } result.reserve(_contactsData.size()); for (ContactsData::const_iterator i = _contactsData.cbegin(), e = _contactsData.cend(); i != e; ++i) { - if (i.value()->check && !i.key()->chat) { + if (i.value()->check && i.key()->isUser()) { result.push_back(i.key()->asUser()->inputUser); } } @@ -1277,7 +1279,7 @@ void CreateGroupBox::created(const MTPUpdates &updates) { } break; } if (v && !v->isEmpty() && v->front().type() == mtpc_chat) { - App::main()->choosePeer(App::peerFromChat(v->front().c_chat().vid.v), ShowAtUnreadMsgId); + App::main()->choosePeer(peerFromChat(v->front().c_chat().vid.v), ShowAtUnreadMsgId); } } diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 58ef6fc7e..6ffde7d99 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -219,7 +219,7 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) { int32 to = ((r.bottom() - skip) / int32(st::dlgHeight)) + 1, w = width(); if (to > searchResults.size()) to = searchResults.size(); for (; from < to; ++from) { - bool active = (searchResults[from]->_item->id == App::main()->activeMsgId()); + bool active = (searchResults[from]->_item->history()->peer == App::main()->activePeer() && searchResults[from]->_item->id == App::main()->activeMsgId()); bool selected = (from == searchedSel); searchResults[from]->paint(p, w, active, selected); p.translate(0, st::dlgHeight); @@ -242,7 +242,7 @@ void DialogsListWidget::peopleResultPaint(UserData *user, QPainter &p, int32 w, QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (history->peer->chat) { + if (history->peer->isChat()) { // CHANNELS_UI p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg)); rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); } @@ -281,7 +281,7 @@ void DialogsListWidget::searchInPeerPaint(QPainter &p, int32 w) const { QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (_searchInPeer->chat) { + if (_searchInPeer->isChat()) { // CHANNELS_UI p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg); rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); } @@ -830,7 +830,7 @@ void DialogsListWidget::contactsReceived(const QVector &contacts) { } int32 DialogsListWidget::addNewContact(int32 uid, bool select) { // -2 - err, -1 - don't scroll, >= 0 - scroll - PeerId peer = App::peerFromUser(uid); + PeerId peer = peerFromUser(uid); if (!App::peerLoaded(peer)) return -2; History *history = App::history(peer); @@ -942,7 +942,7 @@ void DialogsListWidget::clearFilter() { } void DialogsListWidget::addDialog(const MTPDdialog &dialog) { - History *history = App::history(App::peerFromMTP(dialog.vpeer), dialog.vunread_count.v, dialog.vread_inbox_max_id.v); + History *history = App::history(peerFromMTP(dialog.vpeer), dialog.vunread_count.v, dialog.vread_inbox_max_id.v); if (history->lastMsg) { SavedPeersByTime &saved(cRefSavedPeersByTime()); while (!saved.isEmpty() && history->lastMsg->date < saved.lastKey()) { @@ -1451,10 +1451,11 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent) , _drawShadow(true) , _dragInScroll(false) , _dragForward(false) -, dlgOffset(0) -, dlgCount(-1) -, dlgPreloading(0) -, contactsRequest(0) +, _dialogsOffset(0) +, _dialogsCount(-1) +, _dialogsRequest(0) +, _channelDialogsRequest(0) +, _contactsRequest(0) , _filter(this, st::dlgFilter, lang(lng_dlg_filter)) , _newGroup(this, st::btnNewGroup) , _addContact(this, st::btnAddContact) @@ -1585,7 +1586,7 @@ void DialogsWidget::itemReplaced(HistoryItem *oldItem, HistoryItem *newItem) { void DialogsWidget::unreadCountsReceived(const QVector &dialogs) { for (QVector::const_iterator i = dialogs.cbegin(), e = dialogs.cend(); i != e; ++i) { const MTPDdialog &d(i->c_dialog()); - Histories::iterator j = App::histories().find(App::peerFromMTP(d.vpeer)); + Histories::iterator j = App::histories().find(peerFromMTP(d.vpeer)); if (j != App::histories().end()) { App::main()->applyNotifySetting(MTP_notifyPeer(d.vpeer), d.vnotify_settings, j.value()); if (d.vunread_count.v >= j.value()->unreadCount) { @@ -1605,7 +1606,7 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs) { App::feedChats(data.vchats); App::feedMsgs(data.vmessages); dlgList = &data.vdialogs.c_vector().v; - dlgCount = dlgList->size(); + _dialogsCount = dlgList->size(); } break; case mtpc_messages_dialogsSlice: { const MTPDmessages_dialogsSlice &data(dialogs.c_messages_dialogsSlice()); @@ -1613,14 +1614,14 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs) { App::feedChats(data.vchats); App::feedMsgs(data.vmessages); dlgList = &data.vdialogs.c_vector().v; - dlgCount = data.vcount.v; + _dialogsCount = data.vcount.v; } break; } unreadCountsReceived(*dlgList); - if (!contactsRequest) { - contactsRequest = MTP::send(MTPcontacts_GetContacts(MTP_string("")), rpcDone(&DialogsWidget::contactsReceived), rpcFail(&DialogsWidget::contactsFailed)); + if (!_contactsRequest) { + _contactsRequest = MTP::send(MTPcontacts_GetContacts(MTP_string("")), rpcDone(&DialogsWidget::contactsReceived), rpcFail(&DialogsWidget::contactsFailed)); } if (dlgList) { @@ -1628,15 +1629,15 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs) { onListScroll(); if (dlgList->size()) { - dlgOffset += dlgList->size(); + _dialogsOffset += dlgList->size(); } else { - dlgCount = dlgOffset; + _dialogsCount = _dialogsOffset; } } else { - dlgCount = dlgOffset; + _dialogsCount = _dialogsOffset; } - dlgPreloading = 0; + _dialogsRequest = 0; if (dlgList) { loadDialogs(); } @@ -1646,7 +1647,7 @@ bool DialogsWidget::dialogsFailed(const RPCError &error) { if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; LOG(("RPC Error: %1 %2: %3").arg(error.code()).arg(error.type()).arg(error.description())); - dlgPreloading = 0; + _dialogsRequest = 0; return true; } @@ -1727,15 +1728,15 @@ void DialogsWidget::onSearchMore(MsgId minMsgId) { } void DialogsWidget::loadDialogs() { - if (dlgPreloading) return; - if (dlgCount >= 0 && dlgOffset >= dlgCount) { + if (_dialogsRequest) return; + if (_dialogsCount >= 0 && _dialogsOffset >= _dialogsCount) { list.addAllSavedPeers(); cSetDialogsReceived(true); return; } - int32 loadCount = dlgOffset ? DialogsPerPage : DialogsFirstLoad; - dlgPreloading = MTP::send(MTPmessages_GetDialogs(MTP_int(dlgOffset), MTP_int(0), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); + int32 loadCount = _dialogsOffset ? DialogsPerPage : DialogsFirstLoad; + _dialogsRequest = MTP::send(MTPmessages_GetDialogs(MTP_int(_dialogsOffset), MTP_int(loadCount)), rpcDone(&DialogsWidget::dialogsReceived), rpcFail(&DialogsWidget::dialogsFailed)); } void DialogsWidget::contactsReceived(const MTPcontacts_Contacts &contacts) { diff --git a/Telegram/SourceFiles/dialogswidget.h b/Telegram/SourceFiles/dialogswidget.h index bca348727..6ffae7c4a 100644 --- a/Telegram/SourceFiles/dialogswidget.h +++ b/Telegram/SourceFiles/dialogswidget.h @@ -260,9 +260,8 @@ private: bool searchFailed(const RPCError &error, mtpRequestId req); bool peopleFailed(const RPCError &error, mtpRequestId req); - int32 dlgOffset, dlgCount; - mtpRequestId dlgPreloading; - mtpRequestId contactsRequest; + int32 _dialogsOffset, _dialogsCount; + mtpRequestId _dialogsRequest, _channelDialogsRequest, _contactsRequest; FlatInput _filter; IconedButton _newGroup, _addContact, _cancelSearch; diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index f00f47fcb..01e92816b 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -2746,8 +2746,8 @@ void MentionsDropdown::paintEvent(QPaintEvent *e) { } void MentionsDropdown::showFiltered(PeerData *peer, QString start) { - _chat = peer->chat ? peer->asChat() : 0; - _user = peer->chat ? 0 : peer->asUser(); + _chat = peer->asChat(); + _user = peer->asUser(); start = start.toLower(); bool toDown = (_filter != start); if (toDown) { diff --git a/Telegram/SourceFiles/fileuploader.cpp b/Telegram/SourceFiles/fileuploader.cpp index 45d198085..881a3cfbe 100644 --- a/Telegram/SourceFiles/fileuploader.cpp +++ b/Telegram/SourceFiles/fileuploader.cpp @@ -18,7 +18,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include "stdafx.h" #include "fileuploader.h" -FileUploader::FileUploader() : sentSize(0), uploading(0) { +FileUploader::FileUploader() : sentSize(0) { memset(sentSizes, 0, sizeof(sentSizes)); nextTimer.setSingleShot(true); connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext())); @@ -26,7 +26,7 @@ FileUploader::FileUploader() : sentSize(0), uploading(0) { connect(&killSessionsTimer, SIGNAL(timeout()), this, SLOT(killSessions())); } -void FileUploader::uploadMedia(MsgId msgId, const ReadyLocalMedia &media) { +void FileUploader::uploadMedia(const FullMsgId &msgId, const ReadyLocalMedia &media) { if (media.type == ToPreparePhoto) { App::feedPhoto(media.photo, media.photoThumbs); } else if (media.type == ToPrepareDocument) { @@ -73,7 +73,7 @@ void FileUploader::currentFailed() { requestsSent.clear(); docRequestsSent.clear(); dcMap.clear(); - uploading = 0; + uploading = FullMsgId(); sentSize = 0; for (int i = 0; i < MTPUploadSessionsCount; ++i) { sentSizes[i] = 0; @@ -102,8 +102,8 @@ void FileUploader::sendNext() { if (killing) { killSessionsTimer.stop(); } - Queue::iterator i = uploading ? queue.find(uploading) : queue.begin(); - if (!uploading) { + Queue::iterator i = uploading.msg ? queue.find(uploading) : queue.begin(); + if (!uploading.msg) { uploading = i.key(); } else if (i == queue.end()) { i = queue.begin(); @@ -138,7 +138,7 @@ void FileUploader::sendNext() { emit audioReady(uploading, audio); } queue.remove(uploading); - uploading = 0; + uploading = FullMsgId(); sendNext(); } return; @@ -193,7 +193,7 @@ void FileUploader::sendNext() { nextTimer.start(UploadRequestInterval); } -void FileUploader::cancel(MsgId msgId) { +void FileUploader::cancel(const FullMsgId &msgId) { uploaded.remove(msgId); if (uploading == msgId) { currentFailed(); @@ -202,7 +202,7 @@ void FileUploader::cancel(MsgId msgId) { } } -void FileUploader::confirm(MsgId msgId) { +void FileUploader::confirm(const FullMsgId &msgId) { } void FileUploader::clear() { diff --git a/Telegram/SourceFiles/fileuploader.h b/Telegram/SourceFiles/fileuploader.h index e27d7b252..b0fd9ef37 100644 --- a/Telegram/SourceFiles/fileuploader.h +++ b/Telegram/SourceFiles/fileuploader.h @@ -25,13 +25,13 @@ class FileUploader : public QObject, public RPCSender { public: FileUploader(); - void uploadMedia(MsgId msgId, const ReadyLocalMedia &image); + void uploadMedia(const FullMsgId &msgId, const ReadyLocalMedia &image); - int32 currentOffset(MsgId msgId) const; // -1 means file not found - int32 fullSize(MsgId msgId) const; + int32 currentOffset(const FullMsgId &msgId) const; // -1 means file not found + int32 fullSize(const FullMsgId &msgId) const; - void cancel(MsgId msgId); - void confirm(MsgId msgId); + void cancel(const FullMsgId &msgId); + void confirm(const FullMsgId &msgId); void clear(); @@ -42,18 +42,18 @@ public slots: signals: - void photoReady(MsgId msgId, const MTPInputFile &file); - void documentReady(MsgId msgId, const MTPInputFile &file); - void thumbDocumentReady(MsgId msgId, const MTPInputFile &file, const MTPInputFile &thumb); - void audioReady(MsgId msgId, const MTPInputFile &file); + void photoReady(const FullMsgId &msgId, const MTPInputFile &file); + void documentReady(const FullMsgId &msgId, const MTPInputFile &file); + void thumbDocumentReady(const FullMsgId &msgId, const MTPInputFile &file, const MTPInputFile &thumb); + void audioReady(const FullMsgId &msgId, const MTPInputFile &file); - void photoProgress(MsgId msgId); - void documentProgress(MsgId msgId); - void audioProgress(MsgId msgId); + void photoProgress(const FullMsgId &msgId); + void documentProgress(const FullMsgId &msgId); + void audioProgress(const FullMsgId &msgId); - void photoFailed(MsgId msgId); - void documentFailed(MsgId msgId); - void audioFailed(MsgId msgId); + void photoFailed(const FullMsgId &msgId); + void documentFailed(const FullMsgId &msgId); + void audioFailed(const FullMsgId &msgId); private: @@ -94,7 +94,7 @@ private: int32 docPartSize; int32 docPartsCount; }; - typedef QMap Queue; + typedef QMap Queue; void partLoaded(const MTPBool &result, mtpRequestId requestId); bool partFailed(const RPCError &err, mtpRequestId requestId); @@ -107,7 +107,7 @@ private: uint32 sentSize; uint32 sentSizes[MTPUploadSessionsCount]; - MsgId uploading; + FullMsgId uploading; Queue queue; Queue uploaded; QTimer nextTimer, killSessionsTimer; diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 512435906..aec3a786a 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -115,7 +115,7 @@ namespace { } const TextParseOptions &itemTextParseOptions(History *h, UserData *f) { - if ((!h->peer->chat && h->peer->asUser()->botInfo) || (!f->chat && f->asUser()->botInfo) || (h->peer->chat && h->peer->asChat()->botStatus >= 0)) { + if ((h->peer->isUser() && h->peer->asUser()->botInfo) || (f->isUser() && f->asUser()->botInfo) || (h->peer->isChat() && h->peer->asChat()->botStatus >= 0) || (h->peer->isChannel() && h->peer->asChannel()->botStatus >= 0)) { return _historyBotOptions; } return _historyTextOptions; @@ -160,9 +160,11 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const { QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (history->peer->chat) { + if (history->peer->isChat()) { p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg)); rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); + } else if (history->peer->isChannel()) { + // CHANNELS_UI } HistoryItem *last = history->lastMsg; @@ -250,9 +252,11 @@ void FakeDialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const { QRect rectForName(nameleft, st::dlgPaddingVer + st::dlgNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (history->peer->chat) { + if (history->peer->isChat()) { p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), (act ? st::dlgActiveChatImg : st::dlgChatImg)); rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); + } else if (history->peer->isChannel()) { + // CHANNELS_UI } // draw date @@ -364,17 +368,17 @@ bool History::updateTyping(uint64 ms, uint32 dots, bool force) { } else if (cnt > 1) { newTypingStr = lng_users_typing(lt_user, typing.begin().key()->firstName, lt_second_user, (typing.end() - 1).key()->firstName); } else if (cnt) { - newTypingStr = peer->chat ? lng_user_typing(lt_user, typing.begin().key()->firstName) : lang(lng_typing); + newTypingStr = peer->isUser() ? lang(lng_typing) : lng_user_typing(lt_user, typing.begin().key()->firstName); } else if (!sendActions.isEmpty()) { switch (sendActions.begin().value().type) { - case SendActionRecordVideo: newTypingStr = peer->chat ? lng_user_action_record_video(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_record_video); break; - case SendActionUploadVideo: newTypingStr = peer->chat ? lng_user_action_upload_video(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_upload_video); break; - case SendActionRecordAudio: newTypingStr = peer->chat ? lng_user_action_record_audio(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_record_audio); break; - case SendActionUploadAudio: newTypingStr = peer->chat ? lng_user_action_upload_audio(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_upload_audio); break; - case SendActionUploadPhoto: newTypingStr = peer->chat ? lng_user_action_upload_photo(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_upload_photo); break; - case SendActionUploadFile: newTypingStr = peer->chat ? lng_user_action_upload_file(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_upload_file); break; - case SendActionChooseLocation: newTypingStr = peer->chat ? lng_user_action_geo_location(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_geo_location); break; - case SendActionChooseContact: newTypingStr = peer->chat ? lng_user_action_choose_contact(lt_user, sendActions.begin().key()->firstName) : lang(lng_send_action_choose_contact); break; + case SendActionRecordVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_record_video) : lng_user_action_record_video(lt_user, sendActions.begin().key()->firstName); break; + case SendActionUploadVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_video) : lng_user_action_upload_video(lt_user, sendActions.begin().key()->firstName); break; + case SendActionRecordAudio: newTypingStr = peer->isUser() ? lang(lng_send_action_record_audio) : lng_user_action_record_audio(lt_user, sendActions.begin().key()->firstName); break; + case SendActionUploadAudio: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_audio) : lng_user_action_upload_audio(lt_user, sendActions.begin().key()->firstName); break; + case SendActionUploadPhoto: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, sendActions.begin().key()->firstName); break; + case SendActionUploadFile: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_file) : lng_user_action_upload_file(lt_user, sendActions.begin().key()->firstName); break; + case SendActionChooseLocation: newTypingStr = peer->isUser() ? lang(lng_send_action_geo_location) : lng_user_action_geo_location(lt_user, sendActions.begin().key()->firstName); break; + case SendActionChooseContact: newTypingStr = peer->isUser() ? lang(lng_send_action_choose_contact) : lng_user_action_choose_contact(lt_user, sendActions.begin().key()->firstName); break; } } if (!newTypingStr.isEmpty()) { @@ -593,15 +597,15 @@ HistoryItem *Histories::addToBack(const MTPmessage &msg, int msgState) { PeerId from_id = 0, to_id = 0; switch (msg.type()) { case mtpc_message: - from_id = App::peerFromUser(msg.c_message().vfrom_id); - to_id = App::peerFromMTP(msg.c_message().vto_id); + from_id = peerFromUser(msg.c_message().vfrom_id); + to_id = peerFromMTP(msg.c_message().vto_id); break; case mtpc_messageService: - from_id = App::peerFromUser(msg.c_messageService().vfrom_id); - to_id = App::peerFromMTP(msg.c_messageService().vto_id); + from_id = peerFromUser(msg.c_messageService().vfrom_id); + to_id = peerFromMTP(msg.c_messageService().vto_id); break; } - PeerId peer = (to_id == App::peerFromUser(MTP::authedId())) ? from_id : to_id; + PeerId peer = (peerToUser(to_id) == MTP::authedId()) ? from_id : to_id; if (!peer) return 0; @@ -635,7 +639,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo case mtpc_messageService: msgId = msg.c_messageService().vid.v; break; } - HistoryItem *existing = App::histItemById(msgId); + HistoryItem *existing = App::histItemById(channelId(), msgId); if (existing) { bool regged = false; if (existing->detached() && block) { @@ -730,7 +734,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo result = new HistoryMessage(this, block, m); } if (m.has_reply_markup()) { - App::feedReplyMarkup(msgId, m.vreply_markup); + App::feedReplyMarkup(channelId(), msgId, m.vreply_markup); } } } break; @@ -759,7 +763,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo case mtpc_messageActionChatDeleteUser: { const MTPDmessageActionChatDeleteUser &d(action.c_messageActionChatDeleteUser()); - if (lastKeyboardFrom == App::peerFromUser(d.vuser_id)) { + if (lastKeyboardFrom == peerFromUser(d.vuser_id)) { clearLastKeyboard(); } // App::peer(App::peerFromUser(d.vuser_id)); left @@ -770,24 +774,25 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPmessage &msg, boo if (d.vphoto.type() == mtpc_photo) { const QVector &sizes(d.vphoto.c_photo().vsizes.c_vector().v); if (!sizes.isEmpty()) { - ChatData *chat = peer->asChat(); - if (chat) { - PhotoData *photo = App::feedPhoto(d.vphoto.c_photo()); - if (photo) photo->chat = chat; - const MTPPhotoSize &smallSize(sizes.front()), &bigSize(sizes.back()); - const MTPFileLocation *smallLoc = 0, *bigLoc = 0; - switch (smallSize.type()) { - case mtpc_photoSize: smallLoc = &smallSize.c_photoSize().vlocation; break; - case mtpc_photoCachedSize: smallLoc = &smallSize.c_photoCachedSize().vlocation; break; - } - switch (bigSize.type()) { - case mtpc_photoSize: bigLoc = &bigSize.c_photoSize().vlocation; break; - case mtpc_photoCachedSize: bigLoc = &bigSize.c_photoCachedSize().vlocation; break; - } - if (smallLoc && bigLoc) { - chat->setPhoto(MTP_chatPhoto(*smallLoc, *bigLoc), photo ? photo->id : 0); - chat->photo->load(); + PhotoData *photo = App::feedPhoto(d.vphoto.c_photo()); + if (photo) photo->peer = peer; + const MTPPhotoSize &smallSize(sizes.front()), &bigSize(sizes.back()); + const MTPFileLocation *smallLoc = 0, *bigLoc = 0; + switch (smallSize.type()) { + case mtpc_photoSize: smallLoc = &smallSize.c_photoSize().vlocation; break; + case mtpc_photoCachedSize: smallLoc = &smallSize.c_photoCachedSize().vlocation; break; + } + switch (bigSize.type()) { + case mtpc_photoSize: bigLoc = &bigSize.c_photoSize().vlocation; break; + case mtpc_photoCachedSize: bigLoc = &bigSize.c_photoCachedSize().vlocation; break; + } + if (smallLoc && bigLoc) { + if (peer->isChat()) { + peer->asChat()->setPhoto(MTP_chatPhoto(*smallLoc, *bigLoc), photo ? photo->id : 0); + } else if (peer->isChannel()) { + peer->asChannel()->setPhoto(MTP_chatPhoto(*smallLoc, *bigLoc), photo ? photo->id : 0); } + peer->photo->load(); } } } @@ -958,7 +963,7 @@ HistoryItem *History::doAddToBack(HistoryBlock *to, bool newBlock, HistoryItem * addToOverview(adding, OverviewLinks); } if (adding->from()->id) { - if (peer->chat) { + if (peer->isChat()) { QList *lastAuthors = &(peer->asChat()->lastAuthors); int prev = lastAuthors->indexOf(adding->from()); if (prev > 0) { @@ -969,16 +974,16 @@ HistoryItem *History::doAddToBack(HistoryBlock *to, bool newBlock, HistoryItem * } } if (adding->hasReplyMarkup()) { - int32 markupFlags = App::replyMarkup(adding->id).flags; + int32 markupFlags = App::replyMarkup(channelId(), adding->id).flags; if (!(markupFlags & MTPDreplyKeyboardMarkup_flag_personal) || adding->notifyByFrom()) { - if (peer->chat) { + if (peer->isChat()) { // CHANNELS_UX peer->asChat()->markupSenders.insert(adding->from(), true); } if (markupFlags & MTPDreplyKeyboardMarkup_flag_ZERO) { // zero markup means replyKeyboardHide - if (lastKeyboardFrom == adding->from()->id || (!lastKeyboardInited && !peer->chat && !adding->out())) { + if (lastKeyboardFrom == adding->from()->id || (!lastKeyboardInited && !peer->isChat() && !adding->out())) { clearLastKeyboard(); } - } else if (peer->chat && (peer->asChat()->count < 1 || !peer->asChat()->participants.isEmpty()) && !peer->asChat()->participants.contains(adding->from())) { + } else if (peer->isChat() && (peer->asChat()->count < 1 || !peer->asChat()->participants.isEmpty()) && !peer->asChat()->participants.contains(adding->from())) { clearLastKeyboard(); } else { lastKeyboardInited = true; @@ -1097,7 +1102,7 @@ void History::addToFront(const QVector &slice) { if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors int32 mask = 0; - QList *lastAuthors = peer->chat ? &(peer->asChat()->lastAuthors) : 0; + QList *lastAuthors = peer->isChat() ? &(peer->asChat()->lastAuthors) : 0; for (int32 i = block->size(); i > 0; --i) { HistoryItem *item = (*block)[i - 1]; HistoryMedia *media = item->getMedia(true); @@ -1120,7 +1125,7 @@ void History::addToFront(const QVector &slice) { lastAuthors->push_back(item->from()); } if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { // chats with bots - int32 markupFlags = App::replyMarkup(item->id).flags; + int32 markupFlags = App::replyMarkup(channelId(), item->id).flags; if (!(markupFlags & MTPDreplyKeyboardMarkup_flag_personal) || item->notifyByFrom()) { bool wasKeyboardHide = peer->asChat()->markupSenders.contains(item->from()); if (!wasKeyboardHide) { @@ -1141,7 +1146,7 @@ void History::addToFront(const QVector &slice) { } } } else if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { // conversations with bots - int32 markupFlags = App::replyMarkup(item->id).flags; + int32 markupFlags = App::replyMarkup(channelId(), item->id).flags; if (!(markupFlags & MTPDreplyKeyboardMarkup_flag_personal) || item->notifyByFrom()) { if (markupFlags & MTPDreplyKeyboardMarkup_flag_ZERO) { clearLastKeyboard(); @@ -1426,7 +1431,7 @@ bool History::isReadyFor(MsgId msgId, bool check) const { } else if (msgId == ShowAtUnreadMsgId) { return check ? (loadedAtBottom() && (msgCount >= unreadCount)) : !isEmpty(); } else if (check) { - HistoryItem *item = App::histItemById(msgId); + HistoryItem *item = App::histItemById(channelId(), msgId); return item && item->history() == this && !item->detached(); } return !isEmpty(); @@ -1549,7 +1554,7 @@ void History::clear(bool leaveItems) { } height = 0; oldLoaded = false; - if (peer->chat) { + if (peer->isChat()) { peer->asChat()->lastAuthors.clear(); peer->asChat()->markupSenders.clear(); } @@ -1818,7 +1823,7 @@ HistoryItem::~HistoryItem() { itemAnimations().remove(this); App::historyUnregItem(this); if (id < 0) { - App::app()->uploader()->cancel(id); + App::app()->uploader()->cancel(fullId()); } } @@ -1878,14 +1883,14 @@ void HistoryPhoto::initDimensions(const HistoryItem *parent) { if (reply) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else { - if (parent->out() || !parent->history()->peer->chat || !fwd) { + if (!parent->displayFromName() || !fwd) { _minh += st::msgPadding.top(); } if (fwd) { _minh += st::msgServiceNameFont->height + st::msgPadding.top(); } } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (!_caption.isEmpty()) { @@ -1931,14 +1936,14 @@ int32 HistoryPhoto::resize(int32 width, bool dontRecountText, const HistoryItem if (reply) { _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else { - if (parent->out() || !parent->history()->peer->chat || !fwd) { + if (!parent->displayFromName() || !fwd) { _height += st::msgPadding.top(); } if (fwd) { _height += st::msgServiceNameFont->height + st::msgPadding.top(); } } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _height += st::msgPadding.top() + st::msgNameFont->height; } if (!_caption.isEmpty()) { @@ -1982,7 +1987,7 @@ void HistoryPhoto::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x } else if (fwd) { skipy = st::msgServiceNameFont->height + st::msgPadding.top(); } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2094,7 +2099,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, i App::roundRect(p, 0, 0, width, _height, bg, cors, &sh); int replyFrom = 0, fwdFrom = 0; - if (!out && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2292,13 +2297,13 @@ void HistoryVideo::initDimensions(const HistoryItem *parent) { _maxw += st::mediaSaveDelta + _buttonWidth; } _minh = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { _minh += st::msgPadding.top(); } _minh += st::msgServiceNameFont->height; @@ -2348,13 +2353,13 @@ int32 HistoryVideo::countHeight(const HistoryItem *parent, int32 width) const { } int32 h = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { h += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { h += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { h += st::msgPadding.top(); } h += st::msgServiceNameFont->height; @@ -2386,7 +2391,7 @@ void HistoryVideo::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2413,7 +2418,7 @@ void HistoryVideo::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x width -= btnw + st::mediaSaveDelta; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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; @@ -2470,7 +2475,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2515,7 +2520,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, bool selected, i RoundCorners cors(selected ? (out ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out ? MessageOutCorners : MessageInCorners)); App::roundRect(p, 0, 0, width, height, bg, cors, &sh); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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()); @@ -2613,13 +2618,13 @@ int32 HistoryVideo::resize(int32 width, bool dontRecountText, const HistoryItem if (_caption.isEmpty()) return _height; _height = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _height += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { _height += st::msgPadding.top(); } _height += st::msgServiceNameFont->height; @@ -2674,13 +2679,13 @@ void HistoryAudio::initDimensions(const HistoryItem *parent) { } _minh = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { _minh += st::msgPadding.top(); } _minh += st::msgServiceNameFont->height; @@ -2700,7 +2705,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2742,7 +2747,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i RoundCorners cors(selected ? (out ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out ? MessageOutCorners : MessageInCorners)); App::roundRect(p, 0, 0, width, _height, bg, cors, &sh); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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()); @@ -2775,7 +2780,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, bool selected, i img = out ? st::mediaAudioOutImg : st::mediaAudioInImg; } else if (already || hasdata) { bool showPause = false; - if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)); showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } else { @@ -2891,7 +2896,7 @@ void HistoryAudio::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -2914,7 +2919,7 @@ void HistoryAudio::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x width -= btnw + st::mediaSaveDelta; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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; @@ -3006,14 +3011,14 @@ void HistoryDocument::initDimensions(const HistoryItem *parent) { } _minh = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { if (!data->song()) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { _minh += st::msgPadding.top(); } _minh += st::msgServiceNameFont->height; @@ -3053,7 +3058,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -3090,7 +3095,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected RoundCorners cors(selected ? (out ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out ? MessageOutCorners : MessageInCorners)); App::roundRect(p, 0, 0, width, _height, bg, cors, &sh); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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()); @@ -3124,13 +3129,13 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected img = out ? st::mediaMusicOutImg : st::mediaMusicInImg; } else if (already || hasdata) { bool showPause = false; - if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)); showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } else { statusText = formatDurationText(data->song()->duration); } - if (!showPause && playing.msgId == parent->id && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; + if (!showPause && playing.msgId == parent->fullId() && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; img = out ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg); } else { if (data->loader) { @@ -3247,15 +3252,15 @@ void HistoryDocument::drawInPlaylist(QPainter &p, const HistoryItem *parent, boo statusText = _uplTextCache; img = st::mediaMusicInImg; } else if (already || hasdata) { - bool isPlaying = (playing.msgId == parent->id); + bool isPlaying = (playing.msgId == parent->fullId()); bool showPause = false; - if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)); showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } else { statusText = formatDurationText(data->song()->duration); } - if (!showPause && playing.msgId == parent->id && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; + if (!showPause && playing.msgId == parent->fullId() && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; img = isPlaying ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg); } else { if (data->loader) { @@ -3416,7 +3421,7 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -3434,7 +3439,7 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 width -= btnw + st::mediaSaveDelta; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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; @@ -3686,13 +3691,13 @@ void HistoryContact::initDimensions(const HistoryItem *parent) { _maxw = phonew + tleft + st::mediaPadding.right(); } _minh = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (const HistoryReply *reply = toHistoryReply(parent)) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else if (const HistoryForwarded *fwd = toHistoryForwarded(parent)) { - if (parent->out() || !parent->history()->peer->chat) { + if (!parent->displayFromName()) { _minh += st::msgPadding.top(); } _minh += st::msgServiceNameFont->height; @@ -3724,7 +3729,7 @@ void HistoryContact::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -3733,7 +3738,7 @@ void HistoryContact::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 skipy += fwdFrom; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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; @@ -3779,7 +3784,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, bool selected, } else if (fwd) { skipy = st::msgServiceNameFont->height; } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -3798,7 +3803,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, bool selected, RoundCorners cors(selected ? (out ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out ? MessageOutCorners : MessageInCorners)); App::roundRect(p, 0, 0, width, _height, bg, cors, &sh); - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { 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()); @@ -4210,13 +4215,13 @@ void HistoryWebPage::draw(QPainter &p, const HistoryItem *parent, bool selected, img = parent->out() ? st::mediaMusicOutImg : st::mediaMusicInImg; } else if (already || hasdata) { bool showPause = false; - if (playing.msgId == parent->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { statusText = formatDurationText(playingPosition / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)) + qsl(" / ") + formatDurationText(playingDuration / (playingFrequency ? playingFrequency : AudioVoiceMsgFrequency)); showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } else { statusText = formatDurationText(data->doc->song()->duration); } - if (!showPause && playing.msgId == parent->id && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; + if (!showPause && playing.msgId == parent->fullId() && App::main() && App::main()->player()->seekingSong(playing)) showPause = true; img = parent->out() ? (showPause ? st::mediaPauseOutImg : st::mediaPlayOutImg) : (showPause ? st::mediaPauseInImg : st::mediaPlayInImg); } else { if (data->doc->loader) { @@ -4925,14 +4930,14 @@ void HistoryImageLink::initDimensions(const HistoryItem *parent) { if (reply) { _minh += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } else { - if (parent->out() || !parent->history()->peer->chat || !fwd) { + if (!parent->displayFromName() || !fwd) { _minh += st::msgPadding.top(); } if (fwd) { _minh += st::msgServiceNameFont->height + st::msgPadding.top(); } } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _minh += st::msgPadding.top() + st::msgNameFont->height; } if (!_title.isEmpty()) { @@ -4967,7 +4972,7 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte App::roundRect(p, 0, 0, width, _height, bg, cors, &sh); int replyFrom = 0, fwdFrom = 0; - if (!out && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -5111,13 +5116,13 @@ int32 HistoryImageLink::resize(int32 width, bool dontRecountText, const HistoryI _height = st::minPhotoSize; } if (reply || !_title.isEmpty() || !_description.isEmpty()) { - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { _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) { + if (!parent->displayFromName() || !fwd) { _height += st::msgPadding.top(); } if (fwd) { @@ -5181,7 +5186,7 @@ void HistoryImageLink::getState(TextLinkPtr &lnk, HistoryCursorState &state, int } if (fwd) { skipy = st::msgServiceNameFont->height + st::msgPadding.top(); } - if (!parent->out() && parent->history()->peer->chat) { + if (parent->displayFromName()) { replyFrom = st::msgPadding.top() + st::msgNameFont->height; fwdFrom = st::msgPadding.top() + st::msgNameFont->height; skipy += replyFrom; @@ -5398,7 +5403,7 @@ void HistoryMessage::initDimensions(const HistoryItem *parent) { void HistoryMessage::fromNameUpdated() const { if (_media) return; - int32 _namew = ((!out() && _history->peer->chat) ? _from->nameText.maxWidth() : 0) + st::msgPadding.left() + st::msgPadding.right(); + int32 _namew = (displayFromName() ? _from->nameText.maxWidth() : 0) + st::msgPadding.left() + st::msgPadding.right(); if (_namew > _maxw) _maxw = _namew; } @@ -5514,7 +5519,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const { width = mwidth; } - if (!out() && _history->peer->chat) { + if (displayFromName()) { p.drawPixmap(left, _height - st::msgMargin.bottom() - st::msgPhotoSize, _from->photo->pixRounded(st::msgPhotoSize)); // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; @@ -5538,7 +5543,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const { RoundCorners cors(selected ? (out() ? MessageOutSelectedCorners : MessageInSelectedCorners) : (out() ? MessageOutCorners : MessageInCorners)); App::roundRect(p, r, bg, cors, &sh); - if (!out() && _history->peer->chat) { + if (displayFromName()) { p.setFont(st::msgNameFont->f); p.setPen(_from->color->p); _from->nameText.drawElided(p, r.left() + st::msgPadding.left(), r.top() + st::msgPadding.top(), width - st::msgPadding.left() - st::msgPadding.right()); @@ -5612,7 +5617,7 @@ int32 HistoryMessage::resize(int32 width, bool dontRecountText, const HistoryIte _height = _textHeight; if (_media && _media->isDisplayed()) _height += st::msgPadding.bottom() + _media->resize(nwidth, dontRecountText, this); } - if (!out() && _history->peer->chat) { + if (displayFromName()) { _height += st::msgNameFont->height; } _height += st::msgPadding.top() + st::msgPadding.bottom(); @@ -5632,7 +5637,7 @@ bool HistoryMessage::hasPoint(int32 x, int32 y) const { width = mwidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo left += st::msgPhotoSkip; } if (width < 1) return false; @@ -5662,12 +5667,12 @@ void HistoryMessage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 width = mwidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo if (x >= left && x < left + st::msgPhotoSize && y >= _height - st::msgMargin.bottom() - st::msgPhotoSize && y < _height - st::msgMargin.bottom()) { lnk = _from->lnk; return; } - // width -= st::msgPhotoSkip; +// width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } if (width < 1) return; @@ -5681,7 +5686,7 @@ void HistoryMessage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 return; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { // from user left name + if (displayFromName()) { // from user left name if (x >= r.left() + st::msgPadding.left() && y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + st::msgNameFont->height && x < r.left() + r.width() - st::msgPadding.right() && x < r.left() + st::msgPadding.left() + _from->nameText.maxWidth()) { lnk = _from->lnk; return; @@ -5731,7 +5736,7 @@ void HistoryMessage::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } @@ -5742,7 +5747,7 @@ void HistoryMessage::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, width = _maxw; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { // from user left name + if (displayFromName()) { // from user left name r.setTop(r.top() + st::msgNameFont->height); } QRect trect(r.marginsAdded(-st::msgPadding)); @@ -5756,7 +5761,7 @@ void HistoryMessage::drawInDialog(QPainter &p, const QRect &r, bool act, const H if (cacheFor != this) { cacheFor = this; QString msg(inDialogsText()); - if (_history->peer->chat || out()) { + if (!_history->peer->isUser() || out()) { // CHANNELS_UI TextCustomTagsMap custom; custom.insert(QChar('c'), qMakePair(textcmdStartLink(1), textcmdStopLink())); msg = lng_message_with_from(lt_from, textRichPrepare((_from == App::self()) ? lang(lng_from_you) : _from->firstName), lt_message, textRichPrepare(msg)); @@ -5775,7 +5780,7 @@ void HistoryMessage::drawInDialog(QPainter &p, const QRect &r, bool act, const H } QString HistoryMessage::notificationHeader() const { - return _history->peer->chat ? from()->name : QString(); + return !_history->peer->isUser() ? from()->name : QString(); } QString HistoryMessage::notificationText() const { @@ -5790,7 +5795,7 @@ HistoryMessage::~HistoryMessage() { delete _media; } if (_flags & MTPDmessage::flag_reply_markup) { - App::clearReplyMarkup(id); + App::clearReplyMarkup(channelId(), id); } } @@ -5880,7 +5885,7 @@ bool HistoryForwarded::hasPoint(int32 x, int32 y) const { width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } @@ -5907,7 +5912,7 @@ void HistoryForwarded::getState(TextLinkPtr &lnk, HistoryCursorState &state, int width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo if (x >= left && x < left + st::msgPhotoSize) { return HistoryMessage::getState(lnk, state, x, y); } @@ -5921,7 +5926,7 @@ void HistoryForwarded::getState(TextLinkPtr &lnk, HistoryCursorState &state, int width = _maxw; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { + if (displayFromName()) { style::font nameFont(st::msgNameFont); if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { return HistoryMessage::getState(lnk, state, x, y); @@ -5965,7 +5970,7 @@ void HistoryForwarded::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } @@ -5976,7 +5981,7 @@ void HistoryForwarded::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 width = _maxw; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { + if (displayFromName()) { style::font nameFont(st::msgNameFont); if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { return HistoryMessage::getSymbol(symbol, after, upon, x, y); @@ -5997,7 +6002,7 @@ HistoryReply::HistoryReply(History *history, HistoryBlock *block, const MTPDmess , _maxReplyWidth(0) { if (!updateReplyTo()) { - App::api()->requestReplyTo(this, replyToMsgId); + App::api()->requestReplyTo(this, FullMsgId(history->channelId(), replyToMsgId)); } } @@ -6008,7 +6013,7 @@ HistoryReply::HistoryReply(History *history, HistoryBlock *block, MsgId msgId, i , _maxReplyWidth(0) { if (!updateReplyTo()) { - App::api()->requestReplyTo(this, replyToMsgId); + App::api()->requestReplyTo(this, FullMsgId(history->channelId(), replyToMsgId)); } } @@ -6035,7 +6040,7 @@ void HistoryReply::initDimensions(const HistoryItem *parent) { bool HistoryReply::updateReplyTo(bool force) { if (replyToMsg || !replyToMsgId) return true; - replyToMsg = App::histItemById(replyToMsgId); + replyToMsg = App::histItemById(channelId(), replyToMsgId); if (replyToMsg) { App::historyRegReply(this, replyToMsg); replyToText.setText(st::msgFont, replyToMsg->inReplyText(), _textDlgOptions); @@ -6183,7 +6188,7 @@ bool HistoryReply::hasPoint(int32 x, int32 y) const { width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } @@ -6210,7 +6215,7 @@ void HistoryReply::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo if (x >= left && x < left + st::msgPhotoSize) { return HistoryMessage::getState(lnk, state, x, y); } @@ -6224,7 +6229,7 @@ void HistoryReply::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x width = _maxw; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { + if (displayFromName()) { style::font nameFont(st::msgNameFont); if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { return HistoryMessage::getState(lnk, state, x, y); @@ -6265,7 +6270,7 @@ void HistoryReply::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, i width = st::msgMaxWidth; } - if (!out() && _history->peer->chat) { // from user left photo + if (displayFromName()) { // from user left photo // width -= st::msgPhotoSkip; left += st::msgPhotoSkip; } @@ -6276,7 +6281,7 @@ void HistoryReply::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, i width = _maxw; } QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (!out() && _history->peer->chat) { + if (displayFromName()) { style::font nameFont(st::msgNameFont); if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { return HistoryMessage::getSymbol(symbol, after, upon, x, y); @@ -6307,10 +6312,10 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { switch (action.type()) { case mtpc_messageActionChatAddUser: { const MTPDmessageActionChatAddUser &d(action.c_messageActionChatAddUser()); - if (App::peerFromUser(d.vuser_id) == _from->id) { + if (peerFromUser(d.vuser_id) == _from->id) { text = lng_action_user_joined(lt_from, from); } else { - UserData *u = App::user(App::peerFromUser(d.vuser_id)); + UserData *u = App::user(peerFromUser(d.vuser_id)); second = TextLinkPtr(new PeerLink(u)); text = lng_action_add_user(lt_from, from, lt_user, textcmdLink(2, u->name)); } @@ -6318,7 +6323,7 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { case mtpc_messageActionChatJoinedByLink: { const MTPDmessageActionChatJoinedByLink &d(action.c_messageActionChatJoinedByLink()); - if (true || App::peerFromUser(d.vinviter_id) == _from->id) { + if (true || 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)); @@ -6338,10 +6343,10 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { case mtpc_messageActionChatDeleteUser: { const MTPDmessageActionChatDeleteUser &d(action.c_messageActionChatDeleteUser()); - if (App::peerFromUser(d.vuser_id) == _from->id) { + if (peerFromUser(d.vuser_id) == _from->id) { text = lng_action_user_left(lt_from, from); } else { - UserData *u = App::user(App::peerFromUser(d.vuser_id)); + UserData *u = App::user(peerFromUser(d.vuser_id)); second = TextLinkPtr(new PeerLink(u)); text = lng_action_kick_user(lt_from, from, lt_user, textcmdLink(2, u->name)); } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index e696535a4..a8cf80b86 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -160,6 +160,9 @@ class HistoryMessage; class HistoryUnreadBar; struct History : public QList { History(const PeerId &peerId); + ChannelId channelId() const { + return peerToChannel(peer->id); + } typedef QList Parent; void clear(bool leaveItems = false); @@ -774,9 +777,17 @@ public: virtual QString notificationText() const = 0; void markRead(); - int32 y, id; + int32 y; + MsgId id; QDateTime date; + ChannelId channelId() const { + return _history->channelId(); + } + FullMsgId fullId() const { + return FullMsgId(channelId(), id); + } + virtual HistoryMedia *getMedia(bool inOverview = false) const { return 0; } @@ -818,6 +829,10 @@ public: return 0; } + bool displayFromName() const { + return !out() && !history()->peer->isUser(); + } + virtual ~HistoryItem(); protected: diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 614eb4d68..0a4d2d58c 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -37,7 +37,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0) , hist(history) , ySkip(0) - , botInfo(history->peer->chat ? 0 : history->peer->asUser()->botInfo) + , botInfo(history->peer->isUser() ? history->peer->asUser()->botInfo : 0) , botDescWidth(0), botDescHeight(0) , historyWidget(historyWidget) , scrollArea(scroll) @@ -1636,7 +1636,7 @@ void MessageField::focusInEvent(QFocusEvent *e) { emit focused(); } -BotKeyboard::BotKeyboard() : _wasForMsgId(0), _height(0), _maxOuterHeight(0), _maximizeSize(false), _singleUse(false), _forceReply(false), +BotKeyboard::BotKeyboard() : _height(0), _maxOuterHeight(0), _maximizeSize(false), _singleUse(false), _forceReply(false), _sel(-1), _down(-1), _hoverAnim(animFunc(this, &BotKeyboard::hoverStep)), _st(&st::botKbButton) { setGeometry(0, 0, _st->margin, _st->margin); _height = _st->margin; @@ -1749,7 +1749,7 @@ void BotKeyboard::mouseReleaseEvent(QMouseEvent *e) { updateSelected(); if (_sel == down && down >= 0) { int row = (down / MatrixRowShift), col = down % MatrixRowShift; - App::sendBotCommand(_btns.at(row).at(col).cmd, _wasForMsgId); + App::sendBotCommand(_btns.at(row).at(col).cmd, _wasForMsgId.msg); } } @@ -1760,12 +1760,12 @@ void BotKeyboard::leaveEvent(QEvent *e) { bool BotKeyboard::updateMarkup(HistoryItem *to) { if (to && to->hasReplyMarkup()) { - if (_wasForMsgId == to->id) return false; + if (_wasForMsgId == FullMsgId(to->channelId(), to->id)) return false; - _wasForMsgId = to->id; + _wasForMsgId = FullMsgId(to->channelId(), to->id); clearSelection(); _btns.clear(); - const ReplyMarkup &markup(App::replyMarkup(to->id)); + const ReplyMarkup &markup(App::replyMarkup(to->channelId(), to->id)); _forceReply = markup.flags & MTPDreplyKeyboardMarkup_flag_FORCE_REPLY; _maximizeSize = !(markup.flags & MTPDreplyKeyboardMarkup_flag_resize); _singleUse = _forceReply || (markup.flags & MTPDreplyKeyboardMarkup_flag_single_use); @@ -1796,9 +1796,9 @@ bool BotKeyboard::updateMarkup(HistoryItem *to) { } return true; } - if (_wasForMsgId) { + if (_wasForMsgId.msg) { _maximizeSize = _singleUse = _forceReply = false; - _wasForMsgId = 0; + _wasForMsgId = FullMsgId(); clearSelection(); _btns.clear(); return true; @@ -2145,7 +2145,7 @@ bool HistoryHider::offerPeer(PeerId peer) { } offered = App::peer(peer); LangString phrase; - QString recipient = offered->chat ? '\xAB' + offered->name + '\xBB' : offered->name; + QString recipient = offered->isUser() ? offered->name : '\xAB' + offered->name + '\xBB'; if (_sharedContact) { phrase = lng_forward_share_contact(lt_recipient, recipient); } else if (_sendPath) { @@ -2205,6 +2205,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) , _replyReturn(0) , _stickersUpdateRequest(0) , _peer(0) +, _channel(NoChannel) , _showAtMsgId(0) , _preloadRequest(0), _preloadDownRequest(0) , _delayedShowAtMsgId(-1) @@ -2547,7 +2548,7 @@ void HistoryWidget::updateStickers() { } void HistoryWidget::botCommandsChanged(UserData *user) { - if (_peer && (_peer == user || _peer->chat)) { + if (_peer && (_peer == user || !_peer->isUser())) { if (_attachMention.clearFilteredCommands()) { checkMentionDropdown(); } @@ -2659,10 +2660,10 @@ void HistoryWidget::setReplyReturns(PeerId peer, const QList &replyReturn if (!_peer || _peer->id != peer) return; _replyReturns = replyReturns; - _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_replyReturns.back()); + _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_channel, _replyReturns.back()); while (!_replyReturns.isEmpty() && !_replyReturn) { _replyReturns.pop_back(); - _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_replyReturns.back()); + _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_channel, _replyReturns.back()); } updateControlsVisibility(); } @@ -2671,7 +2672,7 @@ void HistoryWidget::calcNextReplyReturn() { _replyReturn = 0; while (!_replyReturns.isEmpty() && !_replyReturn) { _replyReturns.pop_back(); - _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_replyReturns.back()); + _replyReturn = _replyReturns.isEmpty() ? 0 : App::histItemById(_channel, _replyReturns.back()); } if (!_replyReturn) updateControlsVisibility(); } @@ -2795,6 +2796,8 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { } _peer = peerId ? App::peer(peerId) : 0; + _channel = _peer ? peerToChannel(_peer->id) : NoChannel; + _unblockRequest = 0; _titlePeerText = QString(); @@ -2871,7 +2874,7 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { } if (_replyToId) { updateReplyTo(); - if (!_replyTo) App::api()->requestReplyTo(0, _replyToId); + if (!_replyTo) App::api()->requestReplyTo(0, FullMsgId(_channel, _replyToId)); resizeEvent(0); } if (!_previewCancelled) { @@ -2933,7 +2936,15 @@ void HistoryWidget::updateControlsVisibility() { } else { _scroll.show(); } - if ((_peer->chat && !_peer->asChat()->forbidden && !_peer->asChat()->left) || (!_peer->chat && _peer->asUser()->access != UserNoAccess)) { + bool avail = false; + if (_peer->isUser()) { + avail = _peer->asUser()->access != UserNoAccess; + } else if (_peer->isChat()) { + avail = !_peer->asChat()->forbidden && !_peer->asChat()->left; + } else if (_peer->isChannel()) { + avail = !_peer->asChannel()->forbidden && !_peer->asChannel()->left; + } + if (avail) { checkMentionDropdown(); if (isBlocked()) { _botStart.hide(); @@ -3240,7 +3251,7 @@ void HistoryWidget::firstLoadMessages() { offset = -loadCount / 2; from = _showAtMsgId; } - _firstLoadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(from), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); + _firstLoadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(from), MTP_int(0), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); } void HistoryWidget::loadMessages() { @@ -3248,7 +3259,7 @@ void HistoryWidget::loadMessages() { MsgId min = _history->minMsgId(); int32 offset = 0, loadCount = min ? MessagesPerPage : MessagesFirstLoad; - _preloadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(min), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); + _preloadRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(min), MTP_int(0), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); } void HistoryWidget::loadMessagesDown() { @@ -3258,7 +3269,7 @@ void HistoryWidget::loadMessagesDown() { if (!max) return; int32 loadCount = MessagesPerPage, offset = -loadCount - 1; - _preloadDownRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(max + 1), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); + _preloadDownRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(max + 1), MTP_int(0), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); } void HistoryWidget::delayedShowAt(MsgId showAtMsgId) { @@ -3277,7 +3288,7 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) { } else if (_delayedShowAtMsgId > 0) { offset = -loadCount / 2; } - _delayedShowAtRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(from), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); + _delayedShowAtRequest = MTP::send(MTPmessages_GetHistory(_peer->input, MTP_int(offset), MTP_int(from), MTP_int(0), MTP_int(loadCount)), rpcDone(&HistoryWidget::messagesReceived), rpcFail(&HistoryWidget::messagesFailed)); } void HistoryWidget::onListScroll() { @@ -3332,7 +3343,7 @@ void HistoryWidget::onHistoryToEnd() { void HistoryWidget::onSend(bool ctrlShiftEnter, MsgId replyTo) { if (!_history) return; - bool lastKeyboardUsed = lastForceReplyReplied(replyTo); + bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(_channel, replyTo)); QString text = prepareMessage(_field.getLastText()); if (!text.isEmpty()) { App::main()->readServerHistory(_history, false); @@ -3364,7 +3375,7 @@ void HistoryWidget::onSend(bool ctrlShiftEnter, MsgId replyTo) { void HistoryWidget::onUnblock() { if (_unblockRequest) return; - if (!_peer || _peer->chat || _peer->asUser()->blocked != UserIsBlocked) { + if (!_peer || !_peer->isUser() || _peer->asUser()->blocked != UserIsBlocked) { updateControlsVisibility(); return; } @@ -3373,7 +3384,7 @@ void HistoryWidget::onUnblock() { } void HistoryWidget::unblockDone(PeerData *peer, const MTPBool &result) { - if (peer->chat) return; + if (!peer->isUser()) return; _unblockRequest = 0; peer->asUser()->blocked = UserIsNotBlocked; emit App::main()->peerUpdated(peer); @@ -3386,7 +3397,7 @@ bool HistoryWidget::unblockFail(const RPCError &error) { } void HistoryWidget::onBotStart() { - if (!_peer || _peer->chat || !_peer->asUser()->botInfo) { + if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo) { updateControlsVisibility(); return; } @@ -3396,11 +3407,11 @@ void HistoryWidget::onBotStart() { sendBotCommand(qsl("/start"), 0); } else { uint64 randomId = MTP::nonce(); - MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_int(0), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser())); + MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_inputChat(MTP_int(0)), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser())); _peer->asUser()->botInfo->startToken = QString(); if (_keyboard.hasMarkup()) { - if (_keyboard.singleUse() && _keyboard.forMsgId() == _history->lastKeyboardId && _history->lastKeyboardUsed) { + if (_keyboard.singleUse() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) { _kbWasHidden = true; } if (!_kbWasHidden) _kbShown = _keyboard.hasMarkup(); @@ -3416,14 +3427,14 @@ void HistoryWidget::onShareContact(const PeerId &peer, UserData *contact) { App::main()->showPeerHistory(peer, ShowAtTheEndMsgId); if (!_history) return; - shareContact(peer, contact->phone, contact->firstName, contact->lastName, replyToId(), int32(contact->id & 0xFFFFFFFF)); + shareContact(peer, contact->phone, contact->firstName, contact->lastName, replyToId(), peerToUser(contact->id)); } void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, int32 userId) { History *h = App::history(peer); uint64 randomId = MTP::nonce(); - MsgId newId = clientMsgId(); + FullMsgId newId(peerToChannel(peer), clientMsgId()); App::main()->readServerHistory(h, false); fastShowAtEnd(h); @@ -3431,14 +3442,14 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const PeerData *p = App::peer(peer); int32 flags = newMessageFlags(p) | MTPDmessage::flag_media; // unread, out - bool lastKeyboardUsed = lastForceReplyReplied(replyTo); + bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(peerToChannel(peer), replyTo)); int32 sendFlags = 0; if (replyTo) { flags |= MTPDmessage::flag_reply_to_msg_id; sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; } - h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(peer), MTPint(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities)); + h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(MTP::authedId()), peerToMTP(peer), MTPint(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities)); h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, h->sendRequestId); App::historyRegRandom(randomId, newId); @@ -3722,17 +3733,17 @@ void HistoryWidget::sendBotCommand(const QString &cmd, MsgId replyTo) { // reply App::main()->readServerHistory(_history, false); fastShowAtEnd(_history); - bool lastKeyboardUsed = (_keyboard.forMsgId() == _history->lastKeyboardId) && (_keyboard.forMsgId() == replyTo); + bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, replyTo)); QString toSend = cmd; - UserData *bot = _peer->chat ? (App::hoveredLinkItem() ? (App::hoveredLinkItem()->toHistoryForwarded() ? App::hoveredLinkItem()->toHistoryForwarded()->fromForwarded() : App::hoveredLinkItem()->from()) : 0) : _peer->asUser(); + UserData *bot = _peer->isUser() ? _peer->asUser() : (App::hoveredLinkItem() ? (App::hoveredLinkItem()->toHistoryForwarded() ? App::hoveredLinkItem()->toHistoryForwarded()->fromForwarded() : App::hoveredLinkItem()->from()) : 0); QString username = (bot && bot->botInfo) ? bot->username : QString(); - if (!replyTo && toSend.indexOf('@') < 2 && _peer->chat && !username.isEmpty() && (_peer->asChat()->botStatus == 0 || _peer->asChat()->botStatus == 2)) { + int32 botStatus = _peer->isChat() ? _peer->asChat()->botStatus : (_peer->isChannel() ? _peer->asChannel()->botStatus : -1); + if (!replyTo && toSend.indexOf('@') < 2 && !username.isEmpty() && (botStatus == 0 || botStatus == 2)) { toSend += '@' + username; } - int32 botStatus = _peer->chat ? _peer->asChat()->botStatus : -1; - App::main()->sendPreparedText(_history, toSend, replyTo ? ((_peer->chat/* && (botStatus == 0 || botStatus == 2)*/) ? replyTo : -1) : 0); + App::main()->sendPreparedText(_history, toSend, replyTo ? ((!_peer->isUser()/* && (botStatus == 0 || botStatus == 2)*/) ? replyTo : -1) : 0); if (replyTo) { cancelReply(); if (_keyboard.singleUse() && _keyboard.hasMarkup() && lastKeyboardUsed) { @@ -3748,9 +3759,10 @@ void HistoryWidget::insertBotCommand(const QString &cmd) { if (!_history) return; QString toInsert = cmd; - UserData *bot = _peer->chat ? (App::hoveredLinkItem() ? (App::hoveredLinkItem()->toHistoryForwarded() ? App::hoveredLinkItem()->toHistoryForwarded()->fromForwarded() : App::hoveredLinkItem()->from()) : 0) : _peer->asUser(); + UserData *bot = _peer->isUser() ? _peer->asUser() : (App::hoveredLinkItem() ? (App::hoveredLinkItem()->toHistoryForwarded() ? App::hoveredLinkItem()->toHistoryForwarded()->fromForwarded() : App::hoveredLinkItem()->from()) : 0); QString username = (bot && bot->botInfo) ? bot->username : QString(); - if (toInsert.indexOf('@') < 2 && _peer->chat && !username.isEmpty() && (_peer->asChat()->botStatus == 0 || _peer->asChat()->botStatus == 2)) { + int32 botStatus = _peer->isChat() ? _peer->asChat()->botStatus : (_peer->isChannel() ? _peer->asChannel()->botStatus : -1); + if (toInsert.indexOf('@') < 2 && !username.isEmpty() && (botStatus == 0 || botStatus == 2)) { toInsert += '@' + username; } toInsert += ' '; @@ -3848,17 +3860,17 @@ void HistoryWidget::updateDragAreas() { } bool HistoryWidget::isBotStart() const { - if (!_peer || _peer->chat || !_peer->asUser()->botInfo) return false; + if (!_peer || !_peer->isUser() || !_peer->asUser()->botInfo) return false; return !_peer->asUser()->botInfo->startToken.isEmpty() || (_history->isEmpty() && !_history->lastMsg); } bool HistoryWidget::isBlocked() const { - return _peer && !_peer->chat && _peer->asUser()->blocked == UserIsBlocked; + return _peer && _peer->isUser() && _peer->asUser()->blocked == UserIsBlocked; } bool HistoryWidget::updateCmdStartShown() { bool cmdStartShown = false; - if (_history && _peer && ((_peer->chat && _peer->asChat()->botStatus > 0) || (!_peer->chat && _peer->asUser()->botInfo))) { + if (_history && _peer && ((_peer->isChat() && _peer->asChat()->botStatus > 0) || (_peer->isChannel() && _peer->asChannel()->botStatus > 0) || (_peer->isUser() && _peer->asUser()->botInfo))) { if (!isBotStart() && !isBlocked() && !_keyboard.hasMarkup() && !_keyboard.forceReply()) { if (_field.getLastText().isEmpty()) { cmdStartShown = true; @@ -3948,7 +3960,7 @@ void HistoryWidget::onKbToggle(bool manual) { _field.setMaxHeight(st::maxFieldHeight); - _kbReplyTo = (_history->peer->chat || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; + _kbReplyTo = (_history->peer->isChat() || _history->peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; if (_kbReplyTo && !_replyToId) { updateReplyToName(); _replyToText.setText(st::msgFont, _kbReplyTo->inDialogsText(), _textDlgOptions); @@ -3964,7 +3976,7 @@ void HistoryWidget::onKbToggle(bool manual) { int32 maxh = qMin(_keyboard.height(), int(st::maxFieldHeight) - (int(st::maxFieldHeight) / 2)); _field.setMaxHeight(st::maxFieldHeight - maxh); - _kbReplyTo = (_history->peer->chat || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; + _kbReplyTo = (_history->peer->isChat() || _history->peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; if (_kbReplyTo && !_replyToId) { updateReplyToName(); _replyToText.setText(st::msgFont, _kbReplyTo->inDialogsText(), _textDlgOptions); @@ -4069,7 +4081,9 @@ void HistoryWidget::updateOnlineDisplay(int32 x, int32 w) { QString text; int32 t = unixtime(); - if (_peer->chat) { + if (_peer->isUser()) { + text = App::onlineText(_peer->asUser(), t); + } else if (_peer->isChat()) { ChatData *chat = _peer->asChat(); if (chat->forbidden || chat->left) { text = lang(lng_chat_status_unaccessible); @@ -4090,8 +4104,8 @@ void HistoryWidget::updateOnlineDisplay(int32 x, int32 w) { text = lng_chat_status_members(lt_count, chat->participants.size()); } } - } else { - text = App::onlineText(_peer->asUser(), t); + } else if (_peer->isChannel()) { + // CHANNELS_UI } if (_titlePeerText != text) { _titlePeerText = text; @@ -4107,7 +4121,9 @@ void HistoryWidget::updateOnlineDisplayTimer() { if (!_history) return; int32 t = unixtime(), minIn = 86400; - if (_peer->chat) { + if (_peer->isUser()) { + minIn = App::onlineWillChangeIn(_peer->asUser(), t); + } else if (_peer->isChat()) { ChatData *chat = _peer->asChat(); if (chat->participants.isEmpty()) return; @@ -4117,8 +4133,8 @@ void HistoryWidget::updateOnlineDisplayTimer() { minIn = onlineWillChangeIn; } } - } else { - minIn = App::onlineWillChangeIn(_peer->asUser(), t); + } else if (_peer->isChannel()) { + // CHANNELS_UI } App::main()->updateOnlineDisplayIn(minIn * 1000); } @@ -4163,8 +4179,8 @@ void HistoryWidget::checkMentionDropdown() { _field.getMentionHashtagBotCommandStart(start); if (!start.isEmpty()) { if (start.at(0) == '#' && cRecentWriteHashtags().isEmpty() && cRecentSearchHashtags().isEmpty()) Local::readRecentHashtags(); - if (start.at(0) == '@' && !_history->peer->chat) return; - if (start.at(0) == '/' && !_history->peer->chat && !_history->peer->asUser()->botInfo) return; + if (start.at(0) == '@' && _history->peer->isUser()) return; + if (start.at(0) == '/' && _history->peer->isUser() && !_history->peer->asUser()->botInfo) return; _attachMention.showFiltered(_history->peer, start); } else if (!_attachMention.isHidden()) { _attachMention.hideStart(); @@ -4211,7 +4227,7 @@ void HistoryWidget::uploadConfirmImageUncompressed(bool ctrlShiftEnter, MsgId re if (_confirmWithText) { onSend(ctrlShiftEnter, replyTo); } - bool lastKeyboardUsed = lastForceReplyReplied(replyTo); + bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(_channel, replyTo)); _imageLoader.append(_confirmImage, peerId, replyTo, ToPrepareDocument, ctrlShiftEnter); _confirmImageId = 0; _confirmWithText = false; @@ -4290,18 +4306,18 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { _confirmWithText = false; _confirmImage = QImage(); } - MsgId newId = clientMsgId(); + FullMsgId newId(peerToChannel(img.peer), clientMsgId()); - connect(App::uploader(), SIGNAL(photoReady(MsgId, const MTPInputFile &)), this, SLOT(onPhotoUploaded(MsgId, const MTPInputFile &)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(documentReady(MsgId, const MTPInputFile &)), this, SLOT(onDocumentUploaded(MsgId, const MTPInputFile &)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(thumbDocumentReady(MsgId, const MTPInputFile &, const MTPInputFile &)), this, SLOT(onThumbDocumentUploaded(MsgId, const MTPInputFile &, const MTPInputFile &)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(audioReady(MsgId, const MTPInputFile &)), this, SLOT(onAudioUploaded(MsgId, const MTPInputFile &)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(photoProgress(MsgId)), this, SLOT(onPhotoProgress(MsgId)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(documentProgress(MsgId)), this, SLOT(onDocumentProgress(MsgId)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(audioProgress(MsgId)), this, SLOT(onAudioProgress(MsgId)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(photoFailed(MsgId)), this, SLOT(onPhotoFailed(MsgId)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(documentFailed(MsgId)), this, SLOT(onDocumentFailed(MsgId)), Qt::UniqueConnection); - connect(App::uploader(), SIGNAL(audioFailed(MsgId)), this, SLOT(onAudioFailed(MsgId)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(photoReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onPhotoUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(documentReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onDocumentUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(thumbDocumentReady(const FullMsgId&, const MTPInputFile&, const MTPInputFile&)), this, SLOT(onThumbDocumentUploaded(const FullMsgId&, const MTPInputFile&, const MTPInputFile&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(audioReady(const FullMsgId&, const MTPInputFile&)), this, SLOT(onAudioUploaded(const FullMsgId&, const MTPInputFile&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(photoProgress(const FullMsgId&)), this, SLOT(onPhotoProgress(const FullMsgId&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(documentProgress(const FullMsgId&)), this, SLOT(onDocumentProgress(const FullMsgId&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(audioProgress(const FullMsgId&)), this, SLOT(onAudioProgress(const FullMsgId&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(photoFailed(const FullMsgId&)), this, SLOT(onPhotoFailed(const FullMsgId&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(documentFailed(const FullMsgId&)), this, SLOT(onDocumentFailed(const FullMsgId&)), Qt::UniqueConnection); + connect(App::uploader(), SIGNAL(audioFailed(const FullMsgId&)), this, SLOT(onAudioFailed(const FullMsgId&)), Qt::UniqueConnection); App::uploader()->uploadMedia(newId, img); @@ -4312,12 +4328,12 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) { int32 flags = newMessageFlags(h->peer) | MTPDmessage::flag_media; // unread, out if (img.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id; if (img.type == ToPreparePhoto) { - 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("")), MTPnullMarkup, MTPnullEntities)); + h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(MTP::authedId()), peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string("")), MTPnullMarkup, MTPnullEntities)); } else if (img.type == ToPrepareDocument) { - 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_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities)); + h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(MTP::authedId()), peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities)); } else if (img.type == ToPrepareAudio) { flags |= MTPDmessage_flag_media_unread; - 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_messageMediaAudio(img.audio), MTPnullMarkup, MTPnullEntities)); + h->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(MTP::authedId()), peerToMTP(img.peer), MTPint(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(img.audio), MTPnullMarkup, MTPnullEntities)); } if (_peer && img.peer == _peer->id) { @@ -4334,7 +4350,7 @@ void HistoryWidget::cancelSendImage() { _confirmImage = QImage(); } -void HistoryWidget::onPhotoUploaded(MsgId newId, const MTPInputFile &file) { +void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, const MTPInputFile &file) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4367,7 +4383,7 @@ namespace { } } -void HistoryWidget::onDocumentUploaded(MsgId newId, const MTPInputFile &file) { +void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, const MTPInputFile &file) { if (!MTP::authedId()) return; HistoryMessage *item = dynamic_cast(App::histItemById(newId)); if (item) { @@ -4391,7 +4407,7 @@ void HistoryWidget::onDocumentUploaded(MsgId newId, const MTPInputFile &file) { } } -void HistoryWidget::onThumbDocumentUploaded(MsgId newId, const MTPInputFile &file, const MTPInputFile &thumb) { +void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, const MTPInputFile &file, const MTPInputFile &thumb) { if (!MTP::authedId()) return; HistoryMessage *item = dynamic_cast(App::histItemById(newId)); if (item) { @@ -4415,7 +4431,7 @@ void HistoryWidget::onThumbDocumentUploaded(MsgId newId, const MTPInputFile &fil } } -void HistoryWidget::onAudioUploaded(MsgId newId, const MTPInputFile &file) { +void HistoryWidget::onAudioUploaded(const FullMsgId &newId, const MTPInputFile &file) { if (!MTP::authedId()) return; HistoryMessage *item = dynamic_cast(App::histItemById(newId)); if (item) { @@ -4437,7 +4453,7 @@ void HistoryWidget::onAudioUploaded(MsgId newId, const MTPInputFile &file) { } } -void HistoryWidget::onPhotoProgress(MsgId newId) { +void HistoryWidget::onPhotoProgress(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4447,7 +4463,7 @@ void HistoryWidget::onPhotoProgress(MsgId newId) { } } -void HistoryWidget::onDocumentProgress(MsgId newId) { +void HistoryWidget::onDocumentProgress(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4457,7 +4473,7 @@ void HistoryWidget::onDocumentProgress(MsgId newId) { } } -void HistoryWidget::onAudioProgress(MsgId newId) { +void HistoryWidget::onAudioProgress(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4467,7 +4483,7 @@ void HistoryWidget::onAudioProgress(MsgId newId) { } } -void HistoryWidget::onPhotoFailed(MsgId newId) { +void HistoryWidget::onPhotoFailed(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4476,7 +4492,7 @@ void HistoryWidget::onPhotoFailed(MsgId newId) { } } -void HistoryWidget::onDocumentFailed(MsgId newId) { +void HistoryWidget::onDocumentFailed(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4485,7 +4501,7 @@ void HistoryWidget::onDocumentFailed(MsgId newId) { } } -void HistoryWidget::onAudioFailed(MsgId newId) { +void HistoryWidget::onAudioFailed(const FullMsgId &newId) { if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { @@ -4614,7 +4630,15 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, } else if (isBotStart()) { newScrollHeight -= _botStart.height(); } else { - if ((_peer->chat && !_peer->asChat()->forbidden && !_peer->asChat()->left) || (!_peer->chat && _peer->asUser()->access != UserNoAccess)) { + bool avail = false; + if (_peer->isUser()) { + avail = (_peer->asUser()->access != UserNoAccess); + } else if (_peer->isChat()) { + avail = (!_peer->asChat()->forbidden && !_peer->asChat()->left); + } else if (_peer->isChannel()) { + avail = (!_peer->asChannel()->forbidden && !_peer->asChannel()->left); + } + if (avail) { newScrollHeight -= (_field.height() + 2 * st::sendPadding); } if (replyToId() || App::main()->hasForwardingItems() || (_previewData && _previewData->pendingTill >= 0)) { @@ -4668,7 +4692,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, toY = newSt; _history->lastWidth = 0; } else if (initial && _showAtMsgId > 0) { - HistoryItem *item = App::histItemById(_showAtMsgId); + HistoryItem *item = App::histItemById(_channel, _showAtMsgId); if (!item || item->detached()) { _showAtMsgId = 0; _histInited = false; @@ -4742,14 +4766,14 @@ void HistoryWidget::updateBotKeyboard() { } else if (_replyTo) { changed = _keyboard.updateMarkup(_replyTo); } else { - changed = _keyboard.updateMarkup(_history->lastKeyboardId ? App::histItemById(_history->lastKeyboardId) : 0); + changed = _keyboard.updateMarkup(_history->lastKeyboardId ? App::histItemById(_channel, _history->lastKeyboardId) : 0); } updateCmdStartShown(); if (!changed) return; bool hasMarkup = _keyboard.hasMarkup(), forceReply = _keyboard.forceReply() && !_replyTo; if (hasMarkup || forceReply) { - if (_keyboard.singleUse() && _keyboard.hasMarkup() && _keyboard.forMsgId() == _history->lastKeyboardId && _history->lastKeyboardUsed) _kbWasHidden = true; + if (_keyboard.singleUse() && _keyboard.hasMarkup() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _history->lastKeyboardUsed) _kbWasHidden = true; if (!isBotStart() && !isBlocked() && (wasVisible || _replyTo || (_field.getLastText().isEmpty() && !_kbWasHidden))) { if (!_showAnim.animating()) { if (hasMarkup) { @@ -4767,7 +4791,7 @@ void HistoryWidget::updateBotKeyboard() { int32 maxh = hasMarkup ? qMin(_keyboard.height(), int(st::maxFieldHeight) - (int(st::maxFieldHeight) / 2)) : 0; _field.setMaxHeight(st::maxFieldHeight - maxh); _kbShown = hasMarkup; - _kbReplyTo = (_history->peer->chat || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; + _kbReplyTo = (_history->peer->isChat() || _history->peer->isChannel() || _keyboard.forceReply()) ? App::histItemById(_keyboard.forMsgId()) : 0; if (_kbReplyTo && !_replyToId) { updateReplyToName(); _replyToText.setText(st::msgFont, _kbReplyTo->inDialogsText(), _textDlgOptions); @@ -4911,7 +4935,7 @@ void HistoryWidget::onStickerSend(DocumentData *sticker) { fastShowAtEnd(_history); uint64 randomId = MTP::nonce(); - MsgId newId = clientMsgId(); + FullMsgId newId(_channel, clientMsgId()); bool lastKeyboardUsed = lastForceReplyReplied(); @@ -4922,7 +4946,7 @@ void HistoryWidget::onStickerSend(DocumentData *sticker) { flags |= MTPDmessage::flag_reply_to_msg_id; sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; } - _history->addToBackDocument(newId, flags, replyToId(), date(MTP_int(unixtime())), MTP::authedId(), sticker); + _history->addToBackDocument(newId.msg, flags, replyToId(), date(MTP_int(unixtime())), MTP::authedId(), sticker); _history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaDocument(MTP_inputDocument(MTP_long(sticker->id), MTP_long(sticker->access))), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, _history->sendRequestId); App::main()->finishForwarding(_history); @@ -4981,8 +5005,9 @@ void HistoryWidget::onReplyToMessage() { _field.setFocus(); } -bool HistoryWidget::lastForceReplyReplied(MsgId replyTo) const { - return _keyboard.forceReply() && _keyboard.forMsgId() == _history->lastKeyboardId && _keyboard.forMsgId() == (replyTo < 0 ? replyToId() : replyTo); +bool HistoryWidget::lastForceReplyReplied(const FullMsgId &replyTo) const { + if (replyTo.msg > 0 && replyTo.channel != _channel) return false; + return _keyboard.forceReply() && _keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId) && _keyboard.forMsgId().msg == (replyTo.msg < 0 ? replyToId() : replyTo.msg); } void HistoryWidget::cancelReply(bool lastKeyboardUsed) { @@ -5192,9 +5217,9 @@ void HistoryWidget::peerUpdated(PeerData *data) { if (data && data == _peer) { updateListSize(); if (!_showAnim.animating()) updateControlsVisibility(); - if (data->chat && data->asChat()->count > 0 && data->asChat()->participants.isEmpty()) { + if (data->isChat() && data->asChat()->count > 0 && data->asChat()->participants.isEmpty()) { App::api()->requestFullPeer(data); - } else if (!data->chat && data->asUser()->blocked == UserBlockUnknown) { + } else if (data->isUser() && data->asUser()->blocked == UserBlockUnknown) { App::api()->requestFullPeer(data); } else if (!_scroll.isHidden() && _unblock.isHidden() == isBlocked()) { updateControlsVisibility(); @@ -5278,7 +5303,7 @@ void HistoryWidget::onClearSelected() { void HistoryWidget::onAnimActiveStep() { if (!_history || _activeAnimMsgId <= 0) return _animActiveTimer.stop(); - HistoryItem *item = App::histItemById(_activeAnimMsgId); + HistoryItem *item = App::histItemById(_channel, _activeAnimMsgId); if (!item || item->detached()) return _animActiveTimer.stop(); if (getms() - _animActiveStart > st::activeFadeInDuration + st::activeFadeOutDuration) { @@ -5326,7 +5351,7 @@ void HistoryWidget::updateTopBarSelection() { void HistoryWidget::updateReplyTo(bool force) { if (!_replyToId || _replyTo) return; - _replyTo = App::histItemById(_replyToId); + _replyTo = App::histItemById(_channel, _replyToId); if (_replyTo) { _replyToText.setText(st::msgFont, _replyTo->inDialogsText(), _textDlgOptions); diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 0ce5c0c81..a9b16823d 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -232,7 +232,7 @@ public: bool maximizeSize() const; bool singleUse() const; - MsgId forMsgId() const { + FullMsgId forMsgId() const { return _wasForMsgId; } @@ -246,7 +246,7 @@ private: void updateStyle(int32 w = -1); void clearSelection(); - MsgId _wasForMsgId; + FullMsgId _wasForMsgId; int32 _height, _maxOuterHeight; bool _maximizeSize, _singleUse, _forceReply; QTimer _cmdTipTimer; @@ -442,7 +442,7 @@ public: MsgId replyToId() const; void updateReplyTo(bool force = false); - bool lastForceReplyReplied(MsgId replyTo = -1) const; + bool lastForceReplyReplied(const FullMsgId &replyTo = FullMsgId(NoChannel, -1)) const; void cancelReply(bool lastKeyboardUsed = false); void updateForwarding(bool force = false); void cancelForwarding(); // called by MainWidget @@ -502,18 +502,18 @@ public slots: void peerUpdated(PeerData *data); void onFullPeerUpdated(PeerData *data); - void onPhotoUploaded(MsgId msgId, const MTPInputFile &file); - void onDocumentUploaded(MsgId msgId, const MTPInputFile &file); - void onThumbDocumentUploaded(MsgId msgId, const MTPInputFile &file, const MTPInputFile &thumb); - void onAudioUploaded(MsgId msgId, const MTPInputFile &file); + void onPhotoUploaded(const FullMsgId &msgId, const MTPInputFile &file); + void onDocumentUploaded(const FullMsgId &msgId, const MTPInputFile &file); + void onThumbDocumentUploaded(const FullMsgId &msgId, const MTPInputFile &file, const MTPInputFile &thumb); + void onAudioUploaded(const FullMsgId &msgId, const MTPInputFile &file); - void onPhotoProgress(MsgId msgId); - void onDocumentProgress(MsgId msgId); - void onAudioProgress(MsgId msgId); + void onPhotoProgress(const FullMsgId &msgId); + void onDocumentProgress(const FullMsgId &msgId); + void onAudioProgress(const FullMsgId &msgId); - void onPhotoFailed(MsgId msgId); - void onDocumentFailed(MsgId msgId); - void onAudioFailed(MsgId msgId); + void onPhotoFailed(const FullMsgId &msgId); + void onDocumentFailed(const FullMsgId &msgId); + void onAudioFailed(const FullMsgId &msgId); void onListScroll(); void onHistoryToEnd(); @@ -625,6 +625,7 @@ private: void updateDragAreas(); PeerData *_peer; + ChannelId _channel; MsgId _showAtMsgId; mtpRequestId _firstLoadRequest, _preloadRequest, _preloadDownRequest; diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index 75d2fde67..d32979e2a 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -43,7 +43,7 @@ void LocalImageLoaderPrivate::prepareImages() { ToPrepareMediaType type; bool animated = false; bool ctrlShiftEnter = false; - MsgId replyTo = 0; + MsgId replyTo; { QMutexLocker lock(loader->toPrepareMutex()); ToPrepareMedias &list(loader->toPrepareMedias()); diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index abb7952db..019d885cb 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -2762,16 +2762,21 @@ namespace Local { uint32 _peerSize(PeerData *peer) { uint32 result = sizeof(quint64) + sizeof(quint64) + _storageImageLocationSize(); - if (peer->chat) { - ChatData *chat = peer->asChat(); - - // name + count + date + version + admin + forbidden + left + invitationUrl - result += _stringSize(chat->name) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + _stringSize(chat->invitationUrl); - } else { + if (peer->isUser()) { UserData *user = peer->asUser(); // first + last + phone + username + access + onlineTill + contact + botInfoVersion result += _stringSize(user->firstName) + _stringSize(user->lastName) + _stringSize(user->phone) + _stringSize(user->username) + sizeof(quint64) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32); + } else if (peer->isChat()) { + ChatData *chat = peer->asChat(); + + // name + count + date + version + admin + forbidden + left + invitationUrl + result += _stringSize(chat->name) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + _stringSize(chat->invitationUrl); + } else if (peer->isChannel()) { + ChannelData *channel = peer->asChannel(); + + // name + access + date + version + forbidden + left + invitationUrl + result += _stringSize(channel->name) + sizeof(quint64) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + sizeof(qint32) + _stringSize(channel->invitationUrl); } return result; } @@ -2779,15 +2784,20 @@ namespace Local { void _writePeer(QDataStream &stream, PeerData *peer) { stream << quint64(peer->id) << quint64(peer->photoId); _writeStorageImageLocation(stream, peer->photoLoc); - if (peer->chat) { + if (peer->isUser()) { + UserData *user = peer->asUser(); + + stream << user->firstName << user->lastName << user->phone << user->username << quint64(user->access) << qint32(user->onlineTill) << qint32(user->contact) << qint32(user->botInfo ? user->botInfo->version : -1); + } else if (peer->isChat()) { ChatData *chat = peer->asChat(); stream << chat->name << qint32(chat->count) << qint32(chat->date) << qint32(chat->version) << qint32(chat->admin); stream << qint32(chat->forbidden ? 1 : 0) << qint32(chat->left ? 1 : 0) << chat->invitationUrl; - } else { - UserData *user = peer->asUser(); + } else if (peer->isChannel()) { + ChannelData *channel = peer->asChannel(); - stream << user->firstName << user->lastName << user->phone << user->username << quint64(user->access) << qint32(user->onlineTill) << qint32(user->contact) << qint32(user->botInfo ? user->botInfo->version : -1); + stream << channel->name << quint64(channel->access) << qint32(channel->date) << qint32(channel->version); + stream << qint32(channel->forbidden ? 1 : 0) << qint32(channel->left ? 1 : 0) << channel->invitationUrl; } } @@ -2800,7 +2810,34 @@ namespace Local { result = App::peer(peerId); result->loaded = true; - if (result->chat) { + if (result->isUser()) { + UserData *user = result->asUser(); + + QString first, last, phone, username; + quint64 access; + qint32 onlineTill, contact, botInfoVersion; + from.stream >> first >> last >> phone >> username >> access >> onlineTill >> contact >> botInfoVersion; + + bool showPhone = !isServiceUser(user->id) && (peerToUser(user->id) != MTP::authedId()) && (contact <= 0); + QString pname = (showPhone && !phone.isEmpty()) ? App::formatPhone(phone) : QString(); + + user->setName(first, last, pname, username); + + user->access = access; + user->onlineTill = onlineTill; + user->contact = contact; + user->setBotInfoVersion(botInfoVersion); + + if (peerToUser(user->id) == MTP::authedId()) { + user->input = MTP_inputPeerSelf(); + user->inputUser = MTP_inputUserSelf(); + } else { + user->input = MTP_inputPeerUser(MTP_int(peerToUser(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); + user->inputUser = MTP_inputUser(MTP_int(peerToUser(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); + } + + user->photo = photoLoc.isNull() ? ImagePtr(userDefPhoto(user->colorIndex)) : ImagePtr(photoLoc); + } else if (result->isChat()) { ChatData *chat = result->asChat(); QString name, invitationUrl; @@ -2816,36 +2853,30 @@ namespace Local { chat->left = (left == 1); chat->invitationUrl = invitationUrl; - chat->input = MTP_inputPeerChat(MTP_int(App::chatFromPeer(chat->id))); + chat->input = MTP_inputPeerChat(MTP_int(peerToChat(chat->id))); + chat->inputChat = MTP_inputChat(MTP_int(peerToChat(chat->id))); chat->photo = photoLoc.isNull() ? ImagePtr(chatDefPhoto(chat->colorIndex)) : ImagePtr(photoLoc); - } else { - UserData *user = result->asUser(); + } else if (result->isChannel()) { + ChannelData *channel = result->asChannel(); - QString first, last, phone, username; + QString name, invitationUrl; quint64 access; - qint32 onlineTill, contact, botInfoVersion; - from.stream >> first >> last >> phone >> username >> access >> onlineTill >> contact >> botInfoVersion; + qint32 date, version, forbidden, left; + from.stream >> name >> access >> date >> version >> forbidden >> left >> invitationUrl; - bool showPhone = !isServiceUser(user->id) && (App::userFromPeer(user->id) != MTP::authedId()) && (contact <= 0); - QString pname = (showPhone && !phone.isEmpty()) ? App::formatPhone(phone) : QString(); + channel->updateName(name, QString(), QString()); + channel->access = access; + channel->date = date; + channel->version = version; + channel->forbidden = (forbidden == 1); + channel->left = (left == 1); + channel->invitationUrl = invitationUrl; - user->setName(first, last, pname, username); + channel->input = MTP_inputPeerChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); + channel->inputChat = MTP_inputChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); - user->access = access; - user->onlineTill = onlineTill; - user->contact = contact; - user->setBotInfoVersion(botInfoVersion); - - if (App::userFromPeer(user->id) == MTP::authedId()) { - user->input = MTP_inputPeerSelf(); - user->inputUser = MTP_inputUserSelf(); - } else { - user->input = MTP_inputPeerUser(MTP_int(App::userFromPeer(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); - user->inputUser = MTP_inputUser(MTP_int(App::userFromPeer(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); - } - - user->photo = photoLoc.isNull() ? ImagePtr(userDefPhoto(user->colorIndex)) : ImagePtr(photoLoc); + channel->photo = photoLoc.isNull() ? ImagePtr(chatDefPhoto(channel->colorIndex)) : ImagePtr(photoLoc); } App::markPeerUpdated(result); emit App::main()->peerPhotoChanged(result); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 8e273cf68..233a59b0d 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -77,8 +77,8 @@ void TopBarWidget::onInfoClicked() { void TopBarWidget::onAddContact() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; - UserData *u = (p && !p->chat) ? p->asUser() : 0; - if (u) App::wnd()->showLayer(new AddContactBox(u->firstName, u->lastName, u->phone.isEmpty() ? App::phoneFromSharedContact(App::userFromPeer(u->id)) : u->phone)); + UserData *u = p ? p->asUser() : 0; + if (u) App::wnd()->showLayer(new AddContactBox(u->firstName, u->lastName, u->phone.isEmpty() ? App::phoneFromSharedContact(peerToUser(u->id)) : u->phone)); } void TopBarWidget::onEdit() { @@ -88,7 +88,7 @@ void TopBarWidget::onEdit() { void TopBarWidget::onDeleteContact() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; - UserData *u = (p && !p->chat) ? p->asUser() : 0; + UserData *u = p ? p->asUser() : 0; if (u) { ConfirmBox *box = new ConfirmBox(lng_sure_delete_contact(lt_contact, p->name)); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteContactSure())); @@ -98,7 +98,7 @@ void TopBarWidget::onDeleteContact() { void TopBarWidget::onDeleteContactSure() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; - UserData *u = (p && !p->chat) ? p->asUser() : 0; + UserData *u = p ? p->asUser() : 0; if (u) { App::main()->showDialogs(); App::wnd()->hideLayer(); @@ -108,7 +108,7 @@ void TopBarWidget::onDeleteContactSure() { void TopBarWidget::onDeleteAndExit() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; - ChatData *c = (p && p->chat) ? p->asChat() : 0; + ChatData *c = p ? p->asChat() : 0; if (c) { ConfirmBox *box = new ConfirmBox(lng_sure_delete_and_exit(lt_group, p->name)); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteAndExitSure())); @@ -118,11 +118,11 @@ void TopBarWidget::onDeleteAndExit() { void TopBarWidget::onDeleteAndExitSure() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; - ChatData *c = (p && p->chat) ? p->asChat() : 0; + ChatData *c = p ? p->asChat() : 0; if (c) { App::main()->showDialogs(); App::wnd()->hideLayer(); - MTP::send(MTPmessages_DeleteChatUser(MTP_int(p->id & 0xFFFFFFFF), App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, p), App::main()->rpcFail(&MainWidget::leaveChatFailed, p)); + MTP::send(MTPmessages_DeleteChatUser(c->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, p), App::main()->rpcFail(&MainWidget::leaveChatFailed, p)); } } @@ -278,8 +278,8 @@ void TopBarWidget::showAll() { return; } PeerData *p = App::main() ? App::main()->profilePeer() : 0, *o = App::main() ? App::main()->overviewPeer() : 0; - if (p && (p->chat || p->asUser()->contact >= 0 || !App::phoneFromSharedContact(App::userFromPeer(p->id)).isEmpty())) { - if (p->chat) { + if (p && (p->isChat() || (p->isUser() && (p->asUser()->contact >= 0 || !App::phoneFromSharedContact(peerToUser(p->id)).isEmpty())))) { + if (p->isChat()) { if (p->asChat()->forbidden) { _edit.hide(); } else { @@ -511,9 +511,9 @@ void MainWidget::finishForwarding(History *hist) { App::main()->readServerHistory(hist, false); if (_toForward.size() < 2) { uint64 randomId = MTP::nonce(); - MsgId newId = clientMsgId(); + FullMsgId newId(peerToChannel(hist->peer->id), clientMsgId()); HistoryMessage *msg = static_cast(_toForward.cbegin().value()); - hist->addToBackForwarded(newId, msg); + hist->addToBackForwarded(newId.msg, msg); App::historyRegRandom(randomId, newId); hist->sendRequestId = MTP::send(MTPmessages_ForwardMessage(hist->peer->input, MTP_int(_toForward.cbegin().key()), MTP_long(randomId)), rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); if (HistorySticker *sticker = dynamic_cast(msg->getMedia())) { @@ -772,7 +772,7 @@ void MainWidget::deleteMessages(const QVector &ids) { void MainWidget::deletedContact(UserData *user, const MTPcontacts_Link &result) { const MTPDcontacts_link &d(result.c_contacts_link()); App::feedUsers(MTP_vector(1, d.vuser), false); - App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link, false); + App::feedUserLink(MTP_int(peerToUser(user->id)), d.vmy_link, d.vforeign_link, false); App::emitPeerUpdated(); } @@ -802,7 +802,7 @@ void MainWidget::removeContact(UserData *user) { void MainWidget::addParticipants(ChatData *chat, const QVector &users) { for (QVector::const_iterator i = users.cbegin(), e = users.cend(); i != e; ++i) { - MTP::send(MTPmessages_AddChatUser(MTP_int(chat->id & 0xFFFFFFFF), (*i)->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::addParticipantFail, *i), 0, 5); + MTP::send(MTPmessages_AddChatUser(chat->inputChat, (*i)->inputUser, MTP_int(ForwardOnAdd)), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::addParticipantFail, *i), 0, 5); } App::wnd()->hideLayer(); showPeerHistory(chat->id, ShowAtTheEndMsgId); @@ -823,7 +823,7 @@ bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) { } void MainWidget::kickParticipant(ChatData *chat, UserData *user) { - MTP::send(MTPmessages_DeleteChatUser(MTP_int(chat->id & 0xFFFFFFFF), user->inputUser), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::kickParticipantFail, chat)); + MTP::send(MTPmessages_DeleteChatUser(chat->inputChat, user->inputUser), rpcDone(&MainWidget::sentUpdatesReceived), rpcFail(&MainWidget::kickParticipantFail, chat)); App::wnd()->hideLayer(); showPeerHistory(chat->id, ShowAtTheEndMsgId); } @@ -836,7 +836,7 @@ bool MainWidget::kickParticipantFail(ChatData *chat, const RPCError &error) { } void MainWidget::checkPeerHistory(PeerData *peer) { - MTP::send(MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(1)), rpcDone(&MainWidget::checkedHistory, peer)); + MTP::send(MTPmessages_GetHistory(peer->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1)), rpcDone(&MainWidget::checkedHistory, peer)); } void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &result) { @@ -858,7 +858,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu if ((profile && profile->peer() == peer) || (overview && overview->peer() == peer) || _stack.contains(peer) || history.peer() == peer) { showDialogs(); } - if (peer->chat && peer->asChat()->left) { + if (peer->isChat() && peer->asChat()->left) { dialogs.removePeer(peer); } else { History *h = App::historyLoaded(peer->id); @@ -1043,13 +1043,13 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl QString sendingText, leftText = text; if (replyTo < 0) replyTo = history.replyToId(); while (textSplit(sendingText, leftText, MaxMessageSize)) { - MsgId newId = clientMsgId(); + FullMsgId newId(peerToChannel(hist->peer->id), clientMsgId()); uint64 randomId = MTP::nonce(); sendingText = cleanMessage(sendingText); App::historyRegRandom(randomId, newId); - App::historyRegSentText(randomId, sendingText); + App::historyRegSentData(randomId, hist->peer->id, sendingText); MTPstring msgText(MTP_string(sendingText)); int32 flags = newMessageFlags(hist->peer) | MTPDmessage::flag_entities; // unread, out @@ -1067,7 +1067,7 @@ void MainWidget::sendPreparedText(History *hist, const QString &text, MsgId repl flags |= MTPDmessage::flag_media; } MTPVector localEntities = linksToMTP(textParseLinks(sendingText, itemTextParseOptions(hist, App::self()).flags)); - hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities)); + hist->addToBack(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(MTP::authedId()), peerToMTP(hist->peer->id), MTPint(), MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities)); hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, localEntities), App::main()->rpcDone(&MainWidget::sentUpdatesReceived, randomId), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); } @@ -1485,7 +1485,7 @@ void MainWidget::audioLoadProgress(mtpFileLoader *loader) { if (audio->loader->done()) { audio->finish(); QString already = audio->already(); - bool play = audio->openOnSave > 0 && audio->openOnSaveMsgId && audioPlayer(); + bool play = audio->openOnSave > 0 && audio->openOnSaveMsgId.msg && audioPlayer(); if ((!already.isEmpty() && audio->openOnSave) || (!audio->data.isEmpty() && play)) { if (play) { AudioMsgId playing; @@ -1645,17 +1645,17 @@ void MainWidget::documentLoadProgress(mtpFileLoader *loader) { document->finish(); QString already = document->already(); - HistoryItem *item = (document->openOnSave && document->openOnSaveMsgId) ? App::histItemById(document->openOnSaveMsgId) : 0; + HistoryItem *item = (document->openOnSave && document->openOnSaveMsgId.msg) ? App::histItemById(document->openOnSaveMsgId) : 0; bool play = document->song() && audioPlayer() && document->openOnSave && item; if ((!already.isEmpty() || (!document->data.isEmpty() && play)) && document->openOnSave) { if (play) { SongMsgId playing; AudioPlayerState playingState = AudioPlayerStopped; audioPlayer()->currentState(&playing, &playingState); - if (playing.msgId == item->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == item->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { audioPlayer()->pauseresume(OverviewDocuments); } else { - SongMsgId song(document, item->id); + SongMsgId song(document, item->fullId()); audioPlayer()->play(song); if (App::main()) App::main()->documentPlayProgress(song); } @@ -1773,7 +1773,7 @@ void MainWidget::confirmShareContact(bool ctrlShiftEnter, const QString &phone, } void MainWidget::confirmSendImage(const ReadyLocalMedia &img) { - bool lastKeyboardUsed = history.lastForceReplyReplied(img.replyTo); + bool lastKeyboardUsed = history.lastForceReplyReplied(FullMsgId(peerToChannel(img.peer), img.replyTo)); history.confirmSendImage(img); history.cancelReply(lastKeyboardUsed); } @@ -1962,7 +1962,7 @@ void MainWidget::choosePeer(PeerId peerId, MsgId showAtMsgId) { } void MainWidget::clearBotStartToken(PeerData *peer) { - if (peer && !peer->chat && peer->asUser()->botInfo) { + if (peer && peer->isUser() && peer->asUser()->botInfo) { peer->asUser()->botInfo->startToken = QString(); } } @@ -2925,9 +2925,9 @@ void MainWidget::inviteCheckDone(QString hash, const MTPChatInvite &invite) { case mtpc_chatInviteAlready: { const MTPDchatInviteAlready &d(invite.c_chatInviteAlready()); - ChatData *chat = App::feedChats(MTP_vector(1, d.vchat)); + PeerData *chat = App::feedChats(MTP_vector(1, d.vchat)); if (chat) { - if (chat->left) { + if ((chat->isChat() && chat->asChat()->left) || (chat->isChannel() && chat->asChannel()->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())); @@ -2952,8 +2952,8 @@ bool MainWidget::inviteCheckFail(const RPCError &error) { 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); + PeerId id = _inviteHash.midRef(1).toULongLong(); + MTP::send(MTPmessages_AddChatUser(MTP_inputChat(MTP_int(peerToChat(id))), 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)); } @@ -2979,7 +2979,7 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { } break; } if (v && !v->isEmpty() && v->front().type() == mtpc_chat) { - App::main()->showPeerHistory(App::peerFromChat(v->front().c_chat().vid.v), ShowAtTheEndMsgId); + App::main()->showPeerHistory(peerFromChat(v->front().c_chat().vid.v), ShowAtTheEndMsgId); } } @@ -3008,7 +3008,7 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti case mtpc_notifyUsers: globalNotifyUsersPtr = EmptyNotifySettings; break; case mtpc_notifyChats: globalNotifyChatsPtr = EmptyNotifySettings; break; case mtpc_notifyPeer: { - PeerData *data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer)); + PeerData *data = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer)); if (data && data->notify != EmptyNotifySettings) { if (data->notify != UnknownNotifySettings) { delete data->notify; @@ -3030,7 +3030,7 @@ void MainWidget::applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNoti case mtpc_notifyUsers: setTo = globalNotifyUsersPtr = &globalNotifyUsers; break; case mtpc_notifyChats: setTo = globalNotifyChatsPtr = &globalNotifyChats; break; case mtpc_notifyPeer: { - data = App::peerLoaded(App::peerFromMTP(peer.c_notifyPeer().vpeer)); + data = App::peerLoaded(peerFromMTP(peer.c_notifyPeer().vpeer)); if (!data) break; if (data->notify == UnknownNotifySettings || data->notify == EmptyNotifySettings) { @@ -3215,7 +3215,7 @@ void MainWidget::updateOnlineDisplayIn(int32 msecs) { void MainWidget::addNewContact(int32 uid, bool show) { if (dialogs.addNewContact(uid, show)) { - showPeerHistory(App::peerFromUser(uid), ShowAtTheEndMsgId); + showPeerHistory(peerFromUser(uid), ShowAtTheEndMsgId); } } @@ -3412,22 +3412,30 @@ void MainWidget::handleUpdates(const MTPUpdates &updates, uint64 randomId) { case mtpc_updateShortSentMessage: { const MTPDupdateShortSentMessage &d(updates.c_updateShortSentMessage()); - HistoryItem *item = 0; if (randomId) { - QString text = App::histSentTextByItem(randomId); + PeerId peerId = 0; + QString text; + App::histSentDataByItem(randomId, peerId, text); + feedUpdate(MTP_updateMessageID(d.vid, MTP_long(randomId))); // ignore real date - if (!text.isEmpty()) { - bool hasLinks = d.has_entities() && !d.ventities.c_vector().v.isEmpty(); - item = App::histItemById(d.vid.v); - if (item && ((hasLinks && !item->hasTextLinks()) || (!hasLinks && item->textHasLinks()))) { - bool was = item->hasTextLinks(); - item->setText(text, d.has_entities() ? linksFromMTP(d.ventities.c_vector().v) : LinksInText()); - item->initDimensions(0); - itemResized(item); - if (!was && item->hasTextLinks()) { - item->history()->addToOverview(item, OverviewLinks); + + if (peerId) { + HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v); + if (!text.isEmpty()) { + bool hasLinks = d.has_entities() && !d.ventities.c_vector().v.isEmpty(); + if (item && ((hasLinks && !item->hasTextLinks()) || (!hasLinks && item->textHasLinks()))) { + bool was = item->hasTextLinks(); + item->setText(text, d.has_entities() ? linksFromMTP(d.ventities.c_vector().v) : LinksInText()); + item->initDimensions(0); + itemResized(item); + if (!was && item->hasTextLinks()) { + item->history()->addToOverview(item, OverviewLinks); + } } } + if (item) { + item->setMedia(d.has_media() ? (&d.vmedia) : 0); + } } } @@ -3435,12 +3443,6 @@ void MainWidget::handleUpdates(const MTPUpdates &updates, uint64 randomId) { _byPtsUpdates.insert(ptsKey(SkippedUpdates), updates); return; } - if (!item) { - item = App::histItemById(d.vid.v); - } - if (item) { - item->setMedia(d.has_media() ? (&d.vmedia) : 0); - } updSetState(0, d.vdate.v, updQts, updSeq); } break; @@ -3474,8 +3476,8 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { case mtpc_updateMessageID: { const MTPDupdateMessageID &d(update.c_updateMessageID()); - MsgId msg = App::histItemByRandom(d.vrandom_id.v); - if (msg) { + FullMsgId msg = App::histItemByRandom(d.vrandom_id.v); + if (msg.msg) { HistoryItem *msgRow = App::histItemById(msg); if (msgRow) { App::historyUnregItem(msgRow); @@ -3506,7 +3508,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } App::historyUnregRandom(d.vrandom_id.v); } - App::historyUnregSentText(d.vrandom_id.v); + App::historyUnregSentData(d.vrandom_id.v); } break; case mtpc_updateReadMessagesContents: { @@ -3517,11 +3519,11 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } 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 (HistoryItem *item = App::histItemById(NoChannel, v.at(i).v)) { if (item->isMediaUnread()) { item->markMediaRead(); msgUpdated(item->history()->peer->id, item); - if (item->out() && !item->history()->peer->chat) { + if (item->out() && item->history()->peer->isUser()) { item->history()->peer->asUser()->madeAction(); } } @@ -3535,7 +3537,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { _byPtsUpdate.insert(ptsKey(SkippedUpdate), update); return; } - App::feedInboxRead(App::peerFromMTP(d.vpeer), d.vmax_id.v); + App::feedInboxRead(peerFromMTP(d.vpeer), d.vmax_id.v); } break; case mtpc_updateReadHistoryOutbox: { @@ -3544,9 +3546,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { _byPtsUpdate.insert(ptsKey(SkippedUpdate), update); return; } - PeerId peer = App::peerFromMTP(d.vpeer); - App::feedOutboxRead(peer, d.vmax_id.v); - if (history.peer() && history.peer()->id == peer) history.update(); + PeerId id = peerFromMTP(d.vpeer); + App::feedOutboxRead(id, d.vmax_id.v); + if (history.peer() && history.peer()->id == id) history.update(); } break; case mtpc_updateWebPage: { @@ -3562,13 +3564,13 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { _byPtsUpdate.insert(ptsKey(SkippedUpdate), update); return; } - App::feedWereDeleted(d.vmessages.c_vector().v); + App::feedWereDeleted(NoChannel, d.vmessages.c_vector().v); history.peerMessagesUpdated(); } break; case mtpc_updateUserTyping: { const MTPDupdateUserTyping &d(update.c_updateUserTyping()); - History *history = App::historyLoaded(App::peerFromUser(d.vuser_id)); + History *history = App::historyLoaded(peerFromUser(d.vuser_id)); UserData *user = App::userLoaded(d.vuser_id.v); if (history && user) { App::histories().regSendAction(history, user, d.vaction); @@ -3577,7 +3579,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { case mtpc_updateChatUserTyping: { const MTPDupdateChatUserTyping &d(update.c_updateChatUserTyping()); - History *history = App::historyLoaded(App::peerFromChat(d.vchat_id)); + History *history = App::historyLoaded(peerFromChat(d.vchat_id)); UserData *user = (d.vuser_id.v == MTP::authedId()) ? 0 : App::userLoaded(d.vuser_id.v); if (history && user) { App::histories().regSendAction(history, user, d.vaction); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 6baf5b562..cc359c316 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -64,7 +64,7 @@ _docRadialFirst(0), _docRadialStart(0), _docRadialLast(0), _docRadialOpacity(1), _docDownload(this, lang(lng_media_download), st::mvDocLink), _docSaveAs(this, lang(lng_mediaview_save_as), st::mvDocLink), _docCancel(this, lang(lng_cancel), st::mvDocLink), -_history(0), _peer(0), _user(0), _from(0), _index(-1), _msgid(0), +_history(0), _peer(0), _user(0), _from(0), _index(-1), _msgid(0), _channel(NoChannel), _loadRequest(0), _over(OverNone), _down(OverNone), _lastAction(-st::mvDeltaFromLastAction, -st::mvDeltaFromLastAction), _ignoringDropdown(false), _controlsState(ControlsShown), _controlsAnimStarted(0), _menu(0), _dropdown(this, st::mvDropdown), _receiveMouse(true), _touchPress(false), _touchMove(false), _touchRightButton(false), @@ -266,7 +266,7 @@ void MediaView::updateControls() { d = date(_photo->date); } else if (_doc) { d = date(_doc->date); - } else if (HistoryItem *item = App::histItemById(_msgid)) { + } else if (HistoryItem *item = App::histItemById(_channel, _msgid)) { d = item->date; } if (d.date() == dNow.date()) { @@ -315,7 +315,7 @@ void MediaView::updateDropdown() { _btnSaveAs->setVisible(true); _btnCopy->setVisible((_doc && !_current.isNull()) || (_photo && _photo->full->loaded())); _btnForward->setVisible(_msgid > 0); - _btnDelete->setVisible(_msgid > 0 || (_photo && App::self() && App::self()->photoId == _photo->id) || (_photo && _photo->chat && _photo->chat->photoId == _photo->id)); + _btnDelete->setVisible(_msgid > 0 || (_photo && App::self() && App::self()->photoId == _photo->id) || (_photo && _photo->peer && _photo->peer->photoId == _photo->id)); _btnViewAll->setVisible((_overview != OverviewCount) && _history); _btnViewAll->setText(lang(_doc ? lng_mediaview_files_all : lng_mediaview_photos_all)); _dropdown.updateButtons(); @@ -383,7 +383,7 @@ bool MediaView::animStep(float64 msp) { QString fname(_doc->already(true)); QImageReader reader(fname); if (reader.canRead()) { - displayDocument(_doc, App::histItemById(_msgid)); + displayDocument(_doc, App::histItemById(_channel, _msgid)); } } } else { @@ -443,7 +443,7 @@ void MediaView::onDropdownHiding() { void MediaView::onToMessage() { if (_menu) _menu->fastHide(); - if (HistoryItem *item = _msgid ? App::histItemById(_msgid) : 0) { + if (HistoryItem *item = _msgid ? App::histItemById(_channel, _msgid) : 0) { if (App::wnd()) { close(); if (App::main()) App::main()->showPeerHistory(item->history()->peer->id, _msgid); @@ -581,7 +581,7 @@ void MediaView::onShowInFolder() { } void MediaView::onForward() { - HistoryItem *item = App::histItemById(_msgid); + HistoryItem *item = App::histItemById(_channel, _msgid); if (!_msgid || !item) return; if (App::wnd()) { @@ -598,11 +598,11 @@ void MediaView::onDelete() { if (!_msgid) { if (App::self() && _photo && App::self()->photoId == _photo->id) { App::app()->peerClearPhoto(App::self()->id); - } else if (_photo->chat && _photo->chat->photoId == _photo->id) { - App::app()->peerClearPhoto(_photo->chat->id); + } else if (_photo->peer && _photo->peer->photoId == _photo->id) { + App::app()->peerClearPhoto(_photo->peer->id); } } else { - HistoryItem *item = App::histItemById(_msgid); + HistoryItem *item = App::histItemById(_channel, _msgid); if (item) { App::contextItem(item); App::main()->deleteLayer(); @@ -654,6 +654,7 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { _index = -1; _msgid = context ? context->id : 0; + _channel = context ? context->channelId() : NoChannel; _photo = photo; if (_history) { _overview = OverviewPhotos; @@ -668,7 +669,7 @@ void MediaView::showPhoto(PhotoData *photo, HistoryItem *context) { void MediaView::showPhoto(PhotoData *photo, PeerData *context) { _history = 0; _peer = context; - _user = context->chat ? 0 : context->asUser(); + _user = context->asUser(); _saveMsgStarted = 0; _loadRequest = 0; _over = OverNone; @@ -680,6 +681,7 @@ void MediaView::showPhoto(PhotoData *photo, PeerData *context) { if (!_animOpacities.isEmpty()) _animOpacities.clear(); _msgid = 0; + _channel = NoChannel; _index = -1; _photo = photo; _overview = OverviewCount; @@ -722,6 +724,7 @@ void MediaView::showDocument(DocumentData *doc, HistoryItem *context) { _index = -1; _msgid = context ? context->id : 0; + _channel = context ? context->channelId() : NoChannel; if (_history) { _overview = OverviewDocuments; @@ -1379,8 +1382,9 @@ void MediaView::moveToNext(int32 delta) { if (_history && _overview != OverviewCount) { if (newIndex >= 0 && newIndex < _history->_overview[_overview].size()) { _index = newIndex; - if (HistoryItem *item = App::histItemById(_history->_overview[_overview][_index])) { + if (HistoryItem *item = App::histItemById(_history->channelId(), _history->_overview[_overview][_index])) { _msgid = item->id; + _channel = item->channelId(); if (item->getMedia()) { switch (item->getMedia()->type()) { case MediaTypePhoto: displayPhoto(static_cast(item->getMedia())->photo(), item); preloadData(delta); break; @@ -1416,7 +1420,7 @@ void MediaView::preloadData(int32 delta) { if (_history && _overview != OverviewCount) { for (int32 i = from; i <= to; ++i) { if (i >= 0 && i < _history->_overview[_overview].size() && i != _index) { - if (HistoryItem *item = App::histItemById(_history->_overview[_overview][i])) { + if (HistoryItem *item = App::histItemById(_history->channelId(), _history->_overview[_overview][i])) { if (HistoryMedia *media = item->getMedia()) { switch (media->type()) { case MediaTypePhoto: static_cast(media)->photo()->full->load(); break; @@ -1428,7 +1432,7 @@ void MediaView::preloadData(int32 delta) { } } if (forget >= 0 && forget < _history->_overview[_overview].size() && forget != _index) { - if (HistoryItem *item = App::histItemById(_history->_overview[_overview][forget])) { + if (HistoryItem *item = App::histItemById(_history->channelId(), _history->_overview[_overview][forget])) { if (HistoryMedia *media = item->getMedia()) { switch (media->type()) { case MediaTypePhoto: static_cast(media)->photo()->forget(); break; diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index 11b99e266..15d364382 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -160,6 +160,7 @@ private: int32 _index; // index in photos or files array, -1 if just photo MsgId _msgid; // msgId of current photo or file + ChannelId _channel; mtpRequestId _loadRequest; diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h b/Telegram/SourceFiles/mtproto/mtpCoreTypes.h index 682073f14..97da542f7 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 = 36; +static const mtpPrime mtpCurrentLayer = 40; template class MTPBoxed : public bareT { diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.cpp b/Telegram/SourceFiles/mtproto/mtpScheme.cpp index d6bd9b55d..ff907b1c9 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.cpp +++ b/Telegram/SourceFiles/mtproto/mtpScheme.cpp @@ -514,6 +514,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_inputPeerChannel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ inputPeerChannel"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" channel_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(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); 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_inputUserEmpty: to.add("{ inputUserEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; @@ -1001,6 +1015,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_peerChannel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ peerChannel"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" channel_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_storage_fileUnknown: to.add("{ storage_fileUnknown }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; @@ -1215,6 +1242,25 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_channel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ channel"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: 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 3: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" version: "); ++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_chatFull: if (stage) { to.add(",\n").addSpaces(lev); @@ -1233,6 +1279,25 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_channelFull: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ channelFull"); + 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(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" chat_photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: 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; + case mtpc_chatParticipant: if (stage) { to.add(",\n").addSpaces(lev); @@ -1318,7 +1383,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP switch (stage) { case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessage::flag_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; case 3: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" fwd_from_id: "); ++stages.back(); if (flag & MTPDmessage::flag_fwd_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; case 5: to.add(" fwd_date: "); ++stages.back(); if (flag & MTPDmessage::flag_fwd_date) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; @@ -1340,9 +1405,9 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageService::flag_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; case 3: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -1558,6 +1623,19 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messageActionChannelCreate: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageActionChannelCreate"); + 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_dialog: if (stage) { to.add(",\n").addSpaces(lev); @@ -1575,6 +1653,26 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_dialogChannel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ dialogChannel"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); 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_photoEmpty: if (stage) { to.add(",\n").addSpaces(lev); @@ -2128,6 +2226,25 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_channelMessages: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_channelMessages"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" collapsed: "); ++stages.back(); if (flag & MTPDmessages_channelMessages::flag_collapsed) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 5: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + case mtpc_messages_chats: if (stage) { to.add(",\n").addSpaces(lev); @@ -2616,6 +2733,64 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_updateChannelTooLong: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateChannelTooLong"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" channel_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_updateNewChannelMessage: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateNewChannelMessage"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); 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_updateReadChannelInbox: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateReadChannelInbox"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" 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_updateDeleteChannelMessages: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updateDeleteChannelMessages"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); 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); @@ -4315,6 +4490,142 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_inputChatEmpty: + to.add("{ inputChatEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_inputChat: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ inputChat"); + 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_inputChannel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ inputChannel"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" channel_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(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); 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_messageRange: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageRange"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" min_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(" 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_messageGroup: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageGroup"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" min_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(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" count: "); ++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; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_updates_channelDifferenceEmpty: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_channelDifferenceEmpty"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceEmpty::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_updates_channelDifferenceTooLong: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_channelDifferenceTooLong"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceTooLong::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_updates_channelDifference: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_channelDifference"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifference::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" new_messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" other_updates: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_channelMessagesFilterEmpty: + to.add("{ channelMessagesFilterEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_channelMessagesFilter: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ channelMessagesFilter"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" ranges: "); ++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; + case mtpc_req_pq: if (stage) { to.add(",\n").addSpaces(lev); @@ -4496,6 +4807,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_auth_sendSms: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_sendSms"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_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_account_registerDevice: if (stage) { to.add(",\n").addSpaces(lev); @@ -4560,158 +4885,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_contacts_deleteContacts: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ contacts_deleteContacts"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" id: "); ++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; - - case mtpc_contacts_block: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ contacts_block"); - to.add("\n").addSpaces(lev); - } - 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; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } - break; - - case mtpc_contacts_unblock: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ contacts_unblock"); - to.add("\n").addSpaces(lev); - } - 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; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } - break; - - case mtpc_messages_setTyping: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_setTyping"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } - break; - - case mtpc_upload_saveFilePart: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ upload_saveFilePart"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); 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_help_saveAppLog: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ help_saveAppLog"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" events: "); ++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; - - case mtpc_messages_discardEncryption: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_discardEncryption"); - 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_setEncryptedTyping: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_setEncryptedTyping"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" typing: "); ++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_messages_readEncryptedHistory: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_readEncryptedHistory"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_date: "); ++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_upload_saveBigFilePart: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ upload_saveBigFilePart"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" file_total_parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); 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_sendSms: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ auth_sendSms"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_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_account_checkUsername: if (stage) { to.add(",\n").addSpaces(lev); @@ -4791,6 +4964,100 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_contacts_deleteContacts: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_deleteContacts"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" id: "); ++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; + + case mtpc_contacts_block: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_block"); + to.add("\n").addSpaces(lev); + } + 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; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_contacts_unblock: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_unblock"); + to.add("\n").addSpaces(lev); + } + 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; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_messages_setTyping: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_setTyping"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } + break; + + case mtpc_messages_discardEncryption: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_discardEncryption"); + 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_setEncryptedTyping: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_setEncryptedTyping"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" typing: "); ++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_messages_readEncryptedHistory: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_readEncryptedHistory"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_date: "); ++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_installStickerSet: if (stage) { to.add(",\n").addSpaces(lev); @@ -4818,6 +5085,64 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_readChannelHistory: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_readChannelHistory"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" 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_upload_saveFilePart: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ upload_saveFilePart"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); 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_upload_saveBigFilePart: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ upload_saveBigFilePart"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" file_total_parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); 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_help_saveAppLog: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ help_saveAppLog"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" events: "); ++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; + case mtpc_invokeAfterMsg: if (stage) { to.add(",\n").addSpaces(lev); @@ -5022,6 +5347,10 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_auth_requestPasswordRecovery: + to.add("{ auth_requestPasswordRecovery }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + case mtpc_account_getNotifySettings: if (stage) { to.add(",\n").addSpaces(lev); @@ -5049,19 +5378,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_contacts_importCard: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ contacts_importCard"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" export_card: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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_account_updateUsername: if (stage) { to.add(",\n").addSpaces(lev); @@ -5075,19 +5391,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_contacts_resolveUsername: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ contacts_resolveUsername"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" username: "); ++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_account_changePhone: if (stage) { to.add(",\n").addSpaces(lev); @@ -5103,10 +5406,101 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_contacts_importCard: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_importCard"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" export_card: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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_contacts_resolveUsername: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_resolveUsername"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" username: "); ++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_account_getWallPapers: to.add("{ account_getWallPapers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + case mtpc_account_getPrivacy: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ account_getPrivacy"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" key: "); ++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_account_setPrivacy: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ account_setPrivacy"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" key: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" rules: "); ++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; + + case mtpc_account_getAccountTTL: + to.add("{ account_getAccountTTL }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_account_sendChangePhoneCode: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ account_sendChangePhoneCode"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" phone_number: "); ++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_account_getAuthorizations: + to.add("{ account_getAuthorizations }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_account_getPassword: + to.add("{ account_getPassword }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_account_getPasswordSettings: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ account_getPasswordSettings"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes); 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_users_getUsers: if (stage) { to.add(",\n").addSpaces(lev); @@ -5208,6 +5602,20 @@ 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_contacts_search: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ contacts_search"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++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); @@ -5232,7 +5640,8 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" max_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(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" limit: "); ++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; @@ -5257,6 +5666,22 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_getImportantHistory: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_getImportantHistory"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" min_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(" limit: "); ++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_getDialogs: if (stage) { to.add(",\n").addSpaces(lev); @@ -5266,8 +5691,21 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++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_getChannelDialogs: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_getChannelDialogs"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++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; @@ -5327,6 +5765,20 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_messages_deleteChannelMessages: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_deleteChannelMessages"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); 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_receivedMessages: if (stage) { to.add(",\n").addSpaces(lev); @@ -5400,7 +5852,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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; + case 0: to.add(" chat_id: "); ++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; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } @@ -5414,7 +5866,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" photo: "); ++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; } @@ -5428,7 +5880,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" fwd_limit: "); ++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; @@ -5443,7 +5895,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++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; } @@ -5516,13 +5968,26 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } switch (stage) { case 0: to.add(" bot: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" chat_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(" chat_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" start_param: "); ++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_createChannel: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_createChannel"); + 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_messages_getChats: if (stage) { to.add(",\n").addSpaces(lev); @@ -5531,7 +5996,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++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; @@ -5544,150 +6009,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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_updates_getState: - to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_updates_getDifference: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ updates_getDifference"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int); 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_photos_updateProfilePhoto: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ photos_updateProfilePhoto"); - to.add("\n").addSpaces(lev); - } - 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(" crop: "); ++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_photos_uploadProfilePhoto: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ photos_uploadProfilePhoto"); - to.add("\n").addSpaces(lev); - } - 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; - case 2: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" crop: "); ++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_photos_deletePhotos: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ photos_deletePhotos"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" id: "); ++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; - - case mtpc_messages_receivedQueue: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_receivedQueue"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" max_qts: "); ++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_upload_getFile: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ upload_getFile"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" location: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); 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_help_getConfig: - to.add("{ help_getConfig }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_help_getNearestDc: - to.add("{ help_getNearestDc }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_help_getAppUpdate: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ help_getAppUpdate"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); 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_help_getInviteText: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ help_getInviteText"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); 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_photos_getUserPhotos: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ photos_getUserPhotos"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++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; @@ -5782,64 +6104,28 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_help_getSupport: - to.add("{ help_getSupport }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_contacts_search: + case mtpc_messages_receivedQueue: if (stage) { to.add(",\n").addSpaces(lev); } else { - to.add("{ contacts_search"); + to.add("{ messages_receivedQueue"); to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" max_qts: "); ++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_account_getPrivacy: + case mtpc_photos_deletePhotos: if (stage) { to.add(",\n").addSpaces(lev); } else { - to.add("{ account_getPrivacy"); + to.add("{ photos_deletePhotos"); to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" key: "); ++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_account_setPrivacy: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ account_setPrivacy"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" key: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" rules: "); ++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; - - case mtpc_account_getAccountTTL: - to.add("{ account_getAccountTTL }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_account_sendChangePhoneCode: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ account_sendChangePhoneCode"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++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; @@ -5884,31 +6170,6 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; - case mtpc_account_getAuthorizations: - to.add("{ account_getAuthorizations }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_account_getPassword: - to.add("{ account_getPassword }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - break; - - case mtpc_account_getPasswordSettings: - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ account_getPasswordSettings"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes); 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_requestPasswordRecovery: - 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); @@ -5917,7 +6178,7 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP 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; + case 0: to.add(" chat_id: "); ++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; @@ -5948,6 +6209,143 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP } break; + case mtpc_updates_getState: + to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_updates_getDifference: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_getDifference"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int); 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_getChannelDifference: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ updates_getChannelDifference"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); 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_photos_updateProfilePhoto: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ photos_updateProfilePhoto"); + to.add("\n").addSpaces(lev); + } + 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(" crop: "); ++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_photos_uploadProfilePhoto: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ photos_uploadProfilePhoto"); + to.add("\n").addSpaces(lev); + } + 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; + case 2: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" crop: "); ++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_photos_getUserPhotos: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ photos_getUserPhotos"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); 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_upload_getFile: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ upload_getFile"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" location: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); 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_help_getConfig: + to.add("{ help_getConfig }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_help_getNearestDc: + to.add("{ help_getNearestDc }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + + case mtpc_help_getAppUpdate: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ help_getAppUpdate"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); 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_help_getInviteText: + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ help_getInviteText"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); 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_help_getSupport: + to.add("{ help_getSupport }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); + break; + case mtpc_help_getAppChangelog: if (stage) { to.add(",\n").addSpaces(lev); diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.h b/Telegram/SourceFiles/mtproto/mtpScheme.h index 82b548bb1..6dccac3d1 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.h +++ b/Telegram/SourceFiles/mtproto/mtpScheme.h @@ -68,10 +68,14 @@ enum { mtpc_inputPeerEmpty = 0x7f3b18ea, mtpc_inputPeerSelf = 0x7da07ec9, mtpc_inputPeerChat = 0x179be863, + mtpc_inputPeerUser = 0x7b8e7de6, + mtpc_inputPeerChannel = 0x20adaef8, mtpc_inputUserEmpty = 0xb98886cf, mtpc_inputUserSelf = 0xf7c1b13f, + mtpc_inputUser = 0xd8292816, mtpc_inputPhoneContact = 0xf392b7f4, mtpc_inputFile = 0xf52ff27f, + mtpc_inputFileBig = 0xfa4f0bb5, mtpc_inputMediaEmpty = 0x9664f57f, mtpc_inputMediaUploadedPhoto = 0xf7aff1c0, mtpc_inputMediaPhoto = 0xe9bfb4f3, @@ -80,6 +84,12 @@ enum { mtpc_inputMediaUploadedVideo = 0x82713fdf, mtpc_inputMediaUploadedThumbVideo = 0x7780ddf9, mtpc_inputMediaVideo = 0x936a4ebd, + mtpc_inputMediaUploadedAudio = 0x4e498cab, + mtpc_inputMediaAudio = 0x89938781, + mtpc_inputMediaUploadedDocument = 0xffe76b78, + mtpc_inputMediaUploadedThumbDocument = 0x41481486, + mtpc_inputMediaDocument = 0xd184e841, + mtpc_inputMediaVenue = 0x2827a81a, mtpc_inputChatPhotoEmpty = 0x1ca48f57, mtpc_inputChatUploadedPhoto = 0x94254732, mtpc_inputChatPhoto = 0xb2e1bf08, @@ -91,11 +101,15 @@ enum { mtpc_inputVideo = 0xee579652, mtpc_inputFileLocation = 0x14637196, mtpc_inputVideoFileLocation = 0x3d0364ec, + mtpc_inputEncryptedFileLocation = 0xf5235d55, + mtpc_inputAudioFileLocation = 0x74dc404d, + mtpc_inputDocumentFileLocation = 0x4e45abe9, mtpc_inputPhotoCropAuto = 0xade6b004, mtpc_inputPhotoCrop = 0xd9915325, mtpc_inputAppEvent = 0x770656a8, mtpc_peerUser = 0x9db1bc6d, mtpc_peerChat = 0xbad0e5bb, + mtpc_peerChannel = 0xbddde532, mtpc_storage_fileUnknown = 0xaa963b05, mtpc_storage_fileJpeg = 0x7efe0e, mtpc_storage_fileGif = 0xcae1aadf, @@ -109,29 +123,39 @@ enum { mtpc_fileLocationUnavailable = 0x7c596b46, mtpc_fileLocation = 0x53d69076, mtpc_userEmpty = 0x200250ba, + mtpc_user = 0x22e49072, mtpc_userProfilePhotoEmpty = 0x4f11bae1, mtpc_userProfilePhoto = 0xd559d8c8, mtpc_userStatusEmpty = 0x9d05049, mtpc_userStatusOnline = 0xedb93949, mtpc_userStatusOffline = 0x8c703f, + mtpc_userStatusRecently = 0xe26f42f1, + mtpc_userStatusLastWeek = 0x7bf09fc, + mtpc_userStatusLastMonth = 0x77ebc742, mtpc_chatEmpty = 0x9ba2d800, mtpc_chat = 0x6e9c9bc7, mtpc_chatForbidden = 0xfb0ccc41, + mtpc_channel = 0x8dbb1461, mtpc_chatFull = 0x2e02a614, + mtpc_channelFull = 0xeb8a0d68, mtpc_chatParticipant = 0xc8d7493e, mtpc_chatParticipantsForbidden = 0xfd2bb8a, mtpc_chatParticipants = 0x7841b415, mtpc_chatPhotoEmpty = 0x37c1011c, mtpc_chatPhoto = 0x6153276a, mtpc_messageEmpty = 0x83e5de54, - mtpc_message = 0x2bebfa86, - mtpc_messageService = 0x1d86f70e, + mtpc_message = 0xab406723, + mtpc_messageService = 0xc06b9607, mtpc_messageMediaEmpty = 0x3ded6320, mtpc_messageMediaPhoto = 0x3d8ce53d, mtpc_messageMediaVideo = 0x5bcf1675, mtpc_messageMediaGeo = 0x56e0d474, mtpc_messageMediaContact = 0x5e7d2f39, mtpc_messageMediaUnsupported = 0x9f84f49e, + mtpc_messageMediaDocument = 0x2fda2204, + mtpc_messageMediaAudio = 0xc6b68300, + mtpc_messageMediaWebPage = 0xa32dd600, + mtpc_messageMediaVenue = 0x7912b71f, mtpc_messageActionEmpty = 0xb6aef7b0, mtpc_messageActionChatCreate = 0xa6638b9a, mtpc_messageActionChatEditTitle = 0xb5a1ce5a, @@ -139,7 +163,10 @@ enum { mtpc_messageActionChatDeletePhoto = 0x95e3fbef, mtpc_messageActionChatAddUser = 0x5e3cfc4b, mtpc_messageActionChatDeleteUser = 0xb2ae9b0c, + mtpc_messageActionChatJoinedByLink = 0xf89cf5e8, + mtpc_messageActionChannelCreate = 0x95d2ac92, mtpc_dialog = 0xc1dd804a, + mtpc_dialogChannel = 0x5b8496b2, mtpc_photoEmpty = 0x2331b22d, mtpc_photo = 0xcded42fe, mtpc_photoSizeEmpty = 0xe17e23c, @@ -151,6 +178,7 @@ enum { mtpc_geoPoint = 0x2049d70c, mtpc_auth_checkedPhone = 0x811ea28e, mtpc_auth_sentCode = 0xefed51d9, + mtpc_auth_sentAppCode = 0xe325edcf, mtpc_auth_authorization = 0xff036af1, mtpc_auth_exportedAuthorization = 0xdf969c2d, mtpc_inputNotifyPeer = 0xb8bc5b0c, @@ -165,6 +193,7 @@ enum { mtpc_peerNotifySettingsEmpty = 0x70a68512, mtpc_peerNotifySettings = 0x8d5e11ee, mtpc_wallPaper = 0xccb03657, + mtpc_wallPaperSolid = 0x63117f24, mtpc_userFull = 0x5a89ac5b, mtpc_contact = 0xf911c994, mtpc_importedContact = 0xd0028438, @@ -182,6 +211,7 @@ enum { mtpc_messages_dialogsSlice = 0x71e094f3, mtpc_messages_messages = 0x8c718e87, mtpc_messages_messagesSlice = 0xb446ae3, + mtpc_messages_channelMessages = 0xbc0f17bc, mtpc_messages_chats = 0x64ff9fd5, mtpc_messages_chatFull = 0xe5d7d19c, mtpc_messages_affectedHistory = 0xb45c69d1, @@ -206,6 +236,26 @@ enum { mtpc_updateContactRegistered = 0x2575bbb9, mtpc_updateContactLink = 0x9d2e67c5, mtpc_updateNewAuthorization = 0x8f06529a, + mtpc_updateNewEncryptedMessage = 0x12bcbd9a, + mtpc_updateEncryptedChatTyping = 0x1710f156, + mtpc_updateEncryption = 0xb4a2e88d, + mtpc_updateEncryptedMessagesRead = 0x38fe25b7, + mtpc_updateChatParticipantAdd = 0x3a0eeb22, + mtpc_updateChatParticipantDelete = 0x6e5f8c22, + mtpc_updateDcOptions = 0x8e5e9873, + mtpc_updateUserBlocked = 0x80ece81a, + mtpc_updateNotifySettings = 0xbec268ef, + mtpc_updateServiceNotification = 0x382dd3e4, + mtpc_updatePrivacy = 0xee3b272a, + mtpc_updateUserPhone = 0x12b9417b, + mtpc_updateReadHistoryInbox = 0x9961fd5c, + mtpc_updateReadHistoryOutbox = 0x2f2f21bf, + mtpc_updateWebPage = 0x2cc36971, + mtpc_updateReadMessagesContents = 0x68c13933, + mtpc_updateChannelTooLong = 0x60946422, + mtpc_updateNewChannelMessage = 0x62ba04d9, + mtpc_updateReadChannelInbox = 0x87b87b7d, + mtpc_updateDeleteChannelMessages = 0x11da3046, mtpc_updates_state = 0xa56c2a3e, mtpc_updates_differenceEmpty = 0x5d75a138, mtpc_updates_difference = 0xf49ca0, @@ -216,6 +266,7 @@ enum { mtpc_updateShort = 0x78d4dec1, mtpc_updatesCombined = 0x725b04c3, mtpc_updates = 0x74ae4240, + mtpc_updateShortSentMessage = 0x11f1331c, mtpc_photos_photos = 0x8dca6aa5, mtpc_photos_photosSlice = 0x15051f54, mtpc_photos_photo = 0x20212ca8, @@ -226,11 +277,6 @@ enum { mtpc_help_appUpdate = 0x8987f311, mtpc_help_noAppUpdate = 0xc45a6536, mtpc_help_inviteText = 0x18cb9f78, - mtpc_wallPaperSolid = 0x63117f24, - mtpc_updateNewEncryptedMessage = 0x12bcbd9a, - mtpc_updateEncryptedChatTyping = 0x1710f156, - mtpc_updateEncryption = 0xb4a2e88d, - mtpc_updateEncryptedMessagesRead = 0x38fe25b7, mtpc_encryptedChatEmpty = 0xab7ec0a0, mtpc_encryptedChatWaiting = 0x3bf703dc, mtpc_encryptedChatRequested = 0xc878527e, @@ -242,31 +288,17 @@ enum { mtpc_inputEncryptedFileEmpty = 0x1837c364, mtpc_inputEncryptedFileUploaded = 0x64bd0306, mtpc_inputEncryptedFile = 0x5a17b5e5, - mtpc_inputEncryptedFileLocation = 0xf5235d55, + mtpc_inputEncryptedFileBigUploaded = 0x2dc173c8, mtpc_encryptedMessage = 0xed18c118, mtpc_encryptedMessageService = 0x23734b06, mtpc_messages_dhConfigNotModified = 0xc0e24635, mtpc_messages_dhConfig = 0x2c221edd, mtpc_messages_sentEncryptedMessage = 0x560f8935, mtpc_messages_sentEncryptedFile = 0x9493ff32, - mtpc_inputFileBig = 0xfa4f0bb5, - mtpc_inputEncryptedFileBigUploaded = 0x2dc173c8, - mtpc_updateChatParticipantAdd = 0x3a0eeb22, - mtpc_updateChatParticipantDelete = 0x6e5f8c22, - mtpc_updateDcOptions = 0x8e5e9873, - mtpc_inputMediaUploadedAudio = 0x4e498cab, - mtpc_inputMediaAudio = 0x89938781, - mtpc_inputMediaUploadedDocument = 0xffe76b78, - mtpc_inputMediaUploadedThumbDocument = 0x41481486, - mtpc_inputMediaDocument = 0xd184e841, - mtpc_messageMediaDocument = 0x2fda2204, - mtpc_messageMediaAudio = 0xc6b68300, mtpc_inputAudioEmpty = 0xd95adc84, mtpc_inputAudio = 0x77d440ff, mtpc_inputDocumentEmpty = 0x72f0eaae, mtpc_inputDocument = 0x18798952, - mtpc_inputAudioFileLocation = 0x74dc404d, - mtpc_inputDocumentFileLocation = 0x4e45abe9, mtpc_audioEmpty = 0x586988d8, mtpc_audio = 0xf9e35055, mtpc_documentEmpty = 0x36f8c871, @@ -276,9 +308,6 @@ enum { mtpc_notifyUsers = 0xb4c83b4c, mtpc_notifyChats = 0xc007cec3, mtpc_notifyAll = 0x74d07c60, - mtpc_updateUserBlocked = 0x80ece81a, - mtpc_updateNotifySettings = 0xbec268ef, - mtpc_auth_sentAppCode = 0xe325edcf, mtpc_sendMessageTypingAction = 0x16bf744e, mtpc_sendMessageCancelAction = 0xfd5ec8f5, mtpc_sendMessageRecordVideoAction = 0xa187d66f, @@ -291,11 +320,6 @@ enum { mtpc_sendMessageChooseContactAction = 0x628cbc6f, mtpc_contactFound = 0xea879f95, mtpc_contacts_found = 0x566000e, - mtpc_updateServiceNotification = 0x382dd3e4, - mtpc_userStatusRecently = 0xe26f42f1, - mtpc_userStatusLastWeek = 0x7bf09fc, - mtpc_userStatusLastMonth = 0x77ebc742, - mtpc_updatePrivacy = 0xee3b272a, mtpc_inputPrivacyKeyStatusTimestamp = 0x4f96cb18, mtpc_privacyKeyStatusTimestamp = 0xbc2eab30, mtpc_inputPrivacyValueAllowContacts = 0xd09e07b, @@ -313,7 +337,6 @@ enum { mtpc_account_privacyRules = 0x554abb6f, mtpc_accountDaysTTL = 0xb8d0afdf, mtpc_account_sentChangePhoneCode = 0xa4f58c4c, - mtpc_updateUserPhone = 0x12b9417b, mtpc_documentAttributeImageSize = 0x6c37c15c, mtpc_documentAttributeAnimated = 0x11b58939, mtpc_documentAttributeSticker = 0x3a556302, @@ -326,18 +349,14 @@ enum { mtpc_messages_allStickersNotModified = 0xe86602c3, mtpc_messages_allStickers = 0xd51dafdb, mtpc_disabledFeature = 0xae636f24, - mtpc_updateReadHistoryInbox = 0x9961fd5c, - mtpc_updateReadHistoryOutbox = 0x2f2f21bf, mtpc_messages_affectedMessages = 0x84d19185, mtpc_contactLinkUnknown = 0x5f4f9247, mtpc_contactLinkNone = 0xfeedd3ad, mtpc_contactLinkHasPhone = 0x268f3f59, mtpc_contactLinkContact = 0xd502c2d0, - mtpc_updateWebPage = 0x2cc36971, mtpc_webPageEmpty = 0xeb1477e8, mtpc_webPagePending = 0xc586da1c, mtpc_webPage = 0xca820ed7, - mtpc_messageMediaWebPage = 0xa32dd600, mtpc_authorization = 0x7bf2e6f6, mtpc_account_authorizations = 0x1250abde, mtpc_account_noPassword = 0x96dabc18, @@ -345,21 +364,16 @@ 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_inputStickerSetEmpty = 0xffb62b95, mtpc_inputStickerSetID = 0x9de7a269, mtpc_inputStickerSetShortName = 0x861cc8a0, mtpc_stickerSet = 0xcd303b41, mtpc_messages_stickerSet = 0xb60a24a6, - mtpc_user = 0x22e49072, mtpc_botCommand = 0xc27ac8c7, mtpc_botInfoEmpty = 0xbb2e37ce, mtpc_botInfo = 0x9cf585d, @@ -368,8 +382,6 @@ enum { mtpc_replyKeyboardHide = 0xa03e5b85, mtpc_replyKeyboardForceReply = 0xf4108aa0, mtpc_replyKeyboardMarkup = 0x3502758c, - mtpc_inputPeerUser = 0x7b8e7de6, - mtpc_inputUser = 0xd8292816, mtpc_help_appChangelogEmpty = 0xaf7e0394, mtpc_help_appChangelog = 0x4668e6bd, mtpc_messageEntityUnknown = 0xbb92ba95, @@ -383,9 +395,21 @@ enum { mtpc_messageEntityCode = 0x28a20571, mtpc_messageEntityPre = 0x73924be0, mtpc_messageEntityTextUrl = 0x76a6d327, - mtpc_updateShortSentMessage = 0x11f1331c, + mtpc_inputChatEmpty = 0xd9ff343c, + mtpc_inputChat = 0x43a5b9c3, + mtpc_inputChannel = 0x30c6ce73, + mtpc_messageRange = 0xae30253, + mtpc_messageGroup = 0xe8346f53, + mtpc_updates_channelDifferenceEmpty = 0x3e11affb, + mtpc_updates_channelDifferenceTooLong = 0x5e167646, + mtpc_updates_channelDifference = 0x2064674e, + mtpc_channelMessagesFilterEmpty = 0x94d42ee7, + mtpc_channelMessagesFilter = 0xcd77d957, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, + mtpc_initConnection = 0x69796de9, + mtpc_invokeWithLayer = 0xda9b0d0d, + mtpc_invokeWithoutUpdates = 0xbf9459b7, mtpc_auth_checkPhone = 0x6fe51dfb, mtpc_auth_sendCode = 0x768d5f4d, mtpc_auth_sendCall = 0x3c51564, @@ -397,6 +421,11 @@ enum { mtpc_auth_exportAuthorization = 0xe5bfffcd, mtpc_auth_importAuthorization = 0xe3ef9613, mtpc_auth_bindTempAuthKey = 0xcdd42a05, + mtpc_auth_sendSms = 0xda9f3e8, + mtpc_auth_importBotAuthorization = 0x67a3ff2c, + mtpc_auth_checkPassword = 0xa63011e, + mtpc_auth_requestPasswordRecovery = 0xd897bc66, + mtpc_auth_recoverPassword = 0x4ea56e92, mtpc_account_registerDevice = 0x446c712c, mtpc_account_unregisterDevice = 0x65c55b40, mtpc_account_updateNotifySettings = 0x84be5b93, @@ -405,6 +434,21 @@ enum { mtpc_account_updateProfile = 0xf0888d68, mtpc_account_updateStatus = 0x6628562c, mtpc_account_getWallPapers = 0xc04cfac2, + mtpc_account_checkUsername = 0x2714d86c, + mtpc_account_updateUsername = 0x3e0bdd7c, + mtpc_account_getPrivacy = 0xdadbc950, + mtpc_account_setPrivacy = 0xc9f81ce8, + mtpc_account_deleteAccount = 0x418d4e0b, + mtpc_account_getAccountTTL = 0x8fc711d, + mtpc_account_setAccountTTL = 0x2442485e, + mtpc_account_sendChangePhoneCode = 0xa407a8f4, + mtpc_account_changePhone = 0x70c32edb, + mtpc_account_updateDeviceLocked = 0x38df3532, + mtpc_account_getAuthorizations = 0xe320c158, + mtpc_account_resetAuthorization = 0xdf77f3bc, + mtpc_account_getPassword = 0x548a30f5, + mtpc_account_getPasswordSettings = 0xbc8d11bb, + mtpc_account_updatePasswordSettings = 0xfa7c4b86, mtpc_users_getUsers = 0xd91a548, mtpc_users_getFullUser = 0xca30a5b1, mtpc_contacts_getStatuses = 0xc4a353ee, @@ -418,9 +462,11 @@ enum { mtpc_contacts_getBlocked = 0xf57c350f, mtpc_contacts_exportCard = 0x84e53737, mtpc_contacts_importCard = 0x4fe196fe, + mtpc_contacts_search = 0x11f812d8, + mtpc_contacts_resolveUsername = 0xbf0131c, mtpc_messages_getMessages = 0x4222fa74, - mtpc_messages_getDialogs = 0xeccf1df6, - mtpc_messages_getHistory = 0x92a1df2f, + mtpc_messages_getDialogs = 0x859b3d3c, + mtpc_messages_getHistory = 0xe1ded325, mtpc_messages_search = 0x7e9f2ab, mtpc_messages_readHistory = 0xb04f2510, mtpc_messages_deleteHistory = 0xf4f8fb61, @@ -430,26 +476,13 @@ enum { mtpc_messages_sendMessage = 0xfa88427a, mtpc_messages_sendMedia = 0xc8f16791, mtpc_messages_forwardMessages = 0x55e1728d, - mtpc_messages_getChats = 0x3c6aa187, - mtpc_messages_getFullChat = 0x3b831c66, - mtpc_messages_editChatTitle = 0xdc452855, - mtpc_messages_editChatPhoto = 0xca4c79d8, - mtpc_messages_addChatUser = 0xf9a0aa09, - mtpc_messages_deleteChatUser = 0xe0611f16, + mtpc_messages_getChats = 0x27ae65b, + mtpc_messages_getFullChat = 0x36a4dfe, + mtpc_messages_editChatTitle = 0x6699d506, + mtpc_messages_editChatPhoto = 0xdd75758d, + mtpc_messages_addChatUser = 0x819183f4, + mtpc_messages_deleteChatUser = 0x9392c06f, mtpc_messages_createChat = 0x9cb126e, - mtpc_updates_getState = 0xedd4882a, - mtpc_updates_getDifference = 0xa041495, - mtpc_photos_updateProfilePhoto = 0xeef579a0, - mtpc_photos_uploadProfilePhoto = 0xd50f9c88, - mtpc_photos_deletePhotos = 0x87cf7f2f, - mtpc_upload_saveFilePart = 0xb304a621, - mtpc_upload_getFile = 0xe3a6cfb5, - mtpc_help_getConfig = 0xc4f9186b, - mtpc_help_getNearestDc = 0x1fb33026, - mtpc_help_getAppUpdate = 0xc812ac7e, - mtpc_help_saveAppLog = 0x6f02f748, - mtpc_help_getInviteText = 0xa4a95186, - mtpc_photos_getUserPhotos = 0x91cd32a8, mtpc_messages_forwardMessage = 0x33963bf9, mtpc_messages_sendBroadcast = 0xbf73f4da, mtpc_messages_getDhConfig = 0x26cf8950, @@ -462,44 +495,38 @@ enum { mtpc_messages_sendEncryptedFile = 0x9a901b66, mtpc_messages_sendEncryptedService = 0x32d439a4, mtpc_messages_receivedQueue = 0x55a5bb66, - mtpc_upload_saveBigFilePart = 0xde7b673d, - mtpc_initConnection = 0x69796de9, - mtpc_help_getSupport = 0x9cdf08cd, - mtpc_auth_sendSms = 0xda9f3e8, mtpc_messages_readMessageContents = 0x36a73f77, - mtpc_account_checkUsername = 0x2714d86c, - mtpc_account_updateUsername = 0x3e0bdd7c, - mtpc_contacts_search = 0x11f812d8, - mtpc_account_getPrivacy = 0xdadbc950, - mtpc_account_setPrivacy = 0xc9f81ce8, - mtpc_account_deleteAccount = 0x418d4e0b, - mtpc_account_getAccountTTL = 0x8fc711d, - mtpc_account_setAccountTTL = 0x2442485e, - mtpc_invokeWithLayer = 0xda9b0d0d, - mtpc_contacts_resolveUsername = 0xbf0131c, - mtpc_account_sendChangePhoneCode = 0xa407a8f4, - mtpc_account_changePhone = 0x70c32edb, mtpc_messages_getStickers = 0xae22e045, mtpc_messages_getAllStickers = 0xaa3bc868, - mtpc_account_updateDeviceLocked = 0x38df3532, - mtpc_auth_importBotAuthorization = 0x67a3ff2c, mtpc_messages_getWebPagePreview = 0x25223e24, - mtpc_account_getAuthorizations = 0xe320c158, - mtpc_account_resetAuthorization = 0xdf77f3bc, - mtpc_account_getPassword = 0x548a30f5, - mtpc_account_getPasswordSettings = 0xbc8d11bb, - mtpc_account_updatePasswordSettings = 0xfa7c4b86, - mtpc_auth_checkPassword = 0xa63011e, - mtpc_auth_requestPasswordRecovery = 0xd897bc66, - mtpc_auth_recoverPassword = 0x4ea56e92, - mtpc_invokeWithoutUpdates = 0xbf9459b7, - mtpc_messages_exportChatInvite = 0x7d885289, + mtpc_messages_exportChatInvite = 0xc26902ba, mtpc_messages_checkChatInvite = 0x3eadb1bb, mtpc_messages_importChatInvite = 0x6c50051c, mtpc_messages_getStickerSet = 0x2619a90e, mtpc_messages_installStickerSet = 0x7b30c3a6, mtpc_messages_uninstallStickerSet = 0xf96e55de, - mtpc_messages_startBot = 0x1b3e0ffc, + mtpc_messages_startBot = 0xf4cc052d, + mtpc_messages_getChannelDialogs = 0x92689583, + mtpc_messages_getImportantHistory = 0x25b7f3b2, + mtpc_messages_readChannelHistory = 0x36a1210e, + mtpc_messages_createChannel = 0xd9bc5fd2, + mtpc_messages_deleteChannelMessages = 0x9995a84f, + mtpc_updates_getState = 0xedd4882a, + mtpc_updates_getDifference = 0xa041495, + mtpc_updates_getChannelDifference = 0x248af4f5, + mtpc_photos_updateProfilePhoto = 0xeef579a0, + mtpc_photos_uploadProfilePhoto = 0xd50f9c88, + mtpc_photos_deletePhotos = 0x87cf7f2f, + mtpc_photos_getUserPhotos = 0x91cd32a8, + mtpc_upload_saveFilePart = 0xb304a621, + mtpc_upload_getFile = 0xe3a6cfb5, + mtpc_upload_saveBigFilePart = 0xde7b673d, + mtpc_help_getConfig = 0xc4f9186b, + mtpc_help_getNearestDc = 0x1fb33026, + mtpc_help_getAppUpdate = 0xc812ac7e, + mtpc_help_saveAppLog = 0x6f02f748, + mtpc_help_getInviteText = 0xa4a95186, + mtpc_help_getSupport = 0x9cdf08cd, mtpc_help_getAppChangelog = 0x5bab7fb2 }; @@ -581,6 +608,7 @@ class MTPnull; class MTPinputPeer; class MTPDinputPeerChat; class MTPDinputPeerUser; +class MTPDinputPeerChannel; class MTPinputUser; class MTPDinputUser; @@ -636,6 +664,7 @@ class MTPDinputAppEvent; class MTPpeer; class MTPDpeerUser; class MTPDpeerChat; +class MTPDpeerChannel; class MTPstorage_fileType; @@ -658,9 +687,11 @@ class MTPchat; class MTPDchatEmpty; class MTPDchat; class MTPDchatForbidden; +class MTPDchannel; class MTPchatFull; class MTPDchatFull; +class MTPDchannelFull; class MTPchatParticipant; class MTPDchatParticipant; @@ -694,9 +725,11 @@ class MTPDmessageActionChatEditPhoto; class MTPDmessageActionChatAddUser; class MTPDmessageActionChatDeleteUser; class MTPDmessageActionChatJoinedByLink; +class MTPDmessageActionChannelCreate; class MTPdialog; class MTPDdialog; +class MTPDdialogChannel; class MTPphoto; class MTPDphotoEmpty; @@ -785,6 +818,7 @@ class MTPDmessages_dialogsSlice; class MTPmessages_messages; class MTPDmessages_messages; class MTPDmessages_messagesSlice; +class MTPDmessages_channelMessages; class MTPmessages_chats; class MTPDmessages_chats; @@ -826,6 +860,10 @@ class MTPDupdateReadHistoryInbox; class MTPDupdateReadHistoryOutbox; class MTPDupdateWebPage; class MTPDupdateReadMessagesContents; +class MTPDupdateChannelTooLong; +class MTPDupdateNewChannelMessage; +class MTPDupdateReadChannelInbox; +class MTPDupdateDeleteChannelMessages; class MTPupdates_state; class MTPDupdates_state; @@ -1052,6 +1090,24 @@ class MTPDmessageEntityCode; class MTPDmessageEntityPre; class MTPDmessageEntityTextUrl; +class MTPinputChat; +class MTPDinputChat; +class MTPDinputChannel; + +class MTPmessageRange; +class MTPDmessageRange; + +class MTPmessageGroup; +class MTPDmessageGroup; + +class MTPupdates_channelDifference; +class MTPDupdates_channelDifferenceEmpty; +class MTPDupdates_channelDifferenceTooLong; +class MTPDupdates_channelDifference; + +class MTPchannelMessagesFilter; +class MTPDchannelMessagesFilter; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1197,6 +1253,11 @@ typedef MTPBoxed MTPKeyboardButtonRow; typedef MTPBoxed MTPReplyMarkup; typedef MTPBoxed MTPhelp_AppChangelog; typedef MTPBoxed MTPMessageEntity; +typedef MTPBoxed MTPInputChat; +typedef MTPBoxed MTPMessageRange; +typedef MTPBoxed MTPMessageGroup; +typedef MTPBoxed MTPupdates_ChannelDifference; +typedef MTPBoxed MTPChannelMessagesFilter; // Type classes definitions @@ -2057,6 +2118,18 @@ public: return *(const MTPDinputPeerUser*)data; } + MTPDinputPeerChannel &_inputPeerChannel() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputPeerChannel) throw mtpErrorWrongTypeId(_type, mtpc_inputPeerChannel); + split(); + return *(MTPDinputPeerChannel*)data; + } + const MTPDinputPeerChannel &c_inputPeerChannel() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputPeerChannel) throw mtpErrorWrongTypeId(_type, mtpc_inputPeerChannel); + return *(const MTPDinputPeerChannel*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -2068,11 +2141,13 @@ private: explicit MTPinputPeer(mtpTypeId type); explicit MTPinputPeer(MTPDinputPeerChat *_data); explicit MTPinputPeer(MTPDinputPeerUser *_data); + explicit MTPinputPeer(MTPDinputPeerChannel *_data); friend MTPinputPeer MTP_inputPeerEmpty(); friend MTPinputPeer MTP_inputPeerSelf(); friend MTPinputPeer MTP_inputPeerChat(MTPint _chat_id); friend MTPinputPeer MTP_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash); + friend MTPinputPeer MTP_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash); mtpTypeId _type; }; @@ -2765,6 +2840,18 @@ public: return *(const MTPDpeerChat*)data; } + MTPDpeerChannel &_peerChannel() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_peerChannel) throw mtpErrorWrongTypeId(_type, mtpc_peerChannel); + split(); + return *(MTPDpeerChannel*)data; + } + const MTPDpeerChannel &c_peerChannel() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_peerChannel) throw mtpErrorWrongTypeId(_type, mtpc_peerChannel); + return *(const MTPDpeerChannel*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -2776,9 +2863,11 @@ private: explicit MTPpeer(mtpTypeId type); explicit MTPpeer(MTPDpeerUser *_data); explicit MTPpeer(MTPDpeerChat *_data); + explicit MTPpeer(MTPDpeerChannel *_data); friend MTPpeer MTP_peerUser(MTPint _user_id); friend MTPpeer MTP_peerChat(MTPint _chat_id); + friend MTPpeer MTP_peerChannel(MTPint _channel_id); mtpTypeId _type; }; @@ -3056,6 +3145,18 @@ public: return *(const MTPDchatForbidden*)data; } + MTPDchannel &_channel() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channel) throw mtpErrorWrongTypeId(_type, mtpc_channel); + split(); + return *(MTPDchannel*)data; + } + const MTPDchannel &c_channel() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channel) throw mtpErrorWrongTypeId(_type, mtpc_channel); + return *(const MTPDchannel*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3068,10 +3169,12 @@ private: explicit MTPchat(MTPDchatEmpty *_data); explicit MTPchat(MTPDchat *_data); explicit MTPchat(MTPDchatForbidden *_data); + explicit MTPchat(MTPDchannel *_data); friend MTPchat MTP_chatEmpty(MTPint _id); friend MTPchat MTP_chat(MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPBool _left, MTPint _version); friend MTPchat MTP_chatForbidden(MTPint _id, const MTPstring &_title, MTPint _date); + friend MTPchat MTP_channel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _date, MTPint _version); mtpTypeId _type; }; @@ -3079,32 +3182,52 @@ typedef MTPBoxed MTPChat; class MTPchatFull : private mtpDataOwner { public: - MTPchatFull(); - MTPchatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_chatFull) : mtpDataOwner(0) { + MTPchatFull() : mtpDataOwner(0), _type(0) { + } + MTPchatFull(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { read(from, end, cons); } MTPDchatFull &_chatFull() { if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatFull) throw mtpErrorWrongTypeId(_type, mtpc_chatFull); split(); return *(MTPDchatFull*)data; } const MTPDchatFull &c_chatFull() const { if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_chatFull) throw mtpErrorWrongTypeId(_type, mtpc_chatFull); return *(const MTPDchatFull*)data; } + MTPDchannelFull &_channelFull() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channelFull) throw mtpErrorWrongTypeId(_type, mtpc_channelFull); + split(); + return *(MTPDchannelFull*)data; + } + const MTPDchannelFull &c_channelFull() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channelFull) throw mtpErrorWrongTypeId(_type, mtpc_channelFull); + return *(const MTPDchannelFull*)data; + } + uint32 innerLength() const; mtpTypeId type() const; - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_chatFull); + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); void write(mtpBuffer &to) const; typedef void ResponseType; private: + explicit MTPchatFull(mtpTypeId type); explicit MTPchatFull(MTPDchatFull *_data); + explicit MTPchatFull(MTPDchannelFull *_data); friend MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info); + friend MTPchatFull MTP_channelFull(MTPint _id, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite); + + mtpTypeId _type; }; typedef MTPBoxed MTPChatFull; @@ -3510,6 +3633,18 @@ public: return *(const MTPDmessageActionChatJoinedByLink*)data; } + MTPDmessageActionChannelCreate &_messageActionChannelCreate() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionChannelCreate) throw mtpErrorWrongTypeId(_type, mtpc_messageActionChannelCreate); + split(); + return *(MTPDmessageActionChannelCreate*)data; + } + const MTPDmessageActionChannelCreate &c_messageActionChannelCreate() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionChannelCreate) throw mtpErrorWrongTypeId(_type, mtpc_messageActionChannelCreate); + return *(const MTPDmessageActionChannelCreate*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3525,6 +3660,7 @@ private: explicit MTPmessageAction(MTPDmessageActionChatAddUser *_data); explicit MTPmessageAction(MTPDmessageActionChatDeleteUser *_data); explicit MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data); + explicit MTPmessageAction(MTPDmessageActionChannelCreate *_data); friend MTPmessageAction MTP_messageActionEmpty(); friend MTPmessageAction MTP_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users); @@ -3534,6 +3670,7 @@ private: friend MTPmessageAction MTP_messageActionChatAddUser(MTPint _user_id); friend MTPmessageAction MTP_messageActionChatDeleteUser(MTPint _user_id); friend MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id); + friend MTPmessageAction MTP_messageActionChannelCreate(const MTPstring &_title); mtpTypeId _type; }; @@ -3541,32 +3678,52 @@ typedef MTPBoxed MTPMessageAction; class MTPdialog : private mtpDataOwner { public: - MTPdialog(); - MTPdialog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dialog) : mtpDataOwner(0) { + MTPdialog() : mtpDataOwner(0), _type(0) { + } + MTPdialog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { read(from, end, cons); } MTPDdialog &_dialog() { if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_dialog) throw mtpErrorWrongTypeId(_type, mtpc_dialog); split(); return *(MTPDdialog*)data; } const MTPDdialog &c_dialog() const { if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_dialog) throw mtpErrorWrongTypeId(_type, mtpc_dialog); return *(const MTPDdialog*)data; } + MTPDdialogChannel &_dialogChannel() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_dialogChannel) throw mtpErrorWrongTypeId(_type, mtpc_dialogChannel); + split(); + return *(MTPDdialogChannel*)data; + } + const MTPDdialogChannel &c_dialogChannel() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_dialogChannel) throw mtpErrorWrongTypeId(_type, mtpc_dialogChannel); + return *(const MTPDdialogChannel*)data; + } + uint32 innerLength() const; mtpTypeId type() const; - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_dialog); + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); void write(mtpBuffer &to) const; typedef void ResponseType; private: + explicit MTPdialog(mtpTypeId type); explicit MTPdialog(MTPDdialog *_data); + explicit MTPdialog(MTPDdialogChannel *_data); friend MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings); + friend MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts); + + mtpTypeId _type; }; typedef MTPBoxed MTPDialog; @@ -4580,6 +4737,18 @@ public: return *(const MTPDmessages_messagesSlice*)data; } + MTPDmessages_channelMessages &_messages_channelMessages() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messages_channelMessages) throw mtpErrorWrongTypeId(_type, mtpc_messages_channelMessages); + split(); + return *(MTPDmessages_channelMessages*)data; + } + const MTPDmessages_channelMessages &c_messages_channelMessages() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messages_channelMessages) throw mtpErrorWrongTypeId(_type, mtpc_messages_channelMessages); + return *(const MTPDmessages_channelMessages*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -4591,9 +4760,11 @@ private: explicit MTPmessages_messages(mtpTypeId type); explicit MTPmessages_messages(MTPDmessages_messages *_data); explicit MTPmessages_messages(MTPDmessages_messagesSlice *_data); + explicit MTPmessages_messages(MTPDmessages_channelMessages *_data); friend MTPmessages_messages MTP_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); friend MTPmessages_messages MTP_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); + friend MTPmessages_messages MTP_messages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users); mtpTypeId _type; }; @@ -5068,6 +5239,54 @@ public: return *(const MTPDupdateReadMessagesContents*)data; } + MTPDupdateChannelTooLong &_updateChannelTooLong() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateChannelTooLong) throw mtpErrorWrongTypeId(_type, mtpc_updateChannelTooLong); + split(); + return *(MTPDupdateChannelTooLong*)data; + } + const MTPDupdateChannelTooLong &c_updateChannelTooLong() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateChannelTooLong) throw mtpErrorWrongTypeId(_type, mtpc_updateChannelTooLong); + return *(const MTPDupdateChannelTooLong*)data; + } + + MTPDupdateNewChannelMessage &_updateNewChannelMessage() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateNewChannelMessage) throw mtpErrorWrongTypeId(_type, mtpc_updateNewChannelMessage); + split(); + return *(MTPDupdateNewChannelMessage*)data; + } + const MTPDupdateNewChannelMessage &c_updateNewChannelMessage() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateNewChannelMessage) throw mtpErrorWrongTypeId(_type, mtpc_updateNewChannelMessage); + return *(const MTPDupdateNewChannelMessage*)data; + } + + MTPDupdateReadChannelInbox &_updateReadChannelInbox() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadChannelInbox) throw mtpErrorWrongTypeId(_type, mtpc_updateReadChannelInbox); + split(); + return *(MTPDupdateReadChannelInbox*)data; + } + const MTPDupdateReadChannelInbox &c_updateReadChannelInbox() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateReadChannelInbox) throw mtpErrorWrongTypeId(_type, mtpc_updateReadChannelInbox); + return *(const MTPDupdateReadChannelInbox*)data; + } + + MTPDupdateDeleteChannelMessages &_updateDeleteChannelMessages() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateDeleteChannelMessages) throw mtpErrorWrongTypeId(_type, mtpc_updateDeleteChannelMessages); + split(); + return *(MTPDupdateDeleteChannelMessages*)data; + } + const MTPDupdateDeleteChannelMessages &c_updateDeleteChannelMessages() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updateDeleteChannelMessages) throw mtpErrorWrongTypeId(_type, mtpc_updateDeleteChannelMessages); + return *(const MTPDupdateDeleteChannelMessages*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -5105,6 +5324,10 @@ private: explicit MTPupdate(MTPDupdateReadHistoryOutbox *_data); explicit MTPupdate(MTPDupdateWebPage *_data); explicit MTPupdate(MTPDupdateReadMessagesContents *_data); + explicit MTPupdate(MTPDupdateChannelTooLong *_data); + explicit MTPupdate(MTPDupdateNewChannelMessage *_data); + explicit MTPupdate(MTPDupdateReadChannelInbox *_data); + explicit MTPupdate(MTPDupdateDeleteChannelMessages *_data); friend MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); friend MTPupdate MTP_updateMessageID(MTPint _id, const MTPlong &_random_id); @@ -5134,6 +5357,10 @@ private: 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); + friend MTPupdate MTP_updateChannelTooLong(MTPint _channel_id); + friend MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); + friend MTPupdate MTP_updateReadChannelInbox(const MTPPeer &_peer, MTPint _max_id); + friend MTPupdate MTP_updateDeleteChannelMessages(const MTPPeer &_peer, const MTPVector &_messages, MTPint _pts, MTPint _pts_count); mtpTypeId _type; }; @@ -7846,6 +8073,223 @@ private: }; typedef MTPBoxed MTPMessageEntity; +class MTPinputChat : private mtpDataOwner { +public: + MTPinputChat() : mtpDataOwner(0), _type(0) { + } + MTPinputChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDinputChat &_inputChat() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputChat) throw mtpErrorWrongTypeId(_type, mtpc_inputChat); + split(); + return *(MTPDinputChat*)data; + } + const MTPDinputChat &c_inputChat() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputChat) throw mtpErrorWrongTypeId(_type, mtpc_inputChat); + return *(const MTPDinputChat*)data; + } + + MTPDinputChannel &_inputChannel() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputChannel) throw mtpErrorWrongTypeId(_type, mtpc_inputChannel); + split(); + return *(MTPDinputChannel*)data; + } + const MTPDinputChannel &c_inputChannel() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_inputChannel) throw mtpErrorWrongTypeId(_type, mtpc_inputChannel); + return *(const MTPDinputChannel*)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 MTPinputChat(mtpTypeId type); + explicit MTPinputChat(MTPDinputChat *_data); + explicit MTPinputChat(MTPDinputChannel *_data); + + friend MTPinputChat MTP_inputChatEmpty(); + friend MTPinputChat MTP_inputChat(MTPint _chat_id); + friend MTPinputChat MTP_inputChannel(MTPint _channel_id, const MTPlong &_access_hash); + + mtpTypeId _type; +}; +typedef MTPBoxed MTPInputChat; + +class MTPmessageRange : private mtpDataOwner { +public: + MTPmessageRange(); + MTPmessageRange(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageRange) : mtpDataOwner(0) { + read(from, end, cons); + } + + MTPDmessageRange &_messageRange() { + if (!data) throw mtpErrorUninitialized(); + split(); + return *(MTPDmessageRange*)data; + } + const MTPDmessageRange &c_messageRange() const { + if (!data) throw mtpErrorUninitialized(); + return *(const MTPDmessageRange*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageRange); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPmessageRange(MTPDmessageRange *_data); + + friend MTPmessageRange MTP_messageRange(MTPint _min_id, MTPint _max_id); +}; +typedef MTPBoxed MTPMessageRange; + +class MTPmessageGroup : private mtpDataOwner { +public: + MTPmessageGroup(); + MTPmessageGroup(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageGroup) : mtpDataOwner(0) { + read(from, end, cons); + } + + MTPDmessageGroup &_messageGroup() { + if (!data) throw mtpErrorUninitialized(); + split(); + return *(MTPDmessageGroup*)data; + } + const MTPDmessageGroup &c_messageGroup() const { + if (!data) throw mtpErrorUninitialized(); + return *(const MTPDmessageGroup*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messageGroup); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPmessageGroup(MTPDmessageGroup *_data); + + friend MTPmessageGroup MTP_messageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date); +}; +typedef MTPBoxed MTPMessageGroup; + +class MTPupdates_channelDifference : private mtpDataOwner { +public: + MTPupdates_channelDifference() : mtpDataOwner(0), _type(0) { + } + MTPupdates_channelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDupdates_channelDifferenceEmpty &_updates_channelDifferenceEmpty() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifferenceEmpty) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifferenceEmpty); + split(); + return *(MTPDupdates_channelDifferenceEmpty*)data; + } + const MTPDupdates_channelDifferenceEmpty &c_updates_channelDifferenceEmpty() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifferenceEmpty) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifferenceEmpty); + return *(const MTPDupdates_channelDifferenceEmpty*)data; + } + + MTPDupdates_channelDifferenceTooLong &_updates_channelDifferenceTooLong() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifferenceTooLong) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifferenceTooLong); + split(); + return *(MTPDupdates_channelDifferenceTooLong*)data; + } + const MTPDupdates_channelDifferenceTooLong &c_updates_channelDifferenceTooLong() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifferenceTooLong) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifferenceTooLong); + return *(const MTPDupdates_channelDifferenceTooLong*)data; + } + + MTPDupdates_channelDifference &_updates_channelDifference() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifference) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifference); + split(); + return *(MTPDupdates_channelDifference*)data; + } + const MTPDupdates_channelDifference &c_updates_channelDifference() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_updates_channelDifference) throw mtpErrorWrongTypeId(_type, mtpc_updates_channelDifference); + return *(const MTPDupdates_channelDifference*)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 MTPupdates_channelDifference(mtpTypeId type); + explicit MTPupdates_channelDifference(MTPDupdates_channelDifferenceEmpty *_data); + explicit MTPupdates_channelDifference(MTPDupdates_channelDifferenceTooLong *_data); + explicit MTPupdates_channelDifference(MTPDupdates_channelDifference *_data); + + friend MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout); + friend MTPupdates_channelDifference MTP_updates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); + friend MTPupdates_channelDifference MTP_updates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users); + + mtpTypeId _type; +}; +typedef MTPBoxed MTPupdates_ChannelDifference; + +class MTPchannelMessagesFilter : private mtpDataOwner { +public: + MTPchannelMessagesFilter() : mtpDataOwner(0), _type(0) { + } + MTPchannelMessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDchannelMessagesFilter &_channelMessagesFilter() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channelMessagesFilter) throw mtpErrorWrongTypeId(_type, mtpc_channelMessagesFilter); + split(); + return *(MTPDchannelMessagesFilter*)data; + } + const MTPDchannelMessagesFilter &c_channelMessagesFilter() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_channelMessagesFilter) throw mtpErrorWrongTypeId(_type, mtpc_channelMessagesFilter); + return *(const MTPDchannelMessagesFilter*)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 MTPchannelMessagesFilter(mtpTypeId type); + explicit MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data); + + friend MTPchannelMessagesFilter MTP_channelMessagesFilterEmpty(); + friend MTPchannelMessagesFilter MTP_channelMessagesFilter(MTPint _flags, const MTPVector &_ranges); + + mtpTypeId _type; +}; +typedef MTPBoxed MTPChannelMessagesFilter; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -8200,6 +8644,17 @@ public: MTPlong vaccess_hash; }; +class MTPDinputPeerChannel : public mtpDataImpl { +public: + MTPDinputPeerChannel() { + } + MTPDinputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash) : vchannel_id(_channel_id), vaccess_hash(_access_hash) { + } + + MTPint vchannel_id; + MTPlong vaccess_hash; +}; + class MTPDinputUser : public mtpDataImpl { public: MTPDinputUser() { @@ -8562,6 +9017,16 @@ public: MTPint vchat_id; }; +class MTPDpeerChannel : public mtpDataImpl { +public: + MTPDpeerChannel() { + } + MTPDpeerChannel(MTPint _channel_id) : vchannel_id(_channel_id) { + } + + MTPint vchannel_id; +}; + class MTPDfileLocationUnavailable : public mtpDataImpl { public: MTPDfileLocationUnavailable() { @@ -8706,6 +9171,22 @@ public: MTPint vdate; }; +class MTPDchannel : public mtpDataImpl { +public: + MTPDchannel() { + } + MTPDchannel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _date, MTPint _version) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vphoto(_photo), vdate(_date), vversion(_version) { + } + + MTPint vflags; + MTPint vid; + MTPlong vaccess_hash; + MTPstring vtitle; + MTPChatPhoto vphoto; + MTPint vdate; + MTPint vversion; +}; + class MTPDchatFull : public mtpDataImpl { public: MTPDchatFull() { @@ -8721,6 +9202,22 @@ public: MTPVector vbot_info; }; +class MTPDchannelFull : public mtpDataImpl { +public: + MTPDchannelFull() { + } + MTPDchannelFull(MTPint _id, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite) : vid(_id), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vchat_photo(_chat_photo), vnotify_settings(_notify_settings), vexported_invite(_exported_invite) { + } + + MTPint vid; + MTPint vread_inbox_max_id; + MTPint vunread_count; + MTPint vunread_important_count; + MTPPhoto vchat_photo; + MTPPeerNotifySettings vnotify_settings; + MTPExportedChatInvite vexported_invite; +}; + class MTPDchatParticipant : public mtpDataImpl { public: MTPDchatParticipant() { @@ -8798,6 +9295,7 @@ public: MTPVector ventities; enum { + flag_from_id = (1 << 8), flag_fwd_from_id = (1 << 2), flag_fwd_date = (1 << 2), flag_reply_to_msg_id = (1 << 3), @@ -8806,6 +9304,7 @@ public: flag_entities = (1 << 7), }; + bool has_from_id() const { return vflags.v & flag_from_id; } bool has_fwd_from_id() const { return vflags.v & flag_fwd_from_id; } bool has_fwd_date() const { return vflags.v & flag_fwd_date; } bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } @@ -8827,6 +9326,12 @@ public: MTPPeer vto_id; MTPint vdate; MTPMessageAction vaction; + + enum { + flag_from_id = (1 << 8), + }; + + bool has_from_id() const { return vflags.v & flag_from_id; } }; class MTPDmessageMediaPhoto : public mtpDataImpl { @@ -8979,6 +9484,16 @@ public: MTPint vinviter_id; }; +class MTPDmessageActionChannelCreate : public mtpDataImpl { +public: + MTPDmessageActionChannelCreate() { + } + MTPDmessageActionChannelCreate(const MTPstring &_title) : vtitle(_title) { + } + + MTPstring vtitle; +}; + class MTPDdialog : public mtpDataImpl { public: MTPDdialog() { @@ -8993,6 +9508,23 @@ public: MTPPeerNotifySettings vnotify_settings; }; +class MTPDdialogChannel : public mtpDataImpl { +public: + MTPDdialogChannel() { + } + MTPDdialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) : vpeer(_peer), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vnotify_settings(_notify_settings), vpts(_pts) { + } + + MTPPeer vpeer; + MTPint vtop_message; + MTPint vtop_important_message; + MTPint vread_inbox_max_id; + MTPint vunread_count; + MTPint vunread_important_count; + MTPPeerNotifySettings vnotify_settings; + MTPint vpts; +}; + class MTPDphotoEmpty : public mtpDataImpl { public: MTPDphotoEmpty() { @@ -9404,6 +9936,28 @@ public: MTPVector vusers; }; +class MTPDmessages_channelMessages : public mtpDataImpl { +public: + MTPDmessages_channelMessages() { + } + MTPDmessages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vcount(_count), vmessages(_messages), vcollapsed(_collapsed), vchats(_chats), vusers(_users) { + } + + MTPint vflags; + MTPint vpts; + MTPint vcount; + MTPVector vmessages; + MTPVector vcollapsed; + MTPVector vchats; + MTPVector vusers; + + enum { + flag_collapsed = (1 << 0), + }; + + bool has_collapsed() const { return vflags.v & flag_collapsed; } +}; + class MTPDmessages_chats : public mtpDataImpl { public: MTPDmessages_chats() { @@ -9763,6 +10317,52 @@ public: MTPint vpts_count; }; +class MTPDupdateChannelTooLong : public mtpDataImpl { +public: + MTPDupdateChannelTooLong() { + } + MTPDupdateChannelTooLong(MTPint _channel_id) : vchannel_id(_channel_id) { + } + + MTPint vchannel_id; +}; + +class MTPDupdateNewChannelMessage : public mtpDataImpl { +public: + MTPDupdateNewChannelMessage() { + } + MTPDupdateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) : vmessage(_message), vpts(_pts), vpts_count(_pts_count) { + } + + MTPMessage vmessage; + MTPint vpts; + MTPint vpts_count; +}; + +class MTPDupdateReadChannelInbox : public mtpDataImpl { +public: + MTPDupdateReadChannelInbox() { + } + MTPDupdateReadChannelInbox(const MTPPeer &_peer, MTPint _max_id) : vpeer(_peer), vmax_id(_max_id) { + } + + MTPPeer vpeer; + MTPint vmax_id; +}; + +class MTPDupdateDeleteChannelMessages : public mtpDataImpl { +public: + MTPDupdateDeleteChannelMessages() { + } + MTPDupdateDeleteChannelMessages(const MTPPeer &_peer, const MTPVector &_messages, MTPint _pts, MTPint _pts_count) : vpeer(_peer), vmessages(_messages), vpts(_pts), vpts_count(_pts_count) { + } + + MTPPeer vpeer; + MTPVector vmessages; + MTPint vpts; + MTPint vpts_count; +}; + class MTPDupdates_state : public mtpDataImpl { public: MTPDupdates_state() { @@ -11081,6 +11681,128 @@ public: MTPstring vurl; }; +class MTPDinputChat : public mtpDataImpl { +public: + MTPDinputChat() { + } + MTPDinputChat(MTPint _chat_id) : vchat_id(_chat_id) { + } + + MTPint vchat_id; +}; + +class MTPDinputChannel : public mtpDataImpl { +public: + MTPDinputChannel() { + } + MTPDinputChannel(MTPint _channel_id, const MTPlong &_access_hash) : vchannel_id(_channel_id), vaccess_hash(_access_hash) { + } + + MTPint vchannel_id; + MTPlong vaccess_hash; +}; + +class MTPDmessageRange : public mtpDataImpl { +public: + MTPDmessageRange() { + } + MTPDmessageRange(MTPint _min_id, MTPint _max_id) : vmin_id(_min_id), vmax_id(_max_id) { + } + + MTPint vmin_id; + MTPint vmax_id; +}; + +class MTPDmessageGroup : public mtpDataImpl { +public: + MTPDmessageGroup() { + } + MTPDmessageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date) : vmin_id(_min_id), vmax_id(_max_id), vcount(_count), vdate(_date) { + } + + MTPint vmin_id; + MTPint vmax_id; + MTPint vcount; + MTPint vdate; +}; + +class MTPDupdates_channelDifferenceEmpty : public mtpDataImpl { +public: + MTPDupdates_channelDifferenceEmpty() { + } + MTPDupdates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout) : vflags(_flags), vpts(_pts), vtimeout(_timeout) { + } + + MTPint vflags; + MTPint vpts; + MTPint vtimeout; + + enum { + flag_timeout = (1 << 1), + }; + + bool has_timeout() const { return vflags.v & flag_timeout; } +}; + +class MTPDupdates_channelDifferenceTooLong : public mtpDataImpl { +public: + MTPDupdates_channelDifferenceTooLong() { + } + MTPDupdates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vmessages(_messages), vchats(_chats), vusers(_users) { + } + + MTPint vflags; + MTPint vpts; + MTPint vtimeout; + MTPint vtop_message; + MTPint vtop_important_message; + MTPint vread_inbox_max_id; + MTPint vunread_count; + MTPint vunread_important_count; + MTPVector vmessages; + MTPVector vchats; + MTPVector vusers; + + enum { + flag_timeout = (1 << 1), + }; + + bool has_timeout() const { return vflags.v & flag_timeout; } +}; + +class MTPDupdates_channelDifference : public mtpDataImpl { +public: + MTPDupdates_channelDifference() { + } + MTPDupdates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vnew_messages(_new_messages), vother_updates(_other_updates), vchats(_chats), vusers(_users) { + } + + MTPint vflags; + MTPint vpts; + MTPint vtimeout; + MTPVector vnew_messages; + MTPVector vother_updates; + MTPVector vchats; + MTPVector vusers; + + enum { + flag_timeout = (1 << 1), + }; + + bool has_timeout() const { return vflags.v & flag_timeout; } +}; + +class MTPDchannelMessagesFilter : public mtpDataImpl { +public: + MTPDchannelMessagesFilter() { + } + MTPDchannelMessagesFilter(MTPint _flags, const MTPVector &_ranges) : vflags(_flags), vranges(_ranges) { + } + + MTPint vflags; + MTPVector vranges; +}; + // RPC methods class MTPreq_pq { // RPC method 'req_pq' @@ -11554,6 +12276,141 @@ public: } }; +template +class MTPinitConnection { // RPC method 'initConnection' +public: + MTPint vapi_id; + MTPstring vdevice_model; + MTPstring vsystem_version; + MTPstring vapp_version; + MTPstring vlang_code; + TQueryType vquery; + + MTPinitConnection() { + } + MTPinitConnection(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_initConnection) { + read(from, end, cons); + } + MTPinitConnection(MTPint _api_id, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code, const TQueryType &_query) : vapi_id(_api_id), vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code), vquery(_query) { + } + + uint32 innerLength() const { + return vapi_id.innerLength() + vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength() + vquery.innerLength(); + } + mtpTypeId type() const { + return mtpc_initConnection; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_initConnection) { + vapi_id.read(from, end); + vdevice_model.read(from, end); + vsystem_version.read(from, end); + vapp_version.read(from, end); + vlang_code.read(from, end); + vquery.read(from, end); + } + void write(mtpBuffer &to) const { + vapi_id.write(to); + vdevice_model.write(to); + vsystem_version.write(to); + vapp_version.write(to); + vlang_code.write(to); + vquery.write(to); + } + + typedef typename TQueryType::ResponseType ResponseType; +}; +template +class MTPInitConnection : public MTPBoxed > { +public: + MTPInitConnection() { + } + MTPInitConnection(const MTPinitConnection &v) : MTPBoxed >(v) { + } + MTPInitConnection(MTPint _api_id, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code, const TQueryType &_query) : MTPBoxed >(MTPinitConnection(_api_id, _device_model, _system_version, _app_version, _lang_code, _query)) { + } +}; + +template +class MTPinvokeWithLayer { // RPC method 'invokeWithLayer' +public: + MTPint vlayer; + TQueryType vquery; + + MTPinvokeWithLayer() { + } + MTPinvokeWithLayer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithLayer) { + read(from, end, cons); + } + MTPinvokeWithLayer(MTPint _layer, const TQueryType &_query) : vlayer(_layer), vquery(_query) { + } + + uint32 innerLength() const { + return vlayer.innerLength() + vquery.innerLength(); + } + mtpTypeId type() const { + return mtpc_invokeWithLayer; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithLayer) { + vlayer.read(from, end); + vquery.read(from, end); + } + void write(mtpBuffer &to) const { + vlayer.write(to); + vquery.write(to); + } + + typedef typename TQueryType::ResponseType ResponseType; +}; +template +class MTPInvokeWithLayer : public MTPBoxed > { +public: + MTPInvokeWithLayer() { + } + MTPInvokeWithLayer(const MTPinvokeWithLayer &v) : MTPBoxed >(v) { + } + MTPInvokeWithLayer(MTPint _layer, const TQueryType &_query) : MTPBoxed >(MTPinvokeWithLayer(_layer, _query)) { + } +}; + +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 MTPauth_checkPhone { // RPC method 'auth.checkPhone' public: MTPstring vphone_number; @@ -12015,6 +12872,205 @@ public: } }; +class MTPauth_sendSms { // RPC method 'auth.sendSms' +public: + MTPstring vphone_number; + MTPstring vphone_code_hash; + + MTPauth_sendSms() { + } + MTPauth_sendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { + read(from, end, cons); + } + MTPauth_sendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { + } + + uint32 innerLength() const { + return vphone_number.innerLength() + vphone_code_hash.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_sendSms; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { + vphone_number.read(from, end); + vphone_code_hash.read(from, end); + } + void write(mtpBuffer &to) const { + vphone_number.write(to); + vphone_code_hash.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPauth_SendSms : public MTPBoxed { +public: + MTPauth_SendSms() { + } + MTPauth_SendSms(const MTPauth_sendSms &v) : MTPBoxed(v) { + } + MTPauth_SendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_SendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_sendSms(_phone_number, _phone_code_hash)) { + } +}; + +class MTPauth_importBotAuthorization { // RPC method 'auth.importBotAuthorization' +public: + MTPint vflags; + MTPint vapi_id; + MTPstring vapi_hash; + MTPstring vbot_auth_token; + + MTPauth_importBotAuthorization() { + } + MTPauth_importBotAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_importBotAuthorization) { + read(from, end, cons); + } + MTPauth_importBotAuthorization(MTPint _flags, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_bot_auth_token) : vflags(_flags), vapi_id(_api_id), vapi_hash(_api_hash), vbot_auth_token(_bot_auth_token) { + } + + uint32 innerLength() const { + return vflags.innerLength() + vapi_id.innerLength() + vapi_hash.innerLength() + vbot_auth_token.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_importBotAuthorization; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_importBotAuthorization) { + vflags.read(from, end); + vapi_id.read(from, end); + vapi_hash.read(from, end); + vbot_auth_token.read(from, end); + } + void write(mtpBuffer &to) const { + vflags.write(to); + vapi_id.write(to); + vapi_hash.write(to); + vbot_auth_token.write(to); + } + + typedef MTPauth_Authorization ResponseType; +}; +class MTPauth_ImportBotAuthorization : public MTPBoxed { +public: + MTPauth_ImportBotAuthorization() { + } + MTPauth_ImportBotAuthorization(const MTPauth_importBotAuthorization &v) : MTPBoxed(v) { + } + MTPauth_ImportBotAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_ImportBotAuthorization(MTPint _flags, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_bot_auth_token) : MTPBoxed(MTPauth_importBotAuthorization(_flags, _api_id, _api_hash, _bot_auth_token)) { + } +}; + +class MTPauth_checkPassword { // RPC method 'auth.checkPassword' +public: + MTPbytes vpassword_hash; + + MTPauth_checkPassword() { + } + MTPauth_checkPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkPassword) { + read(from, end, cons); + } + MTPauth_checkPassword(const MTPbytes &_password_hash) : vpassword_hash(_password_hash) { + } + + uint32 innerLength() const { + return vpassword_hash.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_checkPassword; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkPassword) { + vpassword_hash.read(from, end); + } + void write(mtpBuffer &to) const { + vpassword_hash.write(to); + } + + typedef MTPauth_Authorization ResponseType; +}; +class MTPauth_CheckPassword : public MTPBoxed { +public: + MTPauth_CheckPassword() { + } + MTPauth_CheckPassword(const MTPauth_checkPassword &v) : MTPBoxed(v) { + } + MTPauth_CheckPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_CheckPassword(const MTPbytes &_password_hash) : MTPBoxed(MTPauth_checkPassword(_password_hash)) { + } +}; + +class MTPauth_requestPasswordRecovery { // RPC method 'auth.requestPasswordRecovery' +public: + MTPauth_requestPasswordRecovery() { + } + MTPauth_requestPasswordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_requestPasswordRecovery) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_auth_requestPasswordRecovery; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_requestPasswordRecovery) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPauth_PasswordRecovery ResponseType; +}; +class MTPauth_RequestPasswordRecovery : public MTPBoxed { +public: + MTPauth_RequestPasswordRecovery() { + } + MTPauth_RequestPasswordRecovery(const MTPauth_requestPasswordRecovery &v) : MTPBoxed(v) { + } + MTPauth_RequestPasswordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPauth_recoverPassword { // RPC method 'auth.recoverPassword' +public: + MTPstring vcode; + + MTPauth_recoverPassword() { + } + MTPauth_recoverPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_recoverPassword) { + read(from, end, cons); + } + MTPauth_recoverPassword(const MTPstring &_code) : vcode(_code) { + } + + uint32 innerLength() const { + return vcode.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_recoverPassword; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_recoverPassword) { + vcode.read(from, end); + } + void write(mtpBuffer &to) const { + vcode.write(to); + } + + typedef MTPauth_Authorization ResponseType; +}; +class MTPauth_RecoverPassword : public MTPBoxed { +public: + MTPauth_RecoverPassword() { + } + MTPauth_RecoverPassword(const MTPauth_recoverPassword &v) : MTPBoxed(v) { + } + MTPauth_RecoverPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_RecoverPassword(const MTPstring &_code) : MTPBoxed(MTPauth_recoverPassword(_code)) { + } +}; + class MTPaccount_registerDevice { // RPC method 'account.registerDevice' public: MTPint vtoken_type; @@ -12338,6 +13394,579 @@ public: } }; +class MTPaccount_checkUsername { // RPC method 'account.checkUsername' +public: + MTPstring vusername; + + MTPaccount_checkUsername() { + } + MTPaccount_checkUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_checkUsername) { + read(from, end, cons); + } + MTPaccount_checkUsername(const MTPstring &_username) : vusername(_username) { + } + + uint32 innerLength() const { + return vusername.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_checkUsername; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_checkUsername) { + vusername.read(from, end); + } + void write(mtpBuffer &to) const { + vusername.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_CheckUsername : public MTPBoxed { +public: + MTPaccount_CheckUsername() { + } + MTPaccount_CheckUsername(const MTPaccount_checkUsername &v) : MTPBoxed(v) { + } + MTPaccount_CheckUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_CheckUsername(const MTPstring &_username) : MTPBoxed(MTPaccount_checkUsername(_username)) { + } +}; + +class MTPaccount_updateUsername { // RPC method 'account.updateUsername' +public: + MTPstring vusername; + + MTPaccount_updateUsername() { + } + MTPaccount_updateUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateUsername) { + read(from, end, cons); + } + MTPaccount_updateUsername(const MTPstring &_username) : vusername(_username) { + } + + uint32 innerLength() const { + return vusername.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_updateUsername; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateUsername) { + vusername.read(from, end); + } + void write(mtpBuffer &to) const { + vusername.write(to); + } + + typedef MTPUser ResponseType; +}; +class MTPaccount_UpdateUsername : public MTPBoxed { +public: + MTPaccount_UpdateUsername() { + } + MTPaccount_UpdateUsername(const MTPaccount_updateUsername &v) : MTPBoxed(v) { + } + MTPaccount_UpdateUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_UpdateUsername(const MTPstring &_username) : MTPBoxed(MTPaccount_updateUsername(_username)) { + } +}; + +class MTPaccount_getPrivacy { // RPC method 'account.getPrivacy' +public: + MTPInputPrivacyKey vkey; + + MTPaccount_getPrivacy() { + } + MTPaccount_getPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPrivacy) { + read(from, end, cons); + } + MTPaccount_getPrivacy(const MTPInputPrivacyKey &_key) : vkey(_key) { + } + + uint32 innerLength() const { + return vkey.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_getPrivacy; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPrivacy) { + vkey.read(from, end); + } + void write(mtpBuffer &to) const { + vkey.write(to); + } + + typedef MTPaccount_PrivacyRules ResponseType; +}; +class MTPaccount_GetPrivacy : public MTPBoxed { +public: + MTPaccount_GetPrivacy() { + } + MTPaccount_GetPrivacy(const MTPaccount_getPrivacy &v) : MTPBoxed(v) { + } + MTPaccount_GetPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_GetPrivacy(const MTPInputPrivacyKey &_key) : MTPBoxed(MTPaccount_getPrivacy(_key)) { + } +}; + +class MTPaccount_setPrivacy { // RPC method 'account.setPrivacy' +public: + MTPInputPrivacyKey vkey; + MTPVector vrules; + + MTPaccount_setPrivacy() { + } + MTPaccount_setPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setPrivacy) { + read(from, end, cons); + } + MTPaccount_setPrivacy(const MTPInputPrivacyKey &_key, const MTPVector &_rules) : vkey(_key), vrules(_rules) { + } + + uint32 innerLength() const { + return vkey.innerLength() + vrules.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_setPrivacy; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setPrivacy) { + vkey.read(from, end); + vrules.read(from, end); + } + void write(mtpBuffer &to) const { + vkey.write(to); + vrules.write(to); + } + + typedef MTPaccount_PrivacyRules ResponseType; +}; +class MTPaccount_SetPrivacy : public MTPBoxed { +public: + MTPaccount_SetPrivacy() { + } + MTPaccount_SetPrivacy(const MTPaccount_setPrivacy &v) : MTPBoxed(v) { + } + MTPaccount_SetPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_SetPrivacy(const MTPInputPrivacyKey &_key, const MTPVector &_rules) : MTPBoxed(MTPaccount_setPrivacy(_key, _rules)) { + } +}; + +class MTPaccount_deleteAccount { // RPC method 'account.deleteAccount' +public: + MTPstring vreason; + + MTPaccount_deleteAccount() { + } + MTPaccount_deleteAccount(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_deleteAccount) { + read(from, end, cons); + } + MTPaccount_deleteAccount(const MTPstring &_reason) : vreason(_reason) { + } + + uint32 innerLength() const { + return vreason.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_deleteAccount; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_deleteAccount) { + vreason.read(from, end); + } + void write(mtpBuffer &to) const { + vreason.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_DeleteAccount : public MTPBoxed { +public: + MTPaccount_DeleteAccount() { + } + MTPaccount_DeleteAccount(const MTPaccount_deleteAccount &v) : MTPBoxed(v) { + } + MTPaccount_DeleteAccount(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_DeleteAccount(const MTPstring &_reason) : MTPBoxed(MTPaccount_deleteAccount(_reason)) { + } +}; + +class MTPaccount_getAccountTTL { // RPC method 'account.getAccountTTL' +public: + MTPaccount_getAccountTTL() { + } + MTPaccount_getAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAccountTTL) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_account_getAccountTTL; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAccountTTL) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPAccountDaysTTL ResponseType; +}; +class MTPaccount_GetAccountTTL : public MTPBoxed { +public: + MTPaccount_GetAccountTTL() { + } + MTPaccount_GetAccountTTL(const MTPaccount_getAccountTTL &v) : MTPBoxed(v) { + } + MTPaccount_GetAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPaccount_setAccountTTL { // RPC method 'account.setAccountTTL' +public: + MTPAccountDaysTTL vttl; + + MTPaccount_setAccountTTL() { + } + MTPaccount_setAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setAccountTTL) { + read(from, end, cons); + } + MTPaccount_setAccountTTL(const MTPAccountDaysTTL &_ttl) : vttl(_ttl) { + } + + uint32 innerLength() const { + return vttl.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_setAccountTTL; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setAccountTTL) { + vttl.read(from, end); + } + void write(mtpBuffer &to) const { + vttl.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_SetAccountTTL : public MTPBoxed { +public: + MTPaccount_SetAccountTTL() { + } + MTPaccount_SetAccountTTL(const MTPaccount_setAccountTTL &v) : MTPBoxed(v) { + } + MTPaccount_SetAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_SetAccountTTL(const MTPAccountDaysTTL &_ttl) : MTPBoxed(MTPaccount_setAccountTTL(_ttl)) { + } +}; + +class MTPaccount_sendChangePhoneCode { // RPC method 'account.sendChangePhoneCode' +public: + MTPstring vphone_number; + + MTPaccount_sendChangePhoneCode() { + } + MTPaccount_sendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { + read(from, end, cons); + } + MTPaccount_sendChangePhoneCode(const MTPstring &_phone_number) : vphone_number(_phone_number) { + } + + uint32 innerLength() const { + return vphone_number.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_sendChangePhoneCode; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { + vphone_number.read(from, end); + } + void write(mtpBuffer &to) const { + vphone_number.write(to); + } + + typedef MTPaccount_SentChangePhoneCode ResponseType; +}; +class MTPaccount_SendChangePhoneCode : public MTPBoxed { +public: + MTPaccount_SendChangePhoneCode() { + } + MTPaccount_SendChangePhoneCode(const MTPaccount_sendChangePhoneCode &v) : MTPBoxed(v) { + } + MTPaccount_SendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_SendChangePhoneCode(const MTPstring &_phone_number) : MTPBoxed(MTPaccount_sendChangePhoneCode(_phone_number)) { + } +}; + +class MTPaccount_changePhone { // RPC method 'account.changePhone' +public: + MTPstring vphone_number; + MTPstring vphone_code_hash; + MTPstring vphone_code; + + MTPaccount_changePhone() { + } + MTPaccount_changePhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_changePhone) { + read(from, end, cons); + } + MTPaccount_changePhone(const MTPstring &_phone_number, const MTPstring &_phone_code_hash, const MTPstring &_phone_code) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash), vphone_code(_phone_code) { + } + + uint32 innerLength() const { + return vphone_number.innerLength() + vphone_code_hash.innerLength() + vphone_code.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_changePhone; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_changePhone) { + vphone_number.read(from, end); + vphone_code_hash.read(from, end); + vphone_code.read(from, end); + } + void write(mtpBuffer &to) const { + vphone_number.write(to); + vphone_code_hash.write(to); + vphone_code.write(to); + } + + typedef MTPUser ResponseType; +}; +class MTPaccount_ChangePhone : public MTPBoxed { +public: + MTPaccount_ChangePhone() { + } + MTPaccount_ChangePhone(const MTPaccount_changePhone &v) : MTPBoxed(v) { + } + MTPaccount_ChangePhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_ChangePhone(const MTPstring &_phone_number, const MTPstring &_phone_code_hash, const MTPstring &_phone_code) : MTPBoxed(MTPaccount_changePhone(_phone_number, _phone_code_hash, _phone_code)) { + } +}; + +class MTPaccount_updateDeviceLocked { // RPC method 'account.updateDeviceLocked' +public: + MTPint vperiod; + + MTPaccount_updateDeviceLocked() { + } + MTPaccount_updateDeviceLocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateDeviceLocked) { + read(from, end, cons); + } + MTPaccount_updateDeviceLocked(MTPint _period) : vperiod(_period) { + } + + uint32 innerLength() const { + return vperiod.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_updateDeviceLocked; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateDeviceLocked) { + vperiod.read(from, end); + } + void write(mtpBuffer &to) const { + vperiod.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_UpdateDeviceLocked : public MTPBoxed { +public: + MTPaccount_UpdateDeviceLocked() { + } + MTPaccount_UpdateDeviceLocked(const MTPaccount_updateDeviceLocked &v) : MTPBoxed(v) { + } + MTPaccount_UpdateDeviceLocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_UpdateDeviceLocked(MTPint _period) : MTPBoxed(MTPaccount_updateDeviceLocked(_period)) { + } +}; + +class MTPaccount_getAuthorizations { // RPC method 'account.getAuthorizations' +public: + MTPaccount_getAuthorizations() { + } + MTPaccount_getAuthorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAuthorizations) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_account_getAuthorizations; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAuthorizations) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPaccount_Authorizations ResponseType; +}; +class MTPaccount_GetAuthorizations : public MTPBoxed { +public: + MTPaccount_GetAuthorizations() { + } + MTPaccount_GetAuthorizations(const MTPaccount_getAuthorizations &v) : MTPBoxed(v) { + } + MTPaccount_GetAuthorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPaccount_resetAuthorization { // RPC method 'account.resetAuthorization' +public: + MTPlong vhash; + + MTPaccount_resetAuthorization() { + } + MTPaccount_resetAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_resetAuthorization) { + read(from, end, cons); + } + MTPaccount_resetAuthorization(const MTPlong &_hash) : vhash(_hash) { + } + + uint32 innerLength() const { + return vhash.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_resetAuthorization; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_resetAuthorization) { + vhash.read(from, end); + } + void write(mtpBuffer &to) const { + vhash.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_ResetAuthorization : public MTPBoxed { +public: + MTPaccount_ResetAuthorization() { + } + MTPaccount_ResetAuthorization(const MTPaccount_resetAuthorization &v) : MTPBoxed(v) { + } + MTPaccount_ResetAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_ResetAuthorization(const MTPlong &_hash) : MTPBoxed(MTPaccount_resetAuthorization(_hash)) { + } +}; + +class MTPaccount_getPassword { // RPC method 'account.getPassword' +public: + MTPaccount_getPassword() { + } + MTPaccount_getPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPassword) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_account_getPassword; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPassword) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPaccount_Password ResponseType; +}; +class MTPaccount_GetPassword : public MTPBoxed { +public: + MTPaccount_GetPassword() { + } + MTPaccount_GetPassword(const MTPaccount_getPassword &v) : MTPBoxed(v) { + } + MTPaccount_GetPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPaccount_getPasswordSettings { // RPC method 'account.getPasswordSettings' +public: + MTPbytes vcurrent_password_hash; + + MTPaccount_getPasswordSettings() { + } + MTPaccount_getPasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPasswordSettings) { + read(from, end, cons); + } + MTPaccount_getPasswordSettings(const MTPbytes &_current_password_hash) : vcurrent_password_hash(_current_password_hash) { + } + + uint32 innerLength() const { + return vcurrent_password_hash.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_getPasswordSettings; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPasswordSettings) { + vcurrent_password_hash.read(from, end); + } + void write(mtpBuffer &to) const { + vcurrent_password_hash.write(to); + } + + typedef MTPaccount_PasswordSettings ResponseType; +}; +class MTPaccount_GetPasswordSettings : public MTPBoxed { +public: + MTPaccount_GetPasswordSettings() { + } + MTPaccount_GetPasswordSettings(const MTPaccount_getPasswordSettings &v) : MTPBoxed(v) { + } + MTPaccount_GetPasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_GetPasswordSettings(const MTPbytes &_current_password_hash) : MTPBoxed(MTPaccount_getPasswordSettings(_current_password_hash)) { + } +}; + +class MTPaccount_updatePasswordSettings { // RPC method 'account.updatePasswordSettings' +public: + MTPbytes vcurrent_password_hash; + MTPaccount_PasswordInputSettings vnew_settings; + + MTPaccount_updatePasswordSettings() { + } + MTPaccount_updatePasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updatePasswordSettings) { + read(from, end, cons); + } + MTPaccount_updatePasswordSettings(const MTPbytes &_current_password_hash, const MTPaccount_PasswordInputSettings &_new_settings) : vcurrent_password_hash(_current_password_hash), vnew_settings(_new_settings) { + } + + uint32 innerLength() const { + return vcurrent_password_hash.innerLength() + vnew_settings.innerLength(); + } + mtpTypeId type() const { + return mtpc_account_updatePasswordSettings; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updatePasswordSettings) { + vcurrent_password_hash.read(from, end); + vnew_settings.read(from, end); + } + void write(mtpBuffer &to) const { + vcurrent_password_hash.write(to); + vnew_settings.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPaccount_UpdatePasswordSettings : public MTPBoxed { +public: + MTPaccount_UpdatePasswordSettings() { + } + MTPaccount_UpdatePasswordSettings(const MTPaccount_updatePasswordSettings &v) : MTPBoxed(v) { + } + MTPaccount_UpdatePasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPaccount_UpdatePasswordSettings(const MTPbytes &_current_password_hash, const MTPaccount_PasswordInputSettings &_new_settings) : MTPBoxed(MTPaccount_updatePasswordSettings(_current_password_hash, _new_settings)) { + } +}; + class MTPusers_getUsers { // RPC method 'users.getUsers' public: MTPVector vid; @@ -12835,6 +14464,87 @@ public: } }; +class MTPcontacts_search { // RPC method 'contacts.search' +public: + MTPstring vq; + MTPint vlimit; + + MTPcontacts_search() { + } + MTPcontacts_search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_search) { + read(from, end, cons); + } + MTPcontacts_search(const MTPstring &_q, MTPint _limit) : vq(_q), vlimit(_limit) { + } + + uint32 innerLength() const { + return vq.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_contacts_search; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_search) { + vq.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vq.write(to); + vlimit.write(to); + } + + typedef MTPcontacts_Found ResponseType; +}; +class MTPcontacts_Search : public MTPBoxed { +public: + MTPcontacts_Search() { + } + MTPcontacts_Search(const MTPcontacts_search &v) : MTPBoxed(v) { + } + MTPcontacts_Search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPcontacts_Search(const MTPstring &_q, MTPint _limit) : MTPBoxed(MTPcontacts_search(_q, _limit)) { + } +}; + +class MTPcontacts_resolveUsername { // RPC method 'contacts.resolveUsername' +public: + MTPstring vusername; + + MTPcontacts_resolveUsername() { + } + MTPcontacts_resolveUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolveUsername) { + read(from, end, cons); + } + MTPcontacts_resolveUsername(const MTPstring &_username) : vusername(_username) { + } + + uint32 innerLength() const { + return vusername.innerLength(); + } + mtpTypeId type() const { + return mtpc_contacts_resolveUsername; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolveUsername) { + vusername.read(from, end); + } + void write(mtpBuffer &to) const { + vusername.write(to); + } + + typedef MTPUser ResponseType; +}; +class MTPcontacts_ResolveUsername : public MTPBoxed { +public: + MTPcontacts_ResolveUsername() { + } + MTPcontacts_ResolveUsername(const MTPcontacts_resolveUsername &v) : MTPBoxed(v) { + } + MTPcontacts_ResolveUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPcontacts_ResolveUsername(const MTPstring &_username) : MTPBoxed(MTPcontacts_resolveUsername(_username)) { + } +}; + class MTPmessages_getMessages { // RPC method 'messages.getMessages' public: MTPVector vid; @@ -12877,7 +14587,6 @@ public: class MTPmessages_getDialogs { // RPC method 'messages.getDialogs' public: MTPint voffset; - MTPint vmax_id; MTPint vlimit; MTPmessages_getDialogs() { @@ -12885,23 +14594,21 @@ public: MTPmessages_getDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getDialogs) { read(from, end, cons); } - MTPmessages_getDialogs(MTPint _offset, MTPint _max_id, MTPint _limit) : voffset(_offset), vmax_id(_max_id), vlimit(_limit) { + MTPmessages_getDialogs(MTPint _offset, MTPint _limit) : voffset(_offset), vlimit(_limit) { } uint32 innerLength() const { - return voffset.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); + return voffset.innerLength() + vlimit.innerLength(); } mtpTypeId type() const { return mtpc_messages_getDialogs; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getDialogs) { voffset.read(from, end); - vmax_id.read(from, end); vlimit.read(from, end); } void write(mtpBuffer &to) const { voffset.write(to); - vmax_id.write(to); vlimit.write(to); } @@ -12915,7 +14622,7 @@ public: } MTPmessages_GetDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetDialogs(MTPint _offset, MTPint _max_id, MTPint _limit) : MTPBoxed(MTPmessages_getDialogs(_offset, _max_id, _limit)) { + MTPmessages_GetDialogs(MTPint _offset, MTPint _limit) : MTPBoxed(MTPmessages_getDialogs(_offset, _limit)) { } }; @@ -12924,6 +14631,7 @@ public: MTPInputPeer vpeer; MTPint voffset; MTPint vmax_id; + MTPint vmin_id; MTPint vlimit; MTPmessages_getHistory() { @@ -12931,11 +14639,11 @@ public: MTPmessages_getHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getHistory) { read(from, end, cons); } - MTPmessages_getHistory(const MTPInputPeer &_peer, MTPint _offset, MTPint _max_id, MTPint _limit) : vpeer(_peer), voffset(_offset), vmax_id(_max_id), vlimit(_limit) { + MTPmessages_getHistory(const MTPInputPeer &_peer, MTPint _offset, MTPint _max_id, MTPint _min_id, MTPint _limit) : vpeer(_peer), voffset(_offset), vmax_id(_max_id), vmin_id(_min_id), vlimit(_limit) { } uint32 innerLength() const { - return vpeer.innerLength() + voffset.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); + return vpeer.innerLength() + voffset.innerLength() + vmax_id.innerLength() + vmin_id.innerLength() + vlimit.innerLength(); } mtpTypeId type() const { return mtpc_messages_getHistory; @@ -12944,12 +14652,14 @@ public: vpeer.read(from, end); voffset.read(from, end); vmax_id.read(from, end); + vmin_id.read(from, end); vlimit.read(from, end); } void write(mtpBuffer &to) const { vpeer.write(to); voffset.write(to); vmax_id.write(to); + vmin_id.write(to); vlimit.write(to); } @@ -12963,7 +14673,7 @@ public: } MTPmessages_GetHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetHistory(const MTPInputPeer &_peer, MTPint _offset, MTPint _max_id, MTPint _limit) : MTPBoxed(MTPmessages_getHistory(_peer, _offset, _max_id, _limit)) { + MTPmessages_GetHistory(const MTPInputPeer &_peer, MTPint _offset, MTPint _max_id, MTPint _min_id, MTPint _limit) : MTPBoxed(MTPmessages_getHistory(_peer, _offset, _max_id, _min_id, _limit)) { } }; @@ -13410,14 +15120,14 @@ public: class MTPmessages_getChats { // RPC method 'messages.getChats' public: - MTPVector vid; + MTPVector vid; MTPmessages_getChats() { } MTPmessages_getChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getChats) { read(from, end, cons); } - MTPmessages_getChats(const MTPVector &_id) : vid(_id) { + MTPmessages_getChats(const MTPVector &_id) : vid(_id) { } uint32 innerLength() const { @@ -13443,20 +15153,20 @@ public: } MTPmessages_GetChats(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetChats(const MTPVector &_id) : MTPBoxed(MTPmessages_getChats(_id)) { + MTPmessages_GetChats(const MTPVector &_id) : MTPBoxed(MTPmessages_getChats(_id)) { } }; class MTPmessages_getFullChat { // RPC method 'messages.getFullChat' public: - MTPint vchat_id; + MTPInputChat vchat_id; MTPmessages_getFullChat() { } MTPmessages_getFullChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getFullChat) { read(from, end, cons); } - MTPmessages_getFullChat(MTPint _chat_id) : vchat_id(_chat_id) { + MTPmessages_getFullChat(const MTPInputChat &_chat_id) : vchat_id(_chat_id) { } uint32 innerLength() const { @@ -13482,13 +15192,13 @@ public: } MTPmessages_GetFullChat(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetFullChat(MTPint _chat_id) : MTPBoxed(MTPmessages_getFullChat(_chat_id)) { + MTPmessages_GetFullChat(const MTPInputChat &_chat_id) : MTPBoxed(MTPmessages_getFullChat(_chat_id)) { } }; class MTPmessages_editChatTitle { // RPC method 'messages.editChatTitle' public: - MTPint vchat_id; + MTPInputChat vchat_id; MTPstring vtitle; MTPmessages_editChatTitle() { @@ -13496,7 +15206,7 @@ public: MTPmessages_editChatTitle(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editChatTitle) { read(from, end, cons); } - MTPmessages_editChatTitle(MTPint _chat_id, const MTPstring &_title) : vchat_id(_chat_id), vtitle(_title) { + MTPmessages_editChatTitle(const MTPInputChat &_chat_id, const MTPstring &_title) : vchat_id(_chat_id), vtitle(_title) { } uint32 innerLength() const { @@ -13524,13 +15234,13 @@ public: } MTPmessages_EditChatTitle(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_EditChatTitle(MTPint _chat_id, const MTPstring &_title) : MTPBoxed(MTPmessages_editChatTitle(_chat_id, _title)) { + MTPmessages_EditChatTitle(const MTPInputChat &_chat_id, const MTPstring &_title) : MTPBoxed(MTPmessages_editChatTitle(_chat_id, _title)) { } }; class MTPmessages_editChatPhoto { // RPC method 'messages.editChatPhoto' public: - MTPint vchat_id; + MTPInputChat vchat_id; MTPInputChatPhoto vphoto; MTPmessages_editChatPhoto() { @@ -13538,7 +15248,7 @@ public: MTPmessages_editChatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editChatPhoto) { read(from, end, cons); } - MTPmessages_editChatPhoto(MTPint _chat_id, const MTPInputChatPhoto &_photo) : vchat_id(_chat_id), vphoto(_photo) { + MTPmessages_editChatPhoto(const MTPInputChat &_chat_id, const MTPInputChatPhoto &_photo) : vchat_id(_chat_id), vphoto(_photo) { } uint32 innerLength() const { @@ -13566,13 +15276,13 @@ public: } MTPmessages_EditChatPhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_EditChatPhoto(MTPint _chat_id, const MTPInputChatPhoto &_photo) : MTPBoxed(MTPmessages_editChatPhoto(_chat_id, _photo)) { + MTPmessages_EditChatPhoto(const MTPInputChat &_chat_id, const MTPInputChatPhoto &_photo) : MTPBoxed(MTPmessages_editChatPhoto(_chat_id, _photo)) { } }; class MTPmessages_addChatUser { // RPC method 'messages.addChatUser' public: - MTPint vchat_id; + MTPInputChat vchat_id; MTPInputUser vuser_id; MTPint vfwd_limit; @@ -13581,7 +15291,7 @@ public: MTPmessages_addChatUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_addChatUser) { read(from, end, cons); } - MTPmessages_addChatUser(MTPint _chat_id, const MTPInputUser &_user_id, MTPint _fwd_limit) : vchat_id(_chat_id), vuser_id(_user_id), vfwd_limit(_fwd_limit) { + MTPmessages_addChatUser(const MTPInputChat &_chat_id, const MTPInputUser &_user_id, MTPint _fwd_limit) : vchat_id(_chat_id), vuser_id(_user_id), vfwd_limit(_fwd_limit) { } uint32 innerLength() const { @@ -13611,13 +15321,13 @@ public: } MTPmessages_AddChatUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_AddChatUser(MTPint _chat_id, const MTPInputUser &_user_id, MTPint _fwd_limit) : MTPBoxed(MTPmessages_addChatUser(_chat_id, _user_id, _fwd_limit)) { + MTPmessages_AddChatUser(const MTPInputChat &_chat_id, const MTPInputUser &_user_id, MTPint _fwd_limit) : MTPBoxed(MTPmessages_addChatUser(_chat_id, _user_id, _fwd_limit)) { } }; class MTPmessages_deleteChatUser { // RPC method 'messages.deleteChatUser' public: - MTPint vchat_id; + MTPInputChat vchat_id; MTPInputUser vuser_id; MTPmessages_deleteChatUser() { @@ -13625,7 +15335,7 @@ public: MTPmessages_deleteChatUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteChatUser) { read(from, end, cons); } - MTPmessages_deleteChatUser(MTPint _chat_id, const MTPInputUser &_user_id) : vchat_id(_chat_id), vuser_id(_user_id) { + MTPmessages_deleteChatUser(const MTPInputChat &_chat_id, const MTPInputUser &_user_id) : vchat_id(_chat_id), vuser_id(_user_id) { } uint32 innerLength() const { @@ -13653,7 +15363,7 @@ public: } MTPmessages_DeleteChatUser(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_DeleteChatUser(MTPint _chat_id, const MTPInputUser &_user_id) : MTPBoxed(MTPmessages_deleteChatUser(_chat_id, _user_id)) { + MTPmessages_DeleteChatUser(const MTPInputChat &_chat_id, const MTPInputUser &_user_id) : MTPBoxed(MTPmessages_deleteChatUser(_chat_id, _user_id)) { } }; @@ -13699,537 +15409,6 @@ public: } }; -class MTPupdates_getState { // RPC method 'updates.getState' -public: - MTPupdates_getState() { - } - MTPupdates_getState(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getState) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_updates_getState; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getState) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPupdates_State ResponseType; -}; -class MTPupdates_GetState : public MTPBoxed { -public: - MTPupdates_GetState() { - } - MTPupdates_GetState(const MTPupdates_getState &v) : MTPBoxed(v) { - } - MTPupdates_GetState(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPupdates_getDifference { // RPC method 'updates.getDifference' -public: - MTPint vpts; - MTPint vdate; - MTPint vqts; - - MTPupdates_getDifference() { - } - MTPupdates_getDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { - read(from, end, cons); - } - MTPupdates_getDifference(MTPint _pts, MTPint _date, MTPint _qts) : vpts(_pts), vdate(_date), vqts(_qts) { - } - - uint32 innerLength() const { - return vpts.innerLength() + vdate.innerLength() + vqts.innerLength(); - } - mtpTypeId type() const { - return mtpc_updates_getDifference; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { - vpts.read(from, end); - vdate.read(from, end); - vqts.read(from, end); - } - void write(mtpBuffer &to) const { - vpts.write(to); - vdate.write(to); - vqts.write(to); - } - - typedef MTPupdates_Difference ResponseType; -}; -class MTPupdates_GetDifference : public MTPBoxed { -public: - MTPupdates_GetDifference() { - } - MTPupdates_GetDifference(const MTPupdates_getDifference &v) : MTPBoxed(v) { - } - MTPupdates_GetDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPupdates_GetDifference(MTPint _pts, MTPint _date, MTPint _qts) : MTPBoxed(MTPupdates_getDifference(_pts, _date, _qts)) { - } -}; - -class MTPphotos_updateProfilePhoto { // RPC method 'photos.updateProfilePhoto' -public: - MTPInputPhoto vid; - MTPInputPhotoCrop vcrop; - - MTPphotos_updateProfilePhoto() { - } - MTPphotos_updateProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_updateProfilePhoto) { - read(from, end, cons); - } - MTPphotos_updateProfilePhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) : vid(_id), vcrop(_crop) { - } - - uint32 innerLength() const { - return vid.innerLength() + vcrop.innerLength(); - } - mtpTypeId type() const { - return mtpc_photos_updateProfilePhoto; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_updateProfilePhoto) { - vid.read(from, end); - vcrop.read(from, end); - } - void write(mtpBuffer &to) const { - vid.write(to); - vcrop.write(to); - } - - typedef MTPUserProfilePhoto ResponseType; -}; -class MTPphotos_UpdateProfilePhoto : public MTPBoxed { -public: - MTPphotos_UpdateProfilePhoto() { - } - MTPphotos_UpdateProfilePhoto(const MTPphotos_updateProfilePhoto &v) : MTPBoxed(v) { - } - MTPphotos_UpdateProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPphotos_UpdateProfilePhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) : MTPBoxed(MTPphotos_updateProfilePhoto(_id, _crop)) { - } -}; - -class MTPphotos_uploadProfilePhoto { // RPC method 'photos.uploadProfilePhoto' -public: - MTPInputFile vfile; - MTPstring vcaption; - MTPInputGeoPoint vgeo_point; - MTPInputPhotoCrop vcrop; - - MTPphotos_uploadProfilePhoto() { - } - MTPphotos_uploadProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_uploadProfilePhoto) { - read(from, end, cons); - } - MTPphotos_uploadProfilePhoto(const MTPInputFile &_file, const MTPstring &_caption, const MTPInputGeoPoint &_geo_point, const MTPInputPhotoCrop &_crop) : vfile(_file), vcaption(_caption), vgeo_point(_geo_point), vcrop(_crop) { - } - - uint32 innerLength() const { - return vfile.innerLength() + vcaption.innerLength() + vgeo_point.innerLength() + vcrop.innerLength(); - } - mtpTypeId type() const { - return mtpc_photos_uploadProfilePhoto; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_uploadProfilePhoto) { - vfile.read(from, end); - vcaption.read(from, end); - vgeo_point.read(from, end); - vcrop.read(from, end); - } - void write(mtpBuffer &to) const { - vfile.write(to); - vcaption.write(to); - vgeo_point.write(to); - vcrop.write(to); - } - - typedef MTPphotos_Photo ResponseType; -}; -class MTPphotos_UploadProfilePhoto : public MTPBoxed { -public: - MTPphotos_UploadProfilePhoto() { - } - MTPphotos_UploadProfilePhoto(const MTPphotos_uploadProfilePhoto &v) : MTPBoxed(v) { - } - MTPphotos_UploadProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPphotos_UploadProfilePhoto(const MTPInputFile &_file, const MTPstring &_caption, const MTPInputGeoPoint &_geo_point, const MTPInputPhotoCrop &_crop) : MTPBoxed(MTPphotos_uploadProfilePhoto(_file, _caption, _geo_point, _crop)) { - } -}; - -class MTPphotos_deletePhotos { // RPC method 'photos.deletePhotos' -public: - MTPVector vid; - - MTPphotos_deletePhotos() { - } - MTPphotos_deletePhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_deletePhotos) { - read(from, end, cons); - } - MTPphotos_deletePhotos(const MTPVector &_id) : vid(_id) { - } - - uint32 innerLength() const { - return vid.innerLength(); - } - mtpTypeId type() const { - return mtpc_photos_deletePhotos; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_deletePhotos) { - vid.read(from, end); - } - void write(mtpBuffer &to) const { - vid.write(to); - } - - typedef MTPVector ResponseType; -}; -class MTPphotos_DeletePhotos : public MTPBoxed { -public: - MTPphotos_DeletePhotos() { - } - MTPphotos_DeletePhotos(const MTPphotos_deletePhotos &v) : MTPBoxed(v) { - } - MTPphotos_DeletePhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPphotos_DeletePhotos(const MTPVector &_id) : MTPBoxed(MTPphotos_deletePhotos(_id)) { - } -}; - -class MTPupload_saveFilePart { // RPC method 'upload.saveFilePart' -public: - MTPlong vfile_id; - MTPint vfile_part; - MTPbytes vbytes; - - MTPupload_saveFilePart() { - } - MTPupload_saveFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveFilePart) { - read(from, end, cons); - } - MTPupload_saveFilePart(const MTPlong &_file_id, MTPint _file_part, const MTPbytes &_bytes) : vfile_id(_file_id), vfile_part(_file_part), vbytes(_bytes) { - } - - uint32 innerLength() const { - return vfile_id.innerLength() + vfile_part.innerLength() + vbytes.innerLength(); - } - mtpTypeId type() const { - return mtpc_upload_saveFilePart; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveFilePart) { - vfile_id.read(from, end); - vfile_part.read(from, end); - vbytes.read(from, end); - } - void write(mtpBuffer &to) const { - vfile_id.write(to); - vfile_part.write(to); - vbytes.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPupload_SaveFilePart : public MTPBoxed { -public: - MTPupload_SaveFilePart() { - } - MTPupload_SaveFilePart(const MTPupload_saveFilePart &v) : MTPBoxed(v) { - } - MTPupload_SaveFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPupload_SaveFilePart(const MTPlong &_file_id, MTPint _file_part, const MTPbytes &_bytes) : MTPBoxed(MTPupload_saveFilePart(_file_id, _file_part, _bytes)) { - } -}; - -class MTPupload_getFile { // RPC method 'upload.getFile' -public: - MTPInputFileLocation vlocation; - MTPint voffset; - MTPint vlimit; - - MTPupload_getFile() { - } - MTPupload_getFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_getFile) { - read(from, end, cons); - } - MTPupload_getFile(const MTPInputFileLocation &_location, MTPint _offset, MTPint _limit) : vlocation(_location), voffset(_offset), vlimit(_limit) { - } - - uint32 innerLength() const { - return vlocation.innerLength() + voffset.innerLength() + vlimit.innerLength(); - } - mtpTypeId type() const { - return mtpc_upload_getFile; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_getFile) { - vlocation.read(from, end); - voffset.read(from, end); - vlimit.read(from, end); - } - void write(mtpBuffer &to) const { - vlocation.write(to); - voffset.write(to); - vlimit.write(to); - } - - typedef MTPupload_File ResponseType; -}; -class MTPupload_GetFile : public MTPBoxed { -public: - MTPupload_GetFile() { - } - MTPupload_GetFile(const MTPupload_getFile &v) : MTPBoxed(v) { - } - MTPupload_GetFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPupload_GetFile(const MTPInputFileLocation &_location, MTPint _offset, MTPint _limit) : MTPBoxed(MTPupload_getFile(_location, _offset, _limit)) { - } -}; - -class MTPhelp_getConfig { // RPC method 'help.getConfig' -public: - MTPhelp_getConfig() { - } - MTPhelp_getConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getConfig) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_help_getConfig; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getConfig) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPConfig ResponseType; -}; -class MTPhelp_GetConfig : public MTPBoxed { -public: - MTPhelp_GetConfig() { - } - MTPhelp_GetConfig(const MTPhelp_getConfig &v) : MTPBoxed(v) { - } - MTPhelp_GetConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPhelp_getNearestDc { // RPC method 'help.getNearestDc' -public: - MTPhelp_getNearestDc() { - } - MTPhelp_getNearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getNearestDc) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_help_getNearestDc; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getNearestDc) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPNearestDc ResponseType; -}; -class MTPhelp_GetNearestDc : public MTPBoxed { -public: - MTPhelp_GetNearestDc() { - } - MTPhelp_GetNearestDc(const MTPhelp_getNearestDc &v) : MTPBoxed(v) { - } - MTPhelp_GetNearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPhelp_getAppUpdate { // RPC method 'help.getAppUpdate' -public: - MTPstring vdevice_model; - MTPstring vsystem_version; - MTPstring vapp_version; - MTPstring vlang_code; - - MTPhelp_getAppUpdate() { - } - MTPhelp_getAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { - read(from, end, cons); - } - MTPhelp_getAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code) { - } - - uint32 innerLength() const { - return vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength(); - } - mtpTypeId type() const { - return mtpc_help_getAppUpdate; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { - vdevice_model.read(from, end); - vsystem_version.read(from, end); - vapp_version.read(from, end); - vlang_code.read(from, end); - } - void write(mtpBuffer &to) const { - vdevice_model.write(to); - vsystem_version.write(to); - vapp_version.write(to); - vlang_code.write(to); - } - - typedef MTPhelp_AppUpdate ResponseType; -}; -class MTPhelp_GetAppUpdate : public MTPBoxed { -public: - MTPhelp_GetAppUpdate() { - } - MTPhelp_GetAppUpdate(const MTPhelp_getAppUpdate &v) : MTPBoxed(v) { - } - MTPhelp_GetAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPhelp_GetAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getAppUpdate(_device_model, _system_version, _app_version, _lang_code)) { - } -}; - -class MTPhelp_saveAppLog { // RPC method 'help.saveAppLog' -public: - MTPVector vevents; - - MTPhelp_saveAppLog() { - } - MTPhelp_saveAppLog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_saveAppLog) { - read(from, end, cons); - } - MTPhelp_saveAppLog(const MTPVector &_events) : vevents(_events) { - } - - uint32 innerLength() const { - return vevents.innerLength(); - } - mtpTypeId type() const { - return mtpc_help_saveAppLog; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_saveAppLog) { - vevents.read(from, end); - } - void write(mtpBuffer &to) const { - vevents.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPhelp_SaveAppLog : public MTPBoxed { -public: - MTPhelp_SaveAppLog() { - } - MTPhelp_SaveAppLog(const MTPhelp_saveAppLog &v) : MTPBoxed(v) { - } - MTPhelp_SaveAppLog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPhelp_SaveAppLog(const MTPVector &_events) : MTPBoxed(MTPhelp_saveAppLog(_events)) { - } -}; - -class MTPhelp_getInviteText { // RPC method 'help.getInviteText' -public: - MTPstring vlang_code; - - MTPhelp_getInviteText() { - } - MTPhelp_getInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { - read(from, end, cons); - } - MTPhelp_getInviteText(const MTPstring &_lang_code) : vlang_code(_lang_code) { - } - - uint32 innerLength() const { - return vlang_code.innerLength(); - } - mtpTypeId type() const { - return mtpc_help_getInviteText; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { - vlang_code.read(from, end); - } - void write(mtpBuffer &to) const { - vlang_code.write(to); - } - - typedef MTPhelp_InviteText ResponseType; -}; -class MTPhelp_GetInviteText : public MTPBoxed { -public: - MTPhelp_GetInviteText() { - } - MTPhelp_GetInviteText(const MTPhelp_getInviteText &v) : MTPBoxed(v) { - } - MTPhelp_GetInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPhelp_GetInviteText(const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getInviteText(_lang_code)) { - } -}; - -class MTPphotos_getUserPhotos { // RPC method 'photos.getUserPhotos' -public: - MTPInputUser vuser_id; - MTPint voffset; - MTPlong vmax_id; - MTPint vlimit; - - MTPphotos_getUserPhotos() { - } - MTPphotos_getUserPhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_getUserPhotos) { - read(from, end, cons); - } - MTPphotos_getUserPhotos(const MTPInputUser &_user_id, MTPint _offset, const MTPlong &_max_id, MTPint _limit) : vuser_id(_user_id), voffset(_offset), vmax_id(_max_id), vlimit(_limit) { - } - - uint32 innerLength() const { - return vuser_id.innerLength() + voffset.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); - } - mtpTypeId type() const { - return mtpc_photos_getUserPhotos; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_getUserPhotos) { - vuser_id.read(from, end); - voffset.read(from, end); - vmax_id.read(from, end); - vlimit.read(from, end); - } - void write(mtpBuffer &to) const { - vuser_id.write(to); - voffset.write(to); - vmax_id.write(to); - vlimit.write(to); - } - - typedef MTPphotos_Photos ResponseType; -}; -class MTPphotos_GetUserPhotos : public MTPBoxed { -public: - MTPphotos_GetUserPhotos() { - } - MTPphotos_GetUserPhotos(const MTPphotos_getUserPhotos &v) : MTPBoxed(v) { - } - MTPphotos_GetUserPhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPphotos_GetUserPhotos(const MTPInputUser &_user_id, MTPint _offset, const MTPlong &_max_id, MTPint _limit) : MTPBoxed(MTPphotos_getUserPhotos(_user_id, _offset, _max_id, _limit)) { - } -}; - class MTPmessages_forwardMessage { // RPC method 'messages.forwardMessage' public: MTPInputPeer vpeer; @@ -14755,181 +15934,6 @@ public: } }; -class MTPupload_saveBigFilePart { // RPC method 'upload.saveBigFilePart' -public: - MTPlong vfile_id; - MTPint vfile_part; - MTPint vfile_total_parts; - MTPbytes vbytes; - - MTPupload_saveBigFilePart() { - } - MTPupload_saveBigFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveBigFilePart) { - read(from, end, cons); - } - MTPupload_saveBigFilePart(const MTPlong &_file_id, MTPint _file_part, MTPint _file_total_parts, const MTPbytes &_bytes) : vfile_id(_file_id), vfile_part(_file_part), vfile_total_parts(_file_total_parts), vbytes(_bytes) { - } - - uint32 innerLength() const { - return vfile_id.innerLength() + vfile_part.innerLength() + vfile_total_parts.innerLength() + vbytes.innerLength(); - } - mtpTypeId type() const { - return mtpc_upload_saveBigFilePart; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveBigFilePart) { - vfile_id.read(from, end); - vfile_part.read(from, end); - vfile_total_parts.read(from, end); - vbytes.read(from, end); - } - void write(mtpBuffer &to) const { - vfile_id.write(to); - vfile_part.write(to); - vfile_total_parts.write(to); - vbytes.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPupload_SaveBigFilePart : public MTPBoxed { -public: - MTPupload_SaveBigFilePart() { - } - MTPupload_SaveBigFilePart(const MTPupload_saveBigFilePart &v) : MTPBoxed(v) { - } - MTPupload_SaveBigFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPupload_SaveBigFilePart(const MTPlong &_file_id, MTPint _file_part, MTPint _file_total_parts, const MTPbytes &_bytes) : MTPBoxed(MTPupload_saveBigFilePart(_file_id, _file_part, _file_total_parts, _bytes)) { - } -}; - -template -class MTPinitConnection { // RPC method 'initConnection' -public: - MTPint vapi_id; - MTPstring vdevice_model; - MTPstring vsystem_version; - MTPstring vapp_version; - MTPstring vlang_code; - TQueryType vquery; - - MTPinitConnection() { - } - MTPinitConnection(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_initConnection) { - read(from, end, cons); - } - MTPinitConnection(MTPint _api_id, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code, const TQueryType &_query) : vapi_id(_api_id), vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code), vquery(_query) { - } - - uint32 innerLength() const { - return vapi_id.innerLength() + vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength() + vquery.innerLength(); - } - mtpTypeId type() const { - return mtpc_initConnection; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_initConnection) { - vapi_id.read(from, end); - vdevice_model.read(from, end); - vsystem_version.read(from, end); - vapp_version.read(from, end); - vlang_code.read(from, end); - vquery.read(from, end); - } - void write(mtpBuffer &to) const { - vapi_id.write(to); - vdevice_model.write(to); - vsystem_version.write(to); - vapp_version.write(to); - vlang_code.write(to); - vquery.write(to); - } - - typedef typename TQueryType::ResponseType ResponseType; -}; -template -class MTPInitConnection : public MTPBoxed > { -public: - MTPInitConnection() { - } - MTPInitConnection(const MTPinitConnection &v) : MTPBoxed >(v) { - } - MTPInitConnection(MTPint _api_id, const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code, const TQueryType &_query) : MTPBoxed >(MTPinitConnection(_api_id, _device_model, _system_version, _app_version, _lang_code, _query)) { - } -}; - -class MTPhelp_getSupport { // RPC method 'help.getSupport' -public: - MTPhelp_getSupport() { - } - MTPhelp_getSupport(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getSupport) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_help_getSupport; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getSupport) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPhelp_Support ResponseType; -}; -class MTPhelp_GetSupport : public MTPBoxed { -public: - MTPhelp_GetSupport() { - } - MTPhelp_GetSupport(const MTPhelp_getSupport &v) : MTPBoxed(v) { - } - MTPhelp_GetSupport(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPauth_sendSms { // RPC method 'auth.sendSms' -public: - MTPstring vphone_number; - MTPstring vphone_code_hash; - - MTPauth_sendSms() { - } - MTPauth_sendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { - read(from, end, cons); - } - MTPauth_sendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { - } - - uint32 innerLength() const { - return vphone_number.innerLength() + vphone_code_hash.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_sendSms; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { - vphone_number.read(from, end); - vphone_code_hash.read(from, end); - } - void write(mtpBuffer &to) const { - vphone_number.write(to); - vphone_code_hash.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPauth_SendSms : public MTPBoxed { -public: - MTPauth_SendSms() { - } - MTPauth_SendSms(const MTPauth_sendSms &v) : MTPBoxed(v) { - } - MTPauth_SendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_SendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_sendSms(_phone_number, _phone_code_hash)) { - } -}; - class MTPmessages_readMessageContents { // RPC method 'messages.readMessageContents' public: MTPVector vid; @@ -14969,481 +15973,6 @@ public: } }; -class MTPaccount_checkUsername { // RPC method 'account.checkUsername' -public: - MTPstring vusername; - - MTPaccount_checkUsername() { - } - MTPaccount_checkUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_checkUsername) { - read(from, end, cons); - } - MTPaccount_checkUsername(const MTPstring &_username) : vusername(_username) { - } - - uint32 innerLength() const { - return vusername.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_checkUsername; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_checkUsername) { - vusername.read(from, end); - } - void write(mtpBuffer &to) const { - vusername.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_CheckUsername : public MTPBoxed { -public: - MTPaccount_CheckUsername() { - } - MTPaccount_CheckUsername(const MTPaccount_checkUsername &v) : MTPBoxed(v) { - } - MTPaccount_CheckUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_CheckUsername(const MTPstring &_username) : MTPBoxed(MTPaccount_checkUsername(_username)) { - } -}; - -class MTPaccount_updateUsername { // RPC method 'account.updateUsername' -public: - MTPstring vusername; - - MTPaccount_updateUsername() { - } - MTPaccount_updateUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateUsername) { - read(from, end, cons); - } - MTPaccount_updateUsername(const MTPstring &_username) : vusername(_username) { - } - - uint32 innerLength() const { - return vusername.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_updateUsername; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateUsername) { - vusername.read(from, end); - } - void write(mtpBuffer &to) const { - vusername.write(to); - } - - typedef MTPUser ResponseType; -}; -class MTPaccount_UpdateUsername : public MTPBoxed { -public: - MTPaccount_UpdateUsername() { - } - MTPaccount_UpdateUsername(const MTPaccount_updateUsername &v) : MTPBoxed(v) { - } - MTPaccount_UpdateUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_UpdateUsername(const MTPstring &_username) : MTPBoxed(MTPaccount_updateUsername(_username)) { - } -}; - -class MTPcontacts_search { // RPC method 'contacts.search' -public: - MTPstring vq; - MTPint vlimit; - - MTPcontacts_search() { - } - MTPcontacts_search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_search) { - read(from, end, cons); - } - MTPcontacts_search(const MTPstring &_q, MTPint _limit) : vq(_q), vlimit(_limit) { - } - - uint32 innerLength() const { - return vq.innerLength() + vlimit.innerLength(); - } - mtpTypeId type() const { - return mtpc_contacts_search; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_search) { - vq.read(from, end); - vlimit.read(from, end); - } - void write(mtpBuffer &to) const { - vq.write(to); - vlimit.write(to); - } - - typedef MTPcontacts_Found ResponseType; -}; -class MTPcontacts_Search : public MTPBoxed { -public: - MTPcontacts_Search() { - } - MTPcontacts_Search(const MTPcontacts_search &v) : MTPBoxed(v) { - } - MTPcontacts_Search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPcontacts_Search(const MTPstring &_q, MTPint _limit) : MTPBoxed(MTPcontacts_search(_q, _limit)) { - } -}; - -class MTPaccount_getPrivacy { // RPC method 'account.getPrivacy' -public: - MTPInputPrivacyKey vkey; - - MTPaccount_getPrivacy() { - } - MTPaccount_getPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPrivacy) { - read(from, end, cons); - } - MTPaccount_getPrivacy(const MTPInputPrivacyKey &_key) : vkey(_key) { - } - - uint32 innerLength() const { - return vkey.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_getPrivacy; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPrivacy) { - vkey.read(from, end); - } - void write(mtpBuffer &to) const { - vkey.write(to); - } - - typedef MTPaccount_PrivacyRules ResponseType; -}; -class MTPaccount_GetPrivacy : public MTPBoxed { -public: - MTPaccount_GetPrivacy() { - } - MTPaccount_GetPrivacy(const MTPaccount_getPrivacy &v) : MTPBoxed(v) { - } - MTPaccount_GetPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_GetPrivacy(const MTPInputPrivacyKey &_key) : MTPBoxed(MTPaccount_getPrivacy(_key)) { - } -}; - -class MTPaccount_setPrivacy { // RPC method 'account.setPrivacy' -public: - MTPInputPrivacyKey vkey; - MTPVector vrules; - - MTPaccount_setPrivacy() { - } - MTPaccount_setPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setPrivacy) { - read(from, end, cons); - } - MTPaccount_setPrivacy(const MTPInputPrivacyKey &_key, const MTPVector &_rules) : vkey(_key), vrules(_rules) { - } - - uint32 innerLength() const { - return vkey.innerLength() + vrules.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_setPrivacy; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setPrivacy) { - vkey.read(from, end); - vrules.read(from, end); - } - void write(mtpBuffer &to) const { - vkey.write(to); - vrules.write(to); - } - - typedef MTPaccount_PrivacyRules ResponseType; -}; -class MTPaccount_SetPrivacy : public MTPBoxed { -public: - MTPaccount_SetPrivacy() { - } - MTPaccount_SetPrivacy(const MTPaccount_setPrivacy &v) : MTPBoxed(v) { - } - MTPaccount_SetPrivacy(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_SetPrivacy(const MTPInputPrivacyKey &_key, const MTPVector &_rules) : MTPBoxed(MTPaccount_setPrivacy(_key, _rules)) { - } -}; - -class MTPaccount_deleteAccount { // RPC method 'account.deleteAccount' -public: - MTPstring vreason; - - MTPaccount_deleteAccount() { - } - MTPaccount_deleteAccount(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_deleteAccount) { - read(from, end, cons); - } - MTPaccount_deleteAccount(const MTPstring &_reason) : vreason(_reason) { - } - - uint32 innerLength() const { - return vreason.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_deleteAccount; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_deleteAccount) { - vreason.read(from, end); - } - void write(mtpBuffer &to) const { - vreason.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_DeleteAccount : public MTPBoxed { -public: - MTPaccount_DeleteAccount() { - } - MTPaccount_DeleteAccount(const MTPaccount_deleteAccount &v) : MTPBoxed(v) { - } - MTPaccount_DeleteAccount(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_DeleteAccount(const MTPstring &_reason) : MTPBoxed(MTPaccount_deleteAccount(_reason)) { - } -}; - -class MTPaccount_getAccountTTL { // RPC method 'account.getAccountTTL' -public: - MTPaccount_getAccountTTL() { - } - MTPaccount_getAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAccountTTL) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_account_getAccountTTL; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAccountTTL) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPAccountDaysTTL ResponseType; -}; -class MTPaccount_GetAccountTTL : public MTPBoxed { -public: - MTPaccount_GetAccountTTL() { - } - MTPaccount_GetAccountTTL(const MTPaccount_getAccountTTL &v) : MTPBoxed(v) { - } - MTPaccount_GetAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPaccount_setAccountTTL { // RPC method 'account.setAccountTTL' -public: - MTPAccountDaysTTL vttl; - - MTPaccount_setAccountTTL() { - } - MTPaccount_setAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setAccountTTL) { - read(from, end, cons); - } - MTPaccount_setAccountTTL(const MTPAccountDaysTTL &_ttl) : vttl(_ttl) { - } - - uint32 innerLength() const { - return vttl.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_setAccountTTL; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_setAccountTTL) { - vttl.read(from, end); - } - void write(mtpBuffer &to) const { - vttl.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_SetAccountTTL : public MTPBoxed { -public: - MTPaccount_SetAccountTTL() { - } - MTPaccount_SetAccountTTL(const MTPaccount_setAccountTTL &v) : MTPBoxed(v) { - } - MTPaccount_SetAccountTTL(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_SetAccountTTL(const MTPAccountDaysTTL &_ttl) : MTPBoxed(MTPaccount_setAccountTTL(_ttl)) { - } -}; - -template -class MTPinvokeWithLayer { // RPC method 'invokeWithLayer' -public: - MTPint vlayer; - TQueryType vquery; - - MTPinvokeWithLayer() { - } - MTPinvokeWithLayer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithLayer) { - read(from, end, cons); - } - MTPinvokeWithLayer(MTPint _layer, const TQueryType &_query) : vlayer(_layer), vquery(_query) { - } - - uint32 innerLength() const { - return vlayer.innerLength() + vquery.innerLength(); - } - mtpTypeId type() const { - return mtpc_invokeWithLayer; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_invokeWithLayer) { - vlayer.read(from, end); - vquery.read(from, end); - } - void write(mtpBuffer &to) const { - vlayer.write(to); - vquery.write(to); - } - - typedef typename TQueryType::ResponseType ResponseType; -}; -template -class MTPInvokeWithLayer : public MTPBoxed > { -public: - MTPInvokeWithLayer() { - } - MTPInvokeWithLayer(const MTPinvokeWithLayer &v) : MTPBoxed >(v) { - } - MTPInvokeWithLayer(MTPint _layer, const TQueryType &_query) : MTPBoxed >(MTPinvokeWithLayer(_layer, _query)) { - } -}; - -class MTPcontacts_resolveUsername { // RPC method 'contacts.resolveUsername' -public: - MTPstring vusername; - - MTPcontacts_resolveUsername() { - } - MTPcontacts_resolveUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolveUsername) { - read(from, end, cons); - } - MTPcontacts_resolveUsername(const MTPstring &_username) : vusername(_username) { - } - - uint32 innerLength() const { - return vusername.innerLength(); - } - mtpTypeId type() const { - return mtpc_contacts_resolveUsername; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_contacts_resolveUsername) { - vusername.read(from, end); - } - void write(mtpBuffer &to) const { - vusername.write(to); - } - - typedef MTPUser ResponseType; -}; -class MTPcontacts_ResolveUsername : public MTPBoxed { -public: - MTPcontacts_ResolveUsername() { - } - MTPcontacts_ResolveUsername(const MTPcontacts_resolveUsername &v) : MTPBoxed(v) { - } - MTPcontacts_ResolveUsername(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPcontacts_ResolveUsername(const MTPstring &_username) : MTPBoxed(MTPcontacts_resolveUsername(_username)) { - } -}; - -class MTPaccount_sendChangePhoneCode { // RPC method 'account.sendChangePhoneCode' -public: - MTPstring vphone_number; - - MTPaccount_sendChangePhoneCode() { - } - MTPaccount_sendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { - read(from, end, cons); - } - MTPaccount_sendChangePhoneCode(const MTPstring &_phone_number) : vphone_number(_phone_number) { - } - - uint32 innerLength() const { - return vphone_number.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_sendChangePhoneCode; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { - vphone_number.read(from, end); - } - void write(mtpBuffer &to) const { - vphone_number.write(to); - } - - typedef MTPaccount_SentChangePhoneCode ResponseType; -}; -class MTPaccount_SendChangePhoneCode : public MTPBoxed { -public: - MTPaccount_SendChangePhoneCode() { - } - MTPaccount_SendChangePhoneCode(const MTPaccount_sendChangePhoneCode &v) : MTPBoxed(v) { - } - MTPaccount_SendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_SendChangePhoneCode(const MTPstring &_phone_number) : MTPBoxed(MTPaccount_sendChangePhoneCode(_phone_number)) { - } -}; - -class MTPaccount_changePhone { // RPC method 'account.changePhone' -public: - MTPstring vphone_number; - MTPstring vphone_code_hash; - MTPstring vphone_code; - - MTPaccount_changePhone() { - } - MTPaccount_changePhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_changePhone) { - read(from, end, cons); - } - MTPaccount_changePhone(const MTPstring &_phone_number, const MTPstring &_phone_code_hash, const MTPstring &_phone_code) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash), vphone_code(_phone_code) { - } - - uint32 innerLength() const { - return vphone_number.innerLength() + vphone_code_hash.innerLength() + vphone_code.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_changePhone; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_changePhone) { - vphone_number.read(from, end); - vphone_code_hash.read(from, end); - vphone_code.read(from, end); - } - void write(mtpBuffer &to) const { - vphone_number.write(to); - vphone_code_hash.write(to); - vphone_code.write(to); - } - - typedef MTPUser ResponseType; -}; -class MTPaccount_ChangePhone : public MTPBoxed { -public: - MTPaccount_ChangePhone() { - } - MTPaccount_ChangePhone(const MTPaccount_changePhone &v) : MTPBoxed(v) { - } - MTPaccount_ChangePhone(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_ChangePhone(const MTPstring &_phone_number, const MTPstring &_phone_code_hash, const MTPstring &_phone_code) : MTPBoxed(MTPaccount_changePhone(_phone_number, _phone_code_hash, _phone_code)) { - } -}; - class MTPmessages_getStickers { // RPC method 'messages.getStickers' public: MTPstring vemoticon; @@ -15525,93 +16054,6 @@ public: } }; -class MTPaccount_updateDeviceLocked { // RPC method 'account.updateDeviceLocked' -public: - MTPint vperiod; - - MTPaccount_updateDeviceLocked() { - } - MTPaccount_updateDeviceLocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateDeviceLocked) { - read(from, end, cons); - } - MTPaccount_updateDeviceLocked(MTPint _period) : vperiod(_period) { - } - - uint32 innerLength() const { - return vperiod.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_updateDeviceLocked; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateDeviceLocked) { - vperiod.read(from, end); - } - void write(mtpBuffer &to) const { - vperiod.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_UpdateDeviceLocked : public MTPBoxed { -public: - MTPaccount_UpdateDeviceLocked() { - } - MTPaccount_UpdateDeviceLocked(const MTPaccount_updateDeviceLocked &v) : MTPBoxed(v) { - } - MTPaccount_UpdateDeviceLocked(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_UpdateDeviceLocked(MTPint _period) : MTPBoxed(MTPaccount_updateDeviceLocked(_period)) { - } -}; - -class MTPauth_importBotAuthorization { // RPC method 'auth.importBotAuthorization' -public: - MTPint vflags; - MTPint vapi_id; - MTPstring vapi_hash; - MTPstring vbot_auth_token; - - MTPauth_importBotAuthorization() { - } - MTPauth_importBotAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_importBotAuthorization) { - read(from, end, cons); - } - MTPauth_importBotAuthorization(MTPint _flags, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_bot_auth_token) : vflags(_flags), vapi_id(_api_id), vapi_hash(_api_hash), vbot_auth_token(_bot_auth_token) { - } - - uint32 innerLength() const { - return vflags.innerLength() + vapi_id.innerLength() + vapi_hash.innerLength() + vbot_auth_token.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_importBotAuthorization; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_importBotAuthorization) { - vflags.read(from, end); - vapi_id.read(from, end); - vapi_hash.read(from, end); - vbot_auth_token.read(from, end); - } - void write(mtpBuffer &to) const { - vflags.write(to); - vapi_id.write(to); - vapi_hash.write(to); - vbot_auth_token.write(to); - } - - typedef MTPauth_Authorization ResponseType; -}; -class MTPauth_ImportBotAuthorization : public MTPBoxed { -public: - MTPauth_ImportBotAuthorization() { - } - MTPauth_ImportBotAuthorization(const MTPauth_importBotAuthorization &v) : MTPBoxed(v) { - } - MTPauth_ImportBotAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_ImportBotAuthorization(MTPint _flags, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_bot_auth_token) : MTPBoxed(MTPauth_importBotAuthorization(_flags, _api_id, _api_hash, _bot_auth_token)) { - } -}; - class MTPmessages_getWebPagePreview { // RPC method 'messages.getWebPagePreview' public: MTPstring vmessage; @@ -15651,346 +16093,16 @@ public: } }; -class MTPaccount_getAuthorizations { // RPC method 'account.getAuthorizations' -public: - MTPaccount_getAuthorizations() { - } - MTPaccount_getAuthorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAuthorizations) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_account_getAuthorizations; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getAuthorizations) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPaccount_Authorizations ResponseType; -}; -class MTPaccount_GetAuthorizations : public MTPBoxed { -public: - MTPaccount_GetAuthorizations() { - } - MTPaccount_GetAuthorizations(const MTPaccount_getAuthorizations &v) : MTPBoxed(v) { - } - MTPaccount_GetAuthorizations(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPaccount_resetAuthorization { // RPC method 'account.resetAuthorization' -public: - MTPlong vhash; - - MTPaccount_resetAuthorization() { - } - MTPaccount_resetAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_resetAuthorization) { - read(from, end, cons); - } - MTPaccount_resetAuthorization(const MTPlong &_hash) : vhash(_hash) { - } - - uint32 innerLength() const { - return vhash.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_resetAuthorization; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_resetAuthorization) { - vhash.read(from, end); - } - void write(mtpBuffer &to) const { - vhash.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_ResetAuthorization : public MTPBoxed { -public: - MTPaccount_ResetAuthorization() { - } - MTPaccount_ResetAuthorization(const MTPaccount_resetAuthorization &v) : MTPBoxed(v) { - } - MTPaccount_ResetAuthorization(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_ResetAuthorization(const MTPlong &_hash) : MTPBoxed(MTPaccount_resetAuthorization(_hash)) { - } -}; - -class MTPaccount_getPassword { // RPC method 'account.getPassword' -public: - MTPaccount_getPassword() { - } - MTPaccount_getPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPassword) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_account_getPassword; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPassword) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPaccount_Password ResponseType; -}; -class MTPaccount_GetPassword : public MTPBoxed { -public: - MTPaccount_GetPassword() { - } - MTPaccount_GetPassword(const MTPaccount_getPassword &v) : MTPBoxed(v) { - } - MTPaccount_GetPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPaccount_getPasswordSettings { // RPC method 'account.getPasswordSettings' -public: - MTPbytes vcurrent_password_hash; - - MTPaccount_getPasswordSettings() { - } - MTPaccount_getPasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPasswordSettings) { - read(from, end, cons); - } - MTPaccount_getPasswordSettings(const MTPbytes &_current_password_hash) : vcurrent_password_hash(_current_password_hash) { - } - - uint32 innerLength() const { - return vcurrent_password_hash.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_getPasswordSettings; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_getPasswordSettings) { - vcurrent_password_hash.read(from, end); - } - void write(mtpBuffer &to) const { - vcurrent_password_hash.write(to); - } - - typedef MTPaccount_PasswordSettings ResponseType; -}; -class MTPaccount_GetPasswordSettings : public MTPBoxed { -public: - MTPaccount_GetPasswordSettings() { - } - MTPaccount_GetPasswordSettings(const MTPaccount_getPasswordSettings &v) : MTPBoxed(v) { - } - MTPaccount_GetPasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_GetPasswordSettings(const MTPbytes &_current_password_hash) : MTPBoxed(MTPaccount_getPasswordSettings(_current_password_hash)) { - } -}; - -class MTPaccount_updatePasswordSettings { // RPC method 'account.updatePasswordSettings' -public: - MTPbytes vcurrent_password_hash; - MTPaccount_PasswordInputSettings vnew_settings; - - MTPaccount_updatePasswordSettings() { - } - MTPaccount_updatePasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updatePasswordSettings) { - read(from, end, cons); - } - MTPaccount_updatePasswordSettings(const MTPbytes &_current_password_hash, const MTPaccount_PasswordInputSettings &_new_settings) : vcurrent_password_hash(_current_password_hash), vnew_settings(_new_settings) { - } - - uint32 innerLength() const { - return vcurrent_password_hash.innerLength() + vnew_settings.innerLength(); - } - mtpTypeId type() const { - return mtpc_account_updatePasswordSettings; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updatePasswordSettings) { - vcurrent_password_hash.read(from, end); - vnew_settings.read(from, end); - } - void write(mtpBuffer &to) const { - vcurrent_password_hash.write(to); - vnew_settings.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPaccount_UpdatePasswordSettings : public MTPBoxed { -public: - MTPaccount_UpdatePasswordSettings() { - } - MTPaccount_UpdatePasswordSettings(const MTPaccount_updatePasswordSettings &v) : MTPBoxed(v) { - } - MTPaccount_UpdatePasswordSettings(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPaccount_UpdatePasswordSettings(const MTPbytes &_current_password_hash, const MTPaccount_PasswordInputSettings &_new_settings) : MTPBoxed(MTPaccount_updatePasswordSettings(_current_password_hash, _new_settings)) { - } -}; - -class MTPauth_checkPassword { // RPC method 'auth.checkPassword' -public: - MTPbytes vpassword_hash; - - MTPauth_checkPassword() { - } - MTPauth_checkPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkPassword) { - read(from, end, cons); - } - MTPauth_checkPassword(const MTPbytes &_password_hash) : vpassword_hash(_password_hash) { - } - - uint32 innerLength() const { - return vpassword_hash.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_checkPassword; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_checkPassword) { - vpassword_hash.read(from, end); - } - void write(mtpBuffer &to) const { - vpassword_hash.write(to); - } - - typedef MTPauth_Authorization ResponseType; -}; -class MTPauth_CheckPassword : public MTPBoxed { -public: - MTPauth_CheckPassword() { - } - MTPauth_CheckPassword(const MTPauth_checkPassword &v) : MTPBoxed(v) { - } - MTPauth_CheckPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_CheckPassword(const MTPbytes &_password_hash) : MTPBoxed(MTPauth_checkPassword(_password_hash)) { - } -}; - -class MTPauth_requestPasswordRecovery { // RPC method 'auth.requestPasswordRecovery' -public: - MTPauth_requestPasswordRecovery() { - } - MTPauth_requestPasswordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_requestPasswordRecovery) { - read(from, end, cons); - } - - uint32 innerLength() const { - return 0; - } - mtpTypeId type() const { - return mtpc_auth_requestPasswordRecovery; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_requestPasswordRecovery) { - } - void write(mtpBuffer &to) const { - } - - typedef MTPauth_PasswordRecovery ResponseType; -}; -class MTPauth_RequestPasswordRecovery : public MTPBoxed { -public: - MTPauth_RequestPasswordRecovery() { - } - MTPauth_RequestPasswordRecovery(const MTPauth_requestPasswordRecovery &v) : MTPBoxed(v) { - } - MTPauth_RequestPasswordRecovery(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } -}; - -class MTPauth_recoverPassword { // RPC method 'auth.recoverPassword' -public: - MTPstring vcode; - - MTPauth_recoverPassword() { - } - MTPauth_recoverPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_recoverPassword) { - read(from, end, cons); - } - MTPauth_recoverPassword(const MTPstring &_code) : vcode(_code) { - } - - uint32 innerLength() const { - return vcode.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_recoverPassword; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_recoverPassword) { - vcode.read(from, end); - } - void write(mtpBuffer &to) const { - vcode.write(to); - } - - typedef MTPauth_Authorization ResponseType; -}; -class MTPauth_RecoverPassword : public MTPBoxed { -public: - MTPauth_RecoverPassword() { - } - MTPauth_RecoverPassword(const MTPauth_recoverPassword &v) : MTPBoxed(v) { - } - MTPauth_RecoverPassword(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_RecoverPassword(const MTPstring &_code) : MTPBoxed(MTPauth_recoverPassword(_code)) { - } -}; - -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; + MTPInputChat 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) { + MTPmessages_exportChatInvite(const MTPInputChat &_chat_id) : vchat_id(_chat_id) { } uint32 innerLength() const { @@ -16016,7 +16128,7 @@ public: } 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)) { + MTPmessages_ExportChatInvite(const MTPInputChat &_chat_id) : MTPBoxed(MTPmessages_exportChatInvite(_chat_id)) { } }; @@ -16221,7 +16333,7 @@ public: class MTPmessages_startBot { // RPC method 'messages.startBot' public: MTPInputUser vbot; - MTPint vchat_id; + MTPInputChat vchat_id; MTPlong vrandom_id; MTPstring vstart_param; @@ -16230,7 +16342,7 @@ public: MTPmessages_startBot(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_startBot) { read(from, end, cons); } - MTPmessages_startBot(const MTPInputUser &_bot, MTPint _chat_id, const MTPlong &_random_id, const MTPstring &_start_param) : vbot(_bot), vchat_id(_chat_id), vrandom_id(_random_id), vstart_param(_start_param) { + MTPmessages_startBot(const MTPInputUser &_bot, const MTPInputChat &_chat_id, const MTPlong &_random_id, const MTPstring &_start_param) : vbot(_bot), vchat_id(_chat_id), vrandom_id(_random_id), vstart_param(_start_param) { } uint32 innerLength() const { @@ -16262,7 +16374,878 @@ public: } MTPmessages_StartBot(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_StartBot(const MTPInputUser &_bot, MTPint _chat_id, const MTPlong &_random_id, const MTPstring &_start_param) : MTPBoxed(MTPmessages_startBot(_bot, _chat_id, _random_id, _start_param)) { + MTPmessages_StartBot(const MTPInputUser &_bot, const MTPInputChat &_chat_id, const MTPlong &_random_id, const MTPstring &_start_param) : MTPBoxed(MTPmessages_startBot(_bot, _chat_id, _random_id, _start_param)) { + } +}; + +class MTPmessages_getChannelDialogs { // RPC method 'messages.getChannelDialogs' +public: + MTPint voffset; + MTPint vlimit; + + MTPmessages_getChannelDialogs() { + } + MTPmessages_getChannelDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getChannelDialogs) { + read(from, end, cons); + } + MTPmessages_getChannelDialogs(MTPint _offset, MTPint _limit) : voffset(_offset), vlimit(_limit) { + } + + uint32 innerLength() const { + return voffset.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getChannelDialogs; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getChannelDialogs) { + voffset.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + voffset.write(to); + vlimit.write(to); + } + + typedef MTPmessages_Dialogs ResponseType; +}; +class MTPmessages_GetChannelDialogs : public MTPBoxed { +public: + MTPmessages_GetChannelDialogs() { + } + MTPmessages_GetChannelDialogs(const MTPmessages_getChannelDialogs &v) : MTPBoxed(v) { + } + MTPmessages_GetChannelDialogs(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetChannelDialogs(MTPint _offset, MTPint _limit) : MTPBoxed(MTPmessages_getChannelDialogs(_offset, _limit)) { + } +}; + +class MTPmessages_getImportantHistory { // RPC method 'messages.getImportantHistory' +public: + MTPInputPeer vpeer; + MTPint vmax_id; + MTPint vmin_id; + MTPint vlimit; + + MTPmessages_getImportantHistory() { + } + MTPmessages_getImportantHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getImportantHistory) { + read(from, end, cons); + } + MTPmessages_getImportantHistory(const MTPInputPeer &_peer, MTPint _max_id, MTPint _min_id, MTPint _limit) : vpeer(_peer), vmax_id(_max_id), vmin_id(_min_id), vlimit(_limit) { + } + + uint32 innerLength() const { + return vpeer.innerLength() + vmax_id.innerLength() + vmin_id.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getImportantHistory; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getImportantHistory) { + vpeer.read(from, end); + vmax_id.read(from, end); + vmin_id.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vpeer.write(to); + vmax_id.write(to); + vmin_id.write(to); + vlimit.write(to); + } + + typedef MTPmessages_Messages ResponseType; +}; +class MTPmessages_GetImportantHistory : public MTPBoxed { +public: + MTPmessages_GetImportantHistory() { + } + MTPmessages_GetImportantHistory(const MTPmessages_getImportantHistory &v) : MTPBoxed(v) { + } + MTPmessages_GetImportantHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetImportantHistory(const MTPInputPeer &_peer, MTPint _max_id, MTPint _min_id, MTPint _limit) : MTPBoxed(MTPmessages_getImportantHistory(_peer, _max_id, _min_id, _limit)) { + } +}; + +class MTPmessages_readChannelHistory { // RPC method 'messages.readChannelHistory' +public: + MTPInputPeer vpeer; + MTPint vmax_id; + + MTPmessages_readChannelHistory() { + } + MTPmessages_readChannelHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readChannelHistory) { + read(from, end, cons); + } + MTPmessages_readChannelHistory(const MTPInputPeer &_peer, MTPint _max_id) : vpeer(_peer), vmax_id(_max_id) { + } + + uint32 innerLength() const { + return vpeer.innerLength() + vmax_id.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_readChannelHistory; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readChannelHistory) { + vpeer.read(from, end); + vmax_id.read(from, end); + } + void write(mtpBuffer &to) const { + vpeer.write(to); + vmax_id.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPmessages_ReadChannelHistory : public MTPBoxed { +public: + MTPmessages_ReadChannelHistory() { + } + MTPmessages_ReadChannelHistory(const MTPmessages_readChannelHistory &v) : MTPBoxed(v) { + } + MTPmessages_ReadChannelHistory(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_ReadChannelHistory(const MTPInputPeer &_peer, MTPint _max_id) : MTPBoxed(MTPmessages_readChannelHistory(_peer, _max_id)) { + } +}; + +class MTPmessages_createChannel { // RPC method 'messages.createChannel' +public: + MTPstring vtitle; + + MTPmessages_createChannel() { + } + MTPmessages_createChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) { + read(from, end, cons); + } + MTPmessages_createChannel(const MTPstring &_title) : vtitle(_title) { + } + + uint32 innerLength() const { + return vtitle.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_createChannel; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_createChannel) { + vtitle.read(from, end); + } + void write(mtpBuffer &to) const { + vtitle.write(to); + } + + typedef MTPUpdates ResponseType; +}; +class MTPmessages_CreateChannel : public MTPBoxed { +public: + MTPmessages_CreateChannel() { + } + MTPmessages_CreateChannel(const MTPmessages_createChannel &v) : MTPBoxed(v) { + } + MTPmessages_CreateChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_CreateChannel(const MTPstring &_title) : MTPBoxed(MTPmessages_createChannel(_title)) { + } +}; + +class MTPmessages_deleteChannelMessages { // RPC method 'messages.deleteChannelMessages' +public: + MTPInputPeer vpeer; + MTPVector vid; + + MTPmessages_deleteChannelMessages() { + } + MTPmessages_deleteChannelMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteChannelMessages) { + read(from, end, cons); + } + MTPmessages_deleteChannelMessages(const MTPInputPeer &_peer, const MTPVector &_id) : vpeer(_peer), vid(_id) { + } + + uint32 innerLength() const { + return vpeer.innerLength() + vid.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_deleteChannelMessages; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteChannelMessages) { + vpeer.read(from, end); + vid.read(from, end); + } + void write(mtpBuffer &to) const { + vpeer.write(to); + vid.write(to); + } + + typedef MTPmessages_AffectedMessages ResponseType; +}; +class MTPmessages_DeleteChannelMessages : public MTPBoxed { +public: + MTPmessages_DeleteChannelMessages() { + } + MTPmessages_DeleteChannelMessages(const MTPmessages_deleteChannelMessages &v) : MTPBoxed(v) { + } + MTPmessages_DeleteChannelMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_DeleteChannelMessages(const MTPInputPeer &_peer, const MTPVector &_id) : MTPBoxed(MTPmessages_deleteChannelMessages(_peer, _id)) { + } +}; + +class MTPupdates_getState { // RPC method 'updates.getState' +public: + MTPupdates_getState() { + } + MTPupdates_getState(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getState) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_updates_getState; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getState) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPupdates_State ResponseType; +}; +class MTPupdates_GetState : public MTPBoxed { +public: + MTPupdates_GetState() { + } + MTPupdates_GetState(const MTPupdates_getState &v) : MTPBoxed(v) { + } + MTPupdates_GetState(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPupdates_getDifference { // RPC method 'updates.getDifference' +public: + MTPint vpts; + MTPint vdate; + MTPint vqts; + + MTPupdates_getDifference() { + } + MTPupdates_getDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { + read(from, end, cons); + } + MTPupdates_getDifference(MTPint _pts, MTPint _date, MTPint _qts) : vpts(_pts), vdate(_date), vqts(_qts) { + } + + uint32 innerLength() const { + return vpts.innerLength() + vdate.innerLength() + vqts.innerLength(); + } + mtpTypeId type() const { + return mtpc_updates_getDifference; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getDifference) { + vpts.read(from, end); + vdate.read(from, end); + vqts.read(from, end); + } + void write(mtpBuffer &to) const { + vpts.write(to); + vdate.write(to); + vqts.write(to); + } + + typedef MTPupdates_Difference ResponseType; +}; +class MTPupdates_GetDifference : public MTPBoxed { +public: + MTPupdates_GetDifference() { + } + MTPupdates_GetDifference(const MTPupdates_getDifference &v) : MTPBoxed(v) { + } + MTPupdates_GetDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPupdates_GetDifference(MTPint _pts, MTPint _date, MTPint _qts) : MTPBoxed(MTPupdates_getDifference(_pts, _date, _qts)) { + } +}; + +class MTPupdates_getChannelDifference { // RPC method 'updates.getChannelDifference' +public: + MTPInputPeer vpeer; + MTPChannelMessagesFilter vfilter; + MTPint vpts; + MTPint vlimit; + + MTPupdates_getChannelDifference() { + } + MTPupdates_getChannelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getChannelDifference) { + read(from, end, cons); + } + MTPupdates_getChannelDifference(const MTPInputPeer &_peer, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : vpeer(_peer), vfilter(_filter), vpts(_pts), vlimit(_limit) { + } + + uint32 innerLength() const { + return vpeer.innerLength() + vfilter.innerLength() + vpts.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_updates_getChannelDifference; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_updates_getChannelDifference) { + vpeer.read(from, end); + vfilter.read(from, end); + vpts.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vpeer.write(to); + vfilter.write(to); + vpts.write(to); + vlimit.write(to); + } + + typedef MTPupdates_ChannelDifference ResponseType; +}; +class MTPupdates_GetChannelDifference : public MTPBoxed { +public: + MTPupdates_GetChannelDifference() { + } + MTPupdates_GetChannelDifference(const MTPupdates_getChannelDifference &v) : MTPBoxed(v) { + } + MTPupdates_GetChannelDifference(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPupdates_GetChannelDifference(const MTPInputPeer &_peer, const MTPChannelMessagesFilter &_filter, MTPint _pts, MTPint _limit) : MTPBoxed(MTPupdates_getChannelDifference(_peer, _filter, _pts, _limit)) { + } +}; + +class MTPphotos_updateProfilePhoto { // RPC method 'photos.updateProfilePhoto' +public: + MTPInputPhoto vid; + MTPInputPhotoCrop vcrop; + + MTPphotos_updateProfilePhoto() { + } + MTPphotos_updateProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_updateProfilePhoto) { + read(from, end, cons); + } + MTPphotos_updateProfilePhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) : vid(_id), vcrop(_crop) { + } + + uint32 innerLength() const { + return vid.innerLength() + vcrop.innerLength(); + } + mtpTypeId type() const { + return mtpc_photos_updateProfilePhoto; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_updateProfilePhoto) { + vid.read(from, end); + vcrop.read(from, end); + } + void write(mtpBuffer &to) const { + vid.write(to); + vcrop.write(to); + } + + typedef MTPUserProfilePhoto ResponseType; +}; +class MTPphotos_UpdateProfilePhoto : public MTPBoxed { +public: + MTPphotos_UpdateProfilePhoto() { + } + MTPphotos_UpdateProfilePhoto(const MTPphotos_updateProfilePhoto &v) : MTPBoxed(v) { + } + MTPphotos_UpdateProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPphotos_UpdateProfilePhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) : MTPBoxed(MTPphotos_updateProfilePhoto(_id, _crop)) { + } +}; + +class MTPphotos_uploadProfilePhoto { // RPC method 'photos.uploadProfilePhoto' +public: + MTPInputFile vfile; + MTPstring vcaption; + MTPInputGeoPoint vgeo_point; + MTPInputPhotoCrop vcrop; + + MTPphotos_uploadProfilePhoto() { + } + MTPphotos_uploadProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_uploadProfilePhoto) { + read(from, end, cons); + } + MTPphotos_uploadProfilePhoto(const MTPInputFile &_file, const MTPstring &_caption, const MTPInputGeoPoint &_geo_point, const MTPInputPhotoCrop &_crop) : vfile(_file), vcaption(_caption), vgeo_point(_geo_point), vcrop(_crop) { + } + + uint32 innerLength() const { + return vfile.innerLength() + vcaption.innerLength() + vgeo_point.innerLength() + vcrop.innerLength(); + } + mtpTypeId type() const { + return mtpc_photos_uploadProfilePhoto; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_uploadProfilePhoto) { + vfile.read(from, end); + vcaption.read(from, end); + vgeo_point.read(from, end); + vcrop.read(from, end); + } + void write(mtpBuffer &to) const { + vfile.write(to); + vcaption.write(to); + vgeo_point.write(to); + vcrop.write(to); + } + + typedef MTPphotos_Photo ResponseType; +}; +class MTPphotos_UploadProfilePhoto : public MTPBoxed { +public: + MTPphotos_UploadProfilePhoto() { + } + MTPphotos_UploadProfilePhoto(const MTPphotos_uploadProfilePhoto &v) : MTPBoxed(v) { + } + MTPphotos_UploadProfilePhoto(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPphotos_UploadProfilePhoto(const MTPInputFile &_file, const MTPstring &_caption, const MTPInputGeoPoint &_geo_point, const MTPInputPhotoCrop &_crop) : MTPBoxed(MTPphotos_uploadProfilePhoto(_file, _caption, _geo_point, _crop)) { + } +}; + +class MTPphotos_deletePhotos { // RPC method 'photos.deletePhotos' +public: + MTPVector vid; + + MTPphotos_deletePhotos() { + } + MTPphotos_deletePhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_deletePhotos) { + read(from, end, cons); + } + MTPphotos_deletePhotos(const MTPVector &_id) : vid(_id) { + } + + uint32 innerLength() const { + return vid.innerLength(); + } + mtpTypeId type() const { + return mtpc_photos_deletePhotos; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_deletePhotos) { + vid.read(from, end); + } + void write(mtpBuffer &to) const { + vid.write(to); + } + + typedef MTPVector ResponseType; +}; +class MTPphotos_DeletePhotos : public MTPBoxed { +public: + MTPphotos_DeletePhotos() { + } + MTPphotos_DeletePhotos(const MTPphotos_deletePhotos &v) : MTPBoxed(v) { + } + MTPphotos_DeletePhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPphotos_DeletePhotos(const MTPVector &_id) : MTPBoxed(MTPphotos_deletePhotos(_id)) { + } +}; + +class MTPphotos_getUserPhotos { // RPC method 'photos.getUserPhotos' +public: + MTPInputUser vuser_id; + MTPint voffset; + MTPlong vmax_id; + MTPint vlimit; + + MTPphotos_getUserPhotos() { + } + MTPphotos_getUserPhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_getUserPhotos) { + read(from, end, cons); + } + MTPphotos_getUserPhotos(const MTPInputUser &_user_id, MTPint _offset, const MTPlong &_max_id, MTPint _limit) : vuser_id(_user_id), voffset(_offset), vmax_id(_max_id), vlimit(_limit) { + } + + uint32 innerLength() const { + return vuser_id.innerLength() + voffset.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_photos_getUserPhotos; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_photos_getUserPhotos) { + vuser_id.read(from, end); + voffset.read(from, end); + vmax_id.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vuser_id.write(to); + voffset.write(to); + vmax_id.write(to); + vlimit.write(to); + } + + typedef MTPphotos_Photos ResponseType; +}; +class MTPphotos_GetUserPhotos : public MTPBoxed { +public: + MTPphotos_GetUserPhotos() { + } + MTPphotos_GetUserPhotos(const MTPphotos_getUserPhotos &v) : MTPBoxed(v) { + } + MTPphotos_GetUserPhotos(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPphotos_GetUserPhotos(const MTPInputUser &_user_id, MTPint _offset, const MTPlong &_max_id, MTPint _limit) : MTPBoxed(MTPphotos_getUserPhotos(_user_id, _offset, _max_id, _limit)) { + } +}; + +class MTPupload_saveFilePart { // RPC method 'upload.saveFilePart' +public: + MTPlong vfile_id; + MTPint vfile_part; + MTPbytes vbytes; + + MTPupload_saveFilePart() { + } + MTPupload_saveFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveFilePart) { + read(from, end, cons); + } + MTPupload_saveFilePart(const MTPlong &_file_id, MTPint _file_part, const MTPbytes &_bytes) : vfile_id(_file_id), vfile_part(_file_part), vbytes(_bytes) { + } + + uint32 innerLength() const { + return vfile_id.innerLength() + vfile_part.innerLength() + vbytes.innerLength(); + } + mtpTypeId type() const { + return mtpc_upload_saveFilePart; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveFilePart) { + vfile_id.read(from, end); + vfile_part.read(from, end); + vbytes.read(from, end); + } + void write(mtpBuffer &to) const { + vfile_id.write(to); + vfile_part.write(to); + vbytes.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPupload_SaveFilePart : public MTPBoxed { +public: + MTPupload_SaveFilePart() { + } + MTPupload_SaveFilePart(const MTPupload_saveFilePart &v) : MTPBoxed(v) { + } + MTPupload_SaveFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPupload_SaveFilePart(const MTPlong &_file_id, MTPint _file_part, const MTPbytes &_bytes) : MTPBoxed(MTPupload_saveFilePart(_file_id, _file_part, _bytes)) { + } +}; + +class MTPupload_getFile { // RPC method 'upload.getFile' +public: + MTPInputFileLocation vlocation; + MTPint voffset; + MTPint vlimit; + + MTPupload_getFile() { + } + MTPupload_getFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_getFile) { + read(from, end, cons); + } + MTPupload_getFile(const MTPInputFileLocation &_location, MTPint _offset, MTPint _limit) : vlocation(_location), voffset(_offset), vlimit(_limit) { + } + + uint32 innerLength() const { + return vlocation.innerLength() + voffset.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_upload_getFile; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_getFile) { + vlocation.read(from, end); + voffset.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + vlocation.write(to); + voffset.write(to); + vlimit.write(to); + } + + typedef MTPupload_File ResponseType; +}; +class MTPupload_GetFile : public MTPBoxed { +public: + MTPupload_GetFile() { + } + MTPupload_GetFile(const MTPupload_getFile &v) : MTPBoxed(v) { + } + MTPupload_GetFile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPupload_GetFile(const MTPInputFileLocation &_location, MTPint _offset, MTPint _limit) : MTPBoxed(MTPupload_getFile(_location, _offset, _limit)) { + } +}; + +class MTPupload_saveBigFilePart { // RPC method 'upload.saveBigFilePart' +public: + MTPlong vfile_id; + MTPint vfile_part; + MTPint vfile_total_parts; + MTPbytes vbytes; + + MTPupload_saveBigFilePart() { + } + MTPupload_saveBigFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveBigFilePart) { + read(from, end, cons); + } + MTPupload_saveBigFilePart(const MTPlong &_file_id, MTPint _file_part, MTPint _file_total_parts, const MTPbytes &_bytes) : vfile_id(_file_id), vfile_part(_file_part), vfile_total_parts(_file_total_parts), vbytes(_bytes) { + } + + uint32 innerLength() const { + return vfile_id.innerLength() + vfile_part.innerLength() + vfile_total_parts.innerLength() + vbytes.innerLength(); + } + mtpTypeId type() const { + return mtpc_upload_saveBigFilePart; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_upload_saveBigFilePart) { + vfile_id.read(from, end); + vfile_part.read(from, end); + vfile_total_parts.read(from, end); + vbytes.read(from, end); + } + void write(mtpBuffer &to) const { + vfile_id.write(to); + vfile_part.write(to); + vfile_total_parts.write(to); + vbytes.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPupload_SaveBigFilePart : public MTPBoxed { +public: + MTPupload_SaveBigFilePart() { + } + MTPupload_SaveBigFilePart(const MTPupload_saveBigFilePart &v) : MTPBoxed(v) { + } + MTPupload_SaveBigFilePart(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPupload_SaveBigFilePart(const MTPlong &_file_id, MTPint _file_part, MTPint _file_total_parts, const MTPbytes &_bytes) : MTPBoxed(MTPupload_saveBigFilePart(_file_id, _file_part, _file_total_parts, _bytes)) { + } +}; + +class MTPhelp_getConfig { // RPC method 'help.getConfig' +public: + MTPhelp_getConfig() { + } + MTPhelp_getConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getConfig) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_help_getConfig; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getConfig) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPConfig ResponseType; +}; +class MTPhelp_GetConfig : public MTPBoxed { +public: + MTPhelp_GetConfig() { + } + MTPhelp_GetConfig(const MTPhelp_getConfig &v) : MTPBoxed(v) { + } + MTPhelp_GetConfig(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPhelp_getNearestDc { // RPC method 'help.getNearestDc' +public: + MTPhelp_getNearestDc() { + } + MTPhelp_getNearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getNearestDc) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_help_getNearestDc; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getNearestDc) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPNearestDc ResponseType; +}; +class MTPhelp_GetNearestDc : public MTPBoxed { +public: + MTPhelp_GetNearestDc() { + } + MTPhelp_GetNearestDc(const MTPhelp_getNearestDc &v) : MTPBoxed(v) { + } + MTPhelp_GetNearestDc(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } +}; + +class MTPhelp_getAppUpdate { // RPC method 'help.getAppUpdate' +public: + MTPstring vdevice_model; + MTPstring vsystem_version; + MTPstring vapp_version; + MTPstring vlang_code; + + MTPhelp_getAppUpdate() { + } + MTPhelp_getAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { + read(from, end, cons); + } + MTPhelp_getAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : vdevice_model(_device_model), vsystem_version(_system_version), vapp_version(_app_version), vlang_code(_lang_code) { + } + + uint32 innerLength() const { + return vdevice_model.innerLength() + vsystem_version.innerLength() + vapp_version.innerLength() + vlang_code.innerLength(); + } + mtpTypeId type() const { + return mtpc_help_getAppUpdate; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getAppUpdate) { + vdevice_model.read(from, end); + vsystem_version.read(from, end); + vapp_version.read(from, end); + vlang_code.read(from, end); + } + void write(mtpBuffer &to) const { + vdevice_model.write(to); + vsystem_version.write(to); + vapp_version.write(to); + vlang_code.write(to); + } + + typedef MTPhelp_AppUpdate ResponseType; +}; +class MTPhelp_GetAppUpdate : public MTPBoxed { +public: + MTPhelp_GetAppUpdate() { + } + MTPhelp_GetAppUpdate(const MTPhelp_getAppUpdate &v) : MTPBoxed(v) { + } + MTPhelp_GetAppUpdate(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPhelp_GetAppUpdate(const MTPstring &_device_model, const MTPstring &_system_version, const MTPstring &_app_version, const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getAppUpdate(_device_model, _system_version, _app_version, _lang_code)) { + } +}; + +class MTPhelp_saveAppLog { // RPC method 'help.saveAppLog' +public: + MTPVector vevents; + + MTPhelp_saveAppLog() { + } + MTPhelp_saveAppLog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_saveAppLog) { + read(from, end, cons); + } + MTPhelp_saveAppLog(const MTPVector &_events) : vevents(_events) { + } + + uint32 innerLength() const { + return vevents.innerLength(); + } + mtpTypeId type() const { + return mtpc_help_saveAppLog; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_saveAppLog) { + vevents.read(from, end); + } + void write(mtpBuffer &to) const { + vevents.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPhelp_SaveAppLog : public MTPBoxed { +public: + MTPhelp_SaveAppLog() { + } + MTPhelp_SaveAppLog(const MTPhelp_saveAppLog &v) : MTPBoxed(v) { + } + MTPhelp_SaveAppLog(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPhelp_SaveAppLog(const MTPVector &_events) : MTPBoxed(MTPhelp_saveAppLog(_events)) { + } +}; + +class MTPhelp_getInviteText { // RPC method 'help.getInviteText' +public: + MTPstring vlang_code; + + MTPhelp_getInviteText() { + } + MTPhelp_getInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { + read(from, end, cons); + } + MTPhelp_getInviteText(const MTPstring &_lang_code) : vlang_code(_lang_code) { + } + + uint32 innerLength() const { + return vlang_code.innerLength(); + } + mtpTypeId type() const { + return mtpc_help_getInviteText; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getInviteText) { + vlang_code.read(from, end); + } + void write(mtpBuffer &to) const { + vlang_code.write(to); + } + + typedef MTPhelp_InviteText ResponseType; +}; +class MTPhelp_GetInviteText : public MTPBoxed { +public: + MTPhelp_GetInviteText() { + } + MTPhelp_GetInviteText(const MTPhelp_getInviteText &v) : MTPBoxed(v) { + } + MTPhelp_GetInviteText(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPhelp_GetInviteText(const MTPstring &_lang_code) : MTPBoxed(MTPhelp_getInviteText(_lang_code)) { + } +}; + +class MTPhelp_getSupport { // RPC method 'help.getSupport' +public: + MTPhelp_getSupport() { + } + MTPhelp_getSupport(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getSupport) { + read(from, end, cons); + } + + uint32 innerLength() const { + return 0; + } + mtpTypeId type() const { + return mtpc_help_getSupport; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_help_getSupport) { + } + void write(mtpBuffer &to) const { + } + + typedef MTPhelp_Support ResponseType; +}; +class MTPhelp_GetSupport : public MTPBoxed { +public: + MTPhelp_GetSupport() { + } + MTPhelp_GetSupport(const MTPhelp_getSupport &v) : MTPBoxed(v) { + } + MTPhelp_GetSupport(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } }; @@ -17262,6 +18245,10 @@ inline uint32 MTPinputPeer::innerLength() const { const MTPDinputPeerUser &v(c_inputPeerUser()); return v.vuser_id.innerLength() + v.vaccess_hash.innerLength(); } + case mtpc_inputPeerChannel: { + const MTPDinputPeerChannel &v(c_inputPeerChannel()); + return v.vchannel_id.innerLength() + v.vaccess_hash.innerLength(); + } } return 0; } @@ -17285,6 +18272,12 @@ inline void MTPinputPeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTy v.vuser_id.read(from, end); v.vaccess_hash.read(from, end); } break; + case mtpc_inputPeerChannel: _type = cons; { + if (!data) setData(new MTPDinputPeerChannel()); + MTPDinputPeerChannel &v(_inputPeerChannel()); + v.vchannel_id.read(from, end); + v.vaccess_hash.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPinputPeer"); } } @@ -17299,6 +18292,11 @@ inline void MTPinputPeer::write(mtpBuffer &to) const { v.vuser_id.write(to); v.vaccess_hash.write(to); } break; + case mtpc_inputPeerChannel: { + const MTPDinputPeerChannel &v(c_inputPeerChannel()); + v.vchannel_id.write(to); + v.vaccess_hash.write(to); + } break; } } inline MTPinputPeer::MTPinputPeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -17307,6 +18305,7 @@ inline MTPinputPeer::MTPinputPeer(mtpTypeId type) : mtpDataOwner(0), _type(type) case mtpc_inputPeerSelf: break; case mtpc_inputPeerChat: setData(new MTPDinputPeerChat()); break; case mtpc_inputPeerUser: setData(new MTPDinputPeerUser()); break; + case mtpc_inputPeerChannel: setData(new MTPDinputPeerChannel()); break; default: throw mtpErrorBadTypeId(type, "MTPinputPeer"); } } @@ -17314,6 +18313,8 @@ inline MTPinputPeer::MTPinputPeer(MTPDinputPeerChat *_data) : mtpDataOwner(_data } inline MTPinputPeer::MTPinputPeer(MTPDinputPeerUser *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerUser) { } +inline MTPinputPeer::MTPinputPeer(MTPDinputPeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerChannel) { +} inline MTPinputPeer MTP_inputPeerEmpty() { return MTPinputPeer(mtpc_inputPeerEmpty); } @@ -17326,6 +18327,9 @@ inline MTPinputPeer MTP_inputPeerChat(MTPint _chat_id) { inline MTPinputPeer MTP_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash) { return MTPinputPeer(new MTPDinputPeerUser(_user_id, _access_hash)); } +inline MTPinputPeer MTP_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash) { + return MTPinputPeer(new MTPDinputPeerChannel(_channel_id, _access_hash)); +} inline uint32 MTPinputUser::innerLength() const { switch (_type) { @@ -18273,6 +19277,10 @@ inline uint32 MTPpeer::innerLength() const { const MTPDpeerChat &v(c_peerChat()); return v.vchat_id.innerLength(); } + case mtpc_peerChannel: { + const MTPDpeerChannel &v(c_peerChannel()); + return v.vchannel_id.innerLength(); + } } return 0; } @@ -18293,6 +19301,11 @@ inline void MTPpeer::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId MTPDpeerChat &v(_peerChat()); v.vchat_id.read(from, end); } break; + case mtpc_peerChannel: _type = cons; { + if (!data) setData(new MTPDpeerChannel()); + MTPDpeerChannel &v(_peerChannel()); + v.vchannel_id.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPpeer"); } } @@ -18306,12 +19319,17 @@ inline void MTPpeer::write(mtpBuffer &to) const { const MTPDpeerChat &v(c_peerChat()); v.vchat_id.write(to); } break; + case mtpc_peerChannel: { + const MTPDpeerChannel &v(c_peerChannel()); + v.vchannel_id.write(to); + } break; } } inline MTPpeer::MTPpeer(mtpTypeId type) : mtpDataOwner(0), _type(type) { switch (type) { case mtpc_peerUser: setData(new MTPDpeerUser()); break; case mtpc_peerChat: setData(new MTPDpeerChat()); break; + case mtpc_peerChannel: setData(new MTPDpeerChannel()); break; default: throw mtpErrorBadTypeId(type, "MTPpeer"); } } @@ -18319,12 +19337,17 @@ inline MTPpeer::MTPpeer(MTPDpeerUser *_data) : mtpDataOwner(_data), _type(mtpc_p } inline MTPpeer::MTPpeer(MTPDpeerChat *_data) : mtpDataOwner(_data), _type(mtpc_peerChat) { } +inline MTPpeer::MTPpeer(MTPDpeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_peerChannel) { +} inline MTPpeer MTP_peerUser(MTPint _user_id) { return MTPpeer(new MTPDpeerUser(_user_id)); } inline MTPpeer MTP_peerChat(MTPint _chat_id) { return MTPpeer(new MTPDpeerChat(_chat_id)); } +inline MTPpeer MTP_peerChannel(MTPint _channel_id) { + return MTPpeer(new MTPDpeerChannel(_channel_id)); +} inline uint32 MTPstorage_fileType::innerLength() const { return 0; @@ -18702,6 +19725,10 @@ inline uint32 MTPchat::innerLength() const { const MTPDchatForbidden &v(c_chatForbidden()); return v.vid.innerLength() + v.vtitle.innerLength() + v.vdate.innerLength(); } + case mtpc_channel: { + const MTPDchannel &v(c_channel()); + return v.vflags.innerLength() + v.vid.innerLength() + v.vaccess_hash.innerLength() + v.vtitle.innerLength() + v.vphoto.innerLength() + v.vdate.innerLength() + v.vversion.innerLength(); + } } return 0; } @@ -18735,6 +19762,17 @@ inline void MTPchat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId v.vtitle.read(from, end); v.vdate.read(from, end); } break; + case mtpc_channel: _type = cons; { + if (!data) setData(new MTPDchannel()); + MTPDchannel &v(_channel()); + v.vflags.read(from, end); + v.vid.read(from, end); + v.vaccess_hash.read(from, end); + v.vtitle.read(from, end); + v.vphoto.read(from, end); + v.vdate.read(from, end); + v.vversion.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPchat"); } } @@ -18760,6 +19798,16 @@ inline void MTPchat::write(mtpBuffer &to) const { v.vtitle.write(to); v.vdate.write(to); } break; + case mtpc_channel: { + const MTPDchannel &v(c_channel()); + v.vflags.write(to); + v.vid.write(to); + v.vaccess_hash.write(to); + v.vtitle.write(to); + v.vphoto.write(to); + v.vdate.write(to); + v.vversion.write(to); + } break; } } inline MTPchat::MTPchat(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -18767,6 +19815,7 @@ inline MTPchat::MTPchat(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_chatEmpty: setData(new MTPDchatEmpty()); break; case mtpc_chat: setData(new MTPDchat()); break; case mtpc_chatForbidden: setData(new MTPDchatForbidden()); break; + case mtpc_channel: setData(new MTPDchannel()); break; default: throw mtpErrorBadTypeId(type, "MTPchat"); } } @@ -18776,6 +19825,8 @@ inline MTPchat::MTPchat(MTPDchat *_data) : mtpDataOwner(_data), _type(mtpc_chat) } inline MTPchat::MTPchat(MTPDchatForbidden *_data) : mtpDataOwner(_data), _type(mtpc_chatForbidden) { } +inline MTPchat::MTPchat(MTPDchannel *_data) : mtpDataOwner(_data), _type(mtpc_channel) { +} inline MTPchat MTP_chatEmpty(MTPint _id) { return MTPchat(new MTPDchatEmpty(_id)); } @@ -18785,43 +19836,94 @@ inline MTPchat MTP_chat(MTPint _id, const MTPstring &_title, const MTPChatPhoto inline MTPchat MTP_chatForbidden(MTPint _id, const MTPstring &_title, MTPint _date) { return MTPchat(new MTPDchatForbidden(_id, _title, _date)); } - -inline MTPchatFull::MTPchatFull() : mtpDataOwner(new MTPDchatFull()) { +inline MTPchat MTP_channel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _date, MTPint _version) { + return MTPchat(new MTPDchannel(_flags, _id, _access_hash, _title, _photo, _date, _version)); } 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() + v.vexported_invite.innerLength() + v.vbot_info.innerLength(); + switch (_type) { + case mtpc_chatFull: { + const MTPDchatFull &v(c_chatFull()); + return v.vid.innerLength() + v.vparticipants.innerLength() + v.vchat_photo.innerLength() + v.vnotify_settings.innerLength() + v.vexported_invite.innerLength() + v.vbot_info.innerLength(); + } + case mtpc_channelFull: { + const MTPDchannelFull &v(c_channelFull()); + return v.vid.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vunread_important_count.innerLength() + v.vchat_photo.innerLength() + v.vnotify_settings.innerLength() + v.vexported_invite.innerLength(); + } + } + return 0; } inline mtpTypeId MTPchatFull::type() const { - return mtpc_chatFull; + if (!_type) throw mtpErrorUninitialized(); + return _type; } inline void MTPchatFull::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != mtpc_chatFull) throw mtpErrorUnexpected(cons, "MTPchatFull"); - - if (!data) setData(new MTPDchatFull()); - MTPDchatFull &v(_chatFull()); - v.vid.read(from, end); - v.vparticipants.read(from, end); - v.vchat_photo.read(from, end); - v.vnotify_settings.read(from, end); - v.vexported_invite.read(from, end); - v.vbot_info.read(from, end); + if (cons != _type) setData(0); + switch (cons) { + case mtpc_chatFull: _type = cons; { + if (!data) setData(new MTPDchatFull()); + MTPDchatFull &v(_chatFull()); + v.vid.read(from, end); + v.vparticipants.read(from, end); + v.vchat_photo.read(from, end); + v.vnotify_settings.read(from, end); + v.vexported_invite.read(from, end); + v.vbot_info.read(from, end); + } break; + case mtpc_channelFull: _type = cons; { + if (!data) setData(new MTPDchannelFull()); + MTPDchannelFull &v(_channelFull()); + v.vid.read(from, end); + v.vread_inbox_max_id.read(from, end); + v.vunread_count.read(from, end); + v.vunread_important_count.read(from, end); + v.vchat_photo.read(from, end); + v.vnotify_settings.read(from, end); + v.vexported_invite.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPchatFull"); + } } inline void MTPchatFull::write(mtpBuffer &to) const { - const MTPDchatFull &v(c_chatFull()); - v.vid.write(to); - v.vparticipants.write(to); - v.vchat_photo.write(to); - v.vnotify_settings.write(to); - v.vexported_invite.write(to); - v.vbot_info.write(to); + switch (_type) { + case mtpc_chatFull: { + const MTPDchatFull &v(c_chatFull()); + v.vid.write(to); + v.vparticipants.write(to); + v.vchat_photo.write(to); + v.vnotify_settings.write(to); + v.vexported_invite.write(to); + v.vbot_info.write(to); + } break; + case mtpc_channelFull: { + const MTPDchannelFull &v(c_channelFull()); + v.vid.write(to); + v.vread_inbox_max_id.write(to); + v.vunread_count.write(to); + v.vunread_important_count.write(to); + v.vchat_photo.write(to); + v.vnotify_settings.write(to); + v.vexported_invite.write(to); + } break; + } } -inline MTPchatFull::MTPchatFull(MTPDchatFull *_data) : mtpDataOwner(_data) { +inline MTPchatFull::MTPchatFull(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_chatFull: setData(new MTPDchatFull()); break; + case mtpc_channelFull: setData(new MTPDchannelFull()); break; + default: throw mtpErrorBadTypeId(type, "MTPchatFull"); + } +} +inline MTPchatFull::MTPchatFull(MTPDchatFull *_data) : mtpDataOwner(_data), _type(mtpc_chatFull) { +} +inline MTPchatFull::MTPchatFull(MTPDchannelFull *_data) : mtpDataOwner(_data), _type(mtpc_channelFull) { } inline MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info) { return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info)); } +inline MTPchatFull MTP_channelFull(MTPint _id, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite) { + return MTPchatFull(new MTPDchannelFull(_id, _read_inbox_max_id, _unread_count, _unread_important_count, _chat_photo, _notify_settings, _exported_invite)); +} inline MTPchatParticipant::MTPchatParticipant() : mtpDataOwner(new MTPDchatParticipant()) { } @@ -18982,11 +20084,11 @@ inline uint32 MTPmessage::innerLength() const { } case mtpc_message: { const MTPDmessage &v(c_message()); - return v.vflags.innerLength() + v.vid.innerLength() + v.vfrom_id.innerLength() + v.vto_id.innerLength() + (v.has_fwd_from_id() ? v.vfwd_from_id.innerLength() : 0) + (v.has_fwd_date() ? v.vfwd_date.innerLength() : 0) + (v.has_reply_to_msg_id() ? v.vreply_to_msg_id.innerLength() : 0) + v.vdate.innerLength() + v.vmessage.innerLength() + (v.has_media() ? v.vmedia.innerLength() : 0) + (v.has_reply_markup() ? v.vreply_markup.innerLength() : 0) + (v.has_entities() ? v.ventities.innerLength() : 0); + return v.vflags.innerLength() + v.vid.innerLength() + (v.has_from_id() ? v.vfrom_id.innerLength() : 0) + v.vto_id.innerLength() + (v.has_fwd_from_id() ? v.vfwd_from_id.innerLength() : 0) + (v.has_fwd_date() ? v.vfwd_date.innerLength() : 0) + (v.has_reply_to_msg_id() ? v.vreply_to_msg_id.innerLength() : 0) + v.vdate.innerLength() + v.vmessage.innerLength() + (v.has_media() ? v.vmedia.innerLength() : 0) + (v.has_reply_markup() ? v.vreply_markup.innerLength() : 0) + (v.has_entities() ? v.ventities.innerLength() : 0); } case mtpc_messageService: { const MTPDmessageService &v(c_messageService()); - return v.vflags.innerLength() + v.vid.innerLength() + v.vfrom_id.innerLength() + v.vto_id.innerLength() + v.vdate.innerLength() + v.vaction.innerLength(); + return v.vflags.innerLength() + v.vid.innerLength() + (v.has_from_id() ? v.vfrom_id.innerLength() : 0) + v.vto_id.innerLength() + v.vdate.innerLength() + v.vaction.innerLength(); } } return 0; @@ -19008,7 +20110,7 @@ inline void MTPmessage::read(const mtpPrime *&from, const mtpPrime *end, mtpType MTPDmessage &v(_message()); v.vflags.read(from, end); v.vid.read(from, end); - v.vfrom_id.read(from, end); + if (v.has_from_id()) { v.vfrom_id.read(from, end); } else { v.vfrom_id = MTPint(); } v.vto_id.read(from, end); if (v.has_fwd_from_id()) { v.vfwd_from_id.read(from, end); } else { v.vfwd_from_id = MTPint(); } if (v.has_fwd_date()) { v.vfwd_date.read(from, end); } else { v.vfwd_date = MTPint(); } @@ -19024,7 +20126,7 @@ inline void MTPmessage::read(const mtpPrime *&from, const mtpPrime *end, mtpType MTPDmessageService &v(_messageService()); v.vflags.read(from, end); v.vid.read(from, end); - v.vfrom_id.read(from, end); + if (v.has_from_id()) { v.vfrom_id.read(from, end); } else { v.vfrom_id = MTPint(); } v.vto_id.read(from, end); v.vdate.read(from, end); v.vaction.read(from, end); @@ -19042,7 +20144,7 @@ inline void MTPmessage::write(mtpBuffer &to) const { const MTPDmessage &v(c_message()); v.vflags.write(to); v.vid.write(to); - v.vfrom_id.write(to); + if (v.has_from_id()) v.vfrom_id.write(to); v.vto_id.write(to); if (v.has_fwd_from_id()) v.vfwd_from_id.write(to); if (v.has_fwd_date()) v.vfwd_date.write(to); @@ -19057,7 +20159,7 @@ inline void MTPmessage::write(mtpBuffer &to) const { const MTPDmessageService &v(c_messageService()); v.vflags.write(to); v.vid.write(to); - v.vfrom_id.write(to); + if (v.has_from_id()) v.vfrom_id.write(to); v.vto_id.write(to); v.vdate.write(to); v.vaction.write(to); @@ -19319,6 +20421,10 @@ inline uint32 MTPmessageAction::innerLength() const { const MTPDmessageActionChatJoinedByLink &v(c_messageActionChatJoinedByLink()); return v.vinviter_id.innerLength(); } + case mtpc_messageActionChannelCreate: { + const MTPDmessageActionChannelCreate &v(c_messageActionChannelCreate()); + return v.vtitle.innerLength(); + } } return 0; } @@ -19362,6 +20468,11 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m MTPDmessageActionChatJoinedByLink &v(_messageActionChatJoinedByLink()); v.vinviter_id.read(from, end); } break; + case mtpc_messageActionChannelCreate: _type = cons; { + if (!data) setData(new MTPDmessageActionChannelCreate()); + MTPDmessageActionChannelCreate &v(_messageActionChannelCreate()); + v.vtitle.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessageAction"); } } @@ -19392,6 +20503,10 @@ inline void MTPmessageAction::write(mtpBuffer &to) const { const MTPDmessageActionChatJoinedByLink &v(c_messageActionChatJoinedByLink()); v.vinviter_id.write(to); } break; + case mtpc_messageActionChannelCreate: { + const MTPDmessageActionChannelCreate &v(c_messageActionChannelCreate()); + v.vtitle.write(to); + } break; } } inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -19404,6 +20519,7 @@ inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _ty case mtpc_messageActionChatAddUser: setData(new MTPDmessageActionChatAddUser()); break; case mtpc_messageActionChatDeleteUser: setData(new MTPDmessageActionChatDeleteUser()); break; case mtpc_messageActionChatJoinedByLink: setData(new MTPDmessageActionChatJoinedByLink()); break; + case mtpc_messageActionChannelCreate: setData(new MTPDmessageActionChannelCreate()); break; default: throw mtpErrorBadTypeId(type, "MTPmessageAction"); } } @@ -19419,6 +20535,8 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatDeleteUser *_data } inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatJoinedByLink *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChatJoinedByLink) { } +inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelCreate *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChannelCreate) { +} inline MTPmessageAction MTP_messageActionEmpty() { return MTPmessageAction(mtpc_messageActionEmpty); } @@ -19443,41 +20561,94 @@ inline MTPmessageAction MTP_messageActionChatDeleteUser(MTPint _user_id) { inline MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id) { return MTPmessageAction(new MTPDmessageActionChatJoinedByLink(_inviter_id)); } - -inline MTPdialog::MTPdialog() : mtpDataOwner(new MTPDdialog()) { +inline MTPmessageAction MTP_messageActionChannelCreate(const MTPstring &_title) { + return MTPmessageAction(new MTPDmessageActionChannelCreate(_title)); } inline uint32 MTPdialog::innerLength() const { - const MTPDdialog &v(c_dialog()); - return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vnotify_settings.innerLength(); + switch (_type) { + case mtpc_dialog: { + const MTPDdialog &v(c_dialog()); + return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vnotify_settings.innerLength(); + } + case mtpc_dialogChannel: { + const MTPDdialogChannel &v(c_dialogChannel()); + return v.vpeer.innerLength() + v.vtop_message.innerLength() + v.vtop_important_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vunread_important_count.innerLength() + v.vnotify_settings.innerLength() + v.vpts.innerLength(); + } + } + return 0; } inline mtpTypeId MTPdialog::type() const { - return mtpc_dialog; + if (!_type) throw mtpErrorUninitialized(); + return _type; } inline void MTPdialog::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != mtpc_dialog) throw mtpErrorUnexpected(cons, "MTPdialog"); - - if (!data) setData(new MTPDdialog()); - MTPDdialog &v(_dialog()); - v.vpeer.read(from, end); - v.vtop_message.read(from, end); - v.vread_inbox_max_id.read(from, end); - v.vunread_count.read(from, end); - v.vnotify_settings.read(from, end); + if (cons != _type) setData(0); + switch (cons) { + case mtpc_dialog: _type = cons; { + if (!data) setData(new MTPDdialog()); + MTPDdialog &v(_dialog()); + v.vpeer.read(from, end); + v.vtop_message.read(from, end); + v.vread_inbox_max_id.read(from, end); + v.vunread_count.read(from, end); + v.vnotify_settings.read(from, end); + } break; + case mtpc_dialogChannel: _type = cons; { + if (!data) setData(new MTPDdialogChannel()); + MTPDdialogChannel &v(_dialogChannel()); + v.vpeer.read(from, end); + v.vtop_message.read(from, end); + v.vtop_important_message.read(from, end); + v.vread_inbox_max_id.read(from, end); + v.vunread_count.read(from, end); + v.vunread_important_count.read(from, end); + v.vnotify_settings.read(from, end); + v.vpts.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPdialog"); + } } inline void MTPdialog::write(mtpBuffer &to) const { - const MTPDdialog &v(c_dialog()); - v.vpeer.write(to); - v.vtop_message.write(to); - v.vread_inbox_max_id.write(to); - v.vunread_count.write(to); - v.vnotify_settings.write(to); + switch (_type) { + case mtpc_dialog: { + const MTPDdialog &v(c_dialog()); + v.vpeer.write(to); + v.vtop_message.write(to); + v.vread_inbox_max_id.write(to); + v.vunread_count.write(to); + v.vnotify_settings.write(to); + } break; + case mtpc_dialogChannel: { + const MTPDdialogChannel &v(c_dialogChannel()); + v.vpeer.write(to); + v.vtop_message.write(to); + v.vtop_important_message.write(to); + v.vread_inbox_max_id.write(to); + v.vunread_count.write(to); + v.vunread_important_count.write(to); + v.vnotify_settings.write(to); + v.vpts.write(to); + } break; + } } -inline MTPdialog::MTPdialog(MTPDdialog *_data) : mtpDataOwner(_data) { +inline MTPdialog::MTPdialog(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_dialog: setData(new MTPDdialog()); break; + case mtpc_dialogChannel: setData(new MTPDdialogChannel()); break; + default: throw mtpErrorBadTypeId(type, "MTPdialog"); + } +} +inline MTPdialog::MTPdialog(MTPDdialog *_data) : mtpDataOwner(_data), _type(mtpc_dialog) { +} +inline MTPdialog::MTPdialog(MTPDdialogChannel *_data) : mtpDataOwner(_data), _type(mtpc_dialogChannel) { } inline MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { return MTPdialog(new MTPDdialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings)); } +inline MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { + return MTPdialog(new MTPDdialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts)); +} inline uint32 MTPphoto::innerLength() const { switch (_type) { @@ -20702,6 +21873,10 @@ inline uint32 MTPmessages_messages::innerLength() const { const MTPDmessages_messagesSlice &v(c_messages_messagesSlice()); return v.vcount.innerLength() + v.vmessages.innerLength() + v.vchats.innerLength() + v.vusers.innerLength(); } + case mtpc_messages_channelMessages: { + const MTPDmessages_channelMessages &v(c_messages_channelMessages()); + return v.vflags.innerLength() + v.vpts.innerLength() + v.vcount.innerLength() + v.vmessages.innerLength() + (v.has_collapsed() ? v.vcollapsed.innerLength() : 0) + v.vchats.innerLength() + v.vusers.innerLength(); + } } return 0; } @@ -20727,6 +21902,17 @@ inline void MTPmessages_messages::read(const mtpPrime *&from, const mtpPrime *en v.vchats.read(from, end); v.vusers.read(from, end); } break; + case mtpc_messages_channelMessages: _type = cons; { + if (!data) setData(new MTPDmessages_channelMessages()); + MTPDmessages_channelMessages &v(_messages_channelMessages()); + v.vflags.read(from, end); + v.vpts.read(from, end); + v.vcount.read(from, end); + v.vmessages.read(from, end); + if (v.has_collapsed()) { v.vcollapsed.read(from, end); } else { v.vcollapsed = MTPVector(); } + v.vchats.read(from, end); + v.vusers.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessages_messages"); } } @@ -20745,12 +21931,23 @@ inline void MTPmessages_messages::write(mtpBuffer &to) const { v.vchats.write(to); v.vusers.write(to); } break; + case mtpc_messages_channelMessages: { + const MTPDmessages_channelMessages &v(c_messages_channelMessages()); + v.vflags.write(to); + v.vpts.write(to); + v.vcount.write(to); + v.vmessages.write(to); + if (v.has_collapsed()) v.vcollapsed.write(to); + v.vchats.write(to); + v.vusers.write(to); + } break; } } inline MTPmessages_messages::MTPmessages_messages(mtpTypeId type) : mtpDataOwner(0), _type(type) { switch (type) { case mtpc_messages_messages: setData(new MTPDmessages_messages()); break; case mtpc_messages_messagesSlice: setData(new MTPDmessages_messagesSlice()); break; + case mtpc_messages_channelMessages: setData(new MTPDmessages_channelMessages()); break; default: throw mtpErrorBadTypeId(type, "MTPmessages_messages"); } } @@ -20758,12 +21955,17 @@ inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_messages *_data) } inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_messagesSlice *_data) : mtpDataOwner(_data), _type(mtpc_messages_messagesSlice) { } +inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_channelMessages *_data) : mtpDataOwner(_data), _type(mtpc_messages_channelMessages) { +} inline MTPmessages_messages MTP_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { return MTPmessages_messages(new MTPDmessages_messages(_messages, _chats, _users)); } inline MTPmessages_messages MTP_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { return MTPmessages_messages(new MTPDmessages_messagesSlice(_count, _messages, _chats, _users)); } +inline MTPmessages_messages MTP_messages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_messages(new MTPDmessages_channelMessages(_flags, _pts, _count, _messages, _collapsed, _chats, _users)); +} inline MTPmessages_chats::MTPmessages_chats() : mtpDataOwner(new MTPDmessages_chats()) { } @@ -21035,6 +22237,22 @@ inline uint32 MTPupdate::innerLength() const { const MTPDupdateReadMessagesContents &v(c_updateReadMessagesContents()); return v.vmessages.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); } + case mtpc_updateChannelTooLong: { + const MTPDupdateChannelTooLong &v(c_updateChannelTooLong()); + return v.vchannel_id.innerLength(); + } + case mtpc_updateNewChannelMessage: { + const MTPDupdateNewChannelMessage &v(c_updateNewChannelMessage()); + return v.vmessage.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); + } + case mtpc_updateReadChannelInbox: { + const MTPDupdateReadChannelInbox &v(c_updateReadChannelInbox()); + return v.vpeer.innerLength() + v.vmax_id.innerLength(); + } + case mtpc_updateDeleteChannelMessages: { + const MTPDupdateDeleteChannelMessages &v(c_updateDeleteChannelMessages()); + return v.vpeer.innerLength() + v.vmessages.innerLength() + v.vpts.innerLength() + v.vpts_count.innerLength(); + } } return 0; } @@ -21230,6 +22448,32 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vpts.read(from, end); v.vpts_count.read(from, end); } break; + case mtpc_updateChannelTooLong: _type = cons; { + if (!data) setData(new MTPDupdateChannelTooLong()); + MTPDupdateChannelTooLong &v(_updateChannelTooLong()); + v.vchannel_id.read(from, end); + } break; + case mtpc_updateNewChannelMessage: _type = cons; { + if (!data) setData(new MTPDupdateNewChannelMessage()); + MTPDupdateNewChannelMessage &v(_updateNewChannelMessage()); + v.vmessage.read(from, end); + v.vpts.read(from, end); + v.vpts_count.read(from, end); + } break; + case mtpc_updateReadChannelInbox: _type = cons; { + if (!data) setData(new MTPDupdateReadChannelInbox()); + MTPDupdateReadChannelInbox &v(_updateReadChannelInbox()); + v.vpeer.read(from, end); + v.vmax_id.read(from, end); + } break; + case mtpc_updateDeleteChannelMessages: _type = cons; { + if (!data) setData(new MTPDupdateDeleteChannelMessages()); + MTPDupdateDeleteChannelMessages &v(_updateDeleteChannelMessages()); + v.vpeer.read(from, end); + v.vmessages.read(from, end); + v.vpts.read(from, end); + v.vpts_count.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); } } @@ -21392,6 +22636,28 @@ inline void MTPupdate::write(mtpBuffer &to) const { v.vpts.write(to); v.vpts_count.write(to); } break; + case mtpc_updateChannelTooLong: { + const MTPDupdateChannelTooLong &v(c_updateChannelTooLong()); + v.vchannel_id.write(to); + } break; + case mtpc_updateNewChannelMessage: { + const MTPDupdateNewChannelMessage &v(c_updateNewChannelMessage()); + v.vmessage.write(to); + v.vpts.write(to); + v.vpts_count.write(to); + } break; + case mtpc_updateReadChannelInbox: { + const MTPDupdateReadChannelInbox &v(c_updateReadChannelInbox()); + v.vpeer.write(to); + v.vmax_id.write(to); + } break; + case mtpc_updateDeleteChannelMessages: { + const MTPDupdateDeleteChannelMessages &v(c_updateDeleteChannelMessages()); + v.vpeer.write(to); + v.vmessages.write(to); + v.vpts.write(to); + v.vpts_count.write(to); + } break; } } inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -21424,6 +22690,10 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) { case mtpc_updateReadHistoryOutbox: setData(new MTPDupdateReadHistoryOutbox()); break; case mtpc_updateWebPage: setData(new MTPDupdateWebPage()); break; case mtpc_updateReadMessagesContents: setData(new MTPDupdateReadMessagesContents()); break; + case mtpc_updateChannelTooLong: setData(new MTPDupdateChannelTooLong()); break; + case mtpc_updateNewChannelMessage: setData(new MTPDupdateNewChannelMessage()); break; + case mtpc_updateReadChannelInbox: setData(new MTPDupdateReadChannelInbox()); break; + case mtpc_updateDeleteChannelMessages: setData(new MTPDupdateDeleteChannelMessages()); break; default: throw mtpErrorBadTypeId(type, "MTPupdate"); } } @@ -21483,6 +22753,14 @@ inline MTPupdate::MTPupdate(MTPDupdateWebPage *_data) : mtpDataOwner(_data), _ty } inline MTPupdate::MTPupdate(MTPDupdateReadMessagesContents *_data) : mtpDataOwner(_data), _type(mtpc_updateReadMessagesContents) { } +inline MTPupdate::MTPupdate(MTPDupdateChannelTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelTooLong) { +} +inline MTPupdate::MTPupdate(MTPDupdateNewChannelMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateNewChannelMessage) { +} +inline MTPupdate::MTPupdate(MTPDupdateReadChannelInbox *_data) : mtpDataOwner(_data), _type(mtpc_updateReadChannelInbox) { +} +inline MTPupdate::MTPupdate(MTPDupdateDeleteChannelMessages *_data) : mtpDataOwner(_data), _type(mtpc_updateDeleteChannelMessages) { +} inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); } @@ -21567,6 +22845,18 @@ inline MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage) { inline MTPupdate MTP_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateReadMessagesContents(_messages, _pts, _pts_count)); } +inline MTPupdate MTP_updateChannelTooLong(MTPint _channel_id) { + return MTPupdate(new MTPDupdateChannelTooLong(_channel_id)); +} +inline MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateNewChannelMessage(_message, _pts, _pts_count)); +} +inline MTPupdate MTP_updateReadChannelInbox(const MTPPeer &_peer, MTPint _max_id) { + return MTPupdate(new MTPDupdateReadChannelInbox(_peer, _max_id)); +} +inline MTPupdate MTP_updateDeleteChannelMessages(const MTPPeer &_peer, const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateDeleteChannelMessages(_peer, _messages, _pts, _pts_count)); +} inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { } @@ -25151,6 +26441,307 @@ inline MTPmessageEntity MTP_messageEntityTextUrl(MTPint _offset, MTPint _length, return MTPmessageEntity(new MTPDmessageEntityTextUrl(_offset, _length, _url)); } +inline uint32 MTPinputChat::innerLength() const { + switch (_type) { + case mtpc_inputChat: { + const MTPDinputChat &v(c_inputChat()); + return v.vchat_id.innerLength(); + } + case mtpc_inputChannel: { + const MTPDinputChannel &v(c_inputChannel()); + return v.vchannel_id.innerLength() + v.vaccess_hash.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPinputChat::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPinputChat::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_inputChatEmpty: _type = cons; break; + case mtpc_inputChat: _type = cons; { + if (!data) setData(new MTPDinputChat()); + MTPDinputChat &v(_inputChat()); + v.vchat_id.read(from, end); + } break; + case mtpc_inputChannel: _type = cons; { + if (!data) setData(new MTPDinputChannel()); + MTPDinputChannel &v(_inputChannel()); + v.vchannel_id.read(from, end); + v.vaccess_hash.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPinputChat"); + } +} +inline void MTPinputChat::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_inputChat: { + const MTPDinputChat &v(c_inputChat()); + v.vchat_id.write(to); + } break; + case mtpc_inputChannel: { + const MTPDinputChannel &v(c_inputChannel()); + v.vchannel_id.write(to); + v.vaccess_hash.write(to); + } break; + } +} +inline MTPinputChat::MTPinputChat(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_inputChatEmpty: break; + case mtpc_inputChat: setData(new MTPDinputChat()); break; + case mtpc_inputChannel: setData(new MTPDinputChannel()); break; + default: throw mtpErrorBadTypeId(type, "MTPinputChat"); + } +} +inline MTPinputChat::MTPinputChat(MTPDinputChat *_data) : mtpDataOwner(_data), _type(mtpc_inputChat) { +} +inline MTPinputChat::MTPinputChat(MTPDinputChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputChannel) { +} +inline MTPinputChat MTP_inputChatEmpty() { + return MTPinputChat(mtpc_inputChatEmpty); +} +inline MTPinputChat MTP_inputChat(MTPint _chat_id) { + return MTPinputChat(new MTPDinputChat(_chat_id)); +} +inline MTPinputChat MTP_inputChannel(MTPint _channel_id, const MTPlong &_access_hash) { + return MTPinputChat(new MTPDinputChannel(_channel_id, _access_hash)); +} + +inline MTPmessageRange::MTPmessageRange() : mtpDataOwner(new MTPDmessageRange()) { +} + +inline uint32 MTPmessageRange::innerLength() const { + const MTPDmessageRange &v(c_messageRange()); + return v.vmin_id.innerLength() + v.vmax_id.innerLength(); +} +inline mtpTypeId MTPmessageRange::type() const { + return mtpc_messageRange; +} +inline void MTPmessageRange::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != mtpc_messageRange) throw mtpErrorUnexpected(cons, "MTPmessageRange"); + + if (!data) setData(new MTPDmessageRange()); + MTPDmessageRange &v(_messageRange()); + v.vmin_id.read(from, end); + v.vmax_id.read(from, end); +} +inline void MTPmessageRange::write(mtpBuffer &to) const { + const MTPDmessageRange &v(c_messageRange()); + v.vmin_id.write(to); + v.vmax_id.write(to); +} +inline MTPmessageRange::MTPmessageRange(MTPDmessageRange *_data) : mtpDataOwner(_data) { +} +inline MTPmessageRange MTP_messageRange(MTPint _min_id, MTPint _max_id) { + return MTPmessageRange(new MTPDmessageRange(_min_id, _max_id)); +} + +inline MTPmessageGroup::MTPmessageGroup() : mtpDataOwner(new MTPDmessageGroup()) { +} + +inline uint32 MTPmessageGroup::innerLength() const { + const MTPDmessageGroup &v(c_messageGroup()); + return v.vmin_id.innerLength() + v.vmax_id.innerLength() + v.vcount.innerLength() + v.vdate.innerLength(); +} +inline mtpTypeId MTPmessageGroup::type() const { + return mtpc_messageGroup; +} +inline void MTPmessageGroup::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != mtpc_messageGroup) throw mtpErrorUnexpected(cons, "MTPmessageGroup"); + + if (!data) setData(new MTPDmessageGroup()); + MTPDmessageGroup &v(_messageGroup()); + v.vmin_id.read(from, end); + v.vmax_id.read(from, end); + v.vcount.read(from, end); + v.vdate.read(from, end); +} +inline void MTPmessageGroup::write(mtpBuffer &to) const { + const MTPDmessageGroup &v(c_messageGroup()); + v.vmin_id.write(to); + v.vmax_id.write(to); + v.vcount.write(to); + v.vdate.write(to); +} +inline MTPmessageGroup::MTPmessageGroup(MTPDmessageGroup *_data) : mtpDataOwner(_data) { +} +inline MTPmessageGroup MTP_messageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date) { + return MTPmessageGroup(new MTPDmessageGroup(_min_id, _max_id, _count, _date)); +} + +inline uint32 MTPupdates_channelDifference::innerLength() const { + switch (_type) { + case mtpc_updates_channelDifferenceEmpty: { + const MTPDupdates_channelDifferenceEmpty &v(c_updates_channelDifferenceEmpty()); + return v.vflags.innerLength() + v.vpts.innerLength() + (v.has_timeout() ? v.vtimeout.innerLength() : 0); + } + case mtpc_updates_channelDifferenceTooLong: { + const MTPDupdates_channelDifferenceTooLong &v(c_updates_channelDifferenceTooLong()); + return v.vflags.innerLength() + v.vpts.innerLength() + (v.has_timeout() ? v.vtimeout.innerLength() : 0) + v.vtop_message.innerLength() + v.vtop_important_message.innerLength() + v.vread_inbox_max_id.innerLength() + v.vunread_count.innerLength() + v.vunread_important_count.innerLength() + v.vmessages.innerLength() + v.vchats.innerLength() + v.vusers.innerLength(); + } + case mtpc_updates_channelDifference: { + const MTPDupdates_channelDifference &v(c_updates_channelDifference()); + return v.vflags.innerLength() + v.vpts.innerLength() + (v.has_timeout() ? v.vtimeout.innerLength() : 0) + v.vnew_messages.innerLength() + v.vother_updates.innerLength() + v.vchats.innerLength() + v.vusers.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPupdates_channelDifference::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPupdates_channelDifference::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_updates_channelDifferenceEmpty: _type = cons; { + if (!data) setData(new MTPDupdates_channelDifferenceEmpty()); + MTPDupdates_channelDifferenceEmpty &v(_updates_channelDifferenceEmpty()); + v.vflags.read(from, end); + v.vpts.read(from, end); + if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } + } break; + case mtpc_updates_channelDifferenceTooLong: _type = cons; { + if (!data) setData(new MTPDupdates_channelDifferenceTooLong()); + MTPDupdates_channelDifferenceTooLong &v(_updates_channelDifferenceTooLong()); + v.vflags.read(from, end); + v.vpts.read(from, end); + if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } + v.vtop_message.read(from, end); + v.vtop_important_message.read(from, end); + v.vread_inbox_max_id.read(from, end); + v.vunread_count.read(from, end); + v.vunread_important_count.read(from, end); + v.vmessages.read(from, end); + v.vchats.read(from, end); + v.vusers.read(from, end); + } break; + case mtpc_updates_channelDifference: _type = cons; { + if (!data) setData(new MTPDupdates_channelDifference()); + MTPDupdates_channelDifference &v(_updates_channelDifference()); + v.vflags.read(from, end); + v.vpts.read(from, end); + if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } + v.vnew_messages.read(from, end); + v.vother_updates.read(from, end); + v.vchats.read(from, end); + v.vusers.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPupdates_channelDifference"); + } +} +inline void MTPupdates_channelDifference::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_updates_channelDifferenceEmpty: { + const MTPDupdates_channelDifferenceEmpty &v(c_updates_channelDifferenceEmpty()); + v.vflags.write(to); + v.vpts.write(to); + if (v.has_timeout()) v.vtimeout.write(to); + } break; + case mtpc_updates_channelDifferenceTooLong: { + const MTPDupdates_channelDifferenceTooLong &v(c_updates_channelDifferenceTooLong()); + v.vflags.write(to); + v.vpts.write(to); + if (v.has_timeout()) v.vtimeout.write(to); + v.vtop_message.write(to); + v.vtop_important_message.write(to); + v.vread_inbox_max_id.write(to); + v.vunread_count.write(to); + v.vunread_important_count.write(to); + v.vmessages.write(to); + v.vchats.write(to); + v.vusers.write(to); + } break; + case mtpc_updates_channelDifference: { + const MTPDupdates_channelDifference &v(c_updates_channelDifference()); + v.vflags.write(to); + v.vpts.write(to); + if (v.has_timeout()) v.vtimeout.write(to); + v.vnew_messages.write(to); + v.vother_updates.write(to); + v.vchats.write(to); + v.vusers.write(to); + } break; + } +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_updates_channelDifferenceEmpty: setData(new MTPDupdates_channelDifferenceEmpty()); break; + case mtpc_updates_channelDifferenceTooLong: setData(new MTPDupdates_channelDifferenceTooLong()); break; + case mtpc_updates_channelDifference: setData(new MTPDupdates_channelDifference()); break; + default: throw mtpErrorBadTypeId(type, "MTPupdates_channelDifference"); + } +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifferenceEmpty *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifferenceEmpty) { +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifferenceTooLong *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifferenceTooLong) { +} +inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifference *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifference) { +} +inline MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceEmpty(_flags, _pts, _timeout)); +} +inline MTPupdates_channelDifference MTP_updates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceTooLong(_flags, _pts, _timeout, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _messages, _chats, _users)); +} +inline MTPupdates_channelDifference MTP_updates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifference(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users)); +} + +inline uint32 MTPchannelMessagesFilter::innerLength() const { + switch (_type) { + case mtpc_channelMessagesFilter: { + const MTPDchannelMessagesFilter &v(c_channelMessagesFilter()); + return v.vflags.innerLength() + v.vranges.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPchannelMessagesFilter::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPchannelMessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_channelMessagesFilterEmpty: _type = cons; break; + case mtpc_channelMessagesFilter: _type = cons; { + if (!data) setData(new MTPDchannelMessagesFilter()); + MTPDchannelMessagesFilter &v(_channelMessagesFilter()); + v.vflags.read(from, end); + v.vranges.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPchannelMessagesFilter"); + } +} +inline void MTPchannelMessagesFilter::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_channelMessagesFilter: { + const MTPDchannelMessagesFilter &v(c_channelMessagesFilter()); + v.vflags.write(to); + v.vranges.write(to); + } break; + } +} +inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_channelMessagesFilterEmpty: break; + case mtpc_channelMessagesFilter: setData(new MTPDchannelMessagesFilter()); break; + default: throw mtpErrorBadTypeId(type, "MTPchannelMessagesFilter"); + } +} +inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data) : mtpDataOwner(_data), _type(mtpc_channelMessagesFilter) { +} +inline MTPchannelMessagesFilter MTP_channelMessagesFilterEmpty() { + return MTPchannelMessagesFilter(mtpc_channelMessagesFilterEmpty); +} +inline MTPchannelMessagesFilter MTP_channelMessagesFilter(MTPint _flags, const MTPVector &_ranges) { + return MTPchannelMessagesFilter(new MTPDchannelMessagesFilter(_flags, _ranges)); +} + // 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 66803e904..7855bf012 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -133,13 +133,17 @@ null#56730bcc = Null; inputPeerEmpty#7f3b18ea = InputPeer; inputPeerSelf#7da07ec9 = InputPeer; inputPeerChat#179be863 chat_id:int = InputPeer; +inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; +inputPeerChannel#20adaef8 channel_id:int access_hash:long = InputPeer; inputUserEmpty#b98886cf = InputUser; inputUserSelf#f7c1b13f = InputUser; +inputUser#d8292816 user_id:int access_hash:long = InputUser; inputPhoneContact#f392b7f4 client_id:long phone:string first_name:string last_name:string = InputContact; inputFile#f52ff27f id:long parts:int name:string md5_checksum:string = InputFile; +inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; inputMediaEmpty#9664f57f = InputMedia; inputMediaUploadedPhoto#f7aff1c0 file:InputFile caption:string = InputMedia; @@ -149,6 +153,12 @@ inputMediaContact#a6e45987 phone_number:string first_name:string last_name:strin inputMediaUploadedVideo#82713fdf file:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; inputMediaUploadedThumbVideo#7780ddf9 file:InputFile thumb:InputFile duration:int w:int h:int mime_type:string caption:string = InputMedia; inputMediaVideo#936a4ebd id:InputVideo caption:string = InputMedia; +inputMediaUploadedAudio#4e498cab file:InputFile duration:int mime_type:string = InputMedia; +inputMediaAudio#89938781 id:InputAudio = InputMedia; +inputMediaUploadedDocument#ffe76b78 file:InputFile mime_type:string attributes:Vector = InputMedia; +inputMediaUploadedThumbDocument#41481486 file:InputFile thumb:InputFile mime_type:string attributes:Vector = InputMedia; +inputMediaDocument#d184e841 id:InputDocument = InputMedia; +inputMediaVenue#2827a81a geo_point:InputGeoPoint title:string address:string provider:string venue_id:string = InputMedia; inputChatPhotoEmpty#1ca48f57 = InputChatPhoto; inputChatUploadedPhoto#94254732 file:InputFile crop:InputPhotoCrop = InputChatPhoto; @@ -165,6 +175,9 @@ inputVideo#ee579652 id:long access_hash:long = InputVideo; inputFileLocation#14637196 volume_id:long local_id:int secret:long = InputFileLocation; inputVideoFileLocation#3d0364ec id:long access_hash:long = InputFileLocation; +inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; +inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation; +inputDocumentFileLocation#4e45abe9 id:long access_hash:long = InputFileLocation; inputPhotoCropAuto#ade6b004 = InputPhotoCrop; inputPhotoCrop#d9915325 crop_left:double crop_top:double crop_width:double = InputPhotoCrop; @@ -173,6 +186,7 @@ inputAppEvent#770656a8 time:double type:string peer:long data:string = InputAppE peerUser#9db1bc6d user_id:int = Peer; peerChat#bad0e5bb chat_id:int = Peer; +peerChannel#bddde532 channel_id:int = Peer; storage.fileUnknown#aa963b05 = storage.FileType; storage.fileJpeg#7efe0e = storage.FileType; @@ -189,6 +203,7 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation; userEmpty#200250ba id:int = User; +user#22e49072 flags:# id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; @@ -196,12 +211,17 @@ userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileL userStatusEmpty#9d05049 = UserStatus; userStatusOnline#edb93949 expires:int = UserStatus; userStatusOffline#8c703f was_online:int = UserStatus; +userStatusRecently#e26f42f1 = UserStatus; +userStatusLastWeek#7bf09fc = UserStatus; +userStatusLastMonth#77ebc742 = UserStatus; 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; +channel#8dbb1461 flags:# id:int access_hash:long title:string photo:ChatPhoto date:int version:int = Chat; chatFull#2e02a614 id:int participants:ChatParticipants chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:Vector = ChatFull; +channelFull#eb8a0d68 id:int read_inbox_max_id:int unread_count:int unread_important_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite = ChatFull; chatParticipant#c8d7493e user_id:int inviter_id:int date:int = ChatParticipant; @@ -212,8 +232,8 @@ chatPhotoEmpty#37c1011c = ChatPhoto; chatPhoto#6153276a photo_small:FileLocation photo_big:FileLocation = ChatPhoto; messageEmpty#83e5de54 id:int = Message; -message#2bebfa86 flags:# id:int from_id:int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector = Message; -messageService#1d86f70e flags:int id:int from_id:int to_id:Peer date:int action:MessageAction = Message; +message#ab406723 flags:# id:int from_id:flags.8?int to_id:Peer fwd_from_id:flags.2?int fwd_date:flags.2?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector = Message; +messageService#c06b9607 flags:# id:int from_id:flags.8?int to_id:Peer date:int action:MessageAction = Message; messageMediaEmpty#3ded6320 = MessageMedia; messageMediaPhoto#3d8ce53d photo:Photo caption:string = MessageMedia; @@ -221,6 +241,10 @@ 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; +messageMediaDocument#2fda2204 document:Document = MessageMedia; +messageMediaAudio#c6b68300 audio:Audio = MessageMedia; +messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; +messageMediaVenue#7912b71f geo:GeoPoint title:string address:string provider:string venue_id:string = MessageMedia; messageActionEmpty#b6aef7b0 = MessageAction; messageActionChatCreate#a6638b9a title:string users:Vector = MessageAction; @@ -229,8 +253,11 @@ messageActionChatEditPhoto#7fcb13a8 photo:Photo = MessageAction; messageActionChatDeletePhoto#95e3fbef = MessageAction; messageActionChatAddUser#5e3cfc4b user_id:int = MessageAction; messageActionChatDeleteUser#b2ae9b0c user_id:int = MessageAction; +messageActionChatJoinedByLink#f89cf5e8 inviter_id:int = MessageAction; +messageActionChannelCreate#95d2ac92 title:string = MessageAction; dialog#c1dd804a peer:Peer top_message:int read_inbox_max_id:int unread_count:int notify_settings:PeerNotifySettings = Dialog; +dialogChannel#5b8496b2 peer:Peer top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int notify_settings:PeerNotifySettings pts:int = Dialog; photoEmpty#2331b22d id:long = Photo; photo#cded42fe id:long access_hash:long date:int sizes:Vector = Photo; @@ -248,6 +275,7 @@ geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; +auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; auth.authorization#ff036af1 user:User = auth.Authorization; @@ -270,6 +298,7 @@ peerNotifySettingsEmpty#70a68512 = PeerNotifySettings; peerNotifySettings#8d5e11ee mute_until:int sound:string show_previews:Bool events_mask:int = PeerNotifySettings; wallPaper#ccb03657 id:int title:string sizes:Vector color:int = WallPaper; +wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; userFull#5a89ac5b user:User link:contacts.Link profile_photo:Photo notify_settings:PeerNotifySettings blocked:Bool bot_info:BotInfo = UserFull; @@ -300,6 +329,7 @@ messages.dialogsSlice#71e094f3 count:int dialogs:Vector messages:Vector< messages.messages#8c718e87 messages:Vector chats:Vector users:Vector = messages.Messages; messages.messagesSlice#b446ae3 count:int messages:Vector chats:Vector users:Vector = messages.Messages; +messages.channelMessages#bc0f17bc flags:# pts:int count:int messages:Vector collapsed:flags.0?Vector chats:Vector users:Vector = messages.Messages; messages.chats#64ff9fd5 chats:Vector = messages.Chats; @@ -329,6 +359,26 @@ updateUserPhoto#95313b0c user_id:int date:int photo:UserProfilePhoto previous:Bo updateContactRegistered#2575bbb9 user_id:int date:int = Update; updateContactLink#9d2e67c5 user_id:int my_link:ContactLink foreign_link:ContactLink = Update; updateNewAuthorization#8f06529a auth_key_id:long date:int device:string location:string = Update; +updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; +updateEncryptedChatTyping#1710f156 chat_id:int = Update; +updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; +updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; +updateChatParticipantAdd#3a0eeb22 chat_id:int user_id:int inviter_id:int version:int = Update; +updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; +updateDcOptions#8e5e9873 dc_options:Vector = Update; +updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; +updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; +updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update; +updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; +updateUserPhone#12b9417b user_id:int phone:string = Update; +updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; +updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; +updateWebPage#2cc36971 webpage:WebPage = Update; +updateReadMessagesContents#68c13933 messages:Vector pts:int pts_count:int = Update; +updateChannelTooLong#60946422 channel_id:int = Update; +updateNewChannelMessage#62ba04d9 message:Message pts:int pts_count:int = Update; +updateReadChannelInbox#87b87b7d peer:Peer max_id:int = Update; +updateDeleteChannelMessages#11da3046 peer:Peer messages:Vector pts:int pts_count:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -342,6 +392,7 @@ updateShortChatMessage#f9409b3d flags:# id:int from_id:int chat_id:int message:s updateShort#78d4dec1 update:Update date:int = Updates; updatesCombined#725b04c3 updates:Vector users:Vector chats:Vector date:int seq_start:int seq:int = Updates; updates#74ae4240 updates:Vector users:Vector chats:Vector date:int seq:int = Updates; +updateShortSentMessage#11f1331c flags:# id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; photos.photos#8dca6aa5 photos:Vector users:Vector = photos.Photos; photos.photosSlice#15051f54 count:int photos:Vector users:Vector = photos.Photos; @@ -361,13 +412,6 @@ help.noAppUpdate#c45a6536 = help.AppUpdate; help.inviteText#18cb9f78 message:string = help.InviteText; -wallPaperSolid#63117f24 id:int title:string bg_color:int color:int = WallPaper; - -updateNewEncryptedMessage#12bcbd9a message:EncryptedMessage qts:int = Update; -updateEncryptedChatTyping#1710f156 chat_id:int = Update; -updateEncryption#b4a2e88d chat:EncryptedChat date:int = Update; -updateEncryptedMessagesRead#38fe25b7 chat_id:int max_date:int date:int = Update; - encryptedChatEmpty#ab7ec0a0 id:int = EncryptedChat; encryptedChatWaiting#3bf703dc id:int access_hash:long date:int admin_id:int participant_id:int = EncryptedChat; encryptedChatRequested#c878527e id:int access_hash:long date:int admin_id:int participant_id:int g_a:bytes = EncryptedChat; @@ -382,8 +426,7 @@ encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerpri inputEncryptedFileEmpty#1837c364 = InputEncryptedFile; inputEncryptedFileUploaded#64bd0306 id:long parts:int md5_checksum:string key_fingerprint:int = InputEncryptedFile; inputEncryptedFile#5a17b5e5 id:long access_hash:long = InputEncryptedFile; - -inputEncryptedFileLocation#f5235d55 id:long access_hash:long = InputFileLocation; +inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; encryptedMessage#ed18c118 random_id:long chat_id:int date:int bytes:bytes file:EncryptedFile = EncryptedMessage; encryptedMessageService#23734b06 random_id:long chat_id:int date:int bytes:bytes = EncryptedMessage; @@ -394,32 +437,12 @@ messages.dhConfig#2c221edd g:int p:bytes version:int random:bytes = messages.DhC messages.sentEncryptedMessage#560f8935 date:int = messages.SentEncryptedMessage; messages.sentEncryptedFile#9493ff32 date:int file:EncryptedFile = messages.SentEncryptedMessage; -inputFileBig#fa4f0bb5 id:long parts:int name:string = InputFile; - -inputEncryptedFileBigUploaded#2dc173c8 id:long parts:int key_fingerprint:int = InputEncryptedFile; - -updateChatParticipantAdd#3a0eeb22 chat_id:int user_id:int inviter_id:int version:int = Update; -updateChatParticipantDelete#6e5f8c22 chat_id:int user_id:int version:int = Update; -updateDcOptions#8e5e9873 dc_options:Vector = Update; - -inputMediaUploadedAudio#4e498cab file:InputFile duration:int mime_type:string = InputMedia; -inputMediaAudio#89938781 id:InputAudio = InputMedia; -inputMediaUploadedDocument#ffe76b78 file:InputFile mime_type:string attributes:Vector = InputMedia; -inputMediaUploadedThumbDocument#41481486 file:InputFile thumb:InputFile mime_type:string attributes:Vector = InputMedia; -inputMediaDocument#d184e841 id:InputDocument = InputMedia; - -messageMediaDocument#2fda2204 document:Document = MessageMedia; -messageMediaAudio#c6b68300 audio:Audio = MessageMedia; - inputAudioEmpty#d95adc84 = InputAudio; inputAudio#77d440ff id:long access_hash:long = InputAudio; inputDocumentEmpty#72f0eaae = InputDocument; inputDocument#18798952 id:long access_hash:long = InputDocument; -inputAudioFileLocation#74dc404d id:long access_hash:long = InputFileLocation; -inputDocumentFileLocation#4e45abe9 id:long access_hash:long = InputFileLocation; - audioEmpty#586988d8 id:long = Audio; audio#f9e35055 id:long access_hash:long date:int duration:int mime_type:string size:int dc_id:int = Audio; @@ -433,11 +456,6 @@ notifyUsers#b4c83b4c = NotifyPeer; notifyChats#c007cec3 = NotifyPeer; notifyAll#74d07c60 = NotifyPeer; -updateUserBlocked#80ece81a user_id:int blocked:Bool = Update; -updateNotifySettings#bec268ef peer:NotifyPeer notify_settings:PeerNotifySettings = Update; - -auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; - sendMessageTypingAction#16bf744e = SendMessageAction; sendMessageCancelAction#fd5ec8f5 = SendMessageAction; sendMessageRecordVideoAction#a187d66f = SendMessageAction; @@ -453,14 +471,6 @@ contactFound#ea879f95 user_id:int = ContactFound; contacts.found#566000e results:Vector users:Vector = contacts.Found; -updateServiceNotification#382dd3e4 type:string message:string media:MessageMedia popup:Bool = Update; - -userStatusRecently#e26f42f1 = UserStatus; -userStatusLastWeek#7bf09fc = UserStatus; -userStatusLastMonth#77ebc742 = UserStatus; - -updatePrivacy#ee3b272a key:PrivacyKey rules:Vector = Update; - inputPrivacyKeyStatusTimestamp#4f96cb18 = InputPrivacyKey; privacyKeyStatusTimestamp#bc2eab30 = PrivacyKey; @@ -485,8 +495,6 @@ accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; account.sentChangePhoneCode#a4f58c4c phone_code_hash:string send_call_timeout:int = account.SentChangePhoneCode; -updateUserPhone#12b9417b user_id:int phone:string = Update; - documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute; @@ -504,9 +512,6 @@ messages.allStickers#d51dafdb hash:string sets:Vector = messages.All disabledFeature#ae636f24 feature:string description:string = DisabledFeature; -updateReadHistoryInbox#9961fd5c peer:Peer max_id:int pts:int pts_count:int = Update; -updateReadHistoryOutbox#2f2f21bf peer:Peer max_id:int pts:int pts_count:int = Update; - messages.affectedMessages#84d19185 pts:int pts_count:int = messages.AffectedMessages; contactLinkUnknown#5f4f9247 = ContactLink; @@ -514,14 +519,10 @@ contactLinkNone#feedd3ad = ContactLink; contactLinkHasPhone#268f3f59 = ContactLink; contactLinkContact#d502c2d0 = ContactLink; -updateWebPage#2cc36971 webpage:WebPage = Update; - webPageEmpty#eb1477e8 id:long = WebPage; webPagePending#c586da1c id:long date:int = WebPage; webPage#ca820ed7 flags:# id:long url:string display_url:string type:flags.0?string site_name:flags.1?string title:flags.2?string description:flags.3?string photo:flags.4?Photo embed_url:flags.5?string embed_type:flags.5?string embed_width:flags.6?int embed_height:flags.6?int duration:flags.7?int author:flags.8?string document:flags.9?Document = WebPage; -messageMediaWebPage#a32dd600 webpage:WebPage = MessageMedia; - authorization#7bf2e6f6 hash:long flags:int device_model:string platform:string system_version:string api_id:int app_name:string app_version:string date_created:int date_active:int ip:string country:string region:string = Authorization; account.authorizations#1250abde authorizations:Vector = account.Authorizations; @@ -535,10 +536,6 @@ 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; @@ -547,10 +544,6 @@ 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; - inputStickerSetEmpty#ffb62b95 = InputStickerSet; inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet; inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet; @@ -559,8 +552,6 @@ stickerSet#cd303b41 flags:# id:long access_hash:long title:string short_name:str messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; -user#22e49072 flags:# id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int = User; - botCommand#c27ac8c7 command:string description:string = BotCommand; botInfoEmpty#bb2e37ce = BotInfo; @@ -574,10 +565,6 @@ replyKeyboardHide#a03e5b85 flags:# = ReplyMarkup; replyKeyboardForceReply#f4108aa0 flags:# = ReplyMarkup; replyKeyboardMarkup#3502758c flags:# rows:Vector = ReplyMarkup; -inputPeerUser#7b8e7de6 user_id:int access_hash:long = InputPeer; - -inputUser#d8292816 user_id:int access_hash:long = InputUser; - help.appChangelogEmpty#af7e0394 = help.AppChangelog; help.appChangelog#4668e6bd text:string = help.AppChangelog; @@ -593,13 +580,28 @@ messageEntityCode#28a20571 offset:int length:int = MessageEntity; messageEntityPre#73924be0 offset:int length:int language:string = MessageEntity; messageEntityTextUrl#76a6d327 offset:int length:int url:string = MessageEntity; -updateShortSentMessage#11f1331c flags:# id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector = Updates; +inputChatEmpty#d9ff343c = InputChat; +inputChat#43a5b9c3 chat_id:int = InputChat; +inputChannel#30c6ce73 channel_id:int access_hash:long = InputChat; + +messageRange#ae30253 min_id:int max_id:int = MessageRange; + +messageGroup#e8346f53 min_id:int max_id:int count:int date:int = MessageGroup; + +updates.channelDifferenceEmpty#3e11affb flags:# pts:int timeout:flags.1?int = updates.ChannelDifference; +updates.channelDifferenceTooLong#5e167646 flags:# pts:int timeout:flags.1?int top_message:int top_important_message:int read_inbox_max_id:int unread_count:int unread_important_count:int messages:Vector chats:Vector users:Vector = updates.ChannelDifference; +updates.channelDifference#2064674e flags:# pts:int timeout:flags.1?int new_messages:Vector other_updates:Vector chats:Vector users:Vector = updates.ChannelDifference; + +channelMessagesFilterEmpty#94d42ee7 = ChannelMessagesFilter; +channelMessagesFilter#cd77d957 flags:# ranges:Vector = ChannelMessagesFilter; ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; - invokeAfterMsgs#3dc4b4f0 {X:Type} msg_ids:Vector query:!X = X; +initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; +invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; +invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode; @@ -612,6 +614,11 @@ auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; +auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool; +auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; +auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; +auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; +auth.recoverPassword#4ea56e92 code:string = auth.Authorization; account.registerDevice#446c712c token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; @@ -621,6 +628,21 @@ account.resetNotifySettings#db7e1747 = Bool; account.updateProfile#f0888d68 first_name:string last_name:string = User; account.updateStatus#6628562c offline:Bool = Bool; account.getWallPapers#c04cfac2 = Vector; +account.checkUsername#2714d86c username:string = Bool; +account.updateUsername#3e0bdd7c username:string = User; +account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; +account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; +account.deleteAccount#418d4e0b reason:string = Bool; +account.getAccountTTL#8fc711d = AccountDaysTTL; +account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; +account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode; +account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; +account.updateDeviceLocked#38df3532 period:int = Bool; +account.getAuthorizations#e320c158 = account.Authorizations; +account.resetAuthorization#df77f3bc hash:long = Bool; +account.getPassword#548a30f5 = account.Password; +account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; +account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; @@ -636,10 +658,12 @@ contacts.unblock#e54100bd id:InputUser = Bool; contacts.getBlocked#f57c350f offset:int limit:int = contacts.Blocked; contacts.exportCard#84e53737 = Vector; contacts.importCard#4fe196fe export_card:Vector = User; +contacts.search#11f812d8 q:string limit:int = contacts.Found; +contacts.resolveUsername#bf0131c username:string = User; messages.getMessages#4222fa74 id:Vector = messages.Messages; -messages.getDialogs#eccf1df6 offset:int max_id:int limit:int = messages.Dialogs; -messages.getHistory#92a1df2f peer:InputPeer offset:int max_id:int limit:int = messages.Messages; +messages.getDialogs#859b3d3c offset:int limit:int = messages.Dialogs; +messages.getHistory#e1ded325 peer:InputPeer offset:int max_id:int min_id:int limit:int = messages.Messages; messages.search#7e9f2ab peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages; messages.readHistory#b04f2510 peer:InputPeer max_id:int offset:int = messages.AffectedHistory; messages.deleteHistory#f4f8fb61 peer:InputPeer offset:int = messages.AffectedHistory; @@ -649,32 +673,13 @@ messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.sendMedia#c8f16791 flags:# peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; messages.forwardMessages#55e1728d peer:InputPeer id:Vector random_id:Vector = Updates; -messages.getChats#3c6aa187 id:Vector = messages.Chats; -messages.getFullChat#3b831c66 chat_id:int = messages.ChatFull; -messages.editChatTitle#dc452855 chat_id:int title:string = Updates; -messages.editChatPhoto#ca4c79d8 chat_id:int photo:InputChatPhoto = Updates; -messages.addChatUser#f9a0aa09 chat_id:int user_id:InputUser fwd_limit:int = Updates; -messages.deleteChatUser#e0611f16 chat_id:int user_id:InputUser = Updates; +messages.getChats#27ae65b id:Vector = messages.Chats; +messages.getFullChat#36a4dfe chat_id:InputChat = messages.ChatFull; +messages.editChatTitle#6699d506 chat_id:InputChat title:string = Updates; +messages.editChatPhoto#dd75758d chat_id:InputChat photo:InputChatPhoto = Updates; +messages.addChatUser#819183f4 chat_id:InputChat user_id:InputUser fwd_limit:int = Updates; +messages.deleteChatUser#9392c06f chat_id:InputChat user_id:InputUser = Updates; messages.createChat#9cb126e users:Vector title:string = Updates; - -updates.getState#edd4882a = updates.State; -updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; - -photos.updateProfilePhoto#eef579a0 id:InputPhoto crop:InputPhotoCrop = UserProfilePhoto; -photos.uploadProfilePhoto#d50f9c88 file:InputFile caption:string geo_point:InputGeoPoint crop:InputPhotoCrop = photos.Photo; -photos.deletePhotos#87cf7f2f id:Vector = Vector; - -upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; -upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; - -help.getConfig#c4f9186b = Config; -help.getNearestDc#1fb33026 = NearestDc; -help.getAppUpdate#c812ac7e device_model:string system_version:string app_version:string lang_code:string = help.AppUpdate; -help.saveAppLog#6f02f748 events:Vector = Bool; -help.getInviteText#a4a95186 lang_code:string = help.InviteText; - -photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; - messages.forwardMessage#33963bf9 peer:InputPeer id:int random_id:long = Updates; messages.sendBroadcast#bf73f4da contacts:Vector random_id:Vector message:string media:InputMedia = Updates; messages.getDhConfig#26cf8950 version:int random_length:int = messages.DhConfig; @@ -687,62 +692,40 @@ messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:byte messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage; messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage; messages.receivedQueue#55a5bb66 max_qts:int = Vector; - -upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; - -initConnection#69796de9 {X:Type} api_id:int device_model:string system_version:string app_version:string lang_code:string query:!X = X; - -help.getSupport#9cdf08cd = help.Support; - -auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool; - messages.readMessageContents#36a73f77 id:Vector = messages.AffectedMessages; - -account.checkUsername#2714d86c username:string = Bool; -account.updateUsername#3e0bdd7c username:string = User; - -contacts.search#11f812d8 q:string limit:int = contacts.Found; - -account.getPrivacy#dadbc950 key:InputPrivacyKey = account.PrivacyRules; -account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.PrivacyRules; -account.deleteAccount#418d4e0b reason:string = Bool; -account.getAccountTTL#8fc711d = AccountDaysTTL; -account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; - -invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; - -contacts.resolveUsername#bf0131c username:string = User; - -account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode; -account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; - messages.getStickers#ae22e045 emoticon:string hash:string = messages.Stickers; messages.getAllStickers#aa3bc868 hash:string = messages.AllStickers; - -account.updateDeviceLocked#38df3532 period:int = Bool; - -auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; - messages.getWebPagePreview#25223e24 message:string = MessageMedia; - -account.getAuthorizations#e320c158 = account.Authorizations; -account.resetAuthorization#df77f3bc hash:long = Bool; -account.getPassword#548a30f5 = account.Password; -account.getPasswordSettings#bc8d11bb current_password_hash:bytes = account.PasswordSettings; -account.updatePasswordSettings#fa7c4b86 current_password_hash:bytes new_settings:account.PasswordInputSettings = Bool; - -auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; -auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; -auth.recoverPassword#4ea56e92 code:string = auth.Authorization; - -invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; - -messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; +messages.exportChatInvite#c26902ba chat_id:InputChat = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; -messages.startBot#1b3e0ffc bot:InputUser chat_id:int random_id:long start_param:string = Updates; +messages.startBot#f4cc052d bot:InputUser chat_id:InputChat random_id:long start_param:string = Updates; +messages.getChannelDialogs#92689583 offset:int limit:int = messages.Dialogs; +messages.getImportantHistory#25b7f3b2 peer:InputPeer max_id:int min_id:int limit:int = messages.Messages; +messages.readChannelHistory#36a1210e peer:InputPeer max_id:int = Bool; +messages.createChannel#d9bc5fd2 title:string = Updates; +messages.deleteChannelMessages#9995a84f peer:InputPeer id:Vector = messages.AffectedMessages; +updates.getState#edd4882a = updates.State; +updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; +updates.getChannelDifference#248af4f5 peer:InputPeer filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference; + +photos.updateProfilePhoto#eef579a0 id:InputPhoto crop:InputPhotoCrop = UserProfilePhoto; +photos.uploadProfilePhoto#d50f9c88 file:InputFile caption:string geo_point:InputGeoPoint crop:InputPhotoCrop = photos.Photo; +photos.deletePhotos#87cf7f2f id:Vector = Vector; +photos.getUserPhotos#91cd32a8 user_id:InputUser offset:int max_id:long limit:int = photos.Photos; + +upload.saveFilePart#b304a621 file_id:long file_part:int bytes:bytes = Bool; +upload.getFile#e3a6cfb5 location:InputFileLocation offset:int limit:int = upload.File; +upload.saveBigFilePart#de7b673d file_id:long file_part:int file_total_parts:int bytes:bytes = Bool; + +help.getConfig#c4f9186b = Config; +help.getNearestDc#1fb33026 = NearestDc; +help.getAppUpdate#c812ac7e device_model:string system_version:string app_version:string lang_code:string = help.AppUpdate; +help.saveAppLog#6f02f748 events:Vector = Bool; +help.getInviteText#a4a95186 lang_code:string = help.InviteText; +help.getSupport#9cdf08cd = help.Support; help.getAppChangelog#5bab7fb2 device_model:string system_version:string app_version:string lang_code:string = help.AppChangelog; diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 83ecf07e0..be7eae4f8 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -141,6 +141,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const , _peer(App::peer(peer->id)) , _type(type) , _hist(App::history(peer->id)) + , _channel(peerToChannel(peer->id)) , _photosInRow(1) , _photosToAdd(0) , _selMode(false) @@ -398,13 +399,13 @@ bool OverviewInner::itemHasPoint(MsgId msgId, int32 index, int32 x, int32 y) con return true; } } else { - HistoryItem *item = App::histItemById(msgId); + HistoryItem *item = App::histItemById(_channel, msgId); HistoryMedia *media = item ? item->getMedia(true) : 0; if (media) { int32 w = _width - st::msgMargin.left() - st::msgMargin.right(); bool out = item->out(); int32 mw = media->maxWidth(), left = (out ? st::msgMargin.right() : st::msgMargin.left()) + (out && mw < w ? (w - mw) : 0); - if (!out && _hist->peer->chat) { + if (item->displayFromName()) { left += st::msgPhotoSkip; } return media->hasPoint(x - left, y - st::msgMargin.top(), item, w); @@ -912,9 +913,9 @@ void OverviewInner::clear() { _cached.clear(); } -int32 OverviewInner::itemTop(MsgId msgId) const { - if (_type == OverviewAudioDocuments) { - int32 index = _hist->_overview[_type].indexOf(msgId); +int32 OverviewInner::itemTop(const FullMsgId &msgId) const { + if (_type == OverviewAudioDocuments && msgId.channel == _channel) { + int32 index = _hist->_overview[_type].indexOf(msgId.msg); if (index >= 0) { return _addToY + int32(index * _audioHeight); } @@ -1003,7 +1004,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { if (index < 0) continue; if (index >= count) break; - HistoryItem *item = App::histItemById(overview[index]); + HistoryItem *item = App::histItemById(_channel, overview[index]); HistoryMedia *m = item ? item->getMedia(true) : 0; if (!m) continue; @@ -1082,7 +1083,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { for (int32 index = from; index < to; ++index) { if (index >= count) break; - HistoryItem *item = App::histItemById(overview[index]); + HistoryItem *item = App::histItemById(_channel, overview[index]); HistoryMedia *m = item ? item->getMedia(true) : 0; if (!m || m->type() != MediaTypeDocument) continue; @@ -1201,12 +1202,12 @@ void OverviewInner::paintEvent(QPaintEvent *e) { p.translate(0, curY - y); if (_items[i].msgid) { // draw item - HistoryItem *item = App::histItemById(_items[i].msgid); + HistoryItem *item = App::histItemById(_channel, _items[i].msgid); HistoryMedia *media = item ? item->getMedia(true) : 0; if (media) { bool out = item->out(); int32 mw = media->maxWidth(), left = (out ? st::msgMargin.right() : st::msgMargin.left()) + (out && mw < w ? (w - mw) : 0); - if (!out && _hist->peer->chat) { + if (item->displayFromName()) { p.drawPixmap(left, media->countHeight(item, w) - st::msgPhotoSize, item->from()->photo->pixRounded(st::msgPhotoSize)); left += st::msgPhotoSkip; } @@ -1290,7 +1291,7 @@ void OverviewInner::onUpdateSelected() { } if (i >= 0) { MsgId msgid = _hist->_overview[_type][i]; - HistoryItem *histItem = App::histItemById(msgid); + HistoryItem *histItem = App::histItemById(_channel, msgid); if (histItem) { item = histItem; index = i; @@ -1318,7 +1319,7 @@ void OverviewInner::onUpdateSelected() { } if (i >= 0) { MsgId msgid = _hist->_overview[_type][i]; - HistoryItem *histItem = App::histItemById(msgid); + HistoryItem *histItem = App::histItemById(_channel, msgid); if (histItem) { item = histItem; index = i; @@ -1332,7 +1333,7 @@ void OverviewInner::onUpdateSelected() { } } if (newsel != _selectedMsgId) { - if (_selectedMsgId) updateMsg(App::histItemById(_selectedMsgId)); + if (_selectedMsgId) updateMsg(App::histItemById(_channel, _selectedMsgId)); _selectedMsgId = newsel; updateMsg(item); } @@ -1356,7 +1357,7 @@ void OverviewInner::onUpdateSelected() { } } - HistoryItem *histItem = App::histItemById(_items[i].msgid); + HistoryItem *histItem = App::histItemById(_channel, _items[i].msgid); if (histItem) { item = histItem; index = i; @@ -1405,7 +1406,7 @@ void OverviewInner::onUpdateSelected() { } } - HistoryItem *histItem = App::histItemById(_items[i].msgid); + HistoryItem *histItem = App::histItemById(_channel, _items[i].msgid); if (histItem) { item = histItem; index = i; @@ -1413,7 +1414,7 @@ void OverviewInner::onUpdateSelected() { if (media) { bool out = item->out(); int32 mw = media->maxWidth(), left = (out ? st::msgMargin.right() : st::msgMargin.left()) + (out && mw < w ? (w - mw) : 0); - if (!out && _hist->peer->chat) { + if (item->displayFromName()) { if (QRect(left, y + st::msgMargin.top() + media->countHeight(item, w) - st::msgPhotoSize, st::msgPhotoSize, st::msgPhotoSize).contains(m)) { lnk = item->from()->lnk; } @@ -1449,7 +1450,7 @@ void OverviewInner::onUpdateSelected() { } if (lnkIndex != _lnkOverIndex || _mousedItem != oldMousedItem) { lnkChanged = true; - if (oldMousedItem) updateMsg(App::histItemById(oldMousedItem)); + if (oldMousedItem) updateMsg(App::histItemById(_channel, oldMousedItem)); _lnkOverIndex = lnkIndex; if (item) updateMsg(item); QToolTip::hideText(); @@ -1622,7 +1623,7 @@ void OverviewInner::showLinkTip() { QToolTip::showText(_dragPos, url, this, r); } } else if (_cursorState == HistoryInDateCursorState && _dragAction == NoDrag && _mousedItem) { - if (HistoryItem *item = App::histItemById(_mousedItem)) { + if (HistoryItem *item = App::histItemById(_channel, _mousedItem)) { QToolTip::showText(_dragPos, item->date.toString(QLocale::system().dateTimeFormat(QLocale::LongFormat)), this, r); } } @@ -1674,7 +1675,7 @@ void OverviewInner::enterEvent(QEvent *e) { void OverviewInner::leaveEvent(QEvent *e) { if (_selectedMsgId > 0) { - updateMsg(App::histItemById(_selectedMsgId)); + updateMsg(App::histItemById(_channel, _selectedMsgId)); _selectedMsgId = 0; } if (textlnkOver()) { @@ -1707,7 +1708,7 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _menu->deleteLater(); _menu = 0; updateMsg(App::contextItem()); - if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId)); + if (_selectedMsgId > 0) updateMsg(App::histItemById(_channel, _selectedMsgId)); } if (e->reason() == QContextMenuEvent::Mouse) { dragActionUpdate(e->globalPos()); @@ -1776,7 +1777,7 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } App::contextItem(App::hoveredLinkItem()); updateMsg(App::contextItem()); - if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId)); + if (_selectedMsgId > 0) updateMsg(App::histItemById(_channel, _selectedMsgId)); } else if (!ignoreMousedItem && App::mousedItem() && App::mousedItem()->id == _mousedItem) { _contextMenuUrl = _lnkOverIndex ? urlByIndex(_mousedItem, _mousedItemIndex, _lnkOverIndex) : QString(); _menu = new ContextMenu(_overview); @@ -1810,7 +1811,7 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } App::contextItem(App::mousedItem()); updateMsg(App::contextItem()); - if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId)); + if (_selectedMsgId > 0) updateMsg(App::histItemById(_channel, _selectedMsgId)); } if (_menu) { _menu->deleteOnHide(); @@ -2052,7 +2053,7 @@ void OverviewInner::onMenuDestroy(QObject *obj) { _menu = 0; dragActionUpdate(QCursor::pos()); updateMsg(App::contextItem()); - if (_selectedMsgId > 0) updateMsg(App::histItemById(_selectedMsgId)); + if (_selectedMsgId > 0) updateMsg(App::histItemById(_channel, _selectedMsgId)); } } @@ -2083,7 +2084,7 @@ void OverviewInner::fillSelectedItems(SelectedItemSet &sel, bool forDelete) { if (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel) return; for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) { - HistoryItem *item = App::histItemById(i.key()); + HistoryItem *item = App::histItemById(_channel, i.key()); if (dynamic_cast(item) && item->id > 0) { sel.insert(item->id, item); } @@ -2158,7 +2159,7 @@ void OverviewInner::mediaOverviewUpdated(bool fromResize) { } allGood = false; } - HistoryItem *item = App::histItemById(msgid); + HistoryItem *item = App::histItemById(_channel, msgid); QDate date = item->date.date(); if (!in || (in > 0 && date != prevDate)) { @@ -2211,7 +2212,7 @@ void OverviewInner::mediaOverviewUpdated(bool fromResize) { if (_items.size() > in && _items.at(in).msgid == msgid) { prevDate = _items.at(in).date; if (fromResize) { - HistoryItem *item = App::histItemById(msgid); + HistoryItem *item = App::histItemById(_channel, msgid); HistoryMedia *media = item ? item->getMedia(true) : 0; if (media) { y += media->countHeight(item, w) + st::msgMargin.top() + st::msgMargin.bottom(); // item height @@ -2231,7 +2232,7 @@ void OverviewInner::mediaOverviewUpdated(bool fromResize) { ++in; prevDate = _items.at(in).date; if (fromResize) { - HistoryItem *item = App::histItemById(msgid); + HistoryItem *item = App::histItemById(_channel, msgid); HistoryMedia *media = item ? item->getMedia(true) : 0; if (media) { y += media->countHeight(item, w) + st::msgMargin.top() + st::msgMargin.bottom(); // item height @@ -2245,7 +2246,7 @@ void OverviewInner::mediaOverviewUpdated(bool fromResize) { } allGood = false; } - HistoryItem *item = App::histItemById(msgid); + HistoryItem *item = App::histItemById(_channel, msgid); HistoryMedia *media = item ? item->getMedia(true) : 0; if (!media) continue; @@ -2513,7 +2514,7 @@ OverviewWidget::OverviewWidget(QWidget *parent, const PeerData *peer, MediaOverv connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer())); _scrollTimer.setSingleShot(false); - connect(App::main()->player(), SIGNAL(playerSongChanged(MsgId)), this, SLOT(onPlayerSongChanged(MsgId))); + connect(App::main()->player(), SIGNAL(playerSongChanged(const FullMsgId&)), this, SLOT(onPlayerSongChanged(const FullMsgId&))); switchType(type); } @@ -2848,7 +2849,7 @@ void OverviewWidget::onScrollTimer() { _scroll.scrollToY(_scroll.scrollTop() + d); } -void OverviewWidget::onPlayerSongChanged(MsgId msgId) { +void OverviewWidget::onPlayerSongChanged(const FullMsgId &msgId) { if (type() == OverviewAudioDocuments) { // int32 top = _inner.itemTop(msgId); // if (top > 0) { diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index bd7e96c03..6496f7c78 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -28,7 +28,7 @@ public: void activate(); void clear(); - int32 itemTop(MsgId msgId) const; + int32 itemTop(const FullMsgId &msgId) const; bool preloadLocal(); void preloadMore(); @@ -133,6 +133,7 @@ private: PeerData *_peer; MediaOverviewType _type; History *_hist; + ChannelId _channel; // photos int32 _photosInRow, _photosToAdd, _vsize; @@ -319,7 +320,7 @@ public slots: void onScroll(); void onScrollTimer(); - void onPlayerSongChanged(MsgId msgId); + void onPlayerSongChanged(const FullMsgId &msgId); void onForwardSelected(); void onDeleteSelected(); diff --git a/Telegram/SourceFiles/playerwidget.cpp b/Telegram/SourceFiles/playerwidget.cpp index 317ac2e85..b398de20e 100644 --- a/Telegram/SourceFiles/playerwidget.cpp +++ b/Telegram/SourceFiles/playerwidget.cpp @@ -262,21 +262,24 @@ void PlayerWidget::findCurrent() { if (!_history) return; const History::MediaOverview *o = &_history->_overview[OverviewAudioDocuments]; - for (int i = 0, l = o->size(); i < l; ++i) { - if (o->at(i) == _song.msgId) { - _index = i; - break; + if (_history->channelId() == _song.msgId.channel) { + for (int i = 0, l = o->size(); i < l; ++i) { + if (o->at(i) == _song.msgId.msg) { + _index = i; + break; + } } } if (_index < 0) return; if (_index < o->size() - 1) { - if (HistoryItem *next = App::histItemById(o->at(_index + 1))) { + if (HistoryItem *next = App::histItemById(_history->channelId(), o->at(_index + 1))) { if (HistoryDocument *document = static_cast(next->getMedia())) { if (document->document()->already(true).isEmpty() && document->document()->data.isEmpty()) { if (!document->document()->loader) { DocumentOpenLink::doOpen(document->document()); - document->document()->openOnSave = document->document()->openOnSaveMsgId = 0; + document->document()->openOnSave = 0; + document->document()->openOnSaveMsgId = FullMsgId(); } } } @@ -284,10 +287,10 @@ void PlayerWidget::findCurrent() { } } -void PlayerWidget::startPlay(MsgId msgId) { +void PlayerWidget::startPlay(const FullMsgId &msgId) { if (HistoryItem *item = App::histItemById(msgId)) { if (HistoryDocument *doc = static_cast(item->getMedia())) { - audioPlayer()->play(SongMsgId(doc->document(), item->id)); + audioPlayer()->play(SongMsgId(doc->document(), item->fullId())); updateState(); } } @@ -303,10 +306,12 @@ void PlayerWidget::clearSelection() { void PlayerWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) { if (_history && _history->peer == peer && type == OverviewAudioDocuments) { _index = -1; - for (int i = 0, l = _history->_overview[OverviewAudioDocuments].size(); i < l; ++i) { - if (_history->_overview[OverviewAudioDocuments].at(i) == _song.msgId) { - _index = i; - break; + if (_history->channelId() == _song.msgId.channel) { + for (int i = 0, l = _history->_overview[OverviewAudioDocuments].size(); i < l; ++i) { + if (_history->_overview[OverviewAudioDocuments].at(i) == _song.msgId.msg) { + _index = i; + break; + } } } updateControls(); @@ -461,7 +466,7 @@ void PlayerWidget::prevPressed() { const History::MediaOverview *o = _history ? &_history->_overview[OverviewAudioDocuments] : 0; if (audioPlayer() && o && _index > 0 && _index <= o->size() && !o->isEmpty()) { - startPlay(o->at(_index - 1)); + startPlay(FullMsgId(_history->channelId(), o->at(_index - 1))); } } @@ -470,7 +475,7 @@ void PlayerWidget::nextPressed() { const History::MediaOverview *o = _history ? &_history->_overview[OverviewAudioDocuments] : 0; if (audioPlayer() && o && _index >= 0 && _index < o->size() - 1) { - startPlay(o->at(_index + 1)); + startPlay(FullMsgId(_history->channelId(), o->at(_index + 1))); } } diff --git a/Telegram/SourceFiles/playerwidget.h b/Telegram/SourceFiles/playerwidget.h index 7e6095287..9c07f0161 100644 --- a/Telegram/SourceFiles/playerwidget.h +++ b/Telegram/SourceFiles/playerwidget.h @@ -53,7 +53,7 @@ public: signals: - void playerSongChanged(MsgId msgId); + void playerSongChanged(const FullMsgId &msgId); private: @@ -77,7 +77,7 @@ private: void updateControls(); void findCurrent(); - void startPlay(MsgId msgId); + void startPlay(const FullMsgId &msgId); QPoint _lastMousePos; void updateSelected(); diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 023b71e40..590dd5925 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const PeerData *peer) : TWidget(0), _profile(profile), _scroll(scroll), _peer(App::peer(peer->id)), - _peerUser(_peer->chat ? 0 : _peer->asUser()), _peerChat(_peer->chat ? _peer->asChat() : 0), _hist(App::history(peer->id)), + _peerUser(_peer->asUser()), _peerChat(_peer->asChat()), _peerChannel(_peer->asChannel()), _hist(App::history(peer->id)), _chatAdmin(_peerChat ? (_peerChat->admin == MTP::authedId()) : false), // profile @@ -63,7 +63,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee // actions _searchInPeer(this, lang(lng_profile_search_messages)), _clearHistory(this, lang(lng_profile_clear_history)), - _deleteConversation(this, lang(_peer->chat ? lng_profile_clear_and_exit : lng_profile_delete_conversation)), + _deleteConversation(this, lang(_peer->isUser() ? lng_profile_delete_conversation : lng_profile_clear_and_exit)), _wasBlocked(_peerUser ? _peerUser->blocked : UserBlockUnknown), _blockRequest(0), _blockUser(this, lang((_peerUser && _peerUser->botInfo) ? lng_profile_block_bot : lng_profile_block_user), st::btnRedLink), @@ -82,7 +82,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee if (_peerUser->blocked == UserIsBlocked) { _blockUser.setText(lang(_peerUser->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user)); } - _phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(App::userFromPeer(_peerUser->id)) : _peerUser->phone); + _phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(peerToUser(_peerUser->id)) : _peerUser->phone); PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0; if (userPhoto && userPhoto->date) { _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer)); @@ -255,7 +255,7 @@ void ProfileInner::onUpdatePhoto() { } void ProfileInner::onClearHistory() { - ConfirmBox *box = new ConfirmBox(_peer->chat ? lng_sure_delete_group_history(lt_group, _peer->name) : lng_sure_delete_history(lt_contact, _peer->name)); + ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : lng_sure_delete_group_history(lt_group, _peer->name)); connect(box, SIGNAL(confirmed()), this, SLOT(onClearHistorySure())); App::wnd()->showLayer(box); } @@ -266,18 +266,19 @@ void ProfileInner::onClearHistorySure() { } void ProfileInner::onDeleteConversation() { - ConfirmBox *box = new ConfirmBox(_peer->chat ? lng_sure_delete_and_exit(lt_group, _peer->name) : lng_sure_delete_history(lt_contact, _peer->name)); + ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : lng_sure_delete_and_exit(lt_group, _peer->name)); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteConversationSure())); App::wnd()->showLayer(box); } void ProfileInner::onDeleteConversationSure() { - if (_peer->chat) { + if (_peerUser) { + App::main()->deleteConversation(_peer); + } else if (_peerChat) { App::wnd()->hideLayer(); App::main()->showDialogs(); - MTP::send(MTPmessages_DeleteChatUser(MTP_int(_peer->id & 0xFFFFFFFF), App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _peer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _peer)); - } else { - App::main()->deleteConversation(_peer); + MTP::send(MTPmessages_DeleteChatUser(_peerChat->inputChat, App::self()->inputUser), App::main()->rpcDone(&MainWidget::deleteHistoryAfterLeave, _peer), App::main()->rpcFail(&MainWidget::leaveChatFailed, _peer)); + } else if (_peerChannel) { // CHANNELS_UX } } @@ -370,7 +371,8 @@ void ProfileInner::onCreateInvitationLink() { } void ProfileInner::onCreateInvitationLinkSure() { - MTP::send(MTPmessages_ExportChatInvite(App::peerToMTP(_peerChat->id).c_peerChat().vchat_id), rpcDone(&ProfileInner::chatInviteDone)); + if (!_peerChat) return; + MTP::send(MTPmessages_ExportChatInvite(_peerChat->inputChat), rpcDone(&ProfileInner::chatInviteDone)); } void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) { @@ -434,7 +436,7 @@ void ProfileInner::peerUpdated(PeerData *data) { if (data == _peer) { PhotoData *photo = 0; if (_peerUser) { - _phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(App::userFromPeer(_peerUser->id)) : _peerUser->phone); + _phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(peerToUser(_peerUser->id)) : _peerUser->phone); if (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) photo = App::photo(_peerUser->photoId); if (_wasBlocked != _peerUser->blocked) { _wasBlocked = _peerUser->blocked; @@ -673,7 +675,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { top += st::profileHeaderSkip; top += _searchInPeer.height() + st::setLittleSkip + _clearHistory.height() + st::setLittleSkip + _deleteConversation.height(); - if (_peerUser && App::userFromPeer(_peerUser->id) != MTP::authedId()) top += st::setSectionSkip + _blockUser.height(); + if (_peerUser && peerToUser(_peerUser->id) != MTP::authedId()) top += st::setSectionSkip + _blockUser.height(); // participants if (_peerChat && (_peerChat->count > 0 || !_participants.isEmpty())) { @@ -944,7 +946,7 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { _searchInPeer.move(_left, top); top += _searchInPeer.height() + st::setLittleSkip; _clearHistory.move(_left, top); top += _clearHistory.height() + st::setLittleSkip; _deleteConversation.move(_left, top); top += _deleteConversation.height(); - if (_peerUser && App::userFromPeer(_peerUser->id) != MTP::authedId()) { + if (_peerUser && peerToUser(_peerUser->id) != MTP::authedId()) { top += st::setSectionSkip; _blockUser.move(_left, top); top += _blockUser.height(); } @@ -1102,7 +1104,7 @@ void ProfileInner::showAll() { _inviteToGroup.hide(); } _clearHistory.show(); - if (App::userFromPeer(_peerUser->id) != MTP::authedId()) { + if (peerToUser(_peerUser->id) != MTP::authedId()) { _blockUser.show(); } else { _blockUser.hide(); @@ -1151,7 +1153,7 @@ void ProfileInner::showAll() { reorderParticipants(); int32 h; if (_peerUser) { - if (App::userFromPeer(_peerUser->id) == MTP::authedId()) { + if (peerToUser(_peerUser->id) == MTP::authedId()) { h = _deleteConversation.y() + _deleteConversation.height() + st::profileHeaderSkip; } else { h = _blockUser.y() + _blockUser.height() + st::profileHeaderSkip; @@ -1269,7 +1271,7 @@ void ProfileWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth) p.drawPixmap(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.pxHeight()) / 2), App::sprite(), st::topBarBackImg); p.setFont(st::topBarBackFont->f); p.setPen(st::topBarBackColor->p); - p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.pxWidth() + st::topBarBackPadding.right(), (st::topBarHeight - st::topBarBackFont->height) / 2 + st::topBarBackFont->ascent, lang(peer()->chat ? lng_profile_group_info : lng_profile_info)); + p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.pxWidth() + st::topBarBackPadding.right(), (st::topBarHeight - st::topBarBackFont->height) / 2 + st::topBarBackFont->ascent, lang(peer()->isUser() ? lng_profile_info : lng_profile_group_info)); } } @@ -1362,7 +1364,7 @@ void ProfileWidget::mediaOverviewUpdated(PeerData *peer, MediaOverviewType type) } void ProfileWidget::clear() { - if (_inner.peer() && !_inner.peer()->chat && _inner.peer()->asUser()->botInfo) { + if (_inner.peer() && _inner.peer()->isUser() && _inner.peer()->asUser()->botInfo) { _inner.peer()->asUser()->botInfo->startGroupToken = QString(); } } diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index 4c2d2ef18..91493bd3e 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -121,6 +121,7 @@ private: PeerData *_peer; UserData *_peerUser; ChatData *_peerChat; + ChannelData *_peerChannel; History *_hist; bool _chatAdmin; diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 68e982f3b..6863af5ea 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -71,7 +71,7 @@ void MacPrivate::notifyClicked(unsigned long long peer, int msgid) { App::wnd()->hideSettings(); bool tomsg = history->peer->chat && (msgid > 0); if (tomsg) { - HistoryItem *item = App::histItemById(msgid); + HistoryItem *item = App::histItemById(peerToChannel(PeerId(peer)), MsgId(msgid)); if (!item || !item->notifyByFrom()) { tomsg = false; } diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index 3cba849fe..ef5246453 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -2569,7 +2569,8 @@ typedef ABI::Windows::Foundation::ITypedEventHandler { public: - ToastEventHandler::ToastEventHandler(uint64 peer, int32 msg) : _ref(1), _peerId(peer), _msgId(msg) { + + ToastEventHandler::ToastEventHandler(const PeerId &peer, MsgId msg) : _ref(1), _peerId(peer), _msgId(msg) { } ~ToastEventHandler() { } @@ -2584,7 +2585,7 @@ public: } } if (App::wnd()) { - History *history = App::history(PeerId(_peerId)); + History *history = App::history(_peerId); App::wnd()->showFromTray(); if (App::passcoded()) { @@ -2592,9 +2593,9 @@ public: App::wnd()->notifyClear(); } else { App::wnd()->hideSettings(); - bool tomsg = history->peer->chat && (_msgId > 0); + bool tomsg = !history->peer->isUser() && (_msgId > 0); if (tomsg) { - HistoryItem *item = App::histItemById(_msgId); + HistoryItem *item = App::histItemById(peerToChannel(_peerId), _msgId); if (!item || !item->notifyByFrom()) { tomsg = false; } @@ -2673,9 +2674,10 @@ public: } private: + ULONG _ref; - uint64 _peerId; - int32 _msgId; + PeerId _peerId; + MsgId _msgId; }; template @@ -2708,7 +2710,7 @@ QString toastImage(const StorageKey &key, PeerData *peer) { if (peer->photo->loaded() && (key.first || key.second)) { peer->photo->pix().save(v.path, "PNG"); } else if (!key.first && key.second) { - (peer->chat ? chatDefPhoto : userDefPhoto)(peer->colorIndex)->pix().save(v.path, "PNG"); + (peer->isUser() ? userDefPhoto : chatDefPhoto)(peer->colorIndex)->pix().save(v.path, "PNG"); } else { App::wnd()->iconLarge().save(v.path, "PNG"); } @@ -2734,7 +2736,7 @@ bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title QString imagePath; if (showpix) { if (peer->photoLoc.isNull() || !peer->photo->loaded()) { - key = StorageKey(0, (peer->chat ? 0x2000 : 0x1000) | peer->colorIndex); + key = StorageKey(0, (peer->isUser() ? 0x1000 : 0x2000) | peer->colorIndex); } else { key = storageKey(peer->photoLoc); } diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 584b3314e..b6ea1a3ea 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -31,18 +31,14 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org namespace { int32 peerColorIndex(const PeerId &peer) { - int32 myId(MTP::authedId()), peerId(peer & 0xFFFFFFFFL); - bool chat = (peer & 0x100000000L); - if (chat) { - int ch = 0; - } + int32 myId(MTP::authedId()), peerId(peerToBareInt(peer)); QByteArray both(qsl("%1%2").arg(peerId).arg(myId).toUtf8()); if (both.size() > 15) { both = both.mid(0, 15); } uchar md5[16]; hashMd5(both.constData(), both.size(), md5); - return (md5[peerId & 0x0F] & (chat ? 0x03 : 0x07)); + return (md5[peerId & 0x0F] & (peerIsUser(peer) ? 0x07 : 0x03)); } } @@ -89,39 +85,23 @@ NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersP PeerData::PeerData(const PeerId &id) : id(id) , loaded(false) -, chat(App::isChat(id)) , colorIndex(peerColorIndex(id)) , color(peerColor(colorIndex)) -, photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)) +, photo((isChat() || isChannel()) ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)) , photoId(UnknownPeerPhotoId) , nameVersion(0) , notify(UnknownNotifySettings) { } -UserData *PeerData::asUser() { - return chat ? App::user(id & 0xFFFFFFFFL) : static_cast(this); -} - -const UserData *PeerData::asUser() const { - return chat ? App::user(id & 0xFFFFFFFFL) : static_cast(this); -} - -ChatData *PeerData::asChat() { - return chat ? static_cast(this) : App::chat(id | 0x100000000L); -} - -const ChatData *PeerData::asChat() const { - return chat ? static_cast(this) : App::chat(id | 0x100000000L); -} - void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, const QString &newUsername) { - if (name == newName && nameOrPhone == newNameOrPhone && (chat || asUser()->username == newUsername) && nameVersion > 0) return; + if (name == newName && nameOrPhone == newNameOrPhone && (!isUser() || asUser()->username == newUsername) && nameVersion > 0) return; ++nameVersion; name = newName; nameOrPhone = newNameOrPhone; - if (!chat) asUser()->username = newUsername; + if (isUser()) asUser()->username = newUsername; + Names oldNames = names; NameFirstChars oldChars = chars; fillNames(); @@ -142,7 +122,7 @@ void UserData::setPhoto(const MTPUserProfilePhoto &p) { // see Local::readPeer a newPhotoId = d.vphoto_id.v; newPhotoLoc = App::imageLocation(160, 160, d.vphoto_small); newPhoto = newPhotoLoc.isNull() ? userDefPhoto(colorIndex) : ImagePtr(newPhotoLoc); - //App::feedPhoto(App::photoFromUserPhoto(MTP_int(id & 0xFFFFFFFF), MTP_int(unixtime()), p)); + //App::feedPhoto(App::photoFromUserPhoto(peerToUser(id), MTP_int(unixtime()), p)); } break; default: { newPhotoId = 0; @@ -171,7 +151,7 @@ void PeerData::fillNames() { if (nameOrPhone != name) { toIndex += ' ' + textAccentFold(nameOrPhone); } - if (!chat) { + if (isUser()) { toIndex += ' ' + textAccentFold(asUser()->username); } if (cRussianLetters().match(toIndex).hasMatch()) { @@ -242,7 +222,7 @@ void UserData::setBotInfo(const MTPBotInfo &info) { break; case mtpc_botInfo: { const MTPDbotInfo &d(info.c_botInfo()); - if (App::peerFromUser(d.vuser_id.v) != id) return; + if (peerFromUser(d.vuser_id.v) != id) return; if (botInfo) { botInfo->version = d.vversion.v; @@ -339,6 +319,35 @@ void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Loc } } +void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Local::readPeer as well + PhotoId newPhotoId = photoId; + ImagePtr newPhoto = photo; + StorageImageLocation newPhotoLoc = photoLoc; + switch (p.type()) { + case mtpc_chatPhoto: { + const MTPDchatPhoto d(p.c_chatPhoto()); + if (phId != UnknownPeerPhotoId) { + newPhotoId = phId; + } + newPhotoLoc = App::imageLocation(160, 160, d.vphoto_small); + newPhoto = newPhotoLoc.isNull() ? chatDefPhoto(colorIndex) : ImagePtr(newPhotoLoc); +// photoFull = ImagePtr(640, 640, d.vphoto_big, chatDefPhoto(colorIndex)); + } break; + default: { + newPhotoId = 0; + newPhotoLoc = StorageImageLocation(); + newPhoto = chatDefPhoto(colorIndex); +// photoFull = ImagePtr(); + } break; + } + if (newPhotoId != photoId || newPhoto.v() != photo.v() || newPhotoLoc != photoLoc) { + photoId = newPhotoId; + photo = newPhoto; + photoLoc = newPhotoLoc; + emit App::main()->peerPhotoChanged(this); + } +} + void PhotoLink::onClick(Qt::MouseButton button) const { if (button == Qt::LeftButton) { App::wnd()->showPhoto(this, App::hoveredLinkItem()); @@ -418,7 +427,7 @@ void VideoOpenLink::onClick(Qt::MouseButton button) const { QString filename = saveFileName(lang(lng_save_video), qsl("MOV Video (*.mov);;All files (*.*)"), qsl("video"), qsl(".mov"), false); if (!filename.isEmpty()) { data->openOnSave = 1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : (App::contextItem() ? App::contextItem()->id : 0); + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); data->save(filename); } } @@ -442,7 +451,7 @@ void VideoSaveLink::doSave(VideoData *data, bool forceSavingAs) { data->cancel(); } else if (!already.isEmpty()) { data->openOnSave = -1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : 0; + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : FullMsgId(); } data->save(filename); } @@ -462,7 +471,7 @@ void VideoCancelLink::onClick(Qt::MouseButton button) const { } VideoData::VideoData(const VideoId &id, const uint64 &access, int32 date, int32 duration, int32 w, int32 h, const ImagePtr &thumb, int32 dc, int32 size) : -id(id), access(access), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), fileType(0), openOnSave(0), openOnSaveMsgId(0), loader(0) { +id(id), access(access), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), fileType(0), openOnSave(0), loader(0) { location = Local::readFileLocation(mediaKey(VideoFileLocation, dc, id)); } @@ -491,10 +500,10 @@ void AudioOpenLink::onClick(Qt::MouseButton button) const { AudioMsgId playing; AudioPlayerState playingState = AudioPlayerStopped; audioPlayer()->currentState(&playing, &playingState); - if (playing.msgId == App::hoveredLinkItem()->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == App::hoveredLinkItem()->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { audioPlayer()->pauseresume(OverviewAudios); } else { - audioPlayer()->play(AudioMsgId(data, App::hoveredLinkItem()->id)); + audioPlayer()->play(AudioMsgId(data, App::hoveredLinkItem()->fullId())); if (App::main()) App::main()->audioMarkRead(data); } } else { @@ -510,7 +519,7 @@ void AudioOpenLink::onClick(Qt::MouseButton button) const { QString filename = saveFileName(lang(lng_save_audio), mp3 ? qsl("MP3 Audio (*.mp3);;All files (*.*)") : qsl("OGG Opus Audio (*.ogg);;All files (*.*)"), qsl("audio"), mp3 ? qsl(".mp3") : qsl(".ogg"), false); if (!filename.isEmpty()) { data->openOnSave = 1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : (App::contextItem() ? App::contextItem()->id : 0); + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); data->save(filename); } } @@ -535,7 +544,7 @@ void AudioSaveLink::doSave(AudioData *data, bool forceSavingAs) { data->cancel(); } else if (!already.isEmpty()) { data->openOnSave = -1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : (App::contextItem() ? App::contextItem()->id : 0); + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); } data->save(filename); } @@ -570,7 +579,7 @@ bool StickerData::setInstalled() const { } AudioData::AudioData(const AudioId &id, const uint64 &access, int32 date, const QString &mime, int32 duration, int32 dc, int32 size) : -id(id), access(access), date(date), mime(mime), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0) { +id(id), access(access), date(date), mime(mime), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0) { location = Local::readFileLocation(mediaKey(AudioFileLocation, dc, id)); } @@ -598,10 +607,10 @@ void DocumentOpenLink::doOpen(DocumentData *data) { SongMsgId playing; AudioPlayerState playingState = AudioPlayerStopped; audioPlayer()->currentState(&playing, &playingState); - if (playing.msgId == App::hoveredLinkItem()->id && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { + if (playing.msgId == App::hoveredLinkItem()->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { audioPlayer()->pauseresume(OverviewDocuments); } else { - SongMsgId song(data, App::hoveredLinkItem()->id); + SongMsgId song(data, App::hoveredLinkItem()->fullId()); audioPlayer()->play(song); if (App::main()) App::main()->documentPlayProgress(song); } @@ -643,7 +652,7 @@ void DocumentOpenLink::doOpen(DocumentData *data) { QString filename = saveFileName(lang(lng_save_file), filter, qsl("doc"), name, false); if (!filename.isEmpty()) { data->openOnSave = 1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : (App::contextItem() ? App::contextItem()->id : 0); + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); data->save(filename); } } @@ -685,7 +694,7 @@ void DocumentSaveLink::doSave(DocumentData *data, bool forceSavingAs) { data->cancel(); } else if (!already.isEmpty()) { data->openOnSave = -1; - data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->id : (App::contextItem() ? App::contextItem()->id : 0); + data->openOnSaveMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); } data->save(filename); } @@ -705,7 +714,7 @@ void DocumentCancelLink::onClick(Qt::MouseButton button) const { } DocumentData::DocumentData(const DocumentId &id, const uint64 &access, int32 date, const QVector &attributes, const QString &mime, const ImagePtr &thumb, int32 dc, int32 size) : -id(id), type(FileDocument), access(access), date(date), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), openOnSaveMsgId(0), loader(0), _additional(0) { +id(id), type(FileDocument), access(access), date(date), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0), _additional(0) { setattributes(attributes); location = Local::readFileLocation(mediaKey(DocumentFileLocation, dc, id)); } diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 32efe1053..b4191f0ab 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -17,13 +17,98 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once +typedef int32 ChannelId; +static const ChannelId NoChannel = 0; + typedef uint64 PeerId; +static const uint64 PeerIdMask = 0xFFFFFFFFULL; +static const uint64 PeerIdTypeMask = 0x300000000ULL; +static const uint64 PeerIdUserShift = 0x000000000ULL; +static const uint64 PeerIdChatShift = 0x100000000ULL; +static const uint64 PeerIdChannelShift = 0x200000000ULL; +inline bool peerIsUser(const PeerId &id) { + return (id & PeerIdTypeMask) == PeerIdUserShift; +} +inline bool peerIsChat(const PeerId &id) { + return (id & PeerIdTypeMask) == PeerIdChatShift; +} +inline bool peerIsChannel(const PeerId &id) { + return (id & PeerIdTypeMask) == PeerIdChannelShift; +} +inline PeerId peerFromUser(int32 user_id) { + return PeerIdUserShift | uint64(uint32(user_id)); +} +inline PeerId peerFromChat(int32 chat_id) { + return PeerIdChatShift | uint64(uint32(chat_id)); +} +inline PeerId peerFromChannel(ChannelId channel_id) { + return PeerIdChannelShift | uint64(uint32(channel_id)); +} +inline PeerId peerFromUser(const MTPint &user_id) { + return peerFromUser(user_id.v); +} +inline PeerId peerFromChat(const MTPint &chat_id) { + return peerFromChat(chat_id.v); +} +inline PeerId peerFromChannel(const MTPint &channel_id) { + return peerFromChannel(channel_id.v); +} +inline int32 peerToBareInt(const PeerId &id) { + return int32(uint32(id & PeerIdMask)); +} +inline int32 peerToUser(const PeerId &id) { + return peerIsUser(id) ? peerToBareInt(id) : 0; +} +inline int32 peerToChat(const PeerId &id) { + return peerIsChat(id) ? peerToBareInt(id) : 0; +} +inline ChannelId peerToChannel(const PeerId &id) { + return peerIsChannel(id) ? peerToBareInt(id) : NoChannel; +} +inline MTPint peerToBareMTPInt(const PeerId &id) { + return MTP_int(peerToBareInt(id)); +} +inline PeerId peerFromMTP(const MTPPeer &peer) { + switch (peer.type()) { + case mtpc_peerUser: return peerFromUser(peer.c_peerUser().vuser_id); + case mtpc_peerChat: return peerFromChat(peer.c_peerChat().vchat_id); + case mtpc_peerChannel: return peerFromChannel(peer.c_peerChannel().vchannel_id); + } + return 0; +} +inline MTPpeer peerToMTP(const PeerId &id) { + if (peerIsUser(id)) { + return MTP_peerUser(peerToBareMTPInt(id)); + } else if (peerIsChat(id)) { + return MTP_peerChat(peerToBareMTPInt(id)); + } else if (peerIsChannel(id)) { + return MTP_peerChannel(peerToBareMTPInt(id)); + } + return MTP_peerUser(MTP_int(0)); +} + typedef uint64 PhotoId; typedef uint64 VideoId; typedef uint64 AudioId; typedef uint64 DocumentId; typedef uint64 WebPageId; typedef int32 MsgId; +struct FullMsgId { + FullMsgId() : channel(NoChannel), msg(0) { + } + FullMsgId(ChannelId channel, MsgId msg) : channel(channel), msg(msg) { + } + ChannelId channel; + MsgId msg; +}; +inline bool operator==(const FullMsgId &a, const FullMsgId &b) { + return (a.channel == b.channel) && (a.msg == b.msg); +} +inline bool operator<(const FullMsgId &a, const FullMsgId &b) { + if (a.msg < b.msg) return true; + if (a.msg > b.msg) return false; + return a.channel < b.channel; +} static const MsgId ShowAtTheEndMsgId = -0x40000000; static const MsgId ShowAtUnreadMsgId = 0; @@ -61,10 +146,12 @@ ImagePtr chatDefPhoto(int32 index); static const PhotoId UnknownPeerPhotoId = 0xFFFFFFFFFFFFFFFFULL; -struct UserData; -struct ChatData; -struct PeerData { - PeerData(const PeerId &id); +class UserData; +class ChatData; +class ChannelData; +class PeerData { +public: + virtual ~PeerData() { if (notify != UnknownNotifySettings && notify != EmptyNotifySettings) { delete notify; @@ -72,11 +159,21 @@ struct PeerData { } } + bool isUser() const { + return peerIsUser(id); + } + bool isChat() const { + return peerIsChat(id); + } + bool isChannel() const { + return peerIsChannel(id); + } UserData *asUser(); const UserData *asUser() const; - ChatData *asChat(); const ChatData *asChat() const; + ChannelData *asChannel(); + const ChannelData *asChannel() const; void updateName(const QString &newName, const QString &newNameOrPhone, const QString &newUsername); @@ -85,7 +182,10 @@ struct PeerData { virtual void nameUpdated() { } - PeerId id; + const PeerId id; + int32 bareId() const { + return int32(uint32(id & 0xFFFFFFFFULL)); + } QString name; QString nameOrPhone; @@ -95,7 +195,6 @@ struct PeerData { NameFirstChars chars; bool loaded; - bool chat; MTPinputPeer input; int32 colorIndex; @@ -107,7 +206,15 @@ struct PeerData { int32 nameVersion; NotifySettingsPtr notify; + +private: + + PeerData(const PeerId &id); + friend class UserData; + friend class ChatData; + friend class ChannelData; }; + static const uint64 UserNoAccess = 0xFFFFFFFFFFFFFFFFULL; class PeerLink : public ITextLink { @@ -174,7 +281,9 @@ enum UserBlockedStatus { }; struct PhotoData; -struct UserData : public PeerData { +class UserData : public PeerData { +public: + UserData(const PeerId &id) : PeerData(id), access(0), lnk(new PeerLink(this)), onlineTill(0), contact(-1), blocked(UserBlockUnknown), photosCount(-1), botInfo(0) { } void setPhoto(const MTPUserProfilePhoto &photo); @@ -188,7 +297,7 @@ struct UserData : public PeerData { uint64 access; - MTPinputUser inputUser; + MTPInputUser inputUser; QString firstName; QString lastName; @@ -207,10 +316,15 @@ struct UserData : public PeerData { BotInfo *botInfo; }; -struct ChatData : public PeerData { - ChatData(const PeerId &id) : PeerData(id), count(0), date(0), version(0), left(false), forbidden(true), botStatus(0) { +class ChatData : public PeerData { +public: + + ChatData(const PeerId &id) : PeerData(id), inputChat(MTP_inputChat(MTP_int(bareId()))), count(0), date(0), version(0), left(false), forbidden(true), botStatus(0) { } void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId); + + MTPInputChat inputChat; + int32 count; int32 date; int32 version; @@ -228,17 +342,56 @@ struct ChatData : public PeerData { int32 botStatus; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other // ImagePtr photoFull; QString invitationUrl; - // geo }; +class ChannelData : public PeerData { +public: + + ChannelData(const PeerId &id) : PeerData(id), access(0), inputChat(MTP_inputChannel(MTP_int(bareId()), MTP_long(0))), date(0), version(0), left(false), forbidden(true), botStatus(-1) { + } + void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId); + + uint64 access; + + MTPInputChat inputChat; + + int32 date; + int32 version; + bool left; + bool forbidden; + + int32 botStatus; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other +// ImagePtr photoFull; + QString invitationUrl; +}; + +inline UserData *PeerData::asUser() { + return isUser() ? static_cast(this) : 0; +} +inline const UserData *PeerData::asUser() const { + return isUser() ? static_cast(this) : 0; +} +inline ChatData *PeerData::asChat() { + return isChat() ? static_cast(this) : 0; +} +inline const ChatData *PeerData::asChat() const { + return isChat() ? static_cast(this) : 0; +} +inline ChannelData *PeerData::asChannel() { + return isChannel() ? static_cast(this) : 0; +} +inline const ChannelData *PeerData::asChannel() const { + return isChannel() ? static_cast(this) : 0; +} + inline int32 newMessageFlags(PeerData *p) { - return (p->input.type() == mtpc_inputPeerSelf) ? 0 : (((p->chat || !p->asUser()->botInfo) ? MTPDmessage_flag_unread : 0) | MTPDmessage_flag_out); + return (p->input.type() == mtpc_inputPeerSelf) ? 0 : (((p->isChat() || (p->isUser() && !p->asUser()->botInfo)) ? MTPDmessage_flag_unread : 0) | MTPDmessage_flag_out); } typedef QMap PreparedPhotoThumbs; struct PhotoData { PhotoData(const PhotoId &id, const uint64 &access = 0, int32 date = 0, const ImagePtr &thumb = ImagePtr(), const ImagePtr &medium = ImagePtr(), const ImagePtr &full = ImagePtr()) : - id(id), access(access), date(date), thumb(thumb), medium(medium), full(full), chat(0) { + id(id), access(access), date(date), thumb(thumb), medium(medium), full(full), peer(0) { } void forget() { thumb->forget(); @@ -265,7 +418,8 @@ struct PhotoData { ImagePtr thumb, replyPreview; ImagePtr medium; ImagePtr full; - ChatData *chat; // for chat photos connection + + PeerData *peer; // for chat and channel photos connection // geo, caption int32 cachew; @@ -319,7 +473,8 @@ struct VideoData { } location = FileLocation(); if (!beforeDownload) { - openOnSave = openOnSaveMsgId = 0; + openOnSave = 0; + openOnSaveMsgId = FullMsgId(); } } @@ -347,7 +502,8 @@ struct VideoData { int32 uploadOffset; mtpTypeId fileType; - int32 openOnSave, openOnSaveMsgId; + int32 openOnSave; + FullMsgId openOnSaveMsgId; mtpFileLoader *loader; FileLocation location; }; @@ -412,7 +568,8 @@ struct AudioData { } location = FileLocation(); if (!beforeDownload) { - openOnSave = openOnSaveMsgId = 0; + openOnSave = 0; + openOnSaveMsgId = FullMsgId(); } } @@ -439,7 +596,8 @@ struct AudioData { FileStatus status; int32 uploadOffset; - int32 openOnSave, openOnSaveMsgId; + int32 openOnSave; + FullMsgId openOnSaveMsgId; mtpFileLoader *loader; FileLocation location; QByteArray data; @@ -447,15 +605,17 @@ struct AudioData { }; struct AudioMsgId { - AudioMsgId() : audio(0), msgId(0) { + AudioMsgId() : audio(0) { } - AudioMsgId(AudioData *audio, MsgId msgId) : audio(audio), msgId(msgId) { + AudioMsgId(AudioData *audio, const FullMsgId &msgId) : audio(audio), msgId(msgId) { + } + AudioMsgId(AudioData *audio, ChannelId channelId, MsgId msgId) : audio(audio), msgId(channelId, msgId) { } operator bool() const { return audio; } AudioData *audio; - MsgId msgId; + FullMsgId msgId; }; inline bool operator<(const AudioMsgId &a, const AudioMsgId &b) { return quintptr(a.audio) < quintptr(b.audio) || (quintptr(a.audio) == quintptr(b.audio) && a.msgId < b.msgId); @@ -574,7 +734,8 @@ struct DocumentData { } location = FileLocation(); if (!beforeDownload) { - openOnSave = openOnSaveMsgId = 0; + openOnSave = 0; + openOnSaveMsgId = FullMsgId(); } } @@ -612,7 +773,8 @@ struct DocumentData { FileStatus status; int32 uploadOffset; - int32 openOnSave, openOnSaveMsgId; + int32 openOnSave; + FullMsgId openOnSaveMsgId; mtpFileLoader *loader; FileLocation location; @@ -623,15 +785,17 @@ struct DocumentData { }; struct SongMsgId { - SongMsgId() : song(0), msgId(0) { + SongMsgId() : song(0) { } - SongMsgId(DocumentData *song, MsgId msgId) : song(song), msgId(msgId) { + SongMsgId(DocumentData *song, const FullMsgId &msgId) : song(song), msgId(msgId) { + } + SongMsgId(DocumentData *song, ChannelId channelId, MsgId msgId) : song(song), msgId(channelId, msgId) { } operator bool() const { return song; } DocumentData *song; - MsgId msgId; + FullMsgId msgId; }; inline bool operator<(const SongMsgId &a, const SongMsgId &b) { return quintptr(a.song) < quintptr(b.song) || (quintptr(a.song) == quintptr(b.song) && a.msgId < b.msgId); diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 8f18cfda6..896bd0312 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -174,7 +174,7 @@ void NotifyWindow::updateNotifyDisplay() { QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height); if (!App::passcoded() && cNotifyView() <= dbinvShowName) { - if (history->peer->chat) { + if (history->peer->isChat()) { // CHANNELS_UI p.drawPixmap(QPoint(rectForName.left() + st::dlgChatImgLeft, rectForName.top() + st::dlgChatImgTop), App::sprite(), st::dlgChatImg); rectForName.setLeft(rectForName.left() + st::dlgChatImgSkip); } @@ -198,7 +198,7 @@ void NotifyWindow::updateNotifyDisplay() { item->drawInDialog(p, r, active, textCachedFor, itemTextCache); } else { p.setFont(st::dlgHistFont->f); - if (history->peer->chat) { + if (item->displayFromName()) { itemTextCache.setText(st::dlgHistFont, item->from()->name); p.setPen(st::dlgSystemColor->p); itemTextCache.drawElided(p, r.left(), r.top(), r.width(), st::dlgHistFont->height); @@ -287,7 +287,7 @@ void NotifyWindow::mousePressEvent(QMouseEvent *e) { App::wnd()->notifyClear(); } else { App::wnd()->hideSettings(); - App::main()->showPeerHistory(peer, (history->peer->chat && item && item->notifyByFrom() && item->id > 0) ? item->id : ShowAtUnreadMsgId); + App::main()->showPeerHistory(peer, (!history->peer->isUser() && item && item->notifyByFrom() && item->id > 0) ? item->id : ShowAtUnreadMsgId); } e->ignore(); } @@ -609,7 +609,7 @@ void Window::sendServiceHistoryRequest() { int32 userFlags = MTPDuser::flag_first_name | MTPDuser::flag_phone | MTPDuser::flag_status; user = App::feedUsers(MTP_vector(1, MTP_user(MTP_int(userFlags), MTP_int(ServiceUserId), MTPlong(), MTP_string("Telegram"), MTPstring(), MTPstring(), MTP_string("42777"), MTP_userProfilePhotoEmpty(), MTP_userStatusRecently(), MTPint()))); } - _serviceHistoryRequest = MTP::send(MTPmessages_GetHistory(user->input, MTP_int(0), MTP_int(0), MTP_int(1)), main->rpcDone(&MainWidget::serviceHistoryDone), main->rpcFail(&MainWidget::serviceHistoryFail)); + _serviceHistoryRequest = MTP::send(MTPmessages_GetHistory(user->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1)), main->rpcDone(&MainWidget::serviceHistoryDone), main->rpcFail(&MainWidget::serviceHistoryFail)); } void Window::setupMain(bool anim, const MTPUser *self) { @@ -1229,7 +1229,7 @@ void Window::quit() { void Window::notifySchedule(History *history, HistoryItem *item) { if (App::quiting() || !history->currentNotification() || !main) return; - UserData *notifyByFrom = (history->peer->chat && item->notifyByFrom()) ? item->from() : 0; + UserData *notifyByFrom = (!history->peer->isUser() && item->notifyByFrom()) ? item->from() : 0; bool haveSetting = (history->peer->notify != UnknownNotifySettings); if (haveSetting) {