From 160895f6e33929f45efeeccfe19cc7a0d7b05005 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Sep 2016 12:11:23 -0400 Subject: [PATCH] Support for game keyboard buttons and score service messages added. --- Telegram/Resources/langs/lang.strings | 1 + Telegram/SourceFiles/facades.cpp | 18 +- Telegram/SourceFiles/history.cpp | 181 +++++++--- Telegram/SourceFiles/history.h | 48 ++- Telegram/SourceFiles/historywidget.cpp | 18 +- Telegram/SourceFiles/mtproto/scheme.tl | 14 +- Telegram/SourceFiles/mtproto/scheme_auto.cpp | 120 ++++++- Telegram/SourceFiles/mtproto/scheme_auto.h | 347 +++++++++++++++++-- 8 files changed, 629 insertions(+), 118 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index c06c6e297..510227e20 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -580,6 +580,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_action_pinned_media_contact" = "a contact information"; "lng_action_pinned_media_location" = "a location mark"; "lng_action_pinned_media_sticker" = "a sticker"; +"lng_action_game_score" = "{from} scored {score} in {game}"; "lng_profile_migrate_reached" = "{count:_not_used_|# member|# members} limit reached"; "lng_profile_migrate_body" = "To get over this limit, you can upgrade your group to a supergroup."; diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index f64038d52..211267147 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -63,37 +63,39 @@ void activateBotCommand(const HistoryItem *msg, int row, int col) { } if (!button) return; + using ButtonType = HistoryMessageReplyMarkup::Button::Type; switch (button->type) { - case HistoryMessageReplyMarkup::Button::Default: { + case ButtonType::Default: { // Copy string before passing it to the sending method // because the original button can be destroyed inside. MsgId replyTo = (msg->id > 0) ? msg->id : 0; sendBotCommand(msg->history()->peer, msg->fromOriginal()->asUser(), QString(button->text), replyTo); } break; - case HistoryMessageReplyMarkup::Button::Callback: { + case ButtonType::Callback: + case ButtonType::Game: { if (MainWidget *m = main()) { m->app_sendBotCallback(button, msg, row, col); } } break; - case HistoryMessageReplyMarkup::Button::Url: { + case ButtonType::Url: { auto url = QString::fromUtf8(button->data); UrlClickHandler(url).onClick(Qt::LeftButton); } break; - case HistoryMessageReplyMarkup::Button::RequestLocation: { + case ButtonType::RequestLocation: { Ui::showLayer(new InformBox(lang(lng_bot_share_location_unavailable))); } break; - case HistoryMessageReplyMarkup::Button::RequestPhone: { + case ButtonType::RequestPhone: { SharePhoneConfirmBox *box = new SharePhoneConfirmBox(msg->history()->peer); box->connect(box, SIGNAL(confirmed(PeerData*)), App::main(), SLOT(onSharePhoneWithBot(PeerData*))); Ui::showLayer(box); } break; - case HistoryMessageReplyMarkup::Button::SwitchInlineSame: - case HistoryMessageReplyMarkup::Button::SwitchInline: { + case ButtonType::SwitchInlineSame: + case ButtonType::SwitchInline: { if (auto m = App::main()) { auto getMessageBot = [msg]() -> UserData* { if (auto bot = msg->viaBot()) { @@ -107,7 +109,7 @@ void activateBotCommand(const HistoryItem *msg, int row, int col) { }; if (auto bot = getMessageBot()) { auto tryFastSwitch = [bot, &button, msgId = msg->id]() -> bool { - auto samePeer = (button->type == HistoryMessageReplyMarkup::Button::SwitchInlineSame); + auto samePeer = (button->type == ButtonType::SwitchInlineSame); if (samePeer) { Notify::switchInlineBotButtonReceived(QString::fromUtf8(button->data), bot, msgId); return true; diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 60892aea2..55b63f32a 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -676,7 +676,7 @@ void checkForSwitchInlineButton(HistoryItem *item) { if (auto markup = item->Get()) { for_const (const auto &row, markup->rows) { for_const (const auto &button, row) { - if (button.type == HistoryMessageReplyMarkup::Button::SwitchInline) { + if (button.type == HistoryMessageReplyMarkup::Button::Type::SwitchInline) { Notify::switchInlineBotButtonReceived(QString::fromUtf8(button.data)); return; } @@ -2222,7 +2222,7 @@ public: // Copy to clipboard support. void copyToClipboard() const override { if (auto button = getButton()) { - if (button->type == HistoryMessageReplyMarkup::Button::Url) { + if (button->type == HistoryMessageReplyMarkup::Button::Type::Url) { auto url = QString::fromUtf8(button->data); if (!url.isEmpty()) { QApplication::clipboard()->setText(url); @@ -2232,7 +2232,7 @@ public: } QString copyToClipboardContextItemText() const override { if (auto button = getButton()) { - if (button->type == HistoryMessageReplyMarkup::Button::Url) { + if (button->type == HistoryMessageReplyMarkup::Button::Type::Url) { return lang(lng_context_copy_link); } } @@ -2514,8 +2514,9 @@ void ReplyKeyboard::Style::paintButton(Painter &p, const ReplyKeyboard::Button & paintButtonBg(p, rect, pressed, button.howMuchOver); paintButtonIcon(p, rect, button.type); - if (button.type == HistoryMessageReplyMarkup::Button::Callback) { - if (const HistoryMessageReplyMarkup::Button *data = button.link->getButton()) { + if (button.type == HistoryMessageReplyMarkup::Button::Type::Callback + || button.type == HistoryMessageReplyMarkup::Button::Type::Game) { + if (auto data = button.link->getButton()) { if (data->requestId) { paintButtonLoading(p, rect); } @@ -2552,32 +2553,37 @@ void HistoryMessageReplyMarkup::createFromButtonRows(const QVector 0) { result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding)); @@ -8005,6 +8012,10 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { } } break; + case mtpc_messageActionGameScore: { + updateGameScoreText(&text); + } break; + default: from = QString(); break; } @@ -8019,42 +8030,42 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) { } } -bool HistoryService::updatePinned(bool force) { - auto pinned = Get(); - t_assert(pinned != nullptr); +bool HistoryService::updateDependent(bool force) { + auto dependent = GetDependentData(); + t_assert(dependent != nullptr); if (!force) { - if (!pinned->msgId || pinned->msg) { + if (!dependent->msgId || dependent->msg) { return true; } } - if (!pinned->lnk) { - pinned->lnk.reset(new GoToMessageClickHandler(history()->peer->id, pinned->msgId)); + if (!dependent->lnk) { + dependent->lnk.reset(new GoToMessageClickHandler(history()->peer->id, dependent->msgId)); } bool gotDependencyItem = false; - if (!pinned->msg) { - pinned->msg = App::histItemById(channelId(), pinned->msgId); - if (pinned->msg) { - App::historyRegDependency(this, pinned->msg); + if (!dependent->msg) { + dependent->msg = App::histItemById(channelId(), dependent->msgId); + if (dependent->msg) { + App::historyRegDependency(this, dependent->msg); gotDependencyItem = true; } } - if (pinned->msg) { - updatePinnedText(); + if (dependent->msg) { + updateDependentText(); } else if (force) { - if (pinned->msgId > 0) { - pinned->msgId = 0; + if (dependent->msgId > 0) { + dependent->msgId = 0; gotDependencyItem = true; } - updatePinnedText(); + updateDependentText(); } if (force) { if (gotDependencyItem && App::wnd()) { App::wnd()->notifySettingGot(); } } - return (pinned->msg || !pinned->msgId); + return (dependent->msg || !dependent->msgId); } bool HistoryService::updatePinnedText(const QString *pfrom, QString *ptext) { @@ -8129,13 +8140,62 @@ bool HistoryService::updatePinnedText(const QString *pfrom, QString *ptext) { return result; } +bool HistoryService::updateGameScoreText(QString *ptext) { + bool result = false; + QString from = _from->name, text; + + auto gamescore = Get(); + if (gamescore && gamescore->msg) { + auto getGameTitle = [item = gamescore->msg]() -> QString { + if (auto markup = item->Get()) { + for_const (auto &row, markup->rows) { + for_const (auto &button, row) { + if (button.type == HistoryMessageReplyMarkup::Button::Type::Game) { + auto strData = QString::fromUtf8(button.data); + return strData.mid(strData.indexOf(',') + 1); + } + } + } + } + return lang(lng_deleted_message); + }; + text = lng_action_game_score(lt_from, from, lt_score, QString::number(gamescore->score), lt_game, getGameTitle()); + result = true; + } else if (gamescore && gamescore->msgId) { + text = lng_action_game_score(lt_from, from, lt_score, QString::number(gamescore->score), lt_game, lang(lng_contacts_loading)); + result = true; + } else { + text = lng_action_game_score(lt_from, from, lt_score, QString::number(gamescore->score), lt_game, lang(lng_deleted_message)); + } + if (ptext) { + *ptext = text; + } else { + setServiceText(text); + if (history()->textCachedFor == this) { + history()->textCachedFor = 0; + } + if (App::main()) { + App::main()->dlgUpdated(history(), id); + } + App::historyUpdateDependent(this); + } + return result; +} + HistoryService::HistoryService(History *history, const MTPDmessageService &msg) : HistoryItem(history, msg.vid.v, mtpCastFlags(msg.vflags.v), ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) { if (msg.has_reply_to_msg_id()) { - UpdateComponents(HistoryServicePinned::Bit()); - MsgId pinnedMsgId = Get()->msgId = msg.vreply_to_msg_id.v; - if (!updatePinned() && App::api()) { - App::api()->requestMessageData(history->peer->asChannel(), pinnedMsgId, std_::make_unique(fullId())); + if (msg.vaction.type() == mtpc_messageActionPinMessage) { + UpdateComponents(HistoryServicePinned::Bit()); + } else if (msg.vaction.type() == mtpc_messageActionGameScore) { + UpdateComponents(HistoryServiceGameScore::Bit()); + Get()->score = msg.vaction.c_messageActionGameScore().vscore.v; + } + if (auto dependent = GetDependentData()) { + dependent->msgId = msg.vreply_to_msg_id.v; + if (!updateDependent() && App::api()) { + App::api()->requestMessageData(history->peer->asChannel(), dependent->msgId, std_::make_unique(fullId())); + } } } setMessageByAction(msg.vaction); @@ -8152,6 +8212,13 @@ void HistoryService::initDimensions() { if (_media) _media->initDimensions(); } +bool HistoryService::updateDependencyItem() { + if (GetDependentData()) { + return updateDependent(true); + } + return HistoryItem::updateDependencyItem(); +} + void HistoryService::countPositionAndSize(int32 &left, int32 &width) const { left = st::msgServiceMargin.left(); int32 maxwidth = _history->width; @@ -8294,7 +8361,14 @@ HistoryTextState HistoryService::getState(int x, int y, HistoryStateRequest requ if (_media) { height -= st::msgServiceMargin.top() + _media->height(); } - QRect trect(QRect(left, st::msgServiceMargin.top(), width, height).marginsAdded(-st::msgServicePadding)); + auto outer = QRect(left, st::msgServiceMargin.top(), width, height); + auto trect = outer.marginsAdded(-st::msgServicePadding); + if (auto gamescore = Get()) { + if (outer.contains(x, y)) { + result.link = gamescore->lnk; + return result; + } + } if (trect.contains(x, y)) { textstyleSet(&st::serviceTextStyle); auto textRequest = request.forText(); @@ -8312,6 +8386,9 @@ void HistoryService::applyEditionToEmpty() { setServiceText(QString()); removeMedia(); + clearDependency(); + UpdateComponents(0); + finishEditionToEmpty(); } @@ -8350,12 +8427,16 @@ void HistoryService::eraseFromOverview() { } } -HistoryService::~HistoryService() { - if (auto pinned = Get()) { - if (pinned->msg) { - App::historyUnregDependency(this, pinned->msg); +void HistoryService::clearDependency() { + if (auto dependent = GetDependentData()) { + if (dependent->msg) { + App::historyUnregDependency(this, dependent->msg); } } +} + +HistoryService::~HistoryService() { + clearDependency(); _media.clear(); } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 44c812344..debb1f0d2 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -813,7 +813,7 @@ struct HistoryMessageReplyMarkup : public BaseComponent { +struct HistoryServiceDependentData { MsgId msgId = 0; HistoryItem *msg = nullptr; ClickHandlerPtr lnk; }; +struct HistoryServicePinned : public BaseComponent, public HistoryServiceDependentData { +}; + +struct HistoryServiceGameScore : public BaseComponent, public HistoryServiceDependentData { + int score = 0; +}; + namespace HistoryLayout { class ServiceMessagePainter; } // namespace HistoryLayout @@ -2776,18 +2784,16 @@ public: return _create(history, msgId, date, msg, flags, from); } - bool updateDependencyItem() override { - return updatePinned(true); - } + bool updateDependencyItem() override; MsgId dependencyMsgId() const override { - if (const HistoryServicePinned *pinned = Get()) { - return pinned->msgId; + if (auto dependent = GetDependentData()) { + return dependent->msgId; } return 0; } bool notificationReady() const override { - if (const HistoryServicePinned *pinned = Get()) { - return (pinned->msg || !pinned->msgId); + if (auto dependent = GetDependentData()) { + return (dependent->msg || !dependent->msgId); } return true; } @@ -2842,9 +2848,31 @@ protected: void removeMedia(); + HistoryServiceDependentData *GetDependentData() { + if (auto pinned = Get()) { + return pinned; + } else if (auto gamescore = Get()) { + return gamescore; + } + return nullptr; + } + const HistoryServiceDependentData *GetDependentData() const { + return const_cast(this)->GetDependentData(); + } + bool updateDependent(bool force = false); + bool updateDependentText() { + if (Has()) { + return updatePinnedText(); + } else if (Has()) { + return updateGameScoreText(); + } + return false; + } + void clearDependency(); + void setMessageByAction(const MTPmessageAction &action); - bool updatePinned(bool force = false); bool updatePinnedText(const QString *pfrom = nullptr, QString *ptext = nullptr); + bool updateGameScoreText(QString *ptext = nullptr); }; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 4230b4be1..dd6703152 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -5764,7 +5764,19 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, msg->id)); BotCallbackInfo info = { msg->fullId(), row, col }; - button->requestId = MTP::send(MTPmessages_GetBotCallbackAnswer(_peer->input, MTP_int(msg->id), MTP_bytes(button->data)), rpcDone(&HistoryWidget::botCallbackDone, info), rpcFail(&HistoryWidget::botCallbackFail, info)); + MTPmessages_GetBotCallbackAnswer::Flags flags = 0; + QByteArray sendData; + int32 sendGameId = 0; + using ButtonType = HistoryMessageReplyMarkup::Button::Type; + if (button->type == ButtonType::Game) { + flags = MTPmessages_GetBotCallbackAnswer::Flag::f_game_id; + auto strData = QString::fromUtf8(button->data); + sendGameId = strData.midRef(0, strData.indexOf(',')).toInt(); + } else if (button->type == ButtonType::Callback) { + flags = MTPmessages_GetBotCallbackAnswer::Flag::f_data; + sendData = button->data; + } + button->requestId = MTP::send(MTPmessages_GetBotCallbackAnswer(MTP_flags(flags), _peer->input, MTP_int(msg->id), MTP_bytes(sendData), MTP_int(sendGameId)), rpcDone(&HistoryWidget::botCallbackDone, info), rpcFail(&HistoryWidget::botCallbackFail, info)); Ui::repaintHistoryItem(msg); if (_replyToId == msg->id) { @@ -5777,7 +5789,7 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button } void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotCallbackAnswer &answer, mtpRequestId req) { - if (HistoryItem *item = App::histItemById(info.msgId)) { + if (auto item = App::histItemById(info.msgId)) { if (auto markup = item->Get()) { if (info.row < markup->rows.size() && info.col < markup->rows.at(info.row).size()) { if (markup->rows.at(info.row).at(info.col).requestId == req) { @@ -5788,7 +5800,7 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC } } if (answer.type() == mtpc_messages_botCallbackAnswer) { - const auto &answerData(answer.c_messages_botCallbackAnswer()); + auto &answerData = answer.c_messages_botCallbackAnswer(); if (answerData.has_message()) { if (answerData.is_alert()) { Ui::showLayer(new InformBox(qs(answerData.vmessage))); diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 64cb8d5ff..5d29d2a42 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -253,6 +253,7 @@ messageActionChatMigrateTo#51bdb021 channel_id:int = MessageAction; messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageAction; messageActionPinMessage#94bd38ed = MessageAction; messageActionHistoryClear#9fbab604 = MessageAction; +messageActionGameScore#3a14cfa5 game_id:int score:int = MessageAction; dialog#66ffba14 flags:# peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog; @@ -389,9 +390,9 @@ updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo updateBotInlineSend#e48f964 flags:# user_id:int query:string geo:flags.0?GeoPoint id:string msg_id:flags.1?InputBotInlineMessageID = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; -updateBotCallbackQuery#a68c688c query_id:long user_id:int peer:Peer msg_id:int data:bytes = Update; +updateBotCallbackQuery#81c5615f flags:# query_id:long user_id:int peer:Peer msg_id:int data:flags.0?bytes game_id:flags.1?int = Update; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; -updateInlineBotCallbackQuery#2cbd95af query_id:long user_id:int msg_id:InputBotInlineMessageID data:bytes = Update; +updateInlineBotCallbackQuery#d618a28b flags:# query_id:long user_id:int msg_id:InputBotInlineMessageID data:flags.0?bytes game_id:flags.1?int = Update; updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update; updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update; updateReadFeaturedStickers#571d2742 = Update; @@ -573,6 +574,7 @@ keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonSwitchInline#568a748 flags:# same_peer:flags.0?true text:string query:string = KeyboardButton; +keyboardButtonGame#28fc3164 text:string game_title:string game_id:int start_param:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -796,7 +798,7 @@ messages.receivedMessages#5a954c0 max_id:int = Vector; messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool; messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true 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:# silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int media:InputMedia random_id:long reply_markup:flags.2?ReplyMarkup = Updates; -messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; +messages.forwardMessages#708e0195 flags:# silent:flags.5?true background:flags.6?true with_my_score:flags.8?true from_peer:InputPeer id:Vector random_id:Vector to_peer:InputPeer = Updates; messages.reportSpam#cf1592db peer:InputPeer = Bool; messages.hideReportSpam#a8f1709b peer:InputPeer = Bool; messages.getPeerSettings#3672e09c peer:InputPeer = PeerSettings; @@ -845,7 +847,7 @@ messages.sendInlineBotResult#b16e06fe flags:# silent:flags.5?true background:fla messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; -messages.getBotCallbackAnswer#a6e94f04 peer:InputPeer msg_id:int data:bytes = messages.BotCallbackAnswer; +messages.getBotCallbackAnswer#6c996518 flags:# peer:InputPeer msg_id:int data:flags.0?bytes game_id:flags.1?int = messages.BotCallbackAnswer; messages.setBotCallbackAnswer#c927d44b flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.2?string = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = messages.PeerDialogs; messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector = Bool; @@ -857,6 +859,8 @@ messages.saveRecentSticker#348e39bf id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#ab02e5d2 = Bool; messages.getUnusedStickers#4309d65b limit:int = Vector; messages.getArchivedStickers#906e241f offset_id:long limit:int = messages.ArchivedStickers; +messages.setGameScore#dfbc7c1f flags:# edit_message:flags.0?true peer:InputPeer id:int user_id:InputUser game_id:int score:int = Updates; +messages.setInlineGameScore#54f882f1 flags:# edit_message:flags.0?true id:InputBotInlineMessageID user_id:InputUser game_id:int score:int = Bool; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; @@ -908,4 +912,4 @@ channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates; channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates; channels.getAdminedPublicChannels#8d8d82d7 = messages.Chats; -// LAYER 55 +// LAYER 56 diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index 19ad70dc3..5043ff1f7 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -1672,6 +1672,20 @@ void _serialize_messageActionHistoryClear(MTPStringLogger &to, int32 stage, int3 to.add("{ messageActionHistoryClear }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_messageActionGameScore(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messageActionGameScore"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" game_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" score: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { MTPDdialog::Flags flag(iflag); @@ -2970,6 +2984,8 @@ void _serialize_updateChannelPinnedMessage(MTPStringLogger &to, int32 stage, int } void _serialize_updateBotCallbackQuery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateBotCallbackQuery::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2977,11 +2993,13 @@ void _serialize_updateBotCallbackQuery(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" data: "); ++stages.back(); if (flag & MTPDupdateBotCallbackQuery::Flag::f_data) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" game_id: "); ++stages.back(); if (flag & MTPDupdateBotCallbackQuery::Flag::f_game_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -3002,6 +3020,8 @@ void _serialize_updateEditMessage(MTPStringLogger &to, int32 stage, int32 lev, T } void _serialize_updateInlineBotCallbackQuery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateInlineBotCallbackQuery::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3009,10 +3029,12 @@ void _serialize_updateInlineBotCallbackQuery(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" msg_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" msg_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" data: "); ++stages.back(); if (flag & MTPDupdateInlineBotCallbackQuery::Flag::f_data) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 5: to.add(" game_id: "); ++stages.back(); if (flag & MTPDupdateInlineBotCallbackQuery::Flag::f_game_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -4585,6 +4607,22 @@ void _serialize_keyboardButtonSwitchInline(MTPStringLogger &to, int32 stage, int } } +void _serialize_keyboardButtonGame(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ keyboardButtonGame"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" game_title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" game_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" start_param: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_keyboardButtonRow(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -6530,6 +6568,26 @@ void _serialize_messages_clearRecentStickers(MTPStringLogger &to, int32 stage, i to.add("{ messages_clearRecentStickers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_messages_setInlineGameScore(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_setInlineGameScore::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_setInlineGameScore"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" edit_message: "); ++stages.back(); if (flag & MTPmessages_setInlineGameScore::Flag::f_edit_message) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" game_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" score: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_upload_saveFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -7447,10 +7505,11 @@ void _serialize_messages_forwardMessages(MTPStringLogger &to, int32 stage, int32 case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; case 2: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 3: to.add(" from_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" to_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" with_my_score: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_with_my_score) { to.add("YES [ BY BIT 8 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 4: to.add(" from_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" to_peer: "); ++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; } } @@ -7645,6 +7704,27 @@ void _serialize_messages_getAllDrafts(MTPStringLogger &to, int32 stage, int32 le to.add("{ messages_getAllDrafts }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_messages_setGameScore(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_setGameScore::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_setGameScore"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" edit_message: "); ++stages.back(); if (flag & MTPmessages_setGameScore::Flag::f_edit_message) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" game_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" score: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + void _serialize_channels_createChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { MTPchannels_createChannel::Flags flag(iflag); @@ -8189,6 +8269,8 @@ void _serialize_messages_getMessageEditData(MTPStringLogger &to, int32 stage, in } void _serialize_messages_getBotCallbackAnswer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_getBotCallbackAnswer::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -8196,9 +8278,11 @@ void _serialize_messages_getBotCallbackAnswer(MTPStringLogger &to, int32 stage, 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(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" data: "); ++stages.back(); if (flag & MTPmessages_getBotCallbackAnswer::Flag::f_data) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 4: to.add(" game_id: "); ++stages.back(); if (flag & MTPmessages_getBotCallbackAnswer::Flag::f_game_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -8619,6 +8703,7 @@ namespace { _serializers.insert(mtpc_messageActionChannelMigrateFrom, _serialize_messageActionChannelMigrateFrom); _serializers.insert(mtpc_messageActionPinMessage, _serialize_messageActionPinMessage); _serializers.insert(mtpc_messageActionHistoryClear, _serialize_messageActionHistoryClear); + _serializers.insert(mtpc_messageActionGameScore, _serialize_messageActionGameScore); _serializers.insert(mtpc_dialog, _serialize_dialog); _serializers.insert(mtpc_photoEmpty, _serialize_photoEmpty); _serializers.insert(mtpc_photo, _serialize_photo); @@ -8854,6 +8939,7 @@ namespace { _serializers.insert(mtpc_keyboardButtonRequestPhone, _serialize_keyboardButtonRequestPhone); _serializers.insert(mtpc_keyboardButtonRequestGeoLocation, _serialize_keyboardButtonRequestGeoLocation); _serializers.insert(mtpc_keyboardButtonSwitchInline, _serialize_keyboardButtonSwitchInline); + _serializers.insert(mtpc_keyboardButtonGame, _serialize_keyboardButtonGame); _serializers.insert(mtpc_keyboardButtonRow, _serialize_keyboardButtonRow); _serializers.insert(mtpc_replyKeyboardHide, _serialize_replyKeyboardHide); _serializers.insert(mtpc_replyKeyboardForceReply, _serialize_replyKeyboardForceReply); @@ -9002,6 +9088,7 @@ namespace { _serializers.insert(mtpc_messages_readFeaturedStickers, _serialize_messages_readFeaturedStickers); _serializers.insert(mtpc_messages_saveRecentSticker, _serialize_messages_saveRecentSticker); _serializers.insert(mtpc_messages_clearRecentStickers, _serialize_messages_clearRecentStickers); + _serializers.insert(mtpc_messages_setInlineGameScore, _serialize_messages_setInlineGameScore); _serializers.insert(mtpc_upload_saveFilePart, _serialize_upload_saveFilePart); _serializers.insert(mtpc_upload_saveBigFilePart, _serialize_upload_saveBigFilePart); _serializers.insert(mtpc_help_saveAppLog, _serialize_help_saveAppLog); @@ -9081,6 +9168,7 @@ namespace { _serializers.insert(mtpc_messages_sendInlineBotResult, _serialize_messages_sendInlineBotResult); _serializers.insert(mtpc_messages_editMessage, _serialize_messages_editMessage); _serializers.insert(mtpc_messages_getAllDrafts, _serialize_messages_getAllDrafts); + _serializers.insert(mtpc_messages_setGameScore, _serialize_messages_setGameScore); _serializers.insert(mtpc_channels_createChannel, _serialize_channels_createChannel); _serializers.insert(mtpc_channels_editAdmin, _serialize_channels_editAdmin); _serializers.insert(mtpc_channels_editTitle, _serialize_channels_editTitle); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index b4e9ede56..ee3c653ae 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org namespace MTP { namespace internal { -static constexpr mtpPrime CurrentLayer = 55; +static constexpr mtpPrime CurrentLayer = 56; class TypeCreator; @@ -181,6 +181,7 @@ enum { mtpc_messageActionChannelMigrateFrom = 0xb055eaee, mtpc_messageActionPinMessage = 0x94bd38ed, mtpc_messageActionHistoryClear = 0x9fbab604, + mtpc_messageActionGameScore = 0x3a14cfa5, mtpc_dialog = 0x66ffba14, mtpc_photoEmpty = 0x2331b22d, mtpc_photo = 0xcded42fe, @@ -285,9 +286,9 @@ enum { mtpc_updateBotInlineSend = 0xe48f964, mtpc_updateEditChannelMessage = 0x1b3f4df7, mtpc_updateChannelPinnedMessage = 0x98592475, - mtpc_updateBotCallbackQuery = 0xa68c688c, + mtpc_updateBotCallbackQuery = 0x81c5615f, mtpc_updateEditMessage = 0xe40370a3, - mtpc_updateInlineBotCallbackQuery = 0x2cbd95af, + mtpc_updateInlineBotCallbackQuery = 0xd618a28b, mtpc_updateReadChannelOutbox = 0x25d6c9c7, mtpc_updateDraftMessage = 0xee2bb969, mtpc_updateReadFeaturedStickers = 0x571d2742, @@ -416,6 +417,7 @@ enum { mtpc_keyboardButtonRequestPhone = 0xb16a6c29, mtpc_keyboardButtonRequestGeoLocation = 0xfc796b3f, mtpc_keyboardButtonSwitchInline = 0x568a748, + mtpc_keyboardButtonGame = 0x28fc3164, mtpc_keyboardButtonRow = 0x77608b83, mtpc_replyKeyboardHide = 0xa03e5b85, mtpc_replyKeyboardForceReply = 0xf4108aa0, @@ -638,7 +640,7 @@ enum { mtpc_messages_getMessageEditData = 0xfda68d36, mtpc_messages_editMessage = 0xce91e4ca, mtpc_messages_editInlineBotMessage = 0x130c2c85, - mtpc_messages_getBotCallbackAnswer = 0xa6e94f04, + mtpc_messages_getBotCallbackAnswer = 0x6c996518, mtpc_messages_setBotCallbackAnswer = 0xc927d44b, mtpc_messages_getPeerDialogs = 0x2d9776b9, mtpc_messages_saveDraft = 0xbc39e14b, @@ -650,6 +652,8 @@ enum { mtpc_messages_clearRecentStickers = 0xab02e5d2, mtpc_messages_getUnusedStickers = 0x4309d65b, mtpc_messages_getArchivedStickers = 0x906e241f, + mtpc_messages_setGameScore = 0xdfbc7c1f, + mtpc_messages_setInlineGameScore = 0x54f882f1, mtpc_updates_getState = 0xedd4882a, mtpc_updates_getDifference = 0xa041495, mtpc_updates_getChannelDifference = 0xbb32d7c0, @@ -893,6 +897,7 @@ class MTPDmessageActionChatJoinedByLink; class MTPDmessageActionChannelCreate; class MTPDmessageActionChatMigrateTo; class MTPDmessageActionChannelMigrateFrom; +class MTPDmessageActionGameScore; class MTPdialog; class MTPDdialog; @@ -1233,6 +1238,7 @@ class MTPDkeyboardButtonCallback; class MTPDkeyboardButtonRequestPhone; class MTPDkeyboardButtonRequestGeoLocation; class MTPDkeyboardButtonSwitchInline; +class MTPDkeyboardButtonGame; class MTPkeyboardButtonRow; class MTPDkeyboardButtonRow; @@ -3884,6 +3890,18 @@ public: return *(const MTPDmessageActionChannelMigrateFrom*)data; } + MTPDmessageActionGameScore &_messageActionGameScore() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionGameScore) throw mtpErrorWrongTypeId(_type, mtpc_messageActionGameScore); + split(); + return *(MTPDmessageActionGameScore*)data; + } + const MTPDmessageActionGameScore &c_messageActionGameScore() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messageActionGameScore) throw mtpErrorWrongTypeId(_type, mtpc_messageActionGameScore); + return *(const MTPDmessageActionGameScore*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -3902,6 +3920,7 @@ private: explicit MTPmessageAction(MTPDmessageActionChannelCreate *_data); explicit MTPmessageAction(MTPDmessageActionChatMigrateTo *_data); explicit MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data); + explicit MTPmessageAction(MTPDmessageActionGameScore *_data); friend class MTP::internal::TypeCreator; @@ -7885,6 +7904,18 @@ public: return *(const MTPDkeyboardButtonSwitchInline*)data; } + MTPDkeyboardButtonGame &_keyboardButtonGame() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_keyboardButtonGame) throw mtpErrorWrongTypeId(_type, mtpc_keyboardButtonGame); + split(); + return *(MTPDkeyboardButtonGame*)data; + } + const MTPDkeyboardButtonGame &c_keyboardButtonGame() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_keyboardButtonGame) throw mtpErrorWrongTypeId(_type, mtpc_keyboardButtonGame); + return *(const MTPDkeyboardButtonGame*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -7900,6 +7931,7 @@ private: explicit MTPkeyboardButton(MTPDkeyboardButtonRequestPhone *_data); explicit MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation *_data); explicit MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data); + explicit MTPkeyboardButton(MTPDkeyboardButtonGame *_data); friend class MTP::internal::TypeCreator; @@ -11142,6 +11174,17 @@ public: MTPint vchat_id; }; +class MTPDmessageActionGameScore : public mtpDataImpl { +public: + MTPDmessageActionGameScore() { + } + MTPDmessageActionGameScore(MTPint _game_id, MTPint _score) : vgame_id(_game_id), vscore(_score) { + } + + MTPint vgame_id; + MTPint vscore; +}; + class MTPDdialog : public mtpDataImpl { public: enum class Flag : int32 { @@ -12196,16 +12239,30 @@ public: class MTPDupdateBotCallbackQuery : public mtpDataImpl { public: + enum class Flag : int32 { + f_data = (1 << 0), + f_game_id = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_data() const { return vflags.v & Flag::f_data; } + bool has_game_id() const { return vflags.v & Flag::f_game_id; } + MTPDupdateBotCallbackQuery() { } - MTPDupdateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : vquery_id(_query_id), vuser_id(_user_id), vpeer(_peer), vmsg_id(_msg_id), vdata(_data) { + MTPDupdateBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data, MTPint _game_id) : vflags(_flags), vquery_id(_query_id), vuser_id(_user_id), vpeer(_peer), vmsg_id(_msg_id), vdata(_data), vgame_id(_game_id) { } + MTPflags vflags; MTPlong vquery_id; MTPint vuser_id; MTPPeer vpeer; MTPint vmsg_id; MTPbytes vdata; + MTPint vgame_id; }; class MTPDupdateEditMessage : public mtpDataImpl { @@ -12222,15 +12279,29 @@ public: class MTPDupdateInlineBotCallbackQuery : public mtpDataImpl { public: + enum class Flag : int32 { + f_data = (1 << 0), + f_game_id = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_data() const { return vflags.v & Flag::f_data; } + bool has_game_id() const { return vflags.v & Flag::f_game_id; } + MTPDupdateInlineBotCallbackQuery() { } - MTPDupdateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) : vquery_id(_query_id), vuser_id(_user_id), vmsg_id(_msg_id), vdata(_data) { + MTPDupdateInlineBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data, MTPint _game_id) : vflags(_flags), vquery_id(_query_id), vuser_id(_user_id), vmsg_id(_msg_id), vdata(_data), vgame_id(_game_id) { } + MTPflags vflags; MTPlong vquery_id; MTPint vuser_id; MTPInputBotInlineMessageID vmsg_id; MTPbytes vdata; + MTPint vgame_id; }; class MTPDupdateReadChannelOutbox : public mtpDataImpl { @@ -13525,6 +13596,19 @@ public: MTPstring vquery; }; +class MTPDkeyboardButtonGame : public mtpDataImpl { +public: + MTPDkeyboardButtonGame() { + } + MTPDkeyboardButtonGame(const MTPstring &_text, const MTPstring &_game_title, MTPint _game_id, const MTPstring &_start_param) : vtext(_text), vgame_title(_game_title), vgame_id(_game_id), vstart_param(_start_param) { + } + + MTPstring vtext; + MTPstring vgame_title; + MTPint vgame_id; + MTPstring vstart_param; +}; + class MTPDkeyboardButtonRow : public mtpDataImpl { public: MTPDkeyboardButtonRow() { @@ -18363,14 +18447,16 @@ public: enum class Flag : int32 { f_silent = (1 << 5), f_background = (1 << 6), + f_with_my_score = (1 << 8), - MAX_FIELD = (1 << 6), + MAX_FIELD = (1 << 8), }; Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } bool is_silent() const { return vflags.v & Flag::f_silent; } bool is_background() const { return vflags.v & Flag::f_background; } + bool is_with_my_score() const { return vflags.v & Flag::f_with_my_score; } MTPflags vflags; MTPInputPeer vfrom_peer; @@ -20575,37 +20661,57 @@ public: class MTPmessages_getBotCallbackAnswer { // RPC method 'messages.getBotCallbackAnswer' public: + enum class Flag : int32 { + f_data = (1 << 0), + f_game_id = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_data() const { return vflags.v & Flag::f_data; } + bool has_game_id() const { return vflags.v & Flag::f_game_id; } + + MTPflags vflags; MTPInputPeer vpeer; MTPint vmsg_id; MTPbytes vdata; + MTPint vgame_id; MTPmessages_getBotCallbackAnswer() { } MTPmessages_getBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) { read(from, end, cons); } - MTPmessages_getBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : vpeer(_peer), vmsg_id(_msg_id), vdata(_data) { + MTPmessages_getBotCallbackAnswer(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data, MTPint _game_id) : vflags(_flags), vpeer(_peer), vmsg_id(_msg_id), vdata(_data), vgame_id(_game_id) { } uint32 innerLength() const { - return vpeer.innerLength() + vmsg_id.innerLength() + vdata.innerLength(); + return vflags.innerLength() + vpeer.innerLength() + vmsg_id.innerLength() + (has_data() ? vdata.innerLength() : 0) + (has_game_id() ? vgame_id.innerLength() : 0); } mtpTypeId type() const { return mtpc_messages_getBotCallbackAnswer; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) { + vflags.read(from, end); vpeer.read(from, end); vmsg_id.read(from, end); - vdata.read(from, end); + if (has_data()) { vdata.read(from, end); } else { vdata = MTPbytes(); } + if (has_game_id()) { vgame_id.read(from, end); } else { vgame_id = MTPint(); } } void write(mtpBuffer &to) const { + vflags.write(to); vpeer.write(to); vmsg_id.write(to); - vdata.write(to); + if (has_data()) vdata.write(to); + if (has_game_id()) vgame_id.write(to); } typedef MTPmessages_BotCallbackAnswer ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_getBotCallbackAnswer::Flags) + class MTPmessages_GetBotCallbackAnswer : public MTPBoxed { public: MTPmessages_GetBotCallbackAnswer() { @@ -20614,7 +20720,7 @@ public: } MTPmessages_GetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_GetBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : MTPBoxed(MTPmessages_getBotCallbackAnswer(_peer, _msg_id, _data)) { + MTPmessages_GetBotCallbackAnswer(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data, MTPint _game_id) : MTPBoxed(MTPmessages_getBotCallbackAnswer(_flags, _peer, _msg_id, _data, _game_id)) { } }; @@ -21082,6 +21188,133 @@ public: } }; +class MTPmessages_setGameScore { // RPC method 'messages.setGameScore' +public: + enum class Flag : int32 { + f_edit_message = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_edit_message() const { return vflags.v & Flag::f_edit_message; } + + MTPflags vflags; + MTPInputPeer vpeer; + MTPint vid; + MTPInputUser vuser_id; + MTPint vgame_id; + MTPint vscore; + + MTPmessages_setGameScore() { + } + MTPmessages_setGameScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setGameScore) { + read(from, end, cons); + } + MTPmessages_setGameScore(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPInputUser &_user_id, MTPint _game_id, MTPint _score) : vflags(_flags), vpeer(_peer), vid(_id), vuser_id(_user_id), vgame_id(_game_id), vscore(_score) { + } + + uint32 innerLength() const { + return vflags.innerLength() + vpeer.innerLength() + vid.innerLength() + vuser_id.innerLength() + vgame_id.innerLength() + vscore.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_setGameScore; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setGameScore) { + vflags.read(from, end); + vpeer.read(from, end); + vid.read(from, end); + vuser_id.read(from, end); + vgame_id.read(from, end); + vscore.read(from, end); + } + void write(mtpBuffer &to) const { + vflags.write(to); + vpeer.write(to); + vid.write(to); + vuser_id.write(to); + vgame_id.write(to); + vscore.write(to); + } + + typedef MTPUpdates ResponseType; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_setGameScore::Flags) + +class MTPmessages_SetGameScore : public MTPBoxed { +public: + MTPmessages_SetGameScore() { + } + MTPmessages_SetGameScore(const MTPmessages_setGameScore &v) : MTPBoxed(v) { + } + MTPmessages_SetGameScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_SetGameScore(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPInputUser &_user_id, MTPint _game_id, MTPint _score) : MTPBoxed(MTPmessages_setGameScore(_flags, _peer, _id, _user_id, _game_id, _score)) { + } +}; + +class MTPmessages_setInlineGameScore { // RPC method 'messages.setInlineGameScore' +public: + enum class Flag : int32 { + f_edit_message = (1 << 0), + MAX_FIELD = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_edit_message() const { return vflags.v & Flag::f_edit_message; } + + MTPflags vflags; + MTPInputBotInlineMessageID vid; + MTPInputUser vuser_id; + MTPint vgame_id; + MTPint vscore; + + MTPmessages_setInlineGameScore() { + } + MTPmessages_setInlineGameScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setInlineGameScore) { + read(from, end, cons); + } + MTPmessages_setInlineGameScore(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPInputUser &_user_id, MTPint _game_id, MTPint _score) : vflags(_flags), vid(_id), vuser_id(_user_id), vgame_id(_game_id), vscore(_score) { + } + + uint32 innerLength() const { + return vflags.innerLength() + vid.innerLength() + vuser_id.innerLength() + vgame_id.innerLength() + vscore.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_setInlineGameScore; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setInlineGameScore) { + vflags.read(from, end); + vid.read(from, end); + vuser_id.read(from, end); + vgame_id.read(from, end); + vscore.read(from, end); + } + void write(mtpBuffer &to) const { + vflags.write(to); + vid.write(to); + vuser_id.write(to); + vgame_id.write(to); + vscore.write(to); + } + + typedef MTPBool ResponseType; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_setInlineGameScore::Flags) + +class MTPmessages_SetInlineGameScore : public MTPBoxed { +public: + MTPmessages_SetInlineGameScore() { + } + MTPmessages_SetInlineGameScore(const MTPmessages_setInlineGameScore &v) : MTPBoxed(v) { + } + MTPmessages_SetInlineGameScore(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_SetInlineGameScore(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPInputUser &_user_id, MTPint _game_id, MTPint _score) : MTPBoxed(MTPmessages_setInlineGameScore(_flags, _id, _user_id, _game_id, _score)) { + } +}; + class MTPupdates_getState { // RPC method 'updates.getState' public: MTPupdates_getState() { @@ -23333,6 +23566,9 @@ public: inline static MTPmessageAction new_messageActionHistoryClear() { return MTPmessageAction(mtpc_messageActionHistoryClear); } + inline static MTPmessageAction new_messageActionGameScore(MTPint _game_id, MTPint _score) { + return MTPmessageAction(new MTPDmessageActionGameScore(_game_id, _score)); + } inline static MTPdialog new_dialog(const MTPflags &_flags, const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts, const MTPDraftMessage &_draft) { return MTPdialog(new MTPDdialog(_flags, _peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings, _pts, _draft)); } @@ -23645,14 +23881,14 @@ public: inline static MTPupdate new_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id)); } - inline static MTPupdate new_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) { - return MTPupdate(new MTPDupdateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _data)); + inline static MTPupdate new_updateBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data, MTPint _game_id) { + return MTPupdate(new MTPDupdateBotCallbackQuery(_flags, _query_id, _user_id, _peer, _msg_id, _data, _game_id)); } inline static MTPupdate new_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTPupdate(new MTPDupdateEditMessage(_message, _pts, _pts_count)); } - inline static MTPupdate new_updateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { - return MTPupdate(new MTPDupdateInlineBotCallbackQuery(_query_id, _user_id, _msg_id, _data)); + inline static MTPupdate new_updateInlineBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data, MTPint _game_id) { + return MTPupdate(new MTPDupdateInlineBotCallbackQuery(_flags, _query_id, _user_id, _msg_id, _data, _game_id)); } inline static MTPupdate new_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) { return MTPupdate(new MTPDupdateReadChannelOutbox(_channel_id, _max_id)); @@ -24038,6 +24274,9 @@ public: inline static MTPkeyboardButton new_keyboardButtonSwitchInline(const MTPflags &_flags, const MTPstring &_text, const MTPstring &_query) { return MTPkeyboardButton(new MTPDkeyboardButtonSwitchInline(_flags, _text, _query)); } + inline static MTPkeyboardButton new_keyboardButtonGame(const MTPstring &_text, const MTPstring &_game_title, MTPint _game_id, const MTPstring &_start_param) { + return MTPkeyboardButton(new MTPDkeyboardButtonGame(_text, _game_title, _game_id, _start_param)); + } inline static MTPkeyboardButtonRow new_keyboardButtonRow(const MTPVector &_buttons) { return MTPkeyboardButtonRow(new MTPDkeyboardButtonRow(_buttons)); } @@ -27461,6 +27700,10 @@ inline uint32 MTPmessageAction::innerLength() const { const MTPDmessageActionChannelMigrateFrom &v(c_messageActionChannelMigrateFrom()); return v.vtitle.innerLength() + v.vchat_id.innerLength(); } + case mtpc_messageActionGameScore: { + const MTPDmessageActionGameScore &v(c_messageActionGameScore()); + return v.vgame_id.innerLength() + v.vscore.innerLength(); + } } return 0; } @@ -27522,6 +27765,12 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m } break; case mtpc_messageActionPinMessage: _type = cons; break; case mtpc_messageActionHistoryClear: _type = cons; break; + case mtpc_messageActionGameScore: _type = cons; { + if (!data) setData(new MTPDmessageActionGameScore()); + MTPDmessageActionGameScore &v(_messageActionGameScore()); + v.vgame_id.read(from, end); + v.vscore.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPmessageAction"); } } @@ -27565,6 +27814,11 @@ inline void MTPmessageAction::write(mtpBuffer &to) const { v.vtitle.write(to); v.vchat_id.write(to); } break; + case mtpc_messageActionGameScore: { + const MTPDmessageActionGameScore &v(c_messageActionGameScore()); + v.vgame_id.write(to); + v.vscore.write(to); + } break; } } inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -27582,6 +27836,7 @@ inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _ty case mtpc_messageActionChannelMigrateFrom: setData(new MTPDmessageActionChannelMigrateFrom()); break; case mtpc_messageActionPinMessage: break; case mtpc_messageActionHistoryClear: break; + case mtpc_messageActionGameScore: setData(new MTPDmessageActionGameScore()); break; default: throw mtpErrorBadTypeId(type, "MTPmessageAction"); } } @@ -27603,6 +27858,8 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatMigrateTo *_data) } inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChannelMigrateFrom) { } +inline MTPmessageAction::MTPmessageAction(MTPDmessageActionGameScore *_data) : mtpDataOwner(_data), _type(mtpc_messageActionGameScore) { +} inline MTPmessageAction MTP_messageActionEmpty() { return MTP::internal::TypeCreator::new_messageActionEmpty(); } @@ -27642,6 +27899,9 @@ inline MTPmessageAction MTP_messageActionPinMessage() { inline MTPmessageAction MTP_messageActionHistoryClear() { return MTP::internal::TypeCreator::new_messageActionHistoryClear(); } +inline MTPmessageAction MTP_messageActionGameScore(MTPint _game_id, MTPint _score) { + return MTP::internal::TypeCreator::new_messageActionGameScore(_game_id, _score); +} inline MTPdialog::MTPdialog() : mtpDataOwner(new MTPDdialog()) { } @@ -29249,7 +29509,7 @@ inline uint32 MTPupdate::innerLength() const { } case mtpc_updateBotCallbackQuery: { const MTPDupdateBotCallbackQuery &v(c_updateBotCallbackQuery()); - return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vpeer.innerLength() + v.vmsg_id.innerLength() + v.vdata.innerLength(); + return v.vflags.innerLength() + v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vpeer.innerLength() + v.vmsg_id.innerLength() + (v.has_data() ? v.vdata.innerLength() : 0) + (v.has_game_id() ? v.vgame_id.innerLength() : 0); } case mtpc_updateEditMessage: { const MTPDupdateEditMessage &v(c_updateEditMessage()); @@ -29257,7 +29517,7 @@ inline uint32 MTPupdate::innerLength() const { } case mtpc_updateInlineBotCallbackQuery: { const MTPDupdateInlineBotCallbackQuery &v(c_updateInlineBotCallbackQuery()); - return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vmsg_id.innerLength() + v.vdata.innerLength(); + return v.vflags.innerLength() + v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vmsg_id.innerLength() + (v.has_data() ? v.vdata.innerLength() : 0) + (v.has_game_id() ? v.vgame_id.innerLength() : 0); } case mtpc_updateReadChannelOutbox: { const MTPDupdateReadChannelOutbox &v(c_updateReadChannelOutbox()); @@ -29568,11 +29828,13 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI case mtpc_updateBotCallbackQuery: _type = cons; { if (!data) setData(new MTPDupdateBotCallbackQuery()); MTPDupdateBotCallbackQuery &v(_updateBotCallbackQuery()); + v.vflags.read(from, end); v.vquery_id.read(from, end); v.vuser_id.read(from, end); v.vpeer.read(from, end); v.vmsg_id.read(from, end); - v.vdata.read(from, end); + if (v.has_data()) { v.vdata.read(from, end); } else { v.vdata = MTPbytes(); } + if (v.has_game_id()) { v.vgame_id.read(from, end); } else { v.vgame_id = MTPint(); } } break; case mtpc_updateEditMessage: _type = cons; { if (!data) setData(new MTPDupdateEditMessage()); @@ -29584,10 +29846,12 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI case mtpc_updateInlineBotCallbackQuery: _type = cons; { if (!data) setData(new MTPDupdateInlineBotCallbackQuery()); MTPDupdateInlineBotCallbackQuery &v(_updateInlineBotCallbackQuery()); + v.vflags.read(from, end); v.vquery_id.read(from, end); v.vuser_id.read(from, end); v.vmsg_id.read(from, end); - v.vdata.read(from, end); + if (v.has_data()) { v.vdata.read(from, end); } else { v.vdata = MTPbytes(); } + if (v.has_game_id()) { v.vgame_id.read(from, end); } else { v.vgame_id = MTPint(); } } break; case mtpc_updateReadChannelOutbox: _type = cons; { if (!data) setData(new MTPDupdateReadChannelOutbox()); @@ -29856,11 +30120,13 @@ inline void MTPupdate::write(mtpBuffer &to) const { } break; case mtpc_updateBotCallbackQuery: { const MTPDupdateBotCallbackQuery &v(c_updateBotCallbackQuery()); + v.vflags.write(to); v.vquery_id.write(to); v.vuser_id.write(to); v.vpeer.write(to); v.vmsg_id.write(to); - v.vdata.write(to); + if (v.has_data()) v.vdata.write(to); + if (v.has_game_id()) v.vgame_id.write(to); } break; case mtpc_updateEditMessage: { const MTPDupdateEditMessage &v(c_updateEditMessage()); @@ -29870,10 +30136,12 @@ inline void MTPupdate::write(mtpBuffer &to) const { } break; case mtpc_updateInlineBotCallbackQuery: { const MTPDupdateInlineBotCallbackQuery &v(c_updateInlineBotCallbackQuery()); + v.vflags.write(to); v.vquery_id.write(to); v.vuser_id.write(to); v.vmsg_id.write(to); - v.vdata.write(to); + if (v.has_data()) v.vdata.write(to); + if (v.has_game_id()) v.vgame_id.write(to); } break; case mtpc_updateReadChannelOutbox: { const MTPDupdateReadChannelOutbox &v(c_updateReadChannelOutbox()); @@ -30174,14 +30442,16 @@ inline MTPupdate MTP_updateEditChannelMessage(const MTPMessage &_message, MTPint inline MTPupdate MTP_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { return MTP::internal::TypeCreator::new_updateChannelPinnedMessage(_channel_id, _id); } -inline MTPupdate MTP_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) { - return MTP::internal::TypeCreator::new_updateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _data); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateBotCallbackQuery::Flags) +inline MTPupdate MTP_updateBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data, MTPint _game_id) { + return MTP::internal::TypeCreator::new_updateBotCallbackQuery(_flags, _query_id, _user_id, _peer, _msg_id, _data, _game_id); } inline MTPupdate MTP_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_updateEditMessage(_message, _pts, _pts_count); } -inline MTPupdate MTP_updateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { - return MTP::internal::TypeCreator::new_updateInlineBotCallbackQuery(_query_id, _user_id, _msg_id, _data); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateInlineBotCallbackQuery::Flags) +inline MTPupdate MTP_updateInlineBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data, MTPint _game_id) { + return MTP::internal::TypeCreator::new_updateInlineBotCallbackQuery(_flags, _query_id, _user_id, _msg_id, _data, _game_id); } inline MTPupdate MTP_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id) { return MTP::internal::TypeCreator::new_updateReadChannelOutbox(_channel_id, _max_id); @@ -33224,6 +33494,10 @@ inline uint32 MTPkeyboardButton::innerLength() const { const MTPDkeyboardButtonSwitchInline &v(c_keyboardButtonSwitchInline()); return v.vflags.innerLength() + v.vtext.innerLength() + v.vquery.innerLength(); } + case mtpc_keyboardButtonGame: { + const MTPDkeyboardButtonGame &v(c_keyboardButtonGame()); + return v.vtext.innerLength() + v.vgame_title.innerLength() + v.vgame_id.innerLength() + v.vstart_param.innerLength(); + } } return 0; } @@ -33268,6 +33542,14 @@ inline void MTPkeyboardButton::read(const mtpPrime *&from, const mtpPrime *end, v.vtext.read(from, end); v.vquery.read(from, end); } break; + case mtpc_keyboardButtonGame: _type = cons; { + if (!data) setData(new MTPDkeyboardButtonGame()); + MTPDkeyboardButtonGame &v(_keyboardButtonGame()); + v.vtext.read(from, end); + v.vgame_title.read(from, end); + v.vgame_id.read(from, end); + v.vstart_param.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPkeyboardButton"); } } @@ -33301,6 +33583,13 @@ inline void MTPkeyboardButton::write(mtpBuffer &to) const { v.vtext.write(to); v.vquery.write(to); } break; + case mtpc_keyboardButtonGame: { + const MTPDkeyboardButtonGame &v(c_keyboardButtonGame()); + v.vtext.write(to); + v.vgame_title.write(to); + v.vgame_id.write(to); + v.vstart_param.write(to); + } break; } } inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -33311,6 +33600,7 @@ inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(0), _ case mtpc_keyboardButtonRequestPhone: setData(new MTPDkeyboardButtonRequestPhone()); break; case mtpc_keyboardButtonRequestGeoLocation: setData(new MTPDkeyboardButtonRequestGeoLocation()); break; case mtpc_keyboardButtonSwitchInline: setData(new MTPDkeyboardButtonSwitchInline()); break; + case mtpc_keyboardButtonGame: setData(new MTPDkeyboardButtonGame()); break; default: throw mtpErrorBadTypeId(type, "MTPkeyboardButton"); } } @@ -33326,6 +33616,8 @@ inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation } inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonSwitchInline) { } +inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonGame *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonGame) { +} inline MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text) { return MTP::internal::TypeCreator::new_keyboardButton(_text); } @@ -33345,6 +33637,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDkeyboardButtonSwitchInline::Flags) inline MTPkeyboardButton MTP_keyboardButtonSwitchInline(const MTPflags &_flags, const MTPstring &_text, const MTPstring &_query) { return MTP::internal::TypeCreator::new_keyboardButtonSwitchInline(_flags, _text, _query); } +inline MTPkeyboardButton MTP_keyboardButtonGame(const MTPstring &_text, const MTPstring &_game_title, MTPint _game_id, const MTPstring &_start_param) { + return MTP::internal::TypeCreator::new_keyboardButtonGame(_text, _game_title, _game_id, _start_param); +} inline MTPkeyboardButtonRow::MTPkeyboardButtonRow() : mtpDataOwner(new MTPDkeyboardButtonRow()) { }