diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 8b7f98853..38180bfd1 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -690,7 +690,7 @@ AppClass::AppClass() : QObject() cSetLang(languageDefault); } } else if (cLang() > languageDefault && cLang() < languageCount) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[cLang()] + qsl(".strings")); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[cLang()].c_str() + qsl(".strings")); if (!loader.errors().isEmpty()) { LOG(("Lang load errors: %1").arg(loader.errors())); } else if (!loader.warnings().isEmpty()) { diff --git a/Telegram/SourceFiles/basic_types.h b/Telegram/SourceFiles/basic_types.h index c2038dee4..6086b4dad 100644 --- a/Telegram/SourceFiles/basic_types.h +++ b/Telegram/SourceFiles/basic_types.h @@ -194,6 +194,31 @@ T *SharedMemoryLocation() { return reinterpret_cast(_SharedMemoryLocation + N); } +// see https://github.com/boostcon/cppnow_presentations_2012/blob/master/wed/schurr_cpp11_tools_for_class_authors.pdf +class str_const { // constexpr string +public: + template + constexpr str_const(const char(&a)[N]) : _str(a), _size(N - 1) { + } + constexpr char operator[](std::size_t n) const { + return (n < _size) ? _str[n] : + throw std::out_of_range(""); + } + constexpr std::size_t size() const { return _size; } + const char *c_str() const { return _str; } + +private: + const char* const _str; + const std::size_t _size; + +}; + +template +inline void accumulate_max(T &a, const T &b) { if (a < b) a = b; } + +template +inline void accumulate_min(T &a, const T &b) { if (a > b) a = b; } + #ifdef Q_OS_WIN typedef float float32; typedef double float64; diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 87e01f6a3..da41b067e 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -139,7 +139,7 @@ void AboutBox::dropEvent(QDropEvent *e) { QString telegramFaqLink() { QString result = qsl("https://telegram.org/faq"); if (cLang() > languageDefault && cLang() < languageCount) { - const char *code = LanguageCodes[cLang()]; + const char *code = LanguageCodes[cLang()].c_str(); if (qstr("de") == code || qstr("es") == code || qstr("it") == code || qstr("ko") == code) { result += qsl("/") + code; } else if (qstr("pt_BR") == code) { diff --git a/Telegram/SourceFiles/boxes/languagebox.cpp b/Telegram/SourceFiles/boxes/languagebox.cpp index f6e7daf2f..9400077e6 100644 --- a/Telegram/SourceFiles/boxes/languagebox.cpp +++ b/Telegram/SourceFiles/boxes/languagebox.cpp @@ -46,12 +46,12 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) { for (int32 i = 0; i < languageCount; ++i) { LangLoaderResult result; if (i) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lng_language_name)); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i].c_str() + qsl(".strings"), LangLoaderRequest(lng_language_name)); result = loader.found(); } else { result.insert(lng_language_name, langOriginal(lng_language_name)); } - _langs.push_back(new Radiobutton(this, qsl("lang"), i, result.value(lng_language_name, LanguageCodes[i] + qsl(" language")), (cLang() == i), st::langsButton)); + _langs.push_back(new Radiobutton(this, qsl("lang"), i, result.value(lng_language_name, LanguageCodes[i].c_str() + qsl(" language")), (cLang() == i), st::langsButton)); _langs.back()->move(st::boxPadding.left() + st::boxOptionListPadding.left(), y); y += _langs.back()->height() + st::boxOptionListPadding.top(); connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); @@ -82,14 +82,14 @@ void LanguageBox::showAll() { void LanguageBox::mousePressEvent(QMouseEvent *e) { if ((e->modifiers() & Qt::CTRL) && (e->modifiers() & Qt::ALT) && (e->modifiers() & Qt::SHIFT)) { for (int32 i = 1; i < languageCount; ++i) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lngkeys_cnt)); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i].c_str() + qsl(".strings"), LangLoaderRequest(lngkeys_cnt)); if (!loader.errors().isEmpty()) { - Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" error :(\n\nError: ") + loader.errors())); + Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i].c_str() + qsl("\" error :(\n\nError: ") + loader.errors())); return; } else if (!loader.warnings().isEmpty()) { QString warn = loader.warnings(); if (warn.size() > 256) warn = warn.mid(0, 253) + qsl("..."); - Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" warnings :(\n\nWarnings: ") + warn)); + Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i].c_str() + qsl("\" warnings :(\n\nWarnings: ") + warn)); return; } } @@ -112,7 +112,7 @@ void LanguageBox::onChange() { if (_langs[i]->checked() && langId != cLang()) { LangLoaderResult result; if (langId > 0) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok)); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId].c_str() + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok)); result = loader.found(); } else if (langId == languageTest) { LangLoaderPlain loader(cLangFile(), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok)); diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp index a24155c86..adde2f004 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.cpp +++ b/Telegram/SourceFiles/boxes/photosendbox.cpp @@ -656,7 +656,7 @@ void EditCaptionBox::onSave(bool ctrlShiftEnter) { if (!sentEntities.c_vector().v.isEmpty()) { flags |= MTPmessages_EditMessage::Flag::f_entities; } - _saveRequestId = MTP::send(MTPmessages_EditMessage(MTP_flags(flags), item->history()->peer->input, MTP_int(item->id), MTP_string(_field->getLastText()), sentEntities, MTPnullMarkup), rpcDone(&EditCaptionBox::saveDone), rpcFail(&EditCaptionBox::saveFail)); + _saveRequestId = MTP::send(MTPmessages_EditMessage(MTP_flags(flags), item->history()->peer->input, MTP_int(item->id), MTP_string(_field->getLastText()), MTPnullMarkup, sentEntities), rpcDone(&EditCaptionBox::saveDone), rpcFail(&EditCaptionBox::saveFail)); } void EditCaptionBox::saveDone(const MTPUpdates &updates) { diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index de1c3d9da..4c42ab32a 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -3629,7 +3629,7 @@ void EmojiPan::inlineBotChanged() { Notify::inlineBotRequesting(false); } -#include + void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { _inlineRequestId = 0; Notify::inlineBotRequesting(false); @@ -3638,7 +3638,7 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { bool adding = (it != _inlineCache.cend()); if (result.type() == mtpc_messages_botResults) { - const MTPDmessages_botResults &d(result.c_messages_botResults()); + const auto &d(result.c_messages_botResults()); const QVector &v(d.vresults.c_vector().v); uint64 queryId(d.vquery_id.v); @@ -3646,13 +3646,18 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { it = _inlineCache.insert(_inlineQuery, new InlineCacheEntry()); } it.value()->nextOffset = qs(d.vnext_offset); + if (d.has_switch_pm() && d.vswitch_pm.type() == mtpc_inlineBotSwitchPM) { + const auto &switchPm = d.vswitch_pm.c_inlineBotSwitchPM(); + it.value()->switchPmText = qs(switchPm.vtext); + it.value()->switchPmStartParam = qs(switchPm.vstart_param); + } - int32 count = v.size(), added = 0; - if (count) { + if (int count = v.size()) { it.value()->results.reserve(it.value()->results.size() + count); } - for (int32 i = 0; i < count; ++i) { - if (UniquePointer result = InlineBots::Result::create(queryId, v.at(i))) { + int added = 0; + for_const (const MTPBotInlineResult &res, v) { + if (UniquePointer result = InlineBots::Result::create(queryId, res)) { ++added; it.value()->results.push_back(result.release()); } diff --git a/Telegram/SourceFiles/dropdown.h b/Telegram/SourceFiles/dropdown.h index 8eae0f42b..5089967cf 100644 --- a/Telegram/SourceFiles/dropdown.h +++ b/Telegram/SourceFiles/dropdown.h @@ -166,8 +166,8 @@ class Result; namespace internal { -static constexpr int InlineItemsMaxPerRow = 5; -static constexpr int EmojiColorsCount = 5; +constexpr int InlineItemsMaxPerRow = 5; +constexpr int EmojiColorsCount = 5; using InlineResult = InlineBots::Result; using InlineResults = QList; @@ -710,6 +710,7 @@ private: clearResults(); } QString nextOffset; + QString switchPmText, switchPmStartParam; internal::InlineResults results; void clearResults(); }; diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index c98bedf48..6bea64693 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -3044,6 +3044,10 @@ void HistoryMessageReplyMarkup::createFromButtonRows(const QVectorhasBubble(); - int32 tw = convertScale(_data->full->width()), th = convertScale(_data->full->height()); + int tw = convertScale(_data->full->width()), th = convertScale(_data->full->height()); if (tw > st::maxMediaSize) { th = (st::maxMediaSize * th) / tw; tw = st::maxMediaSize; @@ -3667,14 +3671,14 @@ int32 HistoryPhoto::resize(int32 width, const HistoryItem *parent) { if (_pixw < 1) _pixw = 1; if (_pixh < 1) _pixh = 1; - int32 minWidth = qMax(st::minPhotoSize, parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + int minWidth = qMax(st::minPhotoSize, parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); _width = qMax(_pixw, int16(minWidth)); _height = qMax(_pixh, int16(st::minPhotoSize)); if (bubble) { _width += st::mediaPadding.left() + st::mediaPadding.right(); _height += st::mediaPadding.top() + st::mediaPadding.bottom(); if (!_caption.isEmpty()) { - int32 captionw = _width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = _width - st::msgPadding.left() - st::msgPadding.right(); _height += st::mediaCaptionSkip + _caption.countHeight(captionw) + st::msgPadding.bottom(); } } @@ -3688,11 +3692,11 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, const QRect &r, b bool loaded = _data->loaded(), displayLoading = _data->displayLoading(); bool notChild = (parent->getMedia() == this); - int32 skipx = 0, skipy = 0, width = _width, height = _height; + int skipx = 0, skipy = 0, width = _width, height = _height; bool bubble = parent->hasBubble(); bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; - int32 captionw = width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = width - st::msgPadding.left() - st::msgPadding.right(); if (displayLoading) { ensureAnimation(parent); @@ -3782,16 +3786,16 @@ void HistoryPhoto::draw(Painter &p, const HistoryItem *parent, const QRect &r, b } } -void HistoryPhoto::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const { +void HistoryPhoto::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const { if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return; - int32 skipx = 0, skipy = 0, width = _width, height = _height; + int skipx = 0, skipy = 0, width = _width, height = _height; bool bubble = parent->hasBubble(); if (bubble) { skipx = st::mediaPadding.left(); skipy = st::mediaPadding.top(); if (!_caption.isEmpty()) { - int32 captionw = width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = width - st::msgPadding.left() - st::msgPadding.right(); height -= _caption.countHeight(captionw) + st::msgPadding.bottom(); if (x >= st::msgPadding.left() && y >= height && x < st::msgPadding.left() + captionw && y < _height) { bool inText = false; @@ -3953,10 +3957,10 @@ void HistoryVideo::initDimensions(const HistoryItem *parent) { } } -int32 HistoryVideo::resize(int32 width, const HistoryItem *parent) { +int HistoryVideo::resizeGetHeight(int width, const HistoryItem *parent) { bool bubble = parent->hasBubble(); - int32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height()); + int tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height()); if (!tw || !th) { tw = th = 1; } @@ -3977,15 +3981,15 @@ int32 HistoryVideo::resize(int32 width, const HistoryItem *parent) { } _thumbw = qMax(tw, 1); - int32 minWidth = qMax(st::minPhotoSize, parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); - minWidth = qMax(minWidth, documentMaxStatusWidth(_data) + 2 * int32(st::msgDateImgDelta + st::msgDateImgPadding.x())); - _width = qMax(_thumbw, int32(minWidth)); - _height = qMax(th, int32(st::minPhotoSize)); + int minWidth = qMax(st::minPhotoSize, parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + minWidth = qMax(minWidth, documentMaxStatusWidth(_data) + 2 * int(st::msgDateImgDelta + st::msgDateImgPadding.x())); + _width = qMax(_thumbw, int(minWidth)); + _height = qMax(th, int(st::minPhotoSize)); if (bubble) { _width += st::mediaPadding.left() + st::mediaPadding.right(); _height += st::mediaPadding.top() + st::mediaPadding.bottom(); if (!_caption.isEmpty()) { - int32 captionw = _width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = _width - st::msgPadding.left() - st::msgPadding.right(); _height += st::mediaCaptionSkip + _caption.countHeight(captionw) + st::msgPadding.bottom(); } } @@ -3998,11 +4002,11 @@ void HistoryVideo::draw(Painter &p, const HistoryItem *parent, const QRect &r, b _data->automaticLoad(parent); bool loaded = _data->loaded(), displayLoading = _data->displayLoading(); - int32 skipx = 0, skipy = 0, width = _width, height = _height; + int skipx = 0, skipy = 0, width = _width, height = _height; bool bubble = parent->hasBubble(); bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; - int32 captionw = width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = width - st::msgPadding.left() - st::msgPadding.right(); if (displayLoading) { ensureAnimation(parent); @@ -4087,7 +4091,7 @@ void HistoryVideo::draw(Painter &p, const HistoryItem *parent, const QRect &r, b } } -void HistoryVideo::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const { +void HistoryVideo::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const { if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return; bool loaded = _data->loaded(); @@ -4313,10 +4317,10 @@ void HistoryDocument::initDimensions(const HistoryItem *parent) { } } -int32 HistoryDocument::resize(int32 width, const HistoryItem *parent) { +int HistoryDocument::resizeGetHeight(int width, const HistoryItem *parent) { auto *captioned = Get(); if (!captioned) { - return HistoryFileMedia::resize(width, parent); + return HistoryFileMedia::resizeGetHeight(width, parent); } _width = qMin(width, _maxw); @@ -4336,7 +4340,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r _data->automaticLoad(parent); bool loaded = _data->loaded(), displayLoading = _data->displayLoading(); - int32 captionw = _width - st::msgPadding.left() - st::msgPadding.right(); + int captionw = _width - st::msgPadding.left() - st::msgPadding.right(); bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; @@ -4349,7 +4353,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r bool showPause = updateStatusText(parent); bool radial = isRadialAnimation(ms); - int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0; + int nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0; if (auto *thumbed = Get()) { nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right(); nametop = st::msgFileThumbNameTop; @@ -4550,7 +4554,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r } } -void HistoryDocument::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const { +void HistoryDocument::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const { if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return; bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; @@ -4862,10 +4866,10 @@ void HistoryGif::initDimensions(const HistoryItem *parent) { } } -int32 HistoryGif::resize(int32 width, const HistoryItem *parent) { +int HistoryGif::resizeGetHeight(int width, const HistoryItem *parent) { bool bubble = parent->hasBubble(); - int32 tw = 0, th = 0; + int tw = 0, th = 0; if (gif() && _gif->ready()) { tw = convertScale(_gif->width()); th = convertScale(_gif->height()); @@ -5031,7 +5035,7 @@ void HistoryGif::draw(Painter &p, const HistoryItem *parent, const QRect &r, boo } } -void HistoryGif::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const { +void HistoryGif::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const { if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return; int32 skipx = 0, skipy = 0, width = _width, height = _height; bool bubble = parent->hasBubble(); @@ -5219,18 +5223,27 @@ void HistorySticker::initDimensions(const HistoryItem *parent) { if (_pixh < 1) _pixh = 1; _maxw = qMax(_pixw, int16(st::minPhotoSize)); _minh = qMax(_pixh, int16(st::minPhotoSize)); - if (auto *reply = parent->Get()) { - _maxw += st::msgReplyPadding.left() + reply->replyToWidth(); + if (parent->getMedia() == this) { + _maxw += additionalWidth(parent); } _height = _minh; } -int32 HistorySticker::resize(int32 width, const HistoryItem *parent) { // return new height +int HistorySticker::resizeGetHeight(int width, const HistoryItem *parent) { // return new height _width = qMin(width, _maxw); - if (auto *reply = parent->Get()) { - int32 usew = _maxw - st::msgReplyPadding.left() - reply->replyToWidth(); - int32 rw = _width - usew - st::msgReplyPadding.left() - st::msgReplyPadding.left() - st::msgReplyPadding.right(); - reply->resize(rw); + if (parent->getMedia() == this) { + auto *via = parent->Get(); + auto *reply = parent->Get(); + if (via || reply) { + int usew = _maxw - additionalWidth(via, reply); + int availw = _width - usew - st::msgReplyPadding.left() - st::msgReplyPadding.left() - st::msgReplyPadding.left(); + if (via) { + via->resize(availw); + } + if (reply) { + reply->resize(availw); + } + } } return _height; } @@ -5241,12 +5254,13 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r, _data->checkSticker(); bool loaded = _data->loaded(); - bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; + bool out = parent->out(), isPost = parent->isPost(), childmedia = (parent->getMedia() != this); - int32 usew = _maxw, usex = 0; - auto *reply = parent->Get(); - if (reply) { - usew -= st::msgReplyPadding.left() + reply->replyToWidth(); + int usew = _maxw, usex = 0; + auto *via = childmedia ? nullptr : parent->Get(); + auto *reply = childmedia ? nullptr : parent->Get(); + if (via || reply) { + usew -= additionalWidth(via, reply); if (isPost) { } else if (out) { usex = _width - usew; @@ -5268,21 +5282,40 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r, } } - if (parent->getMedia() == this) { + if (!childmedia) { parent->drawInfo(p, usex + usew, _height, usex * 2 + usew, selected, InfoDisplayOverBackground); - if (reply) { - int32 rw = _width - usew - st::msgReplyPadding.left(), rh = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - int32 rx = isPost ? (usew + st::msgReplyPadding.left()) : (out ? 0 : (usew + st::msgReplyPadding.left())), ry = _height - rh; - if (rtl()) rx = _width - rx - rw; - - App::roundRect(p, rx, ry, rw, rh, selected ? App::msgServiceSelectBg() : App::msgServiceBg(), selected ? ServiceSelectedCorners : ServiceCorners); - - HistoryMessageReply::PaintFlags flags = 0; - if (selected) { - flags |= HistoryMessageReply::PaintSelected; + if (via || reply) { + int rectw = _width - usew - st::msgReplyPadding.left(); + int recth = st::msgReplyPadding.top() + st::msgReplyPadding.bottom(); + if (via) { + recth += st::msgServiceNameFont->height + (reply ? st::msgReplyPadding.top() : 0); + } + if (reply) { + recth += st::msgReplyBarSize.height(); + } + int rectx = isPost ? (usew + st::msgReplyPadding.left()) : (out ? 0 : (usew + st::msgReplyPadding.left())); + int recty = _height - recth; + if (rtl()) rectx = _width - rectx - rectw; + + // Make the bottom of the rect at the same level as the bottom of the info rect. + recty -= st::msgDateImgDelta; + + App::roundRect(p, rectx, recty, rectw, recth, selected ? App::msgServiceSelectBg() : App::msgServiceBg(), selected ? ServiceSelectedCorners : ServiceCorners); + rectx += st::msgReplyPadding.left(); + rectw -= st::msgReplyPadding.left() + st::msgReplyPadding.right(); + if (via) { + p.drawTextLeft(rectx, recty + st::msgReplyPadding.top(), 2 * rectx + rectw, via->_text); + int skip = st::msgServiceNameFont->height + (reply ? st::msgReplyPadding.top() : 0); + recty += skip; + } + if (reply) { + HistoryMessageReply::PaintFlags flags = 0; + if (selected) { + flags |= HistoryMessageReply::PaintSelected; + } + reply->paint(p, parent, rectx, recty, rectw, flags); } - reply->paint(p, parent, rx + st::msgReplyPadding.left(), ry, rw - st::msgReplyPadding.left() - st::msgReplyPadding.right(), flags); } } } @@ -5290,25 +5323,51 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r, void HistorySticker::getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const { if (_width < st::msgPadding.left() + st::msgPadding.right() + 1) return; - bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; + bool out = parent->out(), isPost = parent->isPost(), childmedia = (parent->getMedia() != this); - int32 usew = _maxw, usex = 0; - auto *reply = parent->Get(); - if (reply) { - usew -= reply->replyToWidth(); + int usew = _maxw, usex = 0; + auto *via = childmedia ? nullptr : parent->Get(); + auto *reply = childmedia ? nullptr : parent->Get(); + if (via || reply) { + usew -= additionalWidth(via, reply); if (isPost) { } else if (out) { usex = _width - usew; } } if (rtl()) usex = _width - usex - usew; - if (reply) { - int32 rw = _width - usew, rh = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - int32 rx = isPost ? (usew + st::msgReplyPadding.left()) : (out ? 0 : (usew + st::msgReplyPadding.left())), ry = _height - rh; - if (rtl()) rx = _width - rx - rw; - if (x >= rx && y >= ry && x < rx + rw && y < ry + rh) { - lnk = reply->replyToLink(); - return; + + if (via || reply) { + int rectw = _width - usew - st::msgReplyPadding.left(); + int recth = st::msgReplyPadding.top() + st::msgReplyPadding.bottom(); + if (via) { + recth += st::msgServiceNameFont->height + (reply ? st::msgReplyPadding.top() : 0); + } + if (reply) { + recth += st::msgReplyBarSize.height(); + } + int rectx = isPost ? (usew + st::msgReplyPadding.left()) : (out ? 0 : (usew + st::msgReplyPadding.left())); + int recty = _height - recth; + if (rtl()) rectx = _width - rectx - rectw; + + // Make the bottom of the rect at the same level as the bottom of the info rect. + recty -= st::msgDateImgDelta; + + if (via) { + int viah = st::msgReplyPadding.top() + st::msgServiceNameFont->height + (reply ? 0 : st::msgReplyPadding.bottom()); + if (x >= rectx && y >= recty && x < rectx + rectw && y < recty + viah) { + lnk = via->_lnk; + return; + } + int skip = st::msgServiceNameFont->height + (reply ? 2 * st::msgReplyPadding.top() : 0); + recty += skip; + recth -= skip; + } + if (reply) { + if (x >= rectx && y >= recty && x < rectx + rectw && y < recty + recth) { + lnk = reply->replyToLink(); + return; + } } } if (parent->getMedia() == this) { @@ -5350,6 +5409,17 @@ void HistorySticker::updateFrom(const MTPMessageMedia &media, HistoryItem *paren } } +int HistorySticker::additionalWidth(const HistoryMessageVia *via, const HistoryMessageReply *reply) const { + int result = 0; + if (via) { + accumulate_max(result, st::msgReplyPadding.left() + st::msgReplyPadding.left() + via->_maxWidth + st::msgReplyPadding.left()); + } + if (reply) { + accumulate_max(result, st::msgReplyPadding.left() + reply->replyToWidth()); + } + return result; +} + void SendMessageClickHandler::onClickImpl() const { Ui::showPeerHistory(peer()->id, ShowAtUnreadMsgId); } @@ -5702,12 +5772,12 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { _maxw += st::msgPadding.left() + st::webPageLeft + st::msgPadding.right(); _minh += st::msgPadding.bottom(); if (_asArticle) { - _minh = resize(_maxw, parent); // hack + _minh = resizeGetHeight(_maxw, parent); // hack // _minh += st::msgDateFont->height; } } -int32 HistoryWebPage::resize(int32 width, const HistoryItem *parent) { +int HistoryWebPage::resizeGetHeight(int width, const HistoryItem *parent) { if (_data->pendingTill) { _width = width; _height = _minh; @@ -5784,7 +5854,7 @@ int32 HistoryWebPage::resize(int32 width, const HistoryItem *parent) { QMargins bubble(_attach->bubbleMargins()); - _attach->resize(width + bubble.left() + bubble.right(), parent); + _attach->resizeGetHeight(width + bubble.left() + bubble.right(), parent); _height += _attach->height() - bubble.top() - bubble.bottom(); if (_attach->customInfoLayout() && _attach->currentWidth() + parent->skipBlockWidth() > width + bubble.left() + bubble.right()) { _height += st::msgDateFont->height; @@ -7207,7 +7277,7 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width App::roundRect(p, dateX - st::msgDateImgPadding.x(), dateY - st::msgDateImgPadding.y(), dateW, dateH, selected ? st::msgDateImgBgSelected : st::msgDateImgBg, selected ? DateSelectedCorners : DateCorners); } else if (type == InfoDisplayOverBackground) { int32 dateW = infoW + 2 * st::msgDateImgPadding.x(), dateH = st::msgDateFont->height + 2 * st::msgDateImgPadding.y(); - App::roundRect(p, dateX - st::msgDateImgPadding.x(), dateY - st::msgDateImgPadding.y(), dateW, dateH, App::msgServiceBg(), ServiceCorners); + App::roundRect(p, dateX - st::msgDateImgPadding.x(), dateY - st::msgDateImgPadding.y(), dateW, dateH, selected ? App::msgServiceSelectBg() : App::msgServiceBg(), selected ? ServiceSelectedCorners : ServiceCorners); } dateX += HistoryMessage::timeLeft(); @@ -7476,7 +7546,7 @@ int HistoryMessage::resizeGetHeight_(int width) { bool media = (_media && _media->isDisplayed()); if (width >= _maxw) { _height = _minh; - if (media) _media->resize(_maxw, this); + if (media) _media->resizeGetHeight(_maxw, this); } else { if (_text.isEmpty()) { _height = 0; @@ -7490,7 +7560,7 @@ int HistoryMessage::resizeGetHeight_(int width) { } _height = st::msgPadding.top() + _textHeight + st::msgPadding.bottom(); } - if (media) _height += _media->resize(width, this); + if (media) _height += _media->resizeGetHeight(width, this); } if (displayFromName()) { @@ -7534,7 +7604,7 @@ int HistoryMessage::resizeGetHeight_(int width) { reply->resize(width - st::msgPadding.left() - st::msgPadding.right()); } } else { - _height = _media->resize(width, this); + _height = _media->resizeGetHeight(width, this); } if (ReplyKeyboard *keyboard = inlineReplyKeyboard()) { int32 l = 0, w = 0; @@ -8175,7 +8245,7 @@ int32 HistoryService::resizeGetHeight_(int32 width) { } _height += st::msgServicePadding.top() + st::msgServicePadding.bottom() + st::msgServiceMargin.top() + st::msgServiceMargin.bottom(); if (_media) { - _height += st::msgServiceMargin.top() + _media->resize(_media->currentWidth(), this); + _height += st::msgServiceMargin.top() + _media->resizeGetHeight(_media->currentWidth(), this); } _height += displayedDateHeight(); if (auto *unreadbar = Get()) { diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 1ad7fd6a1..69a0324eb 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -1103,6 +1103,7 @@ struct HistoryMessageReplyMarkup : public BaseComponent= 0 && y >= 0 && x < _width && y < _height); } @@ -1858,12 +1859,12 @@ public: return true; } virtual void initDimensions(const HistoryItem *parent) = 0; - virtual int32 resize(int32 width, const HistoryItem *parent) { // return new height + virtual int resizeGetHeight(int width, const HistoryItem *parent) { _width = qMin(width, _maxw); return _height; } virtual void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const = 0; - virtual void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const = 0; + virtual void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const = 0; // if we are in selecting items mode perhaps we want to // toggle selection instead of activating the pressed link @@ -1888,10 +1889,10 @@ public: virtual HistoryMedia *clone() const = 0; virtual DocumentData *getDocument() { - return 0; + return nullptr; } virtual ClipReader *getClipReader() { - return 0; + return nullptr; } bool playInline(HistoryItem *item/*, bool autoplay = false*/) { @@ -1941,13 +1942,13 @@ public: return false; } - int32 currentWidth() const { + int currentWidth() const { return _width; } protected: - int32 _width; + int _width; }; @@ -2069,10 +2070,10 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; - void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; + void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const override; const QString inDialogsText() const override; const QString inHistoryText() const override; @@ -2137,10 +2138,10 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; - void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; + void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const override; const QString inDialogsText() const override; const QString inHistoryText() const override; @@ -2244,7 +2245,7 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; @@ -2327,10 +2328,10 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; - void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; + void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const override; const QString inDialogsText() const override; const QString inHistoryText() const override; @@ -2412,10 +2413,10 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; - void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; + void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const override; bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override { return true; @@ -2448,6 +2449,11 @@ public: private: + int additionalWidth(const HistoryMessageVia *via, const HistoryMessageReply *reply) const; + int additionalWidth(const HistoryItem *parent) const { + return additionalWidth(parent->Get(), parent->Get()); + } + int16 _pixw, _pixh; ClickHandlerPtr _packLink; DocumentData *_data; @@ -2544,10 +2550,10 @@ public: } void initDimensions(const HistoryItem *parent) override; - int32 resize(int32 width, const HistoryItem *parent) override; + int resizeGetHeight(int width, const HistoryItem *parent) override; void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; - void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; + void getState(ClickHandlerPtr &lnk, HistoryCursorState &state, int x, int y, const HistoryItem *parent) const override; bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override { return _attach && _attach->toggleSelectionByHandlerClick(p); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index c027dc448..1435d9b02 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -4605,7 +4605,7 @@ void HistoryWidget::saveEditMsg() { if (!sentEntities.c_vector().v.isEmpty()) { sendFlags |= MTPmessages_EditMessage::Flag::f_entities; } - _saveEditMsgRequestId = MTP::send(MTPmessages_EditMessage(MTP_flags(sendFlags), _history->peer->input, MTP_int(_editMsgId), MTP_string(sendingText), sentEntities, MTPnullMarkup), rpcDone(&HistoryWidget::saveEditMsgDone, _history), rpcFail(&HistoryWidget::saveEditMsgFail, _history)); + _saveEditMsgRequestId = MTP::send(MTPmessages_EditMessage(MTP_flags(sendFlags), _history->peer->input, MTP_int(_editMsgId), MTP_string(sendingText), MTPnullMarkup, sentEntities), rpcDone(&HistoryWidget::saveEditMsgDone, _history), rpcFail(&HistoryWidget::saveEditMsgFail, _history)); } void HistoryWidget::saveEditMsgDone(History *history, const MTPUpdates &updates, mtpRequestId req) { diff --git a/Telegram/SourceFiles/intro/introstart.cpp b/Telegram/SourceFiles/intro/introstart.cpp index ba0a39627..eae175761 100644 --- a/Telegram/SourceFiles/intro/introstart.cpp +++ b/Telegram/SourceFiles/intro/introstart.cpp @@ -37,7 +37,7 @@ IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent) if (cLang() == languageDefault) { int32 l = Sandbox::LangSystem(); if (l != languageDefault) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[l] + qsl(".strings"), LangLoaderRequest(lng_switch_to_this)); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[l].c_str() + qsl(".strings"), LangLoaderRequest(lng_switch_to_this)); QString text = loader.found().value(lng_switch_to_this); if (!text.isEmpty()) { _changeLang.setText(text); diff --git a/Telegram/SourceFiles/lang.h b/Telegram/SourceFiles/lang.h index cb1b84c7a..68de63c11 100644 --- a/Telegram/SourceFiles/lang.h +++ b/Telegram/SourceFiles/lang.h @@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -static const char *LanguageCodes[] = { +constexpr const str_const LanguageCodes[] = { "en", "it", "es", @@ -29,7 +29,7 @@ static const char *LanguageCodes[] = { "pt_BR", "ko", }; -static constexpr int languageTest = -1, languageDefault = 0, languageCount = arraysize(LanguageCodes); +constexpr const int languageTest = -1, languageDefault = 0, languageCount = arraysize(LanguageCodes); class LangString : public QString { public: diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index dd9928dc6..f65b0bc08 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1384,13 +1384,13 @@ void executeParsedCommand(const QString &command) { for (int i = 0; i < languageCount; ++i) { LangLoaderResult result; if (i) { - LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lng_language_name, lng_new_version_text)); + LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i].c_str() + qsl(".strings"), LangLoaderRequest(lng_language_name, lng_new_version_text)); result = loader.found(); } else { result.insert(lng_language_name, langOriginal(lng_language_name)); result.insert(lng_new_version_text, langOriginal(lng_new_version_text)); } - App::wnd()->serviceNotification(result.value(lng_language_name, LanguageCodes[i] + qsl(" language")) + qsl(":\n\n") + result.value(lng_new_version_text, qsl("--none--"))); + App::wnd()->serviceNotification(result.value(lng_language_name, LanguageCodes[i].c_str() + qsl(" language")) + qsl(":\n\n") + result.value(lng_new_version_text, qsl("--none--"))); } } } diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 18fdf74a8..f8cdf64d5 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -389,7 +389,7 @@ 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; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update; -updateInlineBotCallbackQuery#8bad2883 flags:# query_id:long user_id:int msg_id:flags.0?InputBotInlineMessageID data:bytes = Update; +updateInlineBotCallbackQuery#2cbd95af query_id:long user_id:int msg_id:InputBotInlineMessageID data:bytes = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -564,6 +564,7 @@ keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; +keyboardButtonSwitchInline#ea1b7a14 text:string query:string = KeyboardButton; keyboardButtonRow#77608b83 buttons:Vector = KeyboardButtonRow; @@ -653,7 +654,7 @@ botInlineMessageMediaContact#35edb4d4 flags:# phone_number:string first_name:str botInlineResult#9bebaeb9 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:BotInlineMessage = BotInlineResult; botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult; -messages.botResults#1170b0a3 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string results:Vector = messages.BotResults; +messages.botResults#256709a6 flags:# gallery:flags.0?true query_id:long next_offset:flags.1?string switch_pm:flags.2?InlineBotSwitchPM results:Vector = messages.BotResults; exportedMessageLink#1f486803 link:string = ExportedMessageLink; @@ -674,6 +675,8 @@ messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.Messag inputBotInlineMessageID#890c3d89 dc_id:int id:long access_hash:long = InputBotInlineMessageID; +inlineBotSwitchPM#3c20629f text:string start_param:string = InlineBotSwitchPM; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -796,13 +799,13 @@ messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs; messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs; messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool; messages.getInlineBotResults#94e7b170 flags:# bot:InputUser geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults; -messages.setInlineBotResults#3f23ec12 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string = Bool; +messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool; messages.sendInlineBotResult#b16e06fe flags:# broadcast:flags.4?true silent:flags.5?true background:flags.6?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates; messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData; -messages.editMessage#d2003257 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:string entities:flags.3?Vector reply_markup:flags.2?ReplyMarkup = Updates; +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.setBotCallbackAnswer#481c591a flags:# alert:flags.1?true query_id:long message:flags.0?string = Bool; -messages.editInlineBotMessage#a39b97fa flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:string entities:flags.3?Vector reply_markup:flags.2?ReplyMarkup = Bool; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index b5ddce7e9..6b0efce83 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -2989,8 +2989,6 @@ 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 { @@ -2998,11 +2996,10 @@ void _serialize_updateInlineBotCallbackQuery(MTPStringLogger &to, int32 stage, i 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(" 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(); if (flag & MTPDupdateInlineBotCallbackQuery::Flag::f_msg_id) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 4: to.add(" 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(" 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; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -4506,6 +4503,20 @@ void _serialize_keyboardButtonRequestGeoLocation(MTPStringLogger &to, int32 stag } } +void _serialize_keyboardButtonSwitchInline(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("{ keyboardButtonSwitchInline"); + 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(" query: "); ++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); @@ -5447,7 +5458,8 @@ void _serialize_messages_botResults(MTPStringLogger &to, int32 stage, int32 lev, case 1: to.add(" gallery: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_gallery) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 2: 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 3: to.add(" next_offset: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_next_offset) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 4: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" switch_pm: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_switch_pm) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" results: "); ++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; } } @@ -5596,6 +5608,20 @@ void _serialize_inputBotInlineMessageID(MTPStringLogger &to, int32 stage, int32 } } +void _serialize_inlineBotSwitchPM(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("{ inlineBotSwitchPM"); + 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(" 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_req_pq(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); @@ -6140,6 +6166,27 @@ void _serialize_messages_setInlineBotResults(MTPStringLogger &to, int32 stage, i case 4: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" cache_time: "); ++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(" next_offset: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::Flag::f_next_offset) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 7: to.add(" switch_pm: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::Flag::f_switch_pm) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_messages_editInlineBotMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_editInlineBotMessage::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_editInlineBotMessage"); + 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(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" message: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_message) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 4: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -6162,26 +6209,6 @@ void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage, } } -void _serialize_messages_editInlineBotMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { - MTPmessages_editInlineBotMessage::Flags flag(iflag); - - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ messages_editInlineBotMessage"); - 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(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 5: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_editInlineBotMessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } 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); @@ -7295,9 +7322,9 @@ void _serialize_messages_editMessage(MTPStringLogger &to, int32 stage, int32 lev case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 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(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 6: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" message: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_message) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 5: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 6: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_editMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -8473,6 +8500,7 @@ namespace { _serializers.insert(mtpc_keyboardButtonCallback, _serialize_keyboardButtonCallback); _serializers.insert(mtpc_keyboardButtonRequestPhone, _serialize_keyboardButtonRequestPhone); _serializers.insert(mtpc_keyboardButtonRequestGeoLocation, _serialize_keyboardButtonRequestGeoLocation); + _serializers.insert(mtpc_keyboardButtonSwitchInline, _serialize_keyboardButtonSwitchInline); _serializers.insert(mtpc_keyboardButtonRow, _serialize_keyboardButtonRow); _serializers.insert(mtpc_replyKeyboardHide, _serialize_replyKeyboardHide); _serializers.insert(mtpc_replyKeyboardForceReply, _serialize_replyKeyboardForceReply); @@ -8551,6 +8579,7 @@ namespace { _serializers.insert(mtpc_messages_botCallbackAnswer, _serialize_messages_botCallbackAnswer); _serializers.insert(mtpc_messages_messageEditData, _serialize_messages_messageEditData); _serializers.insert(mtpc_inputBotInlineMessageID, _serialize_inputBotInlineMessageID); + _serializers.insert(mtpc_inlineBotSwitchPM, _serialize_inlineBotSwitchPM); _serializers.insert(mtpc_req_pq, _serialize_req_pq); _serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params); @@ -8593,8 +8622,8 @@ namespace { _serializers.insert(mtpc_messages_reorderStickerSets, _serialize_messages_reorderStickerSets); _serializers.insert(mtpc_messages_saveGif, _serialize_messages_saveGif); _serializers.insert(mtpc_messages_setInlineBotResults, _serialize_messages_setInlineBotResults); - _serializers.insert(mtpc_messages_setBotCallbackAnswer, _serialize_messages_setBotCallbackAnswer); _serializers.insert(mtpc_messages_editInlineBotMessage, _serialize_messages_editInlineBotMessage); + _serializers.insert(mtpc_messages_setBotCallbackAnswer, _serialize_messages_setBotCallbackAnswer); _serializers.insert(mtpc_upload_saveFilePart, _serialize_upload_saveFilePart); _serializers.insert(mtpc_upload_saveBigFilePart, _serialize_upload_saveBigFilePart); _serializers.insert(mtpc_help_saveAppLog, _serialize_help_saveAppLog); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index a22e9a8dc..ce2627c7b 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -285,7 +285,7 @@ enum { mtpc_updateChannelPinnedMessage = 0x98592475, mtpc_updateBotCallbackQuery = 0xa68c688c, mtpc_updateEditMessage = 0xe40370a3, - mtpc_updateInlineBotCallbackQuery = 0x8bad2883, + mtpc_updateInlineBotCallbackQuery = 0x2cbd95af, mtpc_updates_state = 0xa56c2a3e, mtpc_updates_differenceEmpty = 0x5d75a138, mtpc_updates_difference = 0xf49ca0, @@ -407,6 +407,7 @@ enum { mtpc_keyboardButtonCallback = 0x683a5e46, mtpc_keyboardButtonRequestPhone = 0xb16a6c29, mtpc_keyboardButtonRequestGeoLocation = 0xfc796b3f, + mtpc_keyboardButtonSwitchInline = 0xea1b7a14, mtpc_keyboardButtonRow = 0x77608b83, mtpc_replyKeyboardHide = 0xa03e5b85, mtpc_replyKeyboardForceReply = 0xf4108aa0, @@ -472,7 +473,7 @@ enum { mtpc_botInlineMessageMediaContact = 0x35edb4d4, mtpc_botInlineResult = 0x9bebaeb9, mtpc_botInlineMediaResult = 0x17db940b, - mtpc_messages_botResults = 0x1170b0a3, + mtpc_messages_botResults = 0x256709a6, mtpc_exportedMessageLink = 0x1f486803, mtpc_messageFwdHeader = 0xc786ddcb, mtpc_auth_codeTypeSms = 0x72a3158c, @@ -485,6 +486,7 @@ enum { mtpc_messages_botCallbackAnswer = 0x1264f1c6, mtpc_messages_messageEditData = 0x26b5dde6, mtpc_inputBotInlineMessageID = 0x890c3d89, + mtpc_inlineBotSwitchPM = 0x3c20629f, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_initConnection = 0x69796de9, @@ -600,13 +602,13 @@ enum { mtpc_messages_getSavedGifs = 0x83bf3d52, mtpc_messages_saveGif = 0x327a30cb, mtpc_messages_getInlineBotResults = 0x94e7b170, - mtpc_messages_setInlineBotResults = 0x3f23ec12, + mtpc_messages_setInlineBotResults = 0xeb5ea206, mtpc_messages_sendInlineBotResult = 0xb16e06fe, mtpc_messages_getMessageEditData = 0xfda68d36, - mtpc_messages_editMessage = 0xd2003257, + mtpc_messages_editMessage = 0xce91e4ca, + mtpc_messages_editInlineBotMessage = 0x130c2c85, mtpc_messages_getBotCallbackAnswer = 0xa6e94f04, mtpc_messages_setBotCallbackAnswer = 0x481c591a, - mtpc_messages_editInlineBotMessage = 0xa39b97fa, mtpc_updates_getState = 0xedd4882a, mtpc_updates_getDifference = 0xa041495, mtpc_updates_getChannelDifference = 0xbb32d7c0, @@ -1189,6 +1191,7 @@ class MTPDkeyboardButtonUrl; class MTPDkeyboardButtonCallback; class MTPDkeyboardButtonRequestPhone; class MTPDkeyboardButtonRequestGeoLocation; +class MTPDkeyboardButtonSwitchInline; class MTPkeyboardButtonRow; class MTPDkeyboardButtonRow; @@ -1315,6 +1318,9 @@ class MTPDmessages_messageEditData; class MTPinputBotInlineMessageID; class MTPDinputBotInlineMessageID; +class MTPinlineBotSwitchPM; +class MTPDinlineBotSwitchPM; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1483,6 +1489,7 @@ typedef MTPBoxed MTPauth_SentCodeType; typedef MTPBoxed MTPmessages_BotCallbackAnswer; typedef MTPBoxed MTPmessages_MessageEditData; typedef MTPBoxed MTPInputBotInlineMessageID; +typedef MTPBoxed MTPInlineBotSwitchPM; // Type classes definitions @@ -7764,6 +7771,18 @@ public: return *(const MTPDkeyboardButtonRequestGeoLocation*)data; } + MTPDkeyboardButtonSwitchInline &_keyboardButtonSwitchInline() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_keyboardButtonSwitchInline) throw mtpErrorWrongTypeId(_type, mtpc_keyboardButtonSwitchInline); + split(); + return *(MTPDkeyboardButtonSwitchInline*)data; + } + const MTPDkeyboardButtonSwitchInline &c_keyboardButtonSwitchInline() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_keyboardButtonSwitchInline) throw mtpErrorWrongTypeId(_type, mtpc_keyboardButtonSwitchInline); + return *(const MTPDkeyboardButtonSwitchInline*)data; + } + uint32 innerLength() const; mtpTypeId type() const; void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); @@ -7778,6 +7797,7 @@ private: explicit MTPkeyboardButton(MTPDkeyboardButtonCallback *_data); explicit MTPkeyboardButton(MTPDkeyboardButtonRequestPhone *_data); explicit MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation *_data); + explicit MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data); friend class MTP::internal::TypeCreator; @@ -9264,6 +9284,37 @@ private: }; typedef MTPBoxed MTPInputBotInlineMessageID; +class MTPinlineBotSwitchPM : private mtpDataOwner { +public: + MTPinlineBotSwitchPM(); + MTPinlineBotSwitchPM(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inlineBotSwitchPM) : mtpDataOwner(0) { + read(from, end, cons); + } + + MTPDinlineBotSwitchPM &_inlineBotSwitchPM() { + if (!data) throw mtpErrorUninitialized(); + split(); + return *(MTPDinlineBotSwitchPM*)data; + } + const MTPDinlineBotSwitchPM &c_inlineBotSwitchPM() const { + if (!data) throw mtpErrorUninitialized(); + return *(const MTPDinlineBotSwitchPM*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_inlineBotSwitchPM); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPinlineBotSwitchPM(MTPDinlineBotSwitchPM *_data); + + friend class MTP::internal::TypeCreator; +}; +typedef MTPBoxed MTPInlineBotSwitchPM; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -11683,21 +11734,11 @@ public: class MTPDupdateInlineBotCallbackQuery : public mtpDataImpl { public: - enum class Flag : int32 { - f_msg_id = (1 << 0), - MAX_FIELD = (1 << 0), - }; - Q_DECLARE_FLAGS(Flags, Flag); - friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - - bool has_msg_id() const { return vflags.v & Flag::f_msg_id; } - MTPDupdateInlineBotCallbackQuery() { } - MTPDupdateInlineBotCallbackQuery(const MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) : vflags(_flags), vquery_id(_query_id), vuser_id(_user_id), vmsg_id(_msg_id), vdata(_data) { + 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) { } - MTPflags vflags; MTPlong vquery_id; MTPint vuser_id; MTPInputBotInlineMessageID vmsg_id; @@ -12940,6 +12981,17 @@ public: MTPstring vtext; }; +class MTPDkeyboardButtonSwitchInline : public mtpDataImpl { +public: + MTPDkeyboardButtonSwitchInline() { + } + MTPDkeyboardButtonSwitchInline(const MTPstring &_text, const MTPstring &_query) : vtext(_text), vquery(_query) { + } + + MTPstring vtext; + MTPstring vquery; +}; + class MTPDkeyboardButtonRow : public mtpDataImpl { public: MTPDkeyboardButtonRow() { @@ -13882,23 +13934,26 @@ public: enum class Flag : int32 { f_gallery = (1 << 0), f_next_offset = (1 << 1), + f_switch_pm = (1 << 2), - MAX_FIELD = (1 << 1), + MAX_FIELD = (1 << 2), }; Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } bool is_gallery() const { return vflags.v & Flag::f_gallery; } bool has_next_offset() const { return vflags.v & Flag::f_next_offset; } + bool has_switch_pm() const { return vflags.v & Flag::f_switch_pm; } MTPDmessages_botResults() { } - MTPDmessages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vresults(_results) { + MTPDmessages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vswitch_pm(_switch_pm), vresults(_results) { } MTPflags vflags; MTPlong vquery_id; MTPstring vnext_offset; + MTPInlineBotSwitchPM vswitch_pm; MTPVector vresults; }; @@ -14034,6 +14089,17 @@ public: MTPlong vaccess_hash; }; +class MTPDinlineBotSwitchPM : public mtpDataImpl { +public: + MTPDinlineBotSwitchPM() { + } + MTPDinlineBotSwitchPM(const MTPstring &_text, const MTPstring &_start_param) : vtext(_text), vstart_param(_start_param) { + } + + MTPstring vtext; + MTPstring vstart_param; +}; + // RPC methods class MTPreq_pq { // RPC method 'req_pq' @@ -19362,9 +19428,10 @@ public: f_gallery = (1 << 0), f_private = (1 << 1), f_next_offset = (1 << 2), + f_switch_pm = (1 << 3), - MAX_FIELD = (1 << 2), + MAX_FIELD = (1 << 3), }; Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } @@ -19372,23 +19439,25 @@ public: bool is_gallery() const { return vflags.v & Flag::f_gallery; } bool is_private() const { return vflags.v & Flag::f_private; } bool has_next_offset() const { return vflags.v & Flag::f_next_offset; } + bool has_switch_pm() const { return vflags.v & Flag::f_switch_pm; } MTPflags vflags; MTPlong vquery_id; MTPVector vresults; MTPint vcache_time; MTPstring vnext_offset; + MTPInlineBotSwitchPM vswitch_pm; MTPmessages_setInlineBotResults() { } MTPmessages_setInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setInlineBotResults) { read(from, end, cons); } - MTPmessages_setInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : vflags(_flags), vquery_id(_query_id), vresults(_results), vcache_time(_cache_time), vnext_offset(_next_offset) { + MTPmessages_setInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm) : vflags(_flags), vquery_id(_query_id), vresults(_results), vcache_time(_cache_time), vnext_offset(_next_offset), vswitch_pm(_switch_pm) { } uint32 innerLength() const { - return vflags.innerLength() + vquery_id.innerLength() + vresults.innerLength() + vcache_time.innerLength() + (has_next_offset() ? vnext_offset.innerLength() : 0); + return vflags.innerLength() + vquery_id.innerLength() + vresults.innerLength() + vcache_time.innerLength() + (has_next_offset() ? vnext_offset.innerLength() : 0) + (has_switch_pm() ? vswitch_pm.innerLength() : 0); } mtpTypeId type() const { return mtpc_messages_setInlineBotResults; @@ -19399,6 +19468,7 @@ public: vresults.read(from, end); vcache_time.read(from, end); if (has_next_offset()) { vnext_offset.read(from, end); } else { vnext_offset = MTPstring(); } + if (has_switch_pm()) { vswitch_pm.read(from, end); } else { vswitch_pm = MTPInlineBotSwitchPM(); } } void write(mtpBuffer &to) const { vflags.write(to); @@ -19406,6 +19476,7 @@ public: vresults.write(to); vcache_time.write(to); if (has_next_offset()) vnext_offset.write(to); + if (has_switch_pm()) vswitch_pm.write(to); } typedef MTPBool ResponseType; @@ -19420,7 +19491,7 @@ public: } MTPmessages_SetInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SetInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : MTPBoxed(MTPmessages_setInlineBotResults(_flags, _query_id, _results, _cache_time, _next_offset)) { + MTPmessages_SetInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm) : MTPBoxed(MTPmessages_setInlineBotResults(_flags, _query_id, _results, _cache_time, _next_offset, _switch_pm)) { } }; @@ -19543,36 +19614,38 @@ class MTPmessages_editMessage { // RPC method 'messages.editMessage' public: enum class Flag : int32 { f_no_webpage = (1 << 1), - f_entities = (1 << 3), + f_message = (1 << 11), f_reply_markup = (1 << 2), + f_entities = (1 << 3), - MAX_FIELD = (1 << 3), + MAX_FIELD = (1 << 11), }; Q_DECLARE_FLAGS(Flags, Flag); friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } - bool has_entities() const { return vflags.v & Flag::f_entities; } + bool has_message() const { return vflags.v & Flag::f_message; } bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + bool has_entities() const { return vflags.v & Flag::f_entities; } MTPflags vflags; MTPInputPeer vpeer; MTPint vid; MTPstring vmessage; - MTPVector ventities; MTPReplyMarkup vreply_markup; + MTPVector ventities; MTPmessages_editMessage() { } MTPmessages_editMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editMessage) { read(from, end, cons); } - MTPmessages_editMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vpeer(_peer), vid(_id), vmessage(_message), ventities(_entities), vreply_markup(_reply_markup) { + MTPmessages_editMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPstring &_message, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : vflags(_flags), vpeer(_peer), vid(_id), vmessage(_message), vreply_markup(_reply_markup), ventities(_entities) { } uint32 innerLength() const { - return vflags.innerLength() + vpeer.innerLength() + vid.innerLength() + vmessage.innerLength() + (has_entities() ? ventities.innerLength() : 0) + (has_reply_markup() ? vreply_markup.innerLength() : 0); + return vflags.innerLength() + vpeer.innerLength() + vid.innerLength() + (has_message() ? vmessage.innerLength() : 0) + (has_reply_markup() ? vreply_markup.innerLength() : 0) + (has_entities() ? ventities.innerLength() : 0); } mtpTypeId type() const { return mtpc_messages_editMessage; @@ -19581,17 +19654,17 @@ public: vflags.read(from, end); vpeer.read(from, end); vid.read(from, end); - vmessage.read(from, end); - if (has_entities()) { ventities.read(from, end); } else { ventities = MTPVector(); } + if (has_message()) { vmessage.read(from, end); } else { vmessage = MTPstring(); } if (has_reply_markup()) { vreply_markup.read(from, end); } else { vreply_markup = MTPReplyMarkup(); } + if (has_entities()) { ventities.read(from, end); } else { ventities = MTPVector(); } } void write(mtpBuffer &to) const { vflags.write(to); vpeer.write(to); vid.write(to); - vmessage.write(to); - if (has_entities()) ventities.write(to); + if (has_message()) vmessage.write(to); if (has_reply_markup()) vreply_markup.write(to); + if (has_entities()) ventities.write(to); } typedef MTPUpdates ResponseType; @@ -19606,7 +19679,77 @@ public: } MTPmessages_EditMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_EditMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) : MTPBoxed(MTPmessages_editMessage(_flags, _peer, _id, _message, _entities, _reply_markup)) { + MTPmessages_EditMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _id, const MTPstring &_message, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : MTPBoxed(MTPmessages_editMessage(_flags, _peer, _id, _message, _reply_markup, _entities)) { + } +}; + +class MTPmessages_editInlineBotMessage { // RPC method 'messages.editInlineBotMessage' +public: + enum class Flag : int32 { + f_no_webpage = (1 << 1), + f_message = (1 << 11), + f_reply_markup = (1 << 2), + f_entities = (1 << 3), + + + MAX_FIELD = (1 << 11), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } + bool has_message() const { return vflags.v & Flag::f_message; } + bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + + MTPflags vflags; + MTPInputBotInlineMessageID vid; + MTPstring vmessage; + MTPReplyMarkup vreply_markup; + MTPVector ventities; + + MTPmessages_editInlineBotMessage() { + } + MTPmessages_editInlineBotMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editInlineBotMessage) { + read(from, end, cons); + } + MTPmessages_editInlineBotMessage(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPstring &_message, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : vflags(_flags), vid(_id), vmessage(_message), vreply_markup(_reply_markup), ventities(_entities) { + } + + uint32 innerLength() const { + return vflags.innerLength() + vid.innerLength() + (has_message() ? vmessage.innerLength() : 0) + (has_reply_markup() ? vreply_markup.innerLength() : 0) + (has_entities() ? ventities.innerLength() : 0); + } + mtpTypeId type() const { + return mtpc_messages_editInlineBotMessage; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editInlineBotMessage) { + vflags.read(from, end); + vid.read(from, end); + if (has_message()) { vmessage.read(from, end); } else { vmessage = MTPstring(); } + if (has_reply_markup()) { vreply_markup.read(from, end); } else { vreply_markup = MTPReplyMarkup(); } + if (has_entities()) { ventities.read(from, end); } else { ventities = MTPVector(); } + } + void write(mtpBuffer &to) const { + vflags.write(to); + vid.write(to); + if (has_message()) vmessage.write(to); + if (has_reply_markup()) vreply_markup.write(to); + if (has_entities()) ventities.write(to); + } + + typedef MTPBool ResponseType; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_editInlineBotMessage::Flags) + +class MTPmessages_EditInlineBotMessage : public MTPBoxed { +public: + MTPmessages_EditInlineBotMessage() { + } + MTPmessages_EditInlineBotMessage(const MTPmessages_editInlineBotMessage &v) : MTPBoxed(v) { + } + MTPmessages_EditInlineBotMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_EditInlineBotMessage(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPstring &_message, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : MTPBoxed(MTPmessages_editInlineBotMessage(_flags, _id, _message, _reply_markup, _entities)) { } }; @@ -19715,74 +19858,6 @@ public: } }; -class MTPmessages_editInlineBotMessage { // RPC method 'messages.editInlineBotMessage' -public: - enum class Flag : int32 { - f_no_webpage = (1 << 1), - f_entities = (1 << 3), - f_reply_markup = (1 << 2), - - - MAX_FIELD = (1 << 3), - }; - Q_DECLARE_FLAGS(Flags, Flag); - friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } - - bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } - bool has_entities() const { return vflags.v & Flag::f_entities; } - bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } - - MTPflags vflags; - MTPInputBotInlineMessageID vid; - MTPstring vmessage; - MTPVector ventities; - MTPReplyMarkup vreply_markup; - - MTPmessages_editInlineBotMessage() { - } - MTPmessages_editInlineBotMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editInlineBotMessage) { - read(from, end, cons); - } - MTPmessages_editInlineBotMessage(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vid(_id), vmessage(_message), ventities(_entities), vreply_markup(_reply_markup) { - } - - uint32 innerLength() const { - return vflags.innerLength() + vid.innerLength() + vmessage.innerLength() + (has_entities() ? ventities.innerLength() : 0) + (has_reply_markup() ? vreply_markup.innerLength() : 0); - } - mtpTypeId type() const { - return mtpc_messages_editInlineBotMessage; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_editInlineBotMessage) { - vflags.read(from, end); - vid.read(from, end); - vmessage.read(from, end); - if (has_entities()) { ventities.read(from, end); } else { ventities = MTPVector(); } - if (has_reply_markup()) { vreply_markup.read(from, end); } else { vreply_markup = MTPReplyMarkup(); } - } - void write(mtpBuffer &to) const { - vflags.write(to); - vid.write(to); - vmessage.write(to); - if (has_entities()) ventities.write(to); - if (has_reply_markup()) vreply_markup.write(to); - } - - typedef MTPBool ResponseType; -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_editInlineBotMessage::Flags) - -class MTPmessages_EditInlineBotMessage : public MTPBoxed { -public: - MTPmessages_EditInlineBotMessage() { - } - MTPmessages_EditInlineBotMessage(const MTPmessages_editInlineBotMessage &v) : MTPBoxed(v) { - } - MTPmessages_EditInlineBotMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPmessages_EditInlineBotMessage(const MTPflags &_flags, const MTPInputBotInlineMessageID &_id, const MTPstring &_message, const MTPVector &_entities, const MTPReplyMarkup &_reply_markup) : MTPBoxed(MTPmessages_editInlineBotMessage(_flags, _id, _message, _entities, _reply_markup)) { - } -}; - class MTPupdates_getState { // RPC method 'updates.getState' public: MTPupdates_getState() { @@ -22508,8 +22583,8 @@ public: 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 MTPflags &_flags, const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { - return MTPupdate(new MTPDupdateInlineBotCallbackQuery(_flags, _query_id, _user_id, _msg_id, _data)); + 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 MTPupdates_state new_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count)); @@ -22874,6 +22949,9 @@ public: inline static MTPkeyboardButton new_keyboardButtonRequestGeoLocation(const MTPstring &_text) { return MTPkeyboardButton(new MTPDkeyboardButtonRequestGeoLocation(_text)); } + inline static MTPkeyboardButton new_keyboardButtonSwitchInline(const MTPstring &_text, const MTPstring &_query) { + return MTPkeyboardButton(new MTPDkeyboardButtonSwitchInline(_text, _query)); + } inline static MTPkeyboardButtonRow new_keyboardButtonRow(const MTPVector &_buttons) { return MTPkeyboardButtonRow(new MTPDkeyboardButtonRow(_buttons)); } @@ -23069,8 +23147,8 @@ public: inline static MTPbotInlineResult new_botInlineMediaResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPDocument &_document, const MTPstring &_title, const MTPstring &_description, const MTPBotInlineMessage &_send_message) { return MTPbotInlineResult(new MTPDbotInlineMediaResult(_flags, _id, _type, _photo, _document, _title, _description, _send_message)); } - inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) { - return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _results)); + inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) { + return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results)); } inline static MTPexportedMessageLink new_exportedMessageLink(const MTPstring &_link) { return MTPexportedMessageLink(new MTPDexportedMessageLink(_link)); @@ -23108,6 +23186,9 @@ public: inline static MTPinputBotInlineMessageID new_inputBotInlineMessageID(MTPint _dc_id, const MTPlong &_id, const MTPlong &_access_hash) { return MTPinputBotInlineMessageID(new MTPDinputBotInlineMessageID(_dc_id, _id, _access_hash)); } + inline static MTPinlineBotSwitchPM new_inlineBotSwitchPM(const MTPstring &_text, const MTPstring &_start_param) { + return MTPinlineBotSwitchPM(new MTPDinlineBotSwitchPM(_text, _start_param)); + } }; } // namespace internal @@ -28016,7 +28097,7 @@ inline uint32 MTPupdate::innerLength() const { } case mtpc_updateInlineBotCallbackQuery: { const MTPDupdateInlineBotCallbackQuery &v(c_updateInlineBotCallbackQuery()); - return v.vflags.innerLength() + v.vquery_id.innerLength() + v.vuser_id.innerLength() + (v.has_msg_id() ? v.vmsg_id.innerLength() : 0) + v.vdata.innerLength(); + return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vmsg_id.innerLength() + v.vdata.innerLength(); } } return 0; @@ -28341,10 +28422,9 @@ 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); - if (v.has_msg_id()) { v.vmsg_id.read(from, end); } else { v.vmsg_id = MTPInputBotInlineMessageID(); } + v.vmsg_id.read(from, end); v.vdata.read(from, end); } break; default: throw mtpErrorUnexpected(cons, "MTPupdate"); @@ -28617,10 +28697,9 @@ 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); - if (v.has_msg_id()) v.vmsg_id.write(to); + v.vmsg_id.write(to); v.vdata.write(to); } break; } @@ -28914,9 +28993,8 @@ inline MTPupdate MTP_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _us inline MTPupdate MTP_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { return MTP::internal::TypeCreator::new_updateEditMessage(_message, _pts, _pts_count); } -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) { - return MTP::internal::TypeCreator::new_updateInlineBotCallbackQuery(_flags, _query_id, _user_id, _msg_id, _data); +inline MTPupdate MTP_updateInlineBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPInputBotInlineMessageID &_msg_id, const MTPbytes &_data) { + return MTP::internal::TypeCreator::new_updateInlineBotCallbackQuery(_query_id, _user_id, _msg_id, _data); } inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { @@ -31920,6 +31998,10 @@ inline uint32 MTPkeyboardButton::innerLength() const { const MTPDkeyboardButtonRequestGeoLocation &v(c_keyboardButtonRequestGeoLocation()); return v.vtext.innerLength(); } + case mtpc_keyboardButtonSwitchInline: { + const MTPDkeyboardButtonSwitchInline &v(c_keyboardButtonSwitchInline()); + return v.vtext.innerLength() + v.vquery.innerLength(); + } } return 0; } @@ -31957,6 +32039,12 @@ inline void MTPkeyboardButton::read(const mtpPrime *&from, const mtpPrime *end, MTPDkeyboardButtonRequestGeoLocation &v(_keyboardButtonRequestGeoLocation()); v.vtext.read(from, end); } break; + case mtpc_keyboardButtonSwitchInline: _type = cons; { + if (!data) setData(new MTPDkeyboardButtonSwitchInline()); + MTPDkeyboardButtonSwitchInline &v(_keyboardButtonSwitchInline()); + v.vtext.read(from, end); + v.vquery.read(from, end); + } break; default: throw mtpErrorUnexpected(cons, "MTPkeyboardButton"); } } @@ -31984,6 +32072,11 @@ inline void MTPkeyboardButton::write(mtpBuffer &to) const { const MTPDkeyboardButtonRequestGeoLocation &v(c_keyboardButtonRequestGeoLocation()); v.vtext.write(to); } break; + case mtpc_keyboardButtonSwitchInline: { + const MTPDkeyboardButtonSwitchInline &v(c_keyboardButtonSwitchInline()); + v.vtext.write(to); + v.vquery.write(to); + } break; } } inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(0), _type(type) { @@ -31993,6 +32086,7 @@ inline MTPkeyboardButton::MTPkeyboardButton(mtpTypeId type) : mtpDataOwner(0), _ case mtpc_keyboardButtonCallback: setData(new MTPDkeyboardButtonCallback()); break; case mtpc_keyboardButtonRequestPhone: setData(new MTPDkeyboardButtonRequestPhone()); break; case mtpc_keyboardButtonRequestGeoLocation: setData(new MTPDkeyboardButtonRequestGeoLocation()); break; + case mtpc_keyboardButtonSwitchInline: setData(new MTPDkeyboardButtonSwitchInline()); break; default: throw mtpErrorBadTypeId(type, "MTPkeyboardButton"); } } @@ -32006,6 +32100,8 @@ inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonRequestPhone *_dat } inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonRequestGeoLocation *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonRequestGeoLocation) { } +inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButtonSwitchInline *_data) : mtpDataOwner(_data), _type(mtpc_keyboardButtonSwitchInline) { +} inline MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text) { return MTP::internal::TypeCreator::new_keyboardButton(_text); } @@ -32021,6 +32117,9 @@ inline MTPkeyboardButton MTP_keyboardButtonRequestPhone(const MTPstring &_text) inline MTPkeyboardButton MTP_keyboardButtonRequestGeoLocation(const MTPstring &_text) { return MTP::internal::TypeCreator::new_keyboardButtonRequestGeoLocation(_text); } +inline MTPkeyboardButton MTP_keyboardButtonSwitchInline(const MTPstring &_text, const MTPstring &_query) { + return MTP::internal::TypeCreator::new_keyboardButtonSwitchInline(_text, _query); +} inline MTPkeyboardButtonRow::MTPkeyboardButtonRow() : mtpDataOwner(new MTPDkeyboardButtonRow()) { } @@ -33814,7 +33913,7 @@ inline MTPmessages_botResults::MTPmessages_botResults() : mtpDataOwner(new MTPDm inline uint32 MTPmessages_botResults::innerLength() const { const MTPDmessages_botResults &v(c_messages_botResults()); - return v.vflags.innerLength() + v.vquery_id.innerLength() + (v.has_next_offset() ? v.vnext_offset.innerLength() : 0) + v.vresults.innerLength(); + return v.vflags.innerLength() + v.vquery_id.innerLength() + (v.has_next_offset() ? v.vnext_offset.innerLength() : 0) + (v.has_switch_pm() ? v.vswitch_pm.innerLength() : 0) + v.vresults.innerLength(); } inline mtpTypeId MTPmessages_botResults::type() const { return mtpc_messages_botResults; @@ -33827,6 +33926,7 @@ inline void MTPmessages_botResults::read(const mtpPrime *&from, const mtpPrime * v.vflags.read(from, end); v.vquery_id.read(from, end); if (v.has_next_offset()) { v.vnext_offset.read(from, end); } else { v.vnext_offset = MTPstring(); } + if (v.has_switch_pm()) { v.vswitch_pm.read(from, end); } else { v.vswitch_pm = MTPInlineBotSwitchPM(); } v.vresults.read(from, end); } inline void MTPmessages_botResults::write(mtpBuffer &to) const { @@ -33834,13 +33934,14 @@ inline void MTPmessages_botResults::write(mtpBuffer &to) const { v.vflags.write(to); v.vquery_id.write(to); if (v.has_next_offset()) v.vnext_offset.write(to); + if (v.has_switch_pm()) v.vswitch_pm.write(to); v.vresults.write(to); } inline MTPmessages_botResults::MTPmessages_botResults(MTPDmessages_botResults *_data) : mtpDataOwner(_data) { } Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botResults::Flags) -inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) { - return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _results); +inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPInlineBotSwitchPM &_switch_pm, const MTPVector &_results) { + return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _switch_pm, _results); } inline MTPexportedMessageLink::MTPexportedMessageLink() : mtpDataOwner(new MTPDexportedMessageLink()) { @@ -34130,6 +34231,35 @@ inline MTPinputBotInlineMessageID::MTPinputBotInlineMessageID(MTPDinputBotInline inline MTPinputBotInlineMessageID MTP_inputBotInlineMessageID(MTPint _dc_id, const MTPlong &_id, const MTPlong &_access_hash) { return MTP::internal::TypeCreator::new_inputBotInlineMessageID(_dc_id, _id, _access_hash); } + +inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM() : mtpDataOwner(new MTPDinlineBotSwitchPM()) { +} + +inline uint32 MTPinlineBotSwitchPM::innerLength() const { + const MTPDinlineBotSwitchPM &v(c_inlineBotSwitchPM()); + return v.vtext.innerLength() + v.vstart_param.innerLength(); +} +inline mtpTypeId MTPinlineBotSwitchPM::type() const { + return mtpc_inlineBotSwitchPM; +} +inline void MTPinlineBotSwitchPM::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != mtpc_inlineBotSwitchPM) throw mtpErrorUnexpected(cons, "MTPinlineBotSwitchPM"); + + if (!data) setData(new MTPDinlineBotSwitchPM()); + MTPDinlineBotSwitchPM &v(_inlineBotSwitchPM()); + v.vtext.read(from, end); + v.vstart_param.read(from, end); +} +inline void MTPinlineBotSwitchPM::write(mtpBuffer &to) const { + const MTPDinlineBotSwitchPM &v(c_inlineBotSwitchPM()); + v.vtext.write(to); + v.vstart_param.write(to); +} +inline MTPinlineBotSwitchPM::MTPinlineBotSwitchPM(MTPDinlineBotSwitchPM *_data) : mtpDataOwner(_data) { +} +inline MTPinlineBotSwitchPM MTP_inlineBotSwitchPM(const MTPstring &_text, const MTPstring &_start_param) { + return MTP::internal::TypeCreator::new_inlineBotSwitchPM(_text, _start_param); +} inline MTPDmessage::Flags mtpCastFlags(MTPDmessageService::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } inline MTPDmessage::Flags mtpCastFlags(MTPflags flags) { return mtpCastFlags(flags.v); } inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); }