MTP_bytes() replaces MTP_string() for QByteArray payload.

Scheme updated for bot callbacks sending data bytearrays.
ReplyKeyboard edition is supported when editing the messages.
This commit is contained in:
John Preston 2016-04-01 14:23:40 +04:00
parent fa4137418a
commit 0e0956451a
18 changed files with 202 additions and 105 deletions

View File

@ -962,7 +962,7 @@ namespace {
} }
if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) { if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) {
existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText()); existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText());
existing->updateMedia(m.has_media() ? (&m.vmedia) : 0); existing->updateMedia(m.has_media() ? (&m.vmedia) : nullptr);
existing->setViewsCount(m.has_views() ? m.vviews.v : -1); existing->setViewsCount(m.has_views() ? m.vviews.v : -1);
existing->addToOverview(AddToOverviewNew); existing->addToOverview(AddToOverviewNew);
@ -982,15 +982,7 @@ namespace {
peerId = peerFromUser(m.vfrom_id); peerId = peerFromUser(m.vfrom_id);
} }
if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) { if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) {
existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText()); existing->applyEdition(m);
existing->updateMedia(m.has_media() ? (&m.vmedia) : 0, true);
existing->setViewsCount(m.has_views() ? m.vviews.v : -1);
if (existing->history()->textCachedFor == existing) {
existing->history()->textCachedFor = 0;
}
if (App::main()) {
App::main()->dlgUpdated(existing->history(), existing->id);
}
} }
} }

View File

@ -404,8 +404,8 @@ void PasscodeBox::onSave(bool force) {
if (_oldPasscode.isHidden() || _newPasscode.isHidden()) { if (_oldPasscode.isHidden() || _newPasscode.isHidden()) {
flags |= MTPDaccount_passwordInputSettings::Flag::f_email; flags |= MTPDaccount_passwordInputSettings::Flag::f_email;
} }
MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_string(_newSalt), MTP_string(newPasswordHash), MTP_string(hint), MTP_string(email))); MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_bytes(_newSalt), MTP_bytes(newPasswordHash), MTP_string(hint), MTP_string(email)));
_setRequest = MTP::send(MTPaccount_UpdatePasswordSettings(MTP_string(oldPasswordHash), settings), rpcDone(&PasscodeBox::setPasswordDone), rpcFail(&PasscodeBox::setPasswordFail)); _setRequest = MTP::send(MTPaccount_UpdatePasswordSettings(MTP_bytes(oldPasswordHash), settings), rpcDone(&PasscodeBox::setPasswordDone), rpcFail(&PasscodeBox::setPasswordFail));
} }
} else { } else {
cSetPasscodeBadTries(0); cSetPasscodeBadTries(0);

View File

@ -38,8 +38,8 @@ namespace App {
if (MainWidget *m = main()) m->sendBotCommand(peer, cmd, replyTo); if (MainWidget *m = main()) m->sendBotCommand(peer, cmd, replyTo);
} }
void sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo) { void sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo) {
if (MainWidget *m = main()) m->sendBotCallback(peer, cmd, replyTo); if (MainWidget *m = main()) m->sendBotCallback(peer, data, replyTo);
} }
bool insertBotCommand(const QString &cmd, bool specialGif) { bool insertBotCommand(const QString &cmd, bool specialGif) {
@ -56,11 +56,12 @@ namespace App {
} break; } break;
case HistoryMessageReplyMarkup::Button::Callback: { case HistoryMessageReplyMarkup::Button::Callback: {
sendBotCallback(peer, QString(button.text), replyTo); sendBotCallback(peer, button.data, replyTo);
} break; } break;
case HistoryMessageReplyMarkup::Button::Url: { case HistoryMessageReplyMarkup::Button::Url: {
HiddenUrlClickHandler(button.url).onClick(Qt::LeftButton); auto url = QString::fromUtf8(button.data);
HiddenUrlClickHandler(url).onClick(Qt::LeftButton);
} break; } break;
case HistoryMessageReplyMarkup::Button::RequestLocation: { case HistoryMessageReplyMarkup::Button::RequestLocation: {

View File

@ -25,7 +25,7 @@ class LayeredWidget;
namespace App { namespace App {
void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo = 0); void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo = 0);
void sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo); void sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo);
bool insertBotCommand(const QString &cmd, bool specialGif = false); bool insertBotCommand(const QString &cmd, bool specialGif = false);
void activateBotCommand(PeerData *peer, const HistoryMessageReplyMarkup::Button &button, MsgId replyTo = 0); void activateBotCommand(PeerData *peer, const HistoryMessageReplyMarkup::Button &button, MsgId replyTo = 0);
void searchByHashtag(const QString &tag, PeerData *inPeer); void searchByHashtag(const QString &tag, PeerData *inPeer);

View File

@ -142,14 +142,14 @@ void FileUploader::sendNext() {
if (requestsSent.isEmpty() && docRequestsSent.isEmpty()) { if (requestsSent.isEmpty() && docRequestsSent.isEmpty()) {
bool silent = i->file && i->file->to.silent; bool silent = i->file && i->file->to.silent;
if (i->type() == PreparePhoto) { if (i->type() == PreparePhoto) {
emit photoReady(uploading, silent, MTP_inputFile(MTP_long(i->id()), MTP_int(i->partsCount), MTP_string(i->filename()), MTP_string(i->file ? i->file->filemd5 : i->media.jpeg_md5))); emit photoReady(uploading, silent, MTP_inputFile(MTP_long(i->id()), MTP_int(i->partsCount), MTP_string(i->filename()), MTP_bytes(i->file ? i->file->filemd5 : i->media.jpeg_md5)));
} else if (i->type() == PrepareDocument || i->type() == PrepareAudio) { } else if (i->type() == PrepareDocument || i->type() == PrepareAudio) {
QByteArray docMd5(32, Qt::Uninitialized); QByteArray docMd5(32, Qt::Uninitialized);
hashMd5Hex(i->md5Hash.result(), docMd5.data()); hashMd5Hex(i->md5Hash.result(), docMd5.data());
MTPInputFile doc = (i->docSize > UseBigFilesFrom) ? MTP_inputFileBig(MTP_long(i->id()), MTP_int(i->docPartsCount), MTP_string(i->filename())) : MTP_inputFile(MTP_long(i->id()), MTP_int(i->docPartsCount), MTP_string(i->filename()), MTP_string(docMd5)); MTPInputFile doc = (i->docSize > UseBigFilesFrom) ? MTP_inputFileBig(MTP_long(i->id()), MTP_int(i->docPartsCount), MTP_string(i->filename())) : MTP_inputFile(MTP_long(i->id()), MTP_int(i->docPartsCount), MTP_string(i->filename()), MTP_bytes(docMd5));
if (i->partsCount) { if (i->partsCount) {
emit thumbDocumentReady(uploading, silent, doc, MTP_inputFile(MTP_long(i->thumbId()), MTP_int(i->partsCount), MTP_string(i->file ? i->file->thumbname : (qsl("thumb.") + i->media.thumbExt)), MTP_string(i->file ? i->file->thumbmd5 : i->media.jpeg_md5))); emit thumbDocumentReady(uploading, silent, doc, MTP_inputFile(MTP_long(i->thumbId()), MTP_int(i->partsCount), MTP_string(i->file ? i->file->thumbname : (qsl("thumb.") + i->media.thumbExt)), MTP_bytes(i->file ? i->file->thumbmd5 : i->media.jpeg_md5)));
} else { } else {
emit documentReady(uploading, silent, doc); emit documentReady(uploading, silent, doc);
} }
@ -187,9 +187,9 @@ void FileUploader::sendNext() {
} }
mtpRequestId requestId; mtpRequestId requestId;
if (i->docSize > UseBigFilesFrom) { if (i->docSize > UseBigFilesFrom) {
requestId = MTP::send(MTPupload_SaveBigFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_int(i->docPartsCount), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); requestId = MTP::send(MTPupload_SaveBigFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_int(i->docPartsCount), MTP_bytes(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc));
} else { } else {
requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_bytes(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc));
} }
docRequestsSent.insert(requestId, i->docSentParts); docRequestsSent.insert(requestId, i->docSentParts);
dcMap.insert(requestId, todc); dcMap.insert(requestId, todc);
@ -200,7 +200,7 @@ void FileUploader::sendNext() {
} else { } else {
UploadFileParts::iterator part = parts.begin(); UploadFileParts::iterator part = parts.begin();
mtpRequestId requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(partsOfId), MTP_int(part.key()), MTP_string(part.value())), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); mtpRequestId requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(partsOfId), MTP_int(part.key()), MTP_bytes(part.value())), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc));
requestsSent.insert(requestId, part.value()); requestsSent.insert(requestId, part.value());
dcMap.insert(requestId, todc); dcMap.insert(requestId, todc);
sentSize += part.value().size(); sentSize += part.value().size();

View File

@ -2810,10 +2810,12 @@ void ReplyKeyboard::resize(int width, int height) {
float64 x = 0, coef = widthForText / widthOfText; float64 x = 0, coef = widthForText / widthOfText;
for (Button &button : row) { for (Button &button : row) {
float64 tw = widthForText / float64(s), w = 2 * _st->buttonPadding() + tw; float64 tw = widthForText / float64(s), w = 2 * _st->buttonPadding() + tw;
int minw = _st->minButtonWidth(button.type); float64 minw = _st->minButtonWidth(button.type);
if (w < minw) w = minw; if (w < minw) w = minw;
button.rect = QRect(qRound(x), qRound(y), qRound(w), qRound(buttonHeight - _st->buttonSkip())); int rectx = static_cast<int>(std::floor(x));
int rectw = static_cast<int>(std::floor(x + w)) - rectx;
button.rect = QRect(rectx, qRound(y), rectw, qRound(buttonHeight - _st->buttonSkip()));
if (rtl()) button.rect.setX(_width - button.rect.x() - button.rect.width()); if (rtl()) button.rect.setX(_width - button.rect.x() - button.rect.width());
x += w + _st->buttonSkip(); x += w + _st->buttonSkip();
@ -2984,6 +2986,10 @@ void ReplyKeyboard::Style::paintButton(Painter &p, const ReplyKeyboard::Button &
} }
void HistoryMessageReplyMarkup::create(const MTPReplyMarkup &markup) { void HistoryMessageReplyMarkup::create(const MTPReplyMarkup &markup) {
flags = 0;
rows.clear();
inlineKeyboard.clear();
switch (markup.type()) { switch (markup.type()) {
case mtpc_replyKeyboardMarkup: { case mtpc_replyKeyboardMarkup: {
const MTPDreplyKeyboardMarkup &d(markup.c_replyKeyboardMarkup()); const MTPDreplyKeyboardMarkup &d(markup.c_replyKeyboardMarkup());
@ -3003,20 +3009,21 @@ void HistoryMessageReplyMarkup::create(const MTPReplyMarkup &markup) {
for_const (const MTPKeyboardButton &button, b) { for_const (const MTPKeyboardButton &button, b) {
switch (button.type()) { switch (button.type()) {
case mtpc_keyboardButton: { case mtpc_keyboardButton: {
buttonRow.push_back({ Button::Default, qs(button.c_keyboardButton().vtext), QString() }); buttonRow.push_back({ Button::Default, qs(button.c_keyboardButton().vtext), QByteArray() });
} break; } break;
case mtpc_keyboardButtonCallback: { case mtpc_keyboardButtonCallback: {
buttonRow.push_back({ Button::Callback, qs(button.c_keyboardButtonCallback().vtext), QString() }); const auto &buttonData(button.c_keyboardButtonCallback());
buttonRow.push_back({ Button::Callback, qs(buttonData.vtext), qba(buttonData.vdata) });
} break; } break;
case mtpc_keyboardButtonRequestGeoLocation: { case mtpc_keyboardButtonRequestGeoLocation: {
buttonRow.push_back({ Button::RequestLocation, qs(button.c_keyboardButtonRequestGeoLocation().vtext), QString() }); buttonRow.push_back({ Button::RequestLocation, qs(button.c_keyboardButtonRequestGeoLocation().vtext), QByteArray() });
} break; } break;
case mtpc_keyboardButtonRequestPhone: { case mtpc_keyboardButtonRequestPhone: {
buttonRow.push_back({ Button::RequestPhone, qs(button.c_keyboardButtonRequestPhone().vtext), QString() }); buttonRow.push_back({ Button::RequestPhone, qs(button.c_keyboardButtonRequestPhone().vtext), QByteArray() });
} break; } break;
case mtpc_keyboardButtonUrl: { case mtpc_keyboardButtonUrl: {
const MTPDkeyboardButtonUrl &u(button.c_keyboardButtonUrl()); const auto &buttonData(button.c_keyboardButtonUrl());
buttonRow.push_back({ Button::Url, qs(u.vtext), qs(u.vurl) }); buttonRow.push_back({ Button::Url, qs(buttonData.vtext), qba(buttonData.vurl) });
} break; } break;
} }
} }
@ -6870,7 +6877,7 @@ void HistoryMessage::initDimensions() {
} }
if (HistoryMessageReplyMarkup *markup = inlineReplyMarkup()) { if (HistoryMessageReplyMarkup *markup = inlineReplyMarkup()) {
if (!markup->inlineKeyboard) { if (!markup->inlineKeyboard) {
markup->inlineKeyboard = new ReplyKeyboard(this, MakeUnique<KeyboardStyle>(st::msgBotKbButton)); markup->inlineKeyboard.reset(new ReplyKeyboard(this, MakeUnique<KeyboardStyle>(st::msgBotKbButton)));
} }
// if we have a text bubble we can resize it to fit the keyboard // if we have a text bubble we can resize it to fit the keyboard
@ -6912,6 +6919,27 @@ void HistoryMessage::fromNameUpdated(int32 width) const {
} }
} }
void HistoryMessage::applyEdition(const MTPDmessage &message) {
EntitiesInText entities;
if (message.has_entities()) {
entities = entitiesFromMTP(message.ventities.c_vector().v);
}
setText(qs(message.vmessage), entities);
setMedia(message.has_media() ? (&message.vmedia) : nullptr);
setReplyMarkup(message.has_reply_markup() ? (&message.vreply_markup) : nullptr);
setViewsCount(message.has_views() ? message.vviews.v : -1);
setPendingInitDimensions();
if (App::main()) {
App::main()->dlgUpdated(history(), id);
}
// invalidate cache for drawInDialog
if (history()->textCachedFor == this) {
history()->textCachedFor = nullptr;
}
}
int32 HistoryMessage::addToOverview(AddToOverviewMethod method) { int32 HistoryMessage::addToOverview(AddToOverviewMethod method) {
if (!indexInOverview()) return 0; if (!indexInOverview()) return 0;
@ -7021,6 +7049,25 @@ void HistoryMessage::setText(const QString &text, const EntitiesInText &entities
_textHeight = 0; _textHeight = 0;
} }
void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
if (!markup && !(_flags & MTPDmessage::Flag::f_reply_markup)) return;
// optimization: don't create markup component for the case
// MTPDreplyKeyboardHide with flags = 0, assume it has f_zero flag
if (markup->type() == mtpc_replyKeyboardHide && markup->c_replyKeyboardHide().vflags.v == 0) {
if (Has<HistoryMessageReplyMarkup>()) {
RemoveComponents(HistoryMessageReplyMarkup::Bit());
setPendingInitDimensions();
}
} else {
if (!Has<HistoryMessageReplyMarkup>()) {
AddComponents(HistoryMessageReplyMarkup::Bit());
}
Get<HistoryMessageReplyMarkup>()->create(*markup);
setPendingInitDimensions();
}
}
QString HistoryMessage::originalText() const { QString HistoryMessage::originalText() const {
return emptyText() ? QString() : _text.original(); return emptyText() ? QString() : _text.original();
} }

View File

@ -1105,7 +1105,8 @@ struct HistoryMessageReplyMarkup : public BaseComponent<HistoryMessageReplyMarku
RequestLocation, RequestLocation,
}; };
Type type; Type type;
QString text, url; QString text;
QByteArray data;
}; };
using ButtonRow = QVector<Button>; using ButtonRow = QVector<Button>;
using ButtonRows = QVector<ButtonRow>; using ButtonRows = QVector<ButtonRow>;
@ -1113,7 +1114,7 @@ struct HistoryMessageReplyMarkup : public BaseComponent<HistoryMessageReplyMarku
ButtonRows rows; ButtonRows rows;
MTPDreplyKeyboardMarkup::Flags flags = 0; MTPDreplyKeyboardMarkup::Flags flags = 0;
ReplyKeyboard *inlineKeyboard = nullptr; UniquePointer<ReplyKeyboard> inlineKeyboard;
}; };
class ReplyMarkupClickHandler : public LeftButtonClickHandler { class ReplyMarkupClickHandler : public LeftButtonClickHandler {
@ -1507,6 +1508,8 @@ public:
virtual bool serviceMsg() const { virtual bool serviceMsg() const {
return false; return false;
} }
virtual void applyEdition(const MTPDmessage &message) {
}
virtual void updateMedia(const MTPMessageMedia *media, bool edited = false) { virtual void updateMedia(const MTPMessageMedia *media, bool edited = false) {
} }
virtual int32 addToOverview(AddToOverviewMethod method) { virtual int32 addToOverview(AddToOverviewMethod method) {
@ -1769,7 +1772,7 @@ protected:
} }
const ReplyKeyboard *inlineReplyKeyboard() const { const ReplyKeyboard *inlineReplyKeyboard() const {
if (auto *markup = inlineReplyMarkup()) { if (auto *markup = inlineReplyMarkup()) {
return markup->inlineKeyboard; return markup->inlineKeyboard.data();
} }
return nullptr; return nullptr;
} }
@ -2831,6 +2834,7 @@ public:
QString notificationHeader() const override; QString notificationHeader() const override;
QString notificationText() const override; QString notificationText() const override;
void applyEdition(const MTPDmessage &message) override;
void updateMedia(const MTPMessageMedia *media, bool edited = false) override { void updateMedia(const MTPMessageMedia *media, bool edited = false) override {
if (!edited && media && _media && _media->type() != MediaTypeWebPage) { if (!edited && media && _media && _media->type() != MediaTypeWebPage) {
_media->updateFrom(*media, this); _media->updateFrom(*media, this);
@ -2845,7 +2849,6 @@ public:
QString selectedText(uint32 selection) const override; QString selectedText(uint32 selection) const override;
QString inDialogsText() const override; QString inDialogsText() const override;
HistoryMedia *getMedia() const override; HistoryMedia *getMedia() const override;
void setMedia(const MTPMessageMedia *media);
void setText(const QString &text, const EntitiesInText &entities) override; void setText(const QString &text, const EntitiesInText &entities) override;
QString originalText() const override; QString originalText() const override;
EntitiesInText originalEntities() const override; EntitiesInText originalEntities() const override;
@ -2907,7 +2910,7 @@ public:
~HistoryMessage(); ~HistoryMessage();
protected: private:
HistoryMessage(History *history, const MTPDmessage &msg); HistoryMessage(History *history, const MTPDmessage &msg);
HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *fwd); // local forwarded HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *fwd); // local forwarded
@ -2932,6 +2935,9 @@ protected:
// this method draws "via @bot" if it is not painted in forwarded info or in from name // this method draws "via @bot" if it is not painted in forwarded info or in from name
void paintViaBotIdInfo(Painter &p, QRect &trect, bool selected) const; void paintViaBotIdInfo(Painter &p, QRect &trect, bool selected) const;
void setMedia(const MTPMessageMedia *media);
void setReplyMarkup(const MTPReplyMarkup *markup);
QString _timeText; QString _timeText;
int _timeWidth = 0; int _timeWidth = 0;

View File

@ -5160,12 +5160,12 @@ void HistoryWidget::sendBotCommand(PeerData *peer, const QString &cmd, MsgId rep
_field.setFocus(); _field.setFocus();
} }
void HistoryWidget::sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo) { void HistoryWidget::sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo) {
if (!_peer || _peer != peer) return; if (!_peer || _peer != peer) return;
bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, replyTo)); bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, replyTo));
MTP::send(MTPmessages_GetBotCallbackAnswer(_peer->input, MTP_int(replyTo), MTP_string(cmd)), rpcDone(&HistoryWidget::botCallbackDone), rpcFail(&HistoryWidget::botCallbackFail)); MTP::send(MTPmessages_GetBotCallbackAnswer(_peer->input, MTP_int(replyTo), MTP_bytes(data)), rpcDone(&HistoryWidget::botCallbackDone), rpcFail(&HistoryWidget::botCallbackFail));
if (replyTo) { if (replyTo) {
cancelReply(); cancelReply();
@ -5178,7 +5178,10 @@ void HistoryWidget::sendBotCallback(PeerData *peer, const QString &cmd, MsgId re
void HistoryWidget::botCallbackDone(const MTPmessages_BotCallbackAnswer &answer) { void HistoryWidget::botCallbackDone(const MTPmessages_BotCallbackAnswer &answer) {
if (answer.type() == mtpc_messages_botCallbackAnswer) { if (answer.type() == mtpc_messages_botCallbackAnswer) {
Ui::showLayer(new InformBox(qs(answer.c_messages_botCallbackAnswer().vmessage))); const auto &answerData(answer.c_messages_botCallbackAnswer());
if (answerData.has_message()) {
Ui::showLayer(new InformBox(qs(answerData.vmessage)));
}
} }
} }
@ -5932,7 +5935,7 @@ namespace {
} else if (document->type == SongDocument && document->song()) { } else if (document->type == SongDocument && document->song()) {
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring())); attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring()));
} else if (document->type == VoiceDocument && document->voice()) { } else if (document->type == VoiceDocument && document->voice()) {
attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(document->voice()->waveform)))); attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(document->voice()->waveform))));
} }
return MTP_vector<MTPDocumentAttribute>(attributes); return MTP_vector<MTPDocumentAttribute>(attributes);
} }

View File

@ -604,7 +604,7 @@ public:
void onListEscapePressed(); void onListEscapePressed();
void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo); void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo);
void sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo); void sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo);
bool insertBotCommand(const QString &cmd, bool specialGif); bool insertBotCommand(const QString &cmd, bool specialGif);
bool eventFilter(QObject *obj, QEvent *e) override; bool eventFilter(QObject *obj, QEvent *e) override;

View File

@ -367,7 +367,7 @@ void IntroPwdCheck::onSubmitPwd(bool force) {
QByteArray pwdData = _salt + _pwdField.text().toUtf8() + _salt, pwdHash(32, Qt::Uninitialized); QByteArray pwdData = _salt + _pwdField.text().toUtf8() + _salt, pwdHash(32, Qt::Uninitialized);
hashSha256(pwdData.constData(), pwdData.size(), pwdHash.data()); hashSha256(pwdData.constData(), pwdData.size(), pwdHash.data());
sentRequest = MTP::send(MTPauth_CheckPassword(MTP_string(pwdHash)), rpcDone(&IntroPwdCheck::pwdSubmitDone, false), rpcFail(&IntroPwdCheck::pwdSubmitFail)); sentRequest = MTP::send(MTPauth_CheckPassword(MTP_bytes(pwdHash)), rpcDone(&IntroPwdCheck::pwdSubmitDone, false), rpcFail(&IntroPwdCheck::pwdSubmitFail));
} }
} }

View File

@ -411,7 +411,7 @@ void FileLoadTask::process() {
} }
if (voice) { if (voice) {
attributes[0] = MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(_duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(_waveform))); attributes[0] = MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(_duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(_waveform)));
attributes.resize(1); attributes.resize(1);
document = MTP_document(MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_string(filemime), MTP_int(filesize), thumbSize, MTP_int(MTP::maindc()), MTP_vector<MTPDocumentAttribute>(attributes)); document = MTP_document(MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_string(filemime), MTP_int(filesize), thumbSize, MTP_int(MTP::maindc()), MTP_vector<MTPDocumentAttribute>(attributes));
} else { } else {

View File

@ -1474,8 +1474,8 @@ void MainWidget::sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyT
history.sendBotCommand(peer, cmd, replyTo); history.sendBotCommand(peer, cmd, replyTo);
} }
void MainWidget::sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo) { void MainWidget::sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo) {
history.sendBotCallback(peer, cmd, replyTo); history.sendBotCallback(peer, data, replyTo);
} }
bool MainWidget::insertBotCommand(const QString &cmd, bool specialGif) { bool MainWidget::insertBotCommand(const QString &cmd, bool specialGif) {
@ -4189,7 +4189,7 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) {
if (peerId) { if (peerId) {
if (HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v)) { if (HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v)) {
item->setText(text, d.has_entities() ? entitiesFromMTP(d.ventities.c_vector().v) : EntitiesInText()); item->setText(text, d.has_entities() ? entitiesFromMTP(d.ventities.c_vector().v) : EntitiesInText());
item->updateMedia(d.has_media() ? (&d.vmedia) : 0); item->updateMedia(d.has_media() ? (&d.vmedia) : nullptr);
item->addToOverview(AddToOverviewNew); item->addToOverview(AddToOverviewNew);
} }
} }

View File

@ -344,7 +344,7 @@ public:
void stopAnimActive(); void stopAnimActive();
void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo); void sendBotCommand(PeerData *peer, const QString &cmd, MsgId replyTo);
void sendBotCallback(PeerData *peer, const QString &cmd, MsgId replyTo); void sendBotCallback(PeerData *peer, const QByteArray &data, MsgId replyTo);
bool insertBotCommand(const QString &cmd, bool specialGif); bool insertBotCommand(const QString &cmd, bool specialGif);
void searchMessages(const QString &query, PeerData *inPeer); void searchMessages(const QString &query, PeerData *inPeer);

View File

@ -758,8 +758,10 @@ private:
friend MTPstring MTP_string(const string &v); friend MTPstring MTP_string(const string &v);
friend MTPstring MTP_string(const QString &v); friend MTPstring MTP_string(const QString &v);
friend MTPstring MTP_string(const QByteArray &v);
friend MTPstring MTP_string(const char *v); friend MTPstring MTP_string(const char *v);
friend MTPstring MTP_string(const QByteArray &v) = delete;
friend MTPstring MTP_bytes(const QByteArray &v);
}; };
inline MTPstring MTP_string(const string &v) { inline MTPstring MTP_string(const string &v) {
return MTPstring(new MTPDstring(v)); return MTPstring(new MTPDstring(v));
@ -767,16 +769,17 @@ inline MTPstring MTP_string(const string &v) {
inline MTPstring MTP_string(const QString &v) { inline MTPstring MTP_string(const QString &v) {
return MTPstring(new MTPDstring(v)); return MTPstring(new MTPDstring(v));
} }
inline MTPstring MTP_string(const QByteArray &v) {
return MTPstring(new MTPDstring(v));
}
inline MTPstring MTP_string(const char *v) { inline MTPstring MTP_string(const char *v) {
return MTPstring(new MTPDstring(v)); return MTPstring(new MTPDstring(v));
} }
typedef MTPBoxed<MTPstring> MTPString; typedef MTPBoxed<MTPstring> MTPString;
typedef MTPstring MTPbytes; using MTPbytes = MTPstring;
typedef MTPString MTPBytes; using MTPBytes = MTPBoxed<MTPbytes>;
inline MTPbytes MTP_bytes(const QByteArray &v) {
return MTPbytes(new MTPDstring(v));
}
inline bool operator==(const MTPstring &a, const MTPstring &b) { inline bool operator==(const MTPstring &a, const MTPstring &b) {
return a.c_string().v == b.c_string().v; return a.c_string().v == b.c_string().v;

View File

@ -387,7 +387,7 @@ updateBotInlineQuery#c01eea08 query_id:long user_id:int query:string offset:stri
updateBotInlineSend#f69e113 user_id:int query:string id:string = Update; updateBotInlineSend#f69e113 user_id:int query:string id:string = Update;
updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update; updateEditChannelMessage#1b3f4df7 message:Message pts:int pts_count:int = Update;
updateChannelPinnedMessage#98592475 channel_id:int id:int = Update; updateChannelPinnedMessage#98592475 channel_id:int id:int = Update;
updateBotCallbackQuery#5024c2b0 query_id:long user_id:int peer:Peer msg_id:int text:string = 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; updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -560,7 +560,7 @@ botInfo#98e81d3a user_id:int description:string commands:Vector<BotCommand> = Bo
keyboardButton#a2fa4880 text:string = KeyboardButton; keyboardButton#a2fa4880 text:string = KeyboardButton;
keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton; keyboardButtonUrl#258aff05 text:string url:string = KeyboardButton;
keyboardButtonCallback#2aae4183 text:string = KeyboardButton; keyboardButtonCallback#683a5e46 text:string data:bytes = KeyboardButton;
keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton; keyboardButtonRequestPhone#b16a6c29 text:string = KeyboardButton;
keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton; keyboardButtonRequestGeoLocation#fc796b3f text:string = KeyboardButton;
@ -659,7 +659,7 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
messages.botCallbackAnswer#b4868d29 message:string = messages.BotCallbackAnswer; messages.botCallbackAnswer#1264f1c6 flags:# alert:flags.1?true message:flags.0?string = messages.BotCallbackAnswer;
messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;
@ -789,8 +789,8 @@ messages.setInlineBotResults#3f23ec12 flags:# gallery:flags.0?true private:flags
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.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.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<MessageEntity> reply_markup:flags.2?ReplyMarkup = Updates; messages.editMessage#d2003257 flags:# no_webpage:flags.1?true peer:InputPeer id:int message:string entities:flags.3?Vector<MessageEntity> reply_markup:flags.2?ReplyMarkup = Updates;
messages.getBotCallbackAnswer#d3157edf peer:InputPeer msg_id:int text:string = messages.BotCallbackAnswer; messages.getBotCallbackAnswer#a6e94f04 peer:InputPeer msg_id:int data:bytes = messages.BotCallbackAnswer;
messages.setBotCallbackAnswer#a13a9254 query_id:long message:string = Bool; messages.setBotCallbackAnswer#481c591a flags:# alert:flags.1?true query_id:long message:flags.0?string = Bool;
updates.getState#edd4882a = updates.State; updates.getState#edd4882a = updates.State;
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;

View File

@ -2958,7 +2958,7 @@ void _serialize_updateBotCallbackQuery(MTPStringLogger &to, int32 stage, int32 l
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 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 3: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 4: to.add(" text: "); ++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(" 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; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
} }
@ -4446,6 +4446,7 @@ void _serialize_keyboardButtonCallback(MTPStringLogger &to, int32 stage, int32 l
} }
switch (stage) { 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 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(" 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; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
} }
@ -5356,6 +5357,8 @@ void _serialize_auth_sentCodeTypeFlashCall(MTPStringLogger &to, int32 stage, int
} }
void _serialize_messages_botCallbackAnswer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { void _serialize_messages_botCallbackAnswer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPDmessages_botCallbackAnswer::Flags flag(iflag);
if (stage) { if (stage) {
to.add(",\n").addSpaces(lev); to.add(",\n").addSpaces(lev);
} else { } else {
@ -5363,7 +5366,9 @@ void _serialize_messages_botCallbackAnswer(MTPStringLogger &to, int32 stage, int
to.add("\n").addSpaces(lev); to.add("\n").addSpaces(lev);
} }
switch (stage) { switch (stage) {
case 0: 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 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(" alert: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_alert) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break;
case 2: to.add(" message: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::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 0 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
} }
@ -5933,6 +5938,8 @@ void _serialize_messages_setInlineBotResults(MTPStringLogger &to, int32 stage, i
} }
void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPmessages_setBotCallbackAnswer::Flags flag(iflag);
if (stage) { if (stage) {
to.add(",\n").addSpaces(lev); to.add(",\n").addSpaces(lev);
} else { } else {
@ -5940,8 +5947,10 @@ void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage,
to.add("\n").addSpaces(lev); to.add("\n").addSpaces(lev);
} }
switch (stage) { switch (stage) {
case 0: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 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(" message: "); ++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(" alert: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::Flag::f_alert) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 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(" message: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::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 0 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
} }
@ -7610,7 +7619,7 @@ void _serialize_messages_getBotCallbackAnswer(MTPStringLogger &to, int32 stage,
switch (stage) { switch (stage) {
case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" 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; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
} }
} }

View File

@ -281,7 +281,7 @@ enum {
mtpc_updateBotInlineSend = 0xf69e113, mtpc_updateBotInlineSend = 0xf69e113,
mtpc_updateEditChannelMessage = 0x1b3f4df7, mtpc_updateEditChannelMessage = 0x1b3f4df7,
mtpc_updateChannelPinnedMessage = 0x98592475, mtpc_updateChannelPinnedMessage = 0x98592475,
mtpc_updateBotCallbackQuery = 0x5024c2b0, mtpc_updateBotCallbackQuery = 0xa68c688c,
mtpc_updateEditMessage = 0xe40370a3, mtpc_updateEditMessage = 0xe40370a3,
mtpc_updates_state = 0xa56c2a3e, mtpc_updates_state = 0xa56c2a3e,
mtpc_updates_differenceEmpty = 0x5d75a138, mtpc_updates_differenceEmpty = 0x5d75a138,
@ -401,7 +401,7 @@ enum {
mtpc_botInfo = 0x98e81d3a, mtpc_botInfo = 0x98e81d3a,
mtpc_keyboardButton = 0xa2fa4880, mtpc_keyboardButton = 0xa2fa4880,
mtpc_keyboardButtonUrl = 0x258aff05, mtpc_keyboardButtonUrl = 0x258aff05,
mtpc_keyboardButtonCallback = 0x2aae4183, mtpc_keyboardButtonCallback = 0x683a5e46,
mtpc_keyboardButtonRequestPhone = 0xb16a6c29, mtpc_keyboardButtonRequestPhone = 0xb16a6c29,
mtpc_keyboardButtonRequestGeoLocation = 0xfc796b3f, mtpc_keyboardButtonRequestGeoLocation = 0xfc796b3f,
mtpc_keyboardButtonRow = 0x77608b83, mtpc_keyboardButtonRow = 0x77608b83,
@ -471,7 +471,7 @@ enum {
mtpc_auth_sentCodeTypeSms = 0xc000bba2, mtpc_auth_sentCodeTypeSms = 0xc000bba2,
mtpc_auth_sentCodeTypeCall = 0x5353e5a7, mtpc_auth_sentCodeTypeCall = 0x5353e5a7,
mtpc_auth_sentCodeTypeFlashCall = 0xab03c6d9, mtpc_auth_sentCodeTypeFlashCall = 0xab03c6d9,
mtpc_messages_botCallbackAnswer = 0xb4868d29, mtpc_messages_botCallbackAnswer = 0x1264f1c6,
mtpc_messages_messageEditData = 0x26b5dde6, mtpc_messages_messageEditData = 0x26b5dde6,
mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsg = 0xcb9f372d,
mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_invokeAfterMsgs = 0x3dc4b4f0,
@ -592,8 +592,8 @@ enum {
mtpc_messages_sendInlineBotResult = 0xb16e06fe, mtpc_messages_sendInlineBotResult = 0xb16e06fe,
mtpc_messages_getMessageEditData = 0xfda68d36, mtpc_messages_getMessageEditData = 0xfda68d36,
mtpc_messages_editMessage = 0xd2003257, mtpc_messages_editMessage = 0xd2003257,
mtpc_messages_getBotCallbackAnswer = 0xd3157edf, mtpc_messages_getBotCallbackAnswer = 0xa6e94f04,
mtpc_messages_setBotCallbackAnswer = 0xa13a9254, mtpc_messages_setBotCallbackAnswer = 0x481c591a,
mtpc_updates_getState = 0xedd4882a, mtpc_updates_getState = 0xedd4882a,
mtpc_updates_getDifference = 0xa041495, mtpc_updates_getDifference = 0xa041495,
mtpc_updates_getChannelDifference = 0xbb32d7c0, mtpc_updates_getChannelDifference = 0xbb32d7c0,
@ -11447,14 +11447,14 @@ class MTPDupdateBotCallbackQuery : public mtpDataImpl<MTPDupdateBotCallbackQuery
public: public:
MTPDupdateBotCallbackQuery() { MTPDupdateBotCallbackQuery() {
} }
MTPDupdateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPstring &_text) : vquery_id(_query_id), vuser_id(_user_id), vpeer(_peer), vmsg_id(_msg_id), vtext(_text) { MTPDupdateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : vquery_id(_query_id), vuser_id(_user_id), vpeer(_peer), vmsg_id(_msg_id), vdata(_data) {
} }
MTPlong vquery_id; MTPlong vquery_id;
MTPint vuser_id; MTPint vuser_id;
MTPPeer vpeer; MTPPeer vpeer;
MTPint vmsg_id; MTPint vmsg_id;
MTPstring vtext; MTPbytes vdata;
}; };
class MTPDupdateEditMessage : public mtpDataImpl<MTPDupdateEditMessage> { class MTPDupdateEditMessage : public mtpDataImpl<MTPDupdateEditMessage> {
@ -12678,10 +12678,11 @@ class MTPDkeyboardButtonCallback : public mtpDataImpl<MTPDkeyboardButtonCallback
public: public:
MTPDkeyboardButtonCallback() { MTPDkeyboardButtonCallback() {
} }
MTPDkeyboardButtonCallback(const MTPstring &_text) : vtext(_text) { MTPDkeyboardButtonCallback(const MTPstring &_text, const MTPbytes &_data) : vtext(_text), vdata(_data) {
} }
MTPstring vtext; MTPstring vtext;
MTPbytes vdata;
}; };
class MTPDkeyboardButtonRequestPhone : public mtpDataImpl<MTPDkeyboardButtonRequestPhone> { class MTPDkeyboardButtonRequestPhone : public mtpDataImpl<MTPDkeyboardButtonRequestPhone> {
@ -13516,11 +13517,24 @@ public:
class MTPDmessages_botCallbackAnswer : public mtpDataImpl<MTPDmessages_botCallbackAnswer> { class MTPDmessages_botCallbackAnswer : public mtpDataImpl<MTPDmessages_botCallbackAnswer> {
public: public:
enum class Flag : int32 {
f_alert = (1 << 1),
f_message = (1 << 0),
MAX_FIELD = (1 << 1),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_alert() const { return vflags.v & Flag::f_alert; }
bool has_message() const { return vflags.v & Flag::f_message; }
MTPDmessages_botCallbackAnswer() { MTPDmessages_botCallbackAnswer() {
} }
MTPDmessages_botCallbackAnswer(const MTPstring &_message) : vmessage(_message) { MTPDmessages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message) : vflags(_flags), vmessage(_message) {
} }
MTPflags<MTPDmessages_botCallbackAnswer::Flags> vflags;
MTPstring vmessage; MTPstring vmessage;
}; };
@ -19091,18 +19105,18 @@ class MTPmessages_getBotCallbackAnswer { // RPC method 'messages.getBotCallbackA
public: public:
MTPInputPeer vpeer; MTPInputPeer vpeer;
MTPint vmsg_id; MTPint vmsg_id;
MTPstring vtext; MTPbytes vdata;
MTPmessages_getBotCallbackAnswer() { MTPmessages_getBotCallbackAnswer() {
} }
MTPmessages_getBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) { MTPmessages_getBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) {
read(from, end, cons); read(from, end, cons);
} }
MTPmessages_getBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPstring &_text) : vpeer(_peer), vmsg_id(_msg_id), vtext(_text) { MTPmessages_getBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : vpeer(_peer), vmsg_id(_msg_id), vdata(_data) {
} }
uint32 innerLength() const { uint32 innerLength() const {
return vpeer.innerLength() + vmsg_id.innerLength() + vtext.innerLength(); return vpeer.innerLength() + vmsg_id.innerLength() + vdata.innerLength();
} }
mtpTypeId type() const { mtpTypeId type() const {
return mtpc_messages_getBotCallbackAnswer; return mtpc_messages_getBotCallbackAnswer;
@ -19110,12 +19124,12 @@ public:
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) { void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getBotCallbackAnswer) {
vpeer.read(from, end); vpeer.read(from, end);
vmsg_id.read(from, end); vmsg_id.read(from, end);
vtext.read(from, end); vdata.read(from, end);
} }
void write(mtpBuffer &to) const { void write(mtpBuffer &to) const {
vpeer.write(to); vpeer.write(to);
vmsg_id.write(to); vmsg_id.write(to);
vtext.write(to); vdata.write(to);
} }
typedef MTPmessages_BotCallbackAnswer ResponseType; typedef MTPmessages_BotCallbackAnswer ResponseType;
@ -19128,12 +19142,25 @@ public:
} }
MTPmessages_GetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getBotCallbackAnswer>(from, end, cons) { MTPmessages_GetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getBotCallbackAnswer>(from, end, cons) {
} }
MTPmessages_GetBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPstring &_text) : MTPBoxed<MTPmessages_getBotCallbackAnswer>(MTPmessages_getBotCallbackAnswer(_peer, _msg_id, _text)) { MTPmessages_GetBotCallbackAnswer(const MTPInputPeer &_peer, MTPint _msg_id, const MTPbytes &_data) : MTPBoxed<MTPmessages_getBotCallbackAnswer>(MTPmessages_getBotCallbackAnswer(_peer, _msg_id, _data)) {
} }
}; };
class MTPmessages_setBotCallbackAnswer { // RPC method 'messages.setBotCallbackAnswer' class MTPmessages_setBotCallbackAnswer { // RPC method 'messages.setBotCallbackAnswer'
public: public:
enum class Flag : int32 {
f_alert = (1 << 1),
f_message = (1 << 0),
MAX_FIELD = (1 << 1),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_alert() const { return vflags.v & Flag::f_alert; }
bool has_message() const { return vflags.v & Flag::f_message; }
MTPflags<MTPmessages_setBotCallbackAnswer::Flags> vflags;
MTPlong vquery_id; MTPlong vquery_id;
MTPstring vmessage; MTPstring vmessage;
@ -19142,26 +19169,30 @@ public:
MTPmessages_setBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) { MTPmessages_setBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) {
read(from, end, cons); read(from, end, cons);
} }
MTPmessages_setBotCallbackAnswer(const MTPlong &_query_id, const MTPstring &_message) : vquery_id(_query_id), vmessage(_message) { MTPmessages_setBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message) : vflags(_flags), vquery_id(_query_id), vmessage(_message) {
} }
uint32 innerLength() const { uint32 innerLength() const {
return vquery_id.innerLength() + vmessage.innerLength(); return vflags.innerLength() + vquery_id.innerLength() + (has_message() ? vmessage.innerLength() : 0);
} }
mtpTypeId type() const { mtpTypeId type() const {
return mtpc_messages_setBotCallbackAnswer; return mtpc_messages_setBotCallbackAnswer;
} }
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) { void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) {
vflags.read(from, end);
vquery_id.read(from, end); vquery_id.read(from, end);
vmessage.read(from, end); if (has_message()) { vmessage.read(from, end); } else { vmessage = MTPstring(); }
} }
void write(mtpBuffer &to) const { void write(mtpBuffer &to) const {
vflags.write(to);
vquery_id.write(to); vquery_id.write(to);
vmessage.write(to); if (has_message()) vmessage.write(to);
} }
typedef MTPBool ResponseType; typedef MTPBool ResponseType;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_setBotCallbackAnswer::Flags)
class MTPmessages_SetBotCallbackAnswer : public MTPBoxed<MTPmessages_setBotCallbackAnswer> { class MTPmessages_SetBotCallbackAnswer : public MTPBoxed<MTPmessages_setBotCallbackAnswer> {
public: public:
MTPmessages_SetBotCallbackAnswer() { MTPmessages_SetBotCallbackAnswer() {
@ -19170,7 +19201,7 @@ public:
} }
MTPmessages_SetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(from, end, cons) { MTPmessages_SetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(from, end, cons) {
} }
MTPmessages_SetBotCallbackAnswer(const MTPlong &_query_id, const MTPstring &_message) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(MTPmessages_setBotCallbackAnswer(_query_id, _message)) { MTPmessages_SetBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(MTPmessages_setBotCallbackAnswer(_flags, _query_id, _message)) {
} }
}; };
@ -21890,8 +21921,8 @@ public:
inline static MTPupdate new_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { inline static MTPupdate new_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) {
return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id)); return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id));
} }
inline static MTPupdate new_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPstring &_text) { inline static MTPupdate new_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) {
return MTPupdate(new MTPDupdateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _text)); return MTPupdate(new MTPDupdateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _data));
} }
inline static MTPupdate new_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { inline static MTPupdate new_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) {
return MTPupdate(new MTPDupdateEditMessage(_message, _pts, _pts_count)); return MTPupdate(new MTPDupdateEditMessage(_message, _pts, _pts_count));
@ -22250,8 +22281,8 @@ public:
inline static MTPkeyboardButton new_keyboardButtonUrl(const MTPstring &_text, const MTPstring &_url) { inline static MTPkeyboardButton new_keyboardButtonUrl(const MTPstring &_text, const MTPstring &_url) {
return MTPkeyboardButton(new MTPDkeyboardButtonUrl(_text, _url)); return MTPkeyboardButton(new MTPDkeyboardButtonUrl(_text, _url));
} }
inline static MTPkeyboardButton new_keyboardButtonCallback(const MTPstring &_text) { inline static MTPkeyboardButton new_keyboardButtonCallback(const MTPstring &_text, const MTPbytes &_data) {
return MTPkeyboardButton(new MTPDkeyboardButtonCallback(_text)); return MTPkeyboardButton(new MTPDkeyboardButtonCallback(_text, _data));
} }
inline static MTPkeyboardButton new_keyboardButtonRequestPhone(const MTPstring &_text) { inline static MTPkeyboardButton new_keyboardButtonRequestPhone(const MTPstring &_text) {
return MTPkeyboardButton(new MTPDkeyboardButtonRequestPhone(_text)); return MTPkeyboardButton(new MTPDkeyboardButtonRequestPhone(_text));
@ -22460,8 +22491,8 @@ public:
inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) { inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) {
return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern)); return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern));
} }
inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPstring &_message) { inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message) {
return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_message)); return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message));
} }
inline static MTPmessages_messageEditData new_messages_messageEditData(const MTPflags<MTPDmessages_messageEditData::Flags> &_flags) { inline static MTPmessages_messageEditData new_messages_messageEditData(const MTPflags<MTPDmessages_messageEditData::Flags> &_flags) {
return MTPmessages_messageEditData(new MTPDmessages_messageEditData(_flags)); return MTPmessages_messageEditData(new MTPDmessages_messageEditData(_flags));
@ -27366,7 +27397,7 @@ inline uint32 MTPupdate::innerLength() const {
} }
case mtpc_updateBotCallbackQuery: { case mtpc_updateBotCallbackQuery: {
const MTPDupdateBotCallbackQuery &v(c_updateBotCallbackQuery()); const MTPDupdateBotCallbackQuery &v(c_updateBotCallbackQuery());
return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vpeer.innerLength() + v.vmsg_id.innerLength() + v.vtext.innerLength(); return v.vquery_id.innerLength() + v.vuser_id.innerLength() + v.vpeer.innerLength() + v.vmsg_id.innerLength() + v.vdata.innerLength();
} }
case mtpc_updateEditMessage: { case mtpc_updateEditMessage: {
const MTPDupdateEditMessage &v(c_updateEditMessage()); const MTPDupdateEditMessage &v(c_updateEditMessage());
@ -27678,7 +27709,7 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI
v.vuser_id.read(from, end); v.vuser_id.read(from, end);
v.vpeer.read(from, end); v.vpeer.read(from, end);
v.vmsg_id.read(from, end); v.vmsg_id.read(from, end);
v.vtext.read(from, end); v.vdata.read(from, end);
} break; } break;
case mtpc_updateEditMessage: _type = cons; { case mtpc_updateEditMessage: _type = cons; {
if (!data) setData(new MTPDupdateEditMessage()); if (!data) setData(new MTPDupdateEditMessage());
@ -27942,7 +27973,7 @@ inline void MTPupdate::write(mtpBuffer &to) const {
v.vuser_id.write(to); v.vuser_id.write(to);
v.vpeer.write(to); v.vpeer.write(to);
v.vmsg_id.write(to); v.vmsg_id.write(to);
v.vtext.write(to); v.vdata.write(to);
} break; } break;
case mtpc_updateEditMessage: { case mtpc_updateEditMessage: {
const MTPDupdateEditMessage &v(c_updateEditMessage()); const MTPDupdateEditMessage &v(c_updateEditMessage());
@ -28230,8 +28261,8 @@ inline MTPupdate MTP_updateEditChannelMessage(const MTPMessage &_message, MTPint
inline MTPupdate MTP_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { inline MTPupdate MTP_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) {
return MTP::internal::TypeCreator::new_updateChannelPinnedMessage(_channel_id, _id); return MTP::internal::TypeCreator::new_updateChannelPinnedMessage(_channel_id, _id);
} }
inline MTPupdate MTP_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPstring &_text) { inline MTPupdate MTP_updateBotCallbackQuery(const MTPlong &_query_id, MTPint _user_id, const MTPPeer &_peer, MTPint _msg_id, const MTPbytes &_data) {
return MTP::internal::TypeCreator::new_updateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _text); return MTP::internal::TypeCreator::new_updateBotCallbackQuery(_query_id, _user_id, _peer, _msg_id, _data);
} }
inline MTPupdate MTP_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { inline MTPupdate MTP_updateEditMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) {
return MTP::internal::TypeCreator::new_updateEditMessage(_message, _pts, _pts_count); return MTP::internal::TypeCreator::new_updateEditMessage(_message, _pts, _pts_count);
@ -31228,7 +31259,7 @@ inline uint32 MTPkeyboardButton::innerLength() const {
} }
case mtpc_keyboardButtonCallback: { case mtpc_keyboardButtonCallback: {
const MTPDkeyboardButtonCallback &v(c_keyboardButtonCallback()); const MTPDkeyboardButtonCallback &v(c_keyboardButtonCallback());
return v.vtext.innerLength(); return v.vtext.innerLength() + v.vdata.innerLength();
} }
case mtpc_keyboardButtonRequestPhone: { case mtpc_keyboardButtonRequestPhone: {
const MTPDkeyboardButtonRequestPhone &v(c_keyboardButtonRequestPhone()); const MTPDkeyboardButtonRequestPhone &v(c_keyboardButtonRequestPhone());
@ -31263,6 +31294,7 @@ inline void MTPkeyboardButton::read(const mtpPrime *&from, const mtpPrime *end,
if (!data) setData(new MTPDkeyboardButtonCallback()); if (!data) setData(new MTPDkeyboardButtonCallback());
MTPDkeyboardButtonCallback &v(_keyboardButtonCallback()); MTPDkeyboardButtonCallback &v(_keyboardButtonCallback());
v.vtext.read(from, end); v.vtext.read(from, end);
v.vdata.read(from, end);
} break; } break;
case mtpc_keyboardButtonRequestPhone: _type = cons; { case mtpc_keyboardButtonRequestPhone: _type = cons; {
if (!data) setData(new MTPDkeyboardButtonRequestPhone()); if (!data) setData(new MTPDkeyboardButtonRequestPhone());
@ -31291,6 +31323,7 @@ inline void MTPkeyboardButton::write(mtpBuffer &to) const {
case mtpc_keyboardButtonCallback: { case mtpc_keyboardButtonCallback: {
const MTPDkeyboardButtonCallback &v(c_keyboardButtonCallback()); const MTPDkeyboardButtonCallback &v(c_keyboardButtonCallback());
v.vtext.write(to); v.vtext.write(to);
v.vdata.write(to);
} break; } break;
case mtpc_keyboardButtonRequestPhone: { case mtpc_keyboardButtonRequestPhone: {
const MTPDkeyboardButtonRequestPhone &v(c_keyboardButtonRequestPhone()); const MTPDkeyboardButtonRequestPhone &v(c_keyboardButtonRequestPhone());
@ -31328,8 +31361,8 @@ inline MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text) {
inline MTPkeyboardButton MTP_keyboardButtonUrl(const MTPstring &_text, const MTPstring &_url) { inline MTPkeyboardButton MTP_keyboardButtonUrl(const MTPstring &_text, const MTPstring &_url) {
return MTP::internal::TypeCreator::new_keyboardButtonUrl(_text, _url); return MTP::internal::TypeCreator::new_keyboardButtonUrl(_text, _url);
} }
inline MTPkeyboardButton MTP_keyboardButtonCallback(const MTPstring &_text) { inline MTPkeyboardButton MTP_keyboardButtonCallback(const MTPstring &_text, const MTPbytes &_data) {
return MTP::internal::TypeCreator::new_keyboardButtonCallback(_text); return MTP::internal::TypeCreator::new_keyboardButtonCallback(_text, _data);
} }
inline MTPkeyboardButton MTP_keyboardButtonRequestPhone(const MTPstring &_text) { inline MTPkeyboardButton MTP_keyboardButtonRequestPhone(const MTPstring &_text) {
return MTP::internal::TypeCreator::new_keyboardButtonRequestPhone(_text); return MTP::internal::TypeCreator::new_keyboardButtonRequestPhone(_text);
@ -33104,7 +33137,7 @@ inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer() : mtpDataO
inline uint32 MTPmessages_botCallbackAnswer::innerLength() const { inline uint32 MTPmessages_botCallbackAnswer::innerLength() const {
const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer()); const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer());
return v.vmessage.innerLength(); return v.vflags.innerLength() + (v.has_message() ? v.vmessage.innerLength() : 0);
} }
inline mtpTypeId MTPmessages_botCallbackAnswer::type() const { inline mtpTypeId MTPmessages_botCallbackAnswer::type() const {
return mtpc_messages_botCallbackAnswer; return mtpc_messages_botCallbackAnswer;
@ -33114,16 +33147,19 @@ inline void MTPmessages_botCallbackAnswer::read(const mtpPrime *&from, const mtp
if (!data) setData(new MTPDmessages_botCallbackAnswer()); if (!data) setData(new MTPDmessages_botCallbackAnswer());
MTPDmessages_botCallbackAnswer &v(_messages_botCallbackAnswer()); MTPDmessages_botCallbackAnswer &v(_messages_botCallbackAnswer());
v.vmessage.read(from, end); v.vflags.read(from, end);
if (v.has_message()) { v.vmessage.read(from, end); } else { v.vmessage = MTPstring(); }
} }
inline void MTPmessages_botCallbackAnswer::write(mtpBuffer &to) const { inline void MTPmessages_botCallbackAnswer::write(mtpBuffer &to) const {
const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer()); const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer());
v.vmessage.write(to); v.vflags.write(to);
if (v.has_message()) v.vmessage.write(to);
} }
inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data) : mtpDataOwner(_data) { inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data) : mtpDataOwner(_data) {
} }
inline MTPmessages_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPstring &_message) { Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botCallbackAnswer::Flags)
return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_message); inline MTPmessages_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message) {
return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_flags, _message);
} }
inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(new MTPDmessages_messageEditData()) { inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(new MTPDmessages_messageEditData()) {

View File

@ -1360,8 +1360,8 @@ void SettingsInner::onPasswordOff() {
// int32 flags = MTPDaccount_passwordInputSettings::flag_new_salt | MTPDaccount_passwordInputSettings::flag_new_password_hash | MTPDaccount_passwordInputSettings::flag_hint | MTPDaccount_passwordInputSettings::flag_email; // int32 flags = MTPDaccount_passwordInputSettings::flag_new_salt | MTPDaccount_passwordInputSettings::flag_new_password_hash | MTPDaccount_passwordInputSettings::flag_hint | MTPDaccount_passwordInputSettings::flag_email;
MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_email; MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_email;
MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_string(QByteArray()), MTP_string(QByteArray()), MTP_string(QString()), MTP_string(QString()))); MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_bytes(QByteArray()), MTP_bytes(QByteArray()), MTP_string(QString()), MTP_string(QString())));
MTP::send(MTPaccount_UpdatePasswordSettings(MTP_string(QByteArray()), settings), rpcDone(&SettingsInner::offPasswordDone), rpcFail(&SettingsInner::offPasswordFail)); MTP::send(MTPaccount_UpdatePasswordSettings(MTP_bytes(QByteArray()), settings), rpcDone(&SettingsInner::offPasswordDone), rpcFail(&SettingsInner::offPasswordFail));
} else { } else {
PasscodeBox *box = new PasscodeBox(_newPasswordSalt, _curPasswordSalt, _hasPasswordRecovery, _curPasswordHint, true); PasscodeBox *box = new PasscodeBox(_newPasswordSalt, _curPasswordSalt, _hasPasswordRecovery, _curPasswordHint, true);
connect(box, SIGNAL(reloadPassword()), this, SLOT(onReloadPassword())); connect(box, SIGNAL(reloadPassword()), this, SLOT(onReloadPassword()));