ShareBox used to share game score using tg:// link. Scheme updated.

This commit is contained in:
John Preston 2016-09-07 12:04:57 +03:00
parent 34331f558f
commit 82d92d21f6
14 changed files with 493 additions and 154 deletions

View File

@ -873,6 +873,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_share_title" = "Share to";
"lng_share_confirm" = "Share";
"lng_share_wrong_user" = "This game was opened from a different user.";
"lng_contact_phone" = "Phone number";
"lng_enter_contact_data" = "New Contact";

View File

@ -27,6 +27,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "lang.h"
#include "mainwindow.h"
#include "mainwidget.h"
#include "core/qthelp_url.h"
#include "localstorage.h"
#include "boxes/confirmbox.h"
#include "apiwrap.h"
ShareBox::ShareBox(SubmitCallback &&callback) : ItemListBox(st::boxScroll)
, _callback(std_::move(callback))
@ -886,3 +890,106 @@ QVector<PeerData*> ShareInner::selected() const {
}
} // namespace internal
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) {
auto shareHashData = QByteArray(0x10, Qt::Uninitialized);
auto ints = reinterpret_cast<int32*>(shareHashData.data());
ints[0] = MTP::authedId();
ints[1] = fullId.channel;
ints[2] = fullId.msg;
ints[3] = 0;
auto key128Size = 0x10;
auto shareHashEncrypted = QByteArray(key128Size + shareHashData.size(), Qt::Uninitialized);
hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data());
if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) {
return url;
}
auto shareHash = shareHashEncrypted.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
auto shareUrl = qsl("tg://share_game_score?hash=") + QString::fromLatin1(shareHash);
auto shareComponent = qsl("tgShareScoreUrl=") + qthelp::url_encode(shareUrl);
auto hashPosition = url.indexOf('#');
if (hashPosition < 0) {
return url + '#' + shareComponent;
}
auto hash = url.mid(hashPosition + 1);
if (hash.indexOf('=') >= 0 || hash.indexOf('?') >= 0) {
return url + '&' + shareComponent;
}
if (!hash.isEmpty()) {
return url + '?' + shareComponent;
}
return url + shareComponent;
}
namespace {
void shareGameScoreFromItem(HistoryItem *item) {
Ui::showLayer(new ShareBox([msgId = item->fullId()](const QVector<PeerData*> &result) {
MTPmessages_ForwardMessages::Flags sendFlags = MTPmessages_ForwardMessages::Flag::f_with_my_score;
MTPVector<MTPint> msgIds = MTP_vector<MTPint>(1, MTP_int(msgId.msg));
if (auto main = App::main()) {
if (auto item = App::histItemById(msgId)) {
for_const (auto peer, result) {
MTPVector<MTPlong> random = MTP_vector<MTPlong>(1, rand_value<MTPlong>());
MTP::send(MTPmessages_ForwardMessages(MTP_flags(sendFlags), item->history()->peer->input, msgIds, random, peer->input), main->rpcDone(&MainWidget::sentUpdatesReceived));
}
}
}
Ui::hideLayer();
}));
}
class GameMessageResolvedCallback : public SharedCallback<void, ChannelData*, MsgId> {
public:
void call(ChannelData *channel, MsgId msgId) const override {
if (auto item = App::histItemById(channel, msgId)) {
shareGameScoreFromItem(item);
} else {
Ui::showLayer(new InformBox(lang(lng_edit_deleted)));
}
}
};
} // namespace
void shareGameScoreByHash(const QString &hash) {
auto key128Size = 0x10;
auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() % 0x10) != 0) {
Ui::showLayer(new InformBox(lang(lng_confirm_phone_link_invalid)));
return;
}
auto hashData = QByteArray(hashEncrypted.size() - key128Size, Qt::Uninitialized);
if (!Local::decrypt(hashEncrypted.constData() + key128Size, hashData.data(), hashEncrypted.size() - key128Size, hashEncrypted.constData())) {
return;
}
char checkSha1[20] = { 0 };
if (memcmp(hashSha1(hashData.constData(), hashData.size(), checkSha1), hashEncrypted.constData(), key128Size) != 0) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto ints = reinterpret_cast<int32*>(hashData.data());
if (ints[0] != MTP::authedId()) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto channelId = ints[1];
auto msgId = ints[2];
if (auto item = App::histItemById(channelId, msgId)) {
shareGameScoreFromItem(item);
} else if (App::api()) {
auto channel = channelId ? App::channelLoaded(channelId) : nullptr;
if (channel || !channelId) {
App::api()->requestMessageData(channel, msgId, std_::make_unique<GameMessageResolvedCallback>());
}
}
}

View File

@ -37,6 +37,9 @@ namespace Notify {
struct PeerUpdate;
} // namespace Notify
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId);
void shareGameScoreByHash(const QString &hash);
class ShareBox : public ItemListBox, public RPCSender {
Q_OBJECT

View File

@ -46,8 +46,23 @@ void applyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
archived.reserve(v.size());
QMap<uint64, uint64> setsToRequest;
for_const (auto &stickerSet, v) {
if (stickerSet.type() == mtpc_stickerSetCovered && stickerSet.c_stickerSetCovered().vset.type() == mtpc_stickerSet) {
auto set = Stickers::feedSet(stickerSet.c_stickerSetCovered().vset.c_stickerSet());
const MTPDstickerSet *setData = nullptr;
switch (stickerSet.type()) {
case mtpc_stickerSetCovered: {
auto &d = stickerSet.c_stickerSetCovered();
if (d.vset.type() == mtpc_stickerSet) {
setData = &d.vset.c_stickerSet();
}
} break;
case mtpc_stickerSetMultiCovered: {
auto &d = stickerSet.c_stickerSetMultiCovered();
if (d.vset.type() == mtpc_stickerSet) {
setData = &d.vset.c_stickerSet();
}
} break;
}
if (setData) {
auto set = Stickers::feedSet(*setData);
if (set->stickers.isEmpty()) {
setsToRequest.insert(set->id, set->access);
}
@ -1059,10 +1074,15 @@ void StickersInner::rebuild() {
if (_section == Section::Featured && Global::FeaturedStickerSetsUnreadCount()) {
Global::SetFeaturedStickerSetsUnreadCount(0);
QVector<MTPlong> readIds;
readIds.reserve(Global::StickerSets().size());
for (auto &set : Global::RefStickerSets()) {
set.flags &= ~MTPDstickerSet_ClientFlag::f_unread;
if (set.flags & MTPDstickerSet_ClientFlag::f_unread) {
set.flags &= ~MTPDstickerSet_ClientFlag::f_unread;
readIds.push_back(MTP_long(set.id));
}
}
MTP::send(MTPmessages_ReadFeaturedStickers(), rpcDone(&StickersInner::readFeaturedDone), rpcFail(&StickersInner::readFeaturedFail));
MTP::send(MTPmessages_ReadFeaturedStickers(MTP_vector<MTPlong>(readIds)), rpcDone(&StickersInner::readFeaturedDone), rpcFail(&StickersInner::readFeaturedFail));
}
}
@ -1299,9 +1319,24 @@ void StickersBox::getArchivedDone(uint64 offsetId, const MTPmessages_ArchivedSti
bool addedSet = false;
auto &v = stickers.vsets.c_vector().v;
for_const (auto &stickerSet, v) {
if (stickerSet.type() != mtpc_stickerSetCovered || stickerSet.c_stickerSetCovered().vset.type() != mtpc_stickerSet) continue;
const MTPDstickerSet *setData = nullptr;
switch (stickerSet.type()) {
case mtpc_stickerSetCovered: {
auto &d = stickerSet.c_stickerSetCovered();
if (d.vset.type() == mtpc_stickerSet) {
setData = &d.vset.c_stickerSet();
}
} break;
case mtpc_stickerSetMultiCovered: {
auto &d = stickerSet.c_stickerSetMultiCovered();
if (d.vset.type() == mtpc_stickerSet) {
setData = &d.vset.c_stickerSet();
}
} break;
}
if (!setData) continue;
if (auto set = Stickers::feedSet(stickerSet.c_stickerSetCovered().vset.c_stickerSet())) {
if (auto set = Stickers::feedSet(*setData)) {
auto index = archived.indexOf(set->id);
if (archived.isEmpty() || index != archived.size() - 1) {
if (index < archived.size() - 1) {
@ -1452,10 +1487,12 @@ void StickersBox::saveOrder() {
if (order.size() > 1) {
QVector<MTPlong> mtpOrder;
mtpOrder.reserve(order.size());
for (int32 i = 0, l = order.size(); i < l; ++i) {
for (int i = 0, l = order.size(); i < l; ++i) {
mtpOrder.push_back(MTP_long(order.at(i)));
}
_reorderRequest = MTP::send(MTPmessages_ReorderStickerSets(MTP_vector<MTPlong>(mtpOrder)), rpcDone(&StickersBox::reorderDone), rpcFail(&StickersBox::reorderFail));
MTPmessages_ReorderStickerSets::Flags flags = 0;
_reorderRequest = MTP::send(MTPmessages_ReorderStickerSets(MTP_flags(flags), MTP_vector<MTPlong>(mtpOrder)), rpcDone(&StickersBox::reorderDone), rpcFail(&StickersBox::reorderFail));
} else {
reorderDone(MTP_boolTrue());
}

View File

@ -74,7 +74,7 @@ void activateBotCommand(const HistoryItem *msg, int row, int col) {
case ButtonType::Callback:
case ButtonType::Game: {
if (MainWidget *m = main()) {
if (auto m = main()) {
m->app_sendBotCallback(button, msg, row, col);
}
} break;

View File

@ -25,6 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "styles/style_dialogs.h"
#include "boxes/confirmbox.h"
#include "boxes/photosendbox.h"
#include "boxes/sharebox.h"
#include "ui/filedialog.h"
#include "ui/toast/toast.h"
#include "ui/buttons/history_down_button.h"
@ -3851,37 +3852,53 @@ void HistoryWidget::featuredStickersGot(const MTPmessages_FeaturedStickers &stic
set.flags &= ~MTPDstickerSet_ClientFlag::f_featured; // mark for removing
}
for (int i = 0, l = d_sets.size(); i != l; ++i) {
if (d_sets.at(i).type() == mtpc_stickerSetCovered && d_sets.at(i).c_stickerSetCovered().vset.type() == mtpc_stickerSet) {
const auto &set(d_sets.at(i).c_stickerSetCovered().vset.c_stickerSet());
auto it = sets.find(set.vid.v);
QString title = stickerSetTitle(set);
auto &setData = d_sets[i];
const MTPDstickerSet *set = nullptr;
switch (setData.type()) {
case mtpc_stickerSetCovered: {
auto &d = setData.c_stickerSetCovered();
if (d.vset.type() == mtpc_stickerSet) {
set = &d.vset.c_stickerSet();
}
} break;
case mtpc_stickerSetMultiCovered: {
auto &d = setData.c_stickerSetMultiCovered();
if (d.vset.type() == mtpc_stickerSet) {
set = &d.vset.c_stickerSet();
}
} break;
}
if (set) {
auto it = sets.find(set->vid.v);
QString title = stickerSetTitle(*set);
if (it == sets.cend()) {
auto setClientFlags = MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_not_loaded;
if (unread.contains(set.vid.v)) {
if (unread.contains(set->vid.v)) {
setClientFlags |= MTPDstickerSet_ClientFlag::f_unread;
}
it = sets.insert(set.vid.v, Stickers::Set(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | setClientFlags));
it = sets.insert(set->vid.v, Stickers::Set(set->vid.v, set->vaccess_hash.v, title, qs(set->vshort_name), set->vcount.v, set->vhash.v, set->vflags.v | setClientFlags));
} else {
it->access = set.vaccess_hash.v;
it->access = set->vaccess_hash.v;
it->title = title;
it->shortName = qs(set.vshort_name);
it->shortName = qs(set->vshort_name);
auto clientFlags = it->flags & (MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_unread | MTPDstickerSet_ClientFlag::f_not_loaded | MTPDstickerSet_ClientFlag::f_special);
it->flags = set.vflags.v | clientFlags;
it->flags = set->vflags.v | clientFlags;
it->flags |= MTPDstickerSet_ClientFlag::f_featured;
if (unread.contains(it->id)) {
it->flags |= MTPDstickerSet_ClientFlag::f_unread;
} else {
it->flags &= ~MTPDstickerSet_ClientFlag::f_unread;
}
if (it->count != set.vcount.v || it->hash != set.vhash.v || it->emoji.isEmpty()) {
it->count = set.vcount.v;
it->hash = set.vhash.v;
if (it->count != set->vcount.v || it->hash != set->vhash.v || it->emoji.isEmpty()) {
it->count = set->vcount.v;
it->hash = set->vhash.v;
it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; // need to request this set
}
}
setsOrder.push_back(set.vid.v);
setsOrder.push_back(set->vid.v);
if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) {
setsToRequest.insert(set.vid.v, set.vaccess_hash.v);
setsToRequest.insert(set->vid.v, set->vaccess_hash.v);
}
}
}
@ -5763,12 +5780,12 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button
bool lastKeyboardUsed = (_keyboard.forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard.forMsgId() == FullMsgId(_channel, msg->id));
BotCallbackInfo info = { msg->fullId(), row, col };
using ButtonType = HistoryMessageReplyMarkup::Button::Type;
BotCallbackInfo info = { msg->fullId(), row, col, (button->type == ButtonType::Game) };
MTPmessages_GetBotCallbackAnswer::Flags flags = 0;
QByteArray sendData;
int32 sendGameId = 0;
using ButtonType = HistoryMessageReplyMarkup::Button::Type;
if (button->type == ButtonType::Game) {
if (info.game) {
flags = MTPmessages_GetBotCallbackAnswer::Flag::f_game_id;
auto strData = QString::fromUtf8(button->data);
sendGameId = strData.midRef(0, strData.indexOf(',')).toInt();
@ -5810,7 +5827,11 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC
Ui::Toast::Show(App::wnd(), toast);
}
} else if (answerData.has_url()) {
UrlClickHandler(qs(answerData.vurl)).onClick(Qt::LeftButton);
auto url = qs(answerData.vurl);
if (info.game) {
url = appendShareGameScoreUrl(url, info.msgId);
}
UrlClickHandler(url).onClick(Qt::LeftButton);
}
}
}

View File

@ -960,6 +960,7 @@ private:
struct BotCallbackInfo {
FullMsgId msgId;
int row, col;
bool game;
};
void botCallbackDone(BotCallbackInfo info, const MTPmessages_BotCallbackAnswer &answer, mtpRequestId req);
bool botCallbackFail(BotCallbackInfo info, const RPCError &error, mtpRequestId req);

View File

@ -4011,6 +4011,22 @@ namespace Local {
_writeReportSpamStatuses();
}
bool encrypt(const void *src, void *dst, uint32 len, const void *key128) {
if (!_localKey.created()) {
return false;
}
MTP::aesEncryptLocal(src, dst, len, &_localKey, key128);
return true;
}
bool decrypt(const void *src, void *dst, uint32 len, const void *key128) {
if (!_localKey.created()) {
return false;
}
MTP::aesDecryptLocal(src, dst, len, &_localKey, key128);
return true;
}
struct ClearManagerData {
QThread *thread;
StorageMap images, stickers, audios;

View File

@ -183,4 +183,7 @@ namespace Local {
void writeReportSpamStatuses();
bool encrypt(const void *src, void *dst, uint32 len, const void *key128);
bool decrypt(const void *src, void *dst, uint32 len, const void *key128);
};

View File

@ -45,6 +45,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/contactsbox.h"
#include "boxes/downloadpathbox.h"
#include "boxes/confirmphonebox.h"
#include "boxes/sharebox.h"
#include "localstorage.h"
#include "shortcuts.h"
#include "media/media_audio.h"
@ -3299,33 +3300,34 @@ bool MainWidget::started() {
}
void MainWidget::openLocalUrl(const QString &url) {
QString u(url.trimmed());
if (u.size() > 8192) u = u.mid(0, 8192);
auto urlTrimmed = url.trimmed();
if (urlTrimmed.size() > 8192) urlTrimmed = urlTrimmed.mid(0, 8192);
if (!u.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
if (!urlTrimmed.startsWith(qstr("tg://"), Qt::CaseInsensitive)) {
return;
}
auto command = urlTrimmed.midRef(qstr("tg://").size());
using namespace qthelp;
auto matchOptions = RegExOption::CaseInsensitive;
if (auto joinChatMatch = regex_match(qsl("^tg://join/?\\?invite=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"), u, matchOptions)) {
if (auto joinChatMatch = regex_match(qsl("^join/?\\?invite=([a-zA-Z0-9\\.\\_\\-]+)(&|$)"), command, matchOptions)) {
joinGroupByHash(joinChatMatch->captured(1));
} else if (auto stickerSetMatch = regex_match(qsl("^tg://addstickers/?\\?set=([a-zA-Z0-9\\.\\_]+)(&|$)"), u, matchOptions)) {
} else if (auto stickerSetMatch = regex_match(qsl("^addstickers/?\\?set=([a-zA-Z0-9\\.\\_]+)(&|$)"), command, matchOptions)) {
stickersBox(MTP_inputStickerSetShortName(MTP_string(stickerSetMatch->captured(1))));
} else if (auto shareUrlMatch = regex_match(qsl("^tg://msg_url/?\\?(.+)(#|$)"), u, matchOptions)) {
} else if (auto shareUrlMatch = regex_match(qsl("^msg_url/?\\?(.+)(#|$)"), command, matchOptions)) {
auto params = url_parse_params(shareUrlMatch->captured(1), UrlParamNameTransform::ToLower);
auto url = params.value(qsl("url"));
if (!url.isEmpty()) {
shareUrlLayer(url, params.value("text"));
}
} else if (auto confirmPhoneMatch = regex_match(qsl("^tg://confirmphone/?\\?(.+)(#|$)"), u, matchOptions)) {
} else if (auto confirmPhoneMatch = regex_match(qsl("^confirmphone/?\\?(.+)(#|$)"), command, matchOptions)) {
auto params = url_parse_params(confirmPhoneMatch->captured(1), UrlParamNameTransform::ToLower);
auto phone = params.value(qsl("phone"));
auto hash = params.value(qsl("hash"));
if (!phone.isEmpty() && !hash.isEmpty()) {
ConfirmPhoneBox::start(phone, hash);
}
} else if (auto usernameMatch = regex_match(qsl("^tg://resolve/?\\?(.+)(#|$)"), u, matchOptions)) {
} else if (auto usernameMatch = regex_match(qsl("^resolve/?\\?(.+)(#|$)"), command, matchOptions)) {
auto params = url_parse_params(usernameMatch->captured(1), UrlParamNameTransform::ToLower);
auto domain = params.value(qsl("domain"));
if (auto domainMatch = regex_match(qsl("^[a-zA-Z0-9\\.\\_]+$"), domain, matchOptions)) {
@ -3345,6 +3347,9 @@ void MainWidget::openLocalUrl(const QString &url) {
}
openPeerByName(domain, post, startToken);
}
} else if (auto shareGameScoreMatch = regex_match(qsl("^share_game_score/?\\?(.+)(#|$)"), command, matchOptions)) {
auto params = url_parse_params(shareGameScoreMatch->captured(1), UrlParamNameTransform::ToLower);
shareGameScoreByHash(params.value(qsl("hash")));
}
}
@ -4742,22 +4747,24 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
case mtpc_updateStickerSetsOrder: {
auto &d = update.c_updateStickerSetsOrder();
auto &order = d.vorder.c_vector().v;
auto &sets = Global::StickerSets();
Stickers::Order result;
for (int32 i = 0, l = order.size(); i < l; ++i) {
if (sets.constFind(order.at(i).v) == sets.cend()) {
break;
if (!d.is_masks()) {
auto &order = d.vorder.c_vector().v;
auto &sets = Global::StickerSets();
Stickers::Order result;
for (int32 i = 0, l = order.size(); i < l; ++i) {
if (sets.constFind(order.at(i).v) == sets.cend()) {
break;
}
result.push_back(order.at(i).v);
}
if (result.size() != Global::StickerSetsOrder().size() || result.size() != order.size()) {
Global::SetLastStickersUpdate(0);
App::main()->updateStickers();
} else {
Global::SetStickerSetsOrder(result);
Local::writeInstalledStickers();
emit stickersUpdated();
}
result.push_back(order.at(i).v);
}
if (result.size() != Global::StickerSetsOrder().size() || result.size() != order.size()) {
Global::SetLastStickersUpdate(0);
App::main()->updateStickers();
} else {
Global::SetStickerSetsOrder(result);
Local::writeInstalledStickers();
emit stickersUpdated();
}
} break;

View File

@ -383,7 +383,7 @@ updateChannelMessageViews#98a12b4b channel_id:int id:int views:int = Update;
updateChatAdmins#6e947941 chat_id:int enabled:Bool version:int = Update;
updateChatParticipantAdmin#b6901959 chat_id:int user_id:int is_admin:Bool version:int = Update;
updateNewStickerSet#688a30aa stickerset:messages.StickerSet = Update;
updateStickerSetsOrder#f0dfb451 order:Vector<long> = Update;
updateStickerSetsOrder#bb2d201 flags:# masks:flags.0?true order:Vector<long> = Update;
updateStickerSets#43ae3dec = Update;
updateSavedGifs#9375341e = Update;
updateBotInlineQuery#54826690 flags:# query_id:long user_id:int query:string geo:flags.0?GeoPoint offset:string = Update;
@ -560,7 +560,7 @@ inputStickerSetEmpty#ffb62b95 = InputStickerSet;
inputStickerSetID#9de7a269 id:long access_hash:long = InputStickerSet;
inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
stickerSet#cd303b41 flags:# installed:flags.0?true archived:flags.1?true official:flags.2?true masks:flags.3?true id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet;
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
@ -716,6 +716,7 @@ messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallRes
messages.stickerSetInstallResultArchive#35e410a8 sets:Vector<StickerSetCovered> = messages.StickerSetInstallResult;
stickerSetCovered#6410a5d2 set:StickerSet cover:Document = StickerSetCovered;
stickerSetMultiCovered#3407e51b set:StickerSet covers:Vector<Document> = StickerSetCovered;
---functions---
@ -836,7 +837,7 @@ messages.toggleChatAdmins#ec8bd9e1 chat_id:int enabled:Bool = Updates;
messages.editChatAdmin#a9e69f2e chat_id:int user_id:InputUser is_admin:Bool = Bool;
messages.migrateChat#15a3b8e3 chat_id:int = Updates;
messages.searchGlobal#9e3cacb0 q:string offset_date:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
messages.reorderStickerSets#9fcfbc30 order:Vector<long> = Bool;
messages.reorderStickerSets#78337739 flags:# masks:flags.0?true order:Vector<long> = Bool;
messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Document;
messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs;
messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs;
@ -853,14 +854,14 @@ messages.getPeerDialogs#2d9776b9 peers:Vector<InputPeer> = messages.PeerDialogs;
messages.saveDraft#bc39e14b flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int peer:InputPeer message:string entities:flags.3?Vector<MessageEntity> = Bool;
messages.getAllDrafts#6a3f8d65 = Updates;
messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers;
messages.readFeaturedStickers#e21cbb = Bool;
messages.readFeaturedStickers#5b118126 id:Vector<long> = Bool;
messages.getRecentStickers#99197c2c hash:int = messages.RecentStickers;
messages.saveRecentSticker#348e39bf id:InputDocument unsave:Bool = Bool;
messages.clearRecentStickers#ab02e5d2 = Bool;
messages.getUnusedStickers#4309d65b limit:int = Vector<StickerSetCovered>;
messages.getArchivedStickers#906e241f offset_id:long limit:int = messages.ArchivedStickers;
messages.setGameScore#dfbc7c1f flags:# edit_message:flags.0?true peer:InputPeer id:int user_id:InputUser game_id:int score:int = Updates;
messages.setInlineGameScore#54f882f1 flags:# edit_message:flags.0?true id:InputBotInlineMessageID user_id:InputUser game_id:int score:int = Bool;
messages.getMaskStickers#65b8c79f hash:int = messages.AllStickers;
updates.getState#edd4882a = updates.State;
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;

View File

@ -2894,6 +2894,8 @@ void _serialize_updateNewStickerSet(MTPStringLogger &to, int32 stage, int32 lev,
}
void _serialize_updateStickerSetsOrder(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPDupdateStickerSetsOrder::Flags flag(iflag);
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
@ -2901,7 +2903,9 @@ void _serialize_updateStickerSetsOrder(MTPStringLogger &to, int32 stage, int32 l
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+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(" masks: "); ++stages.back(); if (flag & MTPDupdateStickerSetsOrder::Flag::f_masks) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
case 2: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+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;
}
}
@ -4468,12 +4472,13 @@ void _serialize_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &t
case 1: to.add(" installed: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_installed) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
case 2: to.add(" archived: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_archived) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break;
case 3: to.add(" official: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_official) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break;
case 4: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 5: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 6: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 7: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 8: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 9: to.add(" hash: "); ++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(" masks: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_masks) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break;
case 5: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 6: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 7: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 8: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 9: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 10: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
@ -5929,6 +5934,20 @@ void _serialize_stickerSetCovered(MTPStringLogger &to, int32 stage, int32 lev, T
}
}
void _serialize_stickerSetMultiCovered(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("{ stickerSetMultiCovered");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" set: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" covers: "); ++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;
}
}
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);
@ -6439,6 +6458,8 @@ void _serialize_messages_editChatAdmin(MTPStringLogger &to, int32 stage, int32 l
}
void _serialize_messages_reorderStickerSets(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPmessages_reorderStickerSets::Flags flag(iflag);
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
@ -6446,7 +6467,9 @@ void _serialize_messages_reorderStickerSets(MTPStringLogger &to, int32 stage, in
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+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(" masks: "); ++stages.back(); if (flag & MTPmessages_reorderStickerSets::Flag::f_masks) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
case 2: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+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;
}
}
@ -6547,7 +6570,16 @@ void _serialize_messages_saveDraft(MTPStringLogger &to, int32 stage, int32 lev,
}
void _serialize_messages_readFeaturedStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
to.add("{ messages_readFeaturedStickers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_readFeaturedStickers");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+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_messages_saveRecentSticker(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
@ -8113,6 +8145,19 @@ void _serialize_messages_getAllStickers(MTPStringLogger &to, int32 stage, int32
}
}
void _serialize_messages_getMaskStickers(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("{ messages_getMaskStickers");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
void _serialize_messages_getWebPagePreview(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);
@ -8326,19 +8371,6 @@ void _serialize_messages_getRecentStickers(MTPStringLogger &to, int32 stage, int
}
}
void _serialize_messages_getUnusedStickers(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("{ messages_getUnusedStickers");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
void _serialize_messages_getArchivedStickers(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);
@ -9039,6 +9071,7 @@ namespace {
_serializers.insert(mtpc_messages_stickerSetInstallResultSuccess, _serialize_messages_stickerSetInstallResultSuccess);
_serializers.insert(mtpc_messages_stickerSetInstallResultArchive, _serialize_messages_stickerSetInstallResultArchive);
_serializers.insert(mtpc_stickerSetCovered, _serialize_stickerSetCovered);
_serializers.insert(mtpc_stickerSetMultiCovered, _serialize_stickerSetMultiCovered);
_serializers.insert(mtpc_req_pq, _serialize_req_pq);
_serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params);
@ -9197,6 +9230,7 @@ namespace {
_serializers.insert(mtpc_photos_deletePhotos, _serialize_photos_deletePhotos);
_serializers.insert(mtpc_messages_getStickers, _serialize_messages_getStickers);
_serializers.insert(mtpc_messages_getAllStickers, _serialize_messages_getAllStickers);
_serializers.insert(mtpc_messages_getMaskStickers, _serialize_messages_getMaskStickers);
_serializers.insert(mtpc_messages_getWebPagePreview, _serialize_messages_getWebPagePreview);
_serializers.insert(mtpc_messages_exportChatInvite, _serialize_messages_exportChatInvite);
_serializers.insert(mtpc_channels_exportInvite, _serialize_channels_exportInvite);
@ -9212,7 +9246,6 @@ namespace {
_serializers.insert(mtpc_messages_getPeerDialogs, _serialize_messages_getPeerDialogs);
_serializers.insert(mtpc_messages_getFeaturedStickers, _serialize_messages_getFeaturedStickers);
_serializers.insert(mtpc_messages_getRecentStickers, _serialize_messages_getRecentStickers);
_serializers.insert(mtpc_messages_getUnusedStickers, _serialize_messages_getUnusedStickers);
_serializers.insert(mtpc_messages_getArchivedStickers, _serialize_messages_getArchivedStickers);
_serializers.insert(mtpc_updates_getState, _serialize_updates_getState);
_serializers.insert(mtpc_updates_getDifference, _serialize_updates_getDifference);

View File

@ -279,7 +279,7 @@ enum {
mtpc_updateChatAdmins = 0x6e947941,
mtpc_updateChatParticipantAdmin = 0xb6901959,
mtpc_updateNewStickerSet = 0x688a30aa,
mtpc_updateStickerSetsOrder = 0xf0dfb451,
mtpc_updateStickerSetsOrder = 0xbb2d201,
mtpc_updateStickerSets = 0x43ae3dec,
mtpc_updateSavedGifs = 0x9375341e,
mtpc_updateBotInlineQuery = 0x54826690,
@ -517,6 +517,7 @@ enum {
mtpc_messages_stickerSetInstallResultSuccess = 0x38641628,
mtpc_messages_stickerSetInstallResultArchive = 0x35e410a8,
mtpc_stickerSetCovered = 0x6410a5d2,
mtpc_stickerSetMultiCovered = 0x3407e51b,
mtpc_invokeAfterMsg = 0xcb9f372d,
mtpc_invokeAfterMsgs = 0x3dc4b4f0,
mtpc_initConnection = 0x69796de9,
@ -629,7 +630,7 @@ enum {
mtpc_messages_editChatAdmin = 0xa9e69f2e,
mtpc_messages_migrateChat = 0x15a3b8e3,
mtpc_messages_searchGlobal = 0x9e3cacb0,
mtpc_messages_reorderStickerSets = 0x9fcfbc30,
mtpc_messages_reorderStickerSets = 0x78337739,
mtpc_messages_getDocumentByHash = 0x338e2464,
mtpc_messages_searchGifs = 0xbf9a776b,
mtpc_messages_getSavedGifs = 0x83bf3d52,
@ -646,14 +647,14 @@ enum {
mtpc_messages_saveDraft = 0xbc39e14b,
mtpc_messages_getAllDrafts = 0x6a3f8d65,
mtpc_messages_getFeaturedStickers = 0x2dacca4f,
mtpc_messages_readFeaturedStickers = 0xe21cbb,
mtpc_messages_readFeaturedStickers = 0x5b118126,
mtpc_messages_getRecentStickers = 0x99197c2c,
mtpc_messages_saveRecentSticker = 0x348e39bf,
mtpc_messages_clearRecentStickers = 0xab02e5d2,
mtpc_messages_getUnusedStickers = 0x4309d65b,
mtpc_messages_getArchivedStickers = 0x906e241f,
mtpc_messages_setGameScore = 0xdfbc7c1f,
mtpc_messages_setInlineGameScore = 0x54f882f1,
mtpc_messages_getMaskStickers = 0x65b8c79f,
mtpc_updates_getState = 0xedd4882a,
mtpc_updates_getDifference = 0xa041495,
mtpc_updates_getChannelDifference = 0xbb32d7c0,
@ -1398,6 +1399,7 @@ class MTPDmessages_stickerSetInstallResultArchive;
class MTPstickerSetCovered;
class MTPDstickerSetCovered;
class MTPDstickerSetMultiCovered;
// Boxed types definitions
@ -9779,32 +9781,51 @@ typedef MTPBoxed<MTPmessages_stickerSetInstallResult> MTPmessages_StickerSetInst
class MTPstickerSetCovered : private mtpDataOwner {
public:
MTPstickerSetCovered();
MTPstickerSetCovered(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSetCovered) : mtpDataOwner(0) {
MTPstickerSetCovered() : mtpDataOwner(0), _type(0) {
}
MTPstickerSetCovered(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) {
read(from, end, cons);
}
MTPDstickerSetCovered &_stickerSetCovered() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_stickerSetCovered) throw mtpErrorWrongTypeId(_type, mtpc_stickerSetCovered);
split();
return *(MTPDstickerSetCovered*)data;
}
const MTPDstickerSetCovered &c_stickerSetCovered() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_stickerSetCovered) throw mtpErrorWrongTypeId(_type, mtpc_stickerSetCovered);
return *(const MTPDstickerSetCovered*)data;
}
MTPDstickerSetMultiCovered &_stickerSetMultiCovered() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_stickerSetMultiCovered) throw mtpErrorWrongTypeId(_type, mtpc_stickerSetMultiCovered);
split();
return *(MTPDstickerSetMultiCovered*)data;
}
const MTPDstickerSetMultiCovered &c_stickerSetMultiCovered() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_stickerSetMultiCovered) throw mtpErrorWrongTypeId(_type, mtpc_stickerSetMultiCovered);
return *(const MTPDstickerSetMultiCovered*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_stickerSetCovered);
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons);
void write(mtpBuffer &to) const;
typedef void ResponseType;
private:
explicit MTPstickerSetCovered(mtpTypeId type);
explicit MTPstickerSetCovered(MTPDstickerSetCovered *_data);
explicit MTPstickerSetCovered(MTPDstickerSetMultiCovered *_data);
friend class MTP::internal::TypeCreator;
mtpTypeId _type;
};
typedef MTPBoxed<MTPstickerSetCovered> MTPStickerSetCovered;
@ -12155,11 +12176,21 @@ public:
class MTPDupdateStickerSetsOrder : public mtpDataImpl<MTPDupdateStickerSetsOrder> {
public:
enum class Flag : int32 {
f_masks = (1 << 0),
MAX_FIELD = (1 << 0),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_masks() const { return vflags.v & Flag::f_masks; }
MTPDupdateStickerSetsOrder() {
}
MTPDupdateStickerSetsOrder(const MTPVector<MTPlong> &_order) : vorder(_order) {
MTPDupdateStickerSetsOrder(const MTPflags<MTPDupdateStickerSetsOrder::Flags> &_flags, const MTPVector<MTPlong> &_order) : vflags(_flags), vorder(_order) {
}
MTPflags<MTPDupdateStickerSetsOrder::Flags> vflags;
MTPVector<MTPlong> vorder;
};
@ -13464,8 +13495,9 @@ public:
f_installed = (1 << 0),
f_archived = (1 << 1),
f_official = (1 << 2),
f_masks = (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<int32>(v)); }
@ -13473,6 +13505,7 @@ public:
bool is_installed() const { return vflags.v & Flag::f_installed; }
bool is_archived() const { return vflags.v & Flag::f_archived; }
bool is_official() const { return vflags.v & Flag::f_official; }
bool is_masks() const { return vflags.v & Flag::f_masks; }
MTPDstickerSet() {
}
@ -14862,6 +14895,17 @@ public:
MTPDocument vcover;
};
class MTPDstickerSetMultiCovered : public mtpDataImpl<MTPDstickerSetMultiCovered> {
public:
MTPDstickerSetMultiCovered() {
}
MTPDstickerSetMultiCovered(const MTPStickerSet &_set, const MTPVector<MTPDocument> &_covers) : vset(_set), vcovers(_covers) {
}
MTPStickerSet vset;
MTPVector<MTPDocument> vcovers;
};
// RPC methods
class MTPreq_pq { // RPC method 'req_pq'
@ -20062,6 +20106,16 @@ public:
class MTPmessages_reorderStickerSets { // RPC method 'messages.reorderStickerSets'
public:
enum class Flag : int32 {
f_masks = (1 << 0),
MAX_FIELD = (1 << 0),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_masks() const { return vflags.v & Flag::f_masks; }
MTPflags<MTPmessages_reorderStickerSets::Flags> vflags;
MTPVector<MTPlong> vorder;
MTPmessages_reorderStickerSets() {
@ -20069,24 +20123,28 @@ public:
MTPmessages_reorderStickerSets(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reorderStickerSets) {
read(from, end, cons);
}
MTPmessages_reorderStickerSets(const MTPVector<MTPlong> &_order) : vorder(_order) {
MTPmessages_reorderStickerSets(const MTPflags<MTPmessages_reorderStickerSets::Flags> &_flags, const MTPVector<MTPlong> &_order) : vflags(_flags), vorder(_order) {
}
uint32 innerLength() const {
return vorder.innerLength();
return vflags.innerLength() + vorder.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_reorderStickerSets;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reorderStickerSets) {
vflags.read(from, end);
vorder.read(from, end);
}
void write(mtpBuffer &to) const {
vflags.write(to);
vorder.write(to);
}
typedef MTPBool ResponseType;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_reorderStickerSets::Flags)
class MTPmessages_ReorderStickerSets : public MTPBoxed<MTPmessages_reorderStickerSets> {
public:
MTPmessages_ReorderStickerSets() {
@ -20095,7 +20153,7 @@ public:
}
MTPmessages_ReorderStickerSets(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_reorderStickerSets>(from, end, cons) {
}
MTPmessages_ReorderStickerSets(const MTPVector<MTPlong> &_order) : MTPBoxed<MTPmessages_reorderStickerSets>(MTPmessages_reorderStickerSets(_order)) {
MTPmessages_ReorderStickerSets(const MTPflags<MTPmessages_reorderStickerSets::Flags> &_flags, const MTPVector<MTPlong> &_order) : MTPBoxed<MTPmessages_reorderStickerSets>(MTPmessages_reorderStickerSets(_flags, _order)) {
}
};
@ -20966,21 +21024,27 @@ public:
class MTPmessages_readFeaturedStickers { // RPC method 'messages.readFeaturedStickers'
public:
MTPVector<MTPlong> vid;
MTPmessages_readFeaturedStickers() {
}
MTPmessages_readFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readFeaturedStickers) {
read(from, end, cons);
}
MTPmessages_readFeaturedStickers(const MTPVector<MTPlong> &_id) : vid(_id) {
}
uint32 innerLength() const {
return 0;
return vid.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_readFeaturedStickers;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readFeaturedStickers) {
vid.read(from, end);
}
void write(mtpBuffer &to) const {
vid.write(to);
}
typedef MTPBool ResponseType;
@ -20993,6 +21057,8 @@ public:
}
MTPmessages_ReadFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_readFeaturedStickers>(from, end, cons) {
}
MTPmessages_ReadFeaturedStickers(const MTPVector<MTPlong> &_id) : MTPBoxed<MTPmessages_readFeaturedStickers>(MTPmessages_readFeaturedStickers(_id)) {
}
};
class MTPmessages_getRecentStickers { // RPC method 'messages.getRecentStickers'
@ -21107,45 +21173,6 @@ public:
}
};
class MTPmessages_getUnusedStickers { // RPC method 'messages.getUnusedStickers'
public:
MTPint vlimit;
MTPmessages_getUnusedStickers() {
}
MTPmessages_getUnusedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getUnusedStickers) {
read(from, end, cons);
}
MTPmessages_getUnusedStickers(MTPint _limit) : vlimit(_limit) {
}
uint32 innerLength() const {
return vlimit.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_getUnusedStickers;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getUnusedStickers) {
vlimit.read(from, end);
}
void write(mtpBuffer &to) const {
vlimit.write(to);
}
typedef MTPVector<MTPStickerSetCovered> ResponseType;
};
class MTPmessages_GetUnusedStickers : public MTPBoxed<MTPmessages_getUnusedStickers> {
public:
MTPmessages_GetUnusedStickers() {
}
MTPmessages_GetUnusedStickers(const MTPmessages_getUnusedStickers &v) : MTPBoxed<MTPmessages_getUnusedStickers>(v) {
}
MTPmessages_GetUnusedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getUnusedStickers>(from, end, cons) {
}
MTPmessages_GetUnusedStickers(MTPint _limit) : MTPBoxed<MTPmessages_getUnusedStickers>(MTPmessages_getUnusedStickers(_limit)) {
}
};
class MTPmessages_getArchivedStickers { // RPC method 'messages.getArchivedStickers'
public:
MTPlong voffset_id;
@ -21315,6 +21342,45 @@ public:
}
};
class MTPmessages_getMaskStickers { // RPC method 'messages.getMaskStickers'
public:
MTPint vhash;
MTPmessages_getMaskStickers() {
}
MTPmessages_getMaskStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getMaskStickers) {
read(from, end, cons);
}
MTPmessages_getMaskStickers(MTPint _hash) : vhash(_hash) {
}
uint32 innerLength() const {
return vhash.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_getMaskStickers;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getMaskStickers) {
vhash.read(from, end);
}
void write(mtpBuffer &to) const {
vhash.write(to);
}
typedef MTPmessages_AllStickers ResponseType;
};
class MTPmessages_GetMaskStickers : public MTPBoxed<MTPmessages_getMaskStickers> {
public:
MTPmessages_GetMaskStickers() {
}
MTPmessages_GetMaskStickers(const MTPmessages_getMaskStickers &v) : MTPBoxed<MTPmessages_getMaskStickers>(v) {
}
MTPmessages_GetMaskStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getMaskStickers>(from, end, cons) {
}
MTPmessages_GetMaskStickers(MTPint _hash) : MTPBoxed<MTPmessages_getMaskStickers>(MTPmessages_getMaskStickers(_hash)) {
}
};
class MTPupdates_getState { // RPC method 'updates.getState'
public:
MTPupdates_getState() {
@ -23860,8 +23926,8 @@ public:
inline static MTPupdate new_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset) {
return MTPupdate(new MTPDupdateNewStickerSet(_stickerset));
}
inline static MTPupdate new_updateStickerSetsOrder(const MTPVector<MTPlong> &_order) {
return MTPupdate(new MTPDupdateStickerSetsOrder(_order));
inline static MTPupdate new_updateStickerSetsOrder(const MTPflags<MTPDupdateStickerSetsOrder::Flags> &_flags, const MTPVector<MTPlong> &_order) {
return MTPupdate(new MTPDupdateStickerSetsOrder(_flags, _order));
}
inline static MTPupdate new_updateStickerSets() {
return MTPupdate(mtpc_updateStickerSets);
@ -24574,6 +24640,9 @@ public:
inline static MTPstickerSetCovered new_stickerSetCovered(const MTPStickerSet &_set, const MTPDocument &_cover) {
return MTPstickerSetCovered(new MTPDstickerSetCovered(_set, _cover));
}
inline static MTPstickerSetCovered new_stickerSetMultiCovered(const MTPStickerSet &_set, const MTPVector<MTPDocument> &_covers) {
return MTPstickerSetCovered(new MTPDstickerSetMultiCovered(_set, _covers));
}
};
} // namespace internal
@ -29489,7 +29558,7 @@ inline uint32 MTPupdate::innerLength() const {
}
case mtpc_updateStickerSetsOrder: {
const MTPDupdateStickerSetsOrder &v(c_updateStickerSetsOrder());
return v.vorder.innerLength();
return v.vflags.innerLength() + v.vorder.innerLength();
}
case mtpc_updateBotInlineQuery: {
const MTPDupdateBotInlineQuery &v(c_updateBotInlineQuery());
@ -29788,6 +29857,7 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI
case mtpc_updateStickerSetsOrder: _type = cons; {
if (!data) setData(new MTPDupdateStickerSetsOrder());
MTPDupdateStickerSetsOrder &v(_updateStickerSetsOrder());
v.vflags.read(from, end);
v.vorder.read(from, end);
} break;
case mtpc_updateStickerSets: _type = cons; break;
@ -30087,6 +30157,7 @@ inline void MTPupdate::write(mtpBuffer &to) const {
} break;
case mtpc_updateStickerSetsOrder: {
const MTPDupdateStickerSetsOrder &v(c_updateStickerSetsOrder());
v.vflags.write(to);
v.vorder.write(to);
} break;
case mtpc_updateBotInlineQuery: {
@ -30419,8 +30490,9 @@ inline MTPupdate MTP_updateChatParticipantAdmin(MTPint _chat_id, MTPint _user_id
inline MTPupdate MTP_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset) {
return MTP::internal::TypeCreator::new_updateNewStickerSet(_stickerset);
}
inline MTPupdate MTP_updateStickerSetsOrder(const MTPVector<MTPlong> &_order) {
return MTP::internal::TypeCreator::new_updateStickerSetsOrder(_order);
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateStickerSetsOrder::Flags)
inline MTPupdate MTP_updateStickerSetsOrder(const MTPflags<MTPDupdateStickerSetsOrder::Flags> &_flags, const MTPVector<MTPlong> &_order) {
return MTP::internal::TypeCreator::new_updateStickerSetsOrder(_flags, _order);
}
inline MTPupdate MTP_updateStickerSets() {
return MTP::internal::TypeCreator::new_updateStickerSets();
@ -36222,34 +36294,72 @@ inline MTPmessages_stickerSetInstallResult MTP_messages_stickerSetInstallResultA
return MTP::internal::TypeCreator::new_messages_stickerSetInstallResultArchive(_sets);
}
inline MTPstickerSetCovered::MTPstickerSetCovered() : mtpDataOwner(new MTPDstickerSetCovered()) {
}
inline uint32 MTPstickerSetCovered::innerLength() const {
const MTPDstickerSetCovered &v(c_stickerSetCovered());
return v.vset.innerLength() + v.vcover.innerLength();
switch (_type) {
case mtpc_stickerSetCovered: {
const MTPDstickerSetCovered &v(c_stickerSetCovered());
return v.vset.innerLength() + v.vcover.innerLength();
}
case mtpc_stickerSetMultiCovered: {
const MTPDstickerSetMultiCovered &v(c_stickerSetMultiCovered());
return v.vset.innerLength() + v.vcovers.innerLength();
}
}
return 0;
}
inline mtpTypeId MTPstickerSetCovered::type() const {
return mtpc_stickerSetCovered;
if (!_type) throw mtpErrorUninitialized();
return _type;
}
inline void MTPstickerSetCovered::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != mtpc_stickerSetCovered) throw mtpErrorUnexpected(cons, "MTPstickerSetCovered");
if (!data) setData(new MTPDstickerSetCovered());
MTPDstickerSetCovered &v(_stickerSetCovered());
v.vset.read(from, end);
v.vcover.read(from, end);
if (cons != _type) setData(0);
switch (cons) {
case mtpc_stickerSetCovered: _type = cons; {
if (!data) setData(new MTPDstickerSetCovered());
MTPDstickerSetCovered &v(_stickerSetCovered());
v.vset.read(from, end);
v.vcover.read(from, end);
} break;
case mtpc_stickerSetMultiCovered: _type = cons; {
if (!data) setData(new MTPDstickerSetMultiCovered());
MTPDstickerSetMultiCovered &v(_stickerSetMultiCovered());
v.vset.read(from, end);
v.vcovers.read(from, end);
} break;
default: throw mtpErrorUnexpected(cons, "MTPstickerSetCovered");
}
}
inline void MTPstickerSetCovered::write(mtpBuffer &to) const {
const MTPDstickerSetCovered &v(c_stickerSetCovered());
v.vset.write(to);
v.vcover.write(to);
switch (_type) {
case mtpc_stickerSetCovered: {
const MTPDstickerSetCovered &v(c_stickerSetCovered());
v.vset.write(to);
v.vcover.write(to);
} break;
case mtpc_stickerSetMultiCovered: {
const MTPDstickerSetMultiCovered &v(c_stickerSetMultiCovered());
v.vset.write(to);
v.vcovers.write(to);
} break;
}
}
inline MTPstickerSetCovered::MTPstickerSetCovered(MTPDstickerSetCovered *_data) : mtpDataOwner(_data) {
inline MTPstickerSetCovered::MTPstickerSetCovered(mtpTypeId type) : mtpDataOwner(0), _type(type) {
switch (type) {
case mtpc_stickerSetCovered: setData(new MTPDstickerSetCovered()); break;
case mtpc_stickerSetMultiCovered: setData(new MTPDstickerSetMultiCovered()); break;
default: throw mtpErrorBadTypeId(type, "MTPstickerSetCovered");
}
}
inline MTPstickerSetCovered::MTPstickerSetCovered(MTPDstickerSetCovered *_data) : mtpDataOwner(_data), _type(mtpc_stickerSetCovered) {
}
inline MTPstickerSetCovered::MTPstickerSetCovered(MTPDstickerSetMultiCovered *_data) : mtpDataOwner(_data), _type(mtpc_stickerSetMultiCovered) {
}
inline MTPstickerSetCovered MTP_stickerSetCovered(const MTPStickerSet &_set, const MTPDocument &_cover) {
return MTP::internal::TypeCreator::new_stickerSetCovered(_set, _cover);
}
inline MTPstickerSetCovered MTP_stickerSetMultiCovered(const MTPStickerSet &_set, const MTPVector<MTPDocument> &_covers) {
return MTP::internal::TypeCreator::new_stickerSetMultiCovered(_set, _covers);
}
inline MTPDmessage::Flags mtpCastFlags(MTPDmessageService::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); }
inline MTPDmessage::Flags mtpCastFlags(MTPflags<MTPDmessageService::Flags> flags) { return mtpCastFlags(flags.v); }
inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); }

View File

@ -142,13 +142,12 @@ void TitleWidget::setHideLevel(float64 level) {
}
}
}
#include "boxes/sharebox.h" // TODO
void TitleWidget::onContacts() {
if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray();
if (!App::self()) return;
Ui::showLayer(new ShareBox([](const QVector<PeerData*> &result) {
}));
Ui::showLayer(new ContactsBox());
}
void TitleWidget::onAbout() {