diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index a3ca3af67..fbc893d8d 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -636,6 +636,8 @@ PRIVATE history/history_item.h history/history_item_components.cpp history/history_item_components.h + history/history_item_reply_markup.cpp + history/history_item_reply_markup.h history/history_item_text.cpp history/history_item_text.h history/history_inner_widget.cpp diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp index 554c54734..ad8743b6a 100644 --- a/Telegram/SourceFiles/api/api_sending.cpp +++ b/Telegram/SourceFiles/api/api_sending.cpp @@ -128,7 +128,7 @@ void SendExistingMedia( messagePostAuthor, media, caption, - MTPReplyMarkup()); + HistoryMessageMarkupData()); auto performRequest = [=](const auto &repeatRequest) -> void { auto &histories = history->owner().histories(); @@ -288,7 +288,7 @@ bool SendDice(Api::MessageToSend &message) { messagePostAuthor, TextWithEntities(), MTP_messageMediaDice(MTP_int(0), MTP_string(emoji)), - MTPReplyMarkup()); + HistoryMessageMarkupData()); const auto requestType = Data::Histories::RequestType::Send; histories.sendRequest(history, requestType, [=](Fn finish) { @@ -471,7 +471,7 @@ void SendConfirmedFile( messagePostAuthor, caption, media, - MTPReplyMarkup(), + HistoryMessageMarkupData(), groupId); } diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 154eb436e..a53718bb4 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3839,7 +3839,7 @@ void ApiWrap::sendSharedContact( MTP_string(lastName), MTP_string(), // vcard MTP_long(userId.bare)), - MTPReplyMarkup()); + HistoryMessageMarkupData()); const auto media = MTP_inputMediaContact( MTP_string(phone), @@ -4103,7 +4103,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) { messagePostAuthor, sending, media, - MTPReplyMarkup()); + HistoryMessageMarkupData()); histories.sendRequest(history, requestType, [=](Fn finish) { history->sendRequestId = request(MTPmessages_SendMessage( MTP_flags(sendFlags), diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index 1285000b9..64e82a007 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -304,7 +304,7 @@ bool ServiceCheck::checkRippleStartPosition(QPoint position) const { QString(), TextWithEntities{ TextUtilities::Clean(text) }, MTP_messageMediaEmpty(), - MTPReplyMarkup(), + HistoryMessageMarkupData(), groupedId); return AdminLog::OwnedItem(delegate, item); } diff --git a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp index 4fd649683..061ffec71 100644 --- a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp +++ b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp @@ -199,9 +199,9 @@ bool BotKeyboard::moderateKeyActivate(int key) { if (const auto markup = item->Get()) { if (key >= Qt::Key_1 && key <= Qt::Key_2) { const auto index = int(key - Qt::Key_1); - if (!markup->rows.empty() + if (!markup->data.rows.empty() && index >= 0 - && index < int(markup->rows.front().size())) { + && index < int(markup->data.rows.front().size())) { App::activateBotCommand(_controller, item, 0, index); return true; } @@ -257,14 +257,14 @@ bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) { _singleUse = _forceReply || (markupFlags & ReplyMarkupFlag::SingleUse); if (const auto markup = to->Get()) { - _placeholder = markup->placeholder; + _placeholder = markup->data.placeholder; } else { _placeholder = QString(); } _impl = nullptr; if (auto markup = to->Get()) { - if (!markup->rows.empty()) { + if (!markup->data.rows.empty()) { _impl = std::make_unique( to, std::make_unique