Saving featured stickers for new 0.9.57 version in local storage.

This commit is contained in:
John Preston 2016-06-27 19:25:21 +03:00
parent a89185565a
commit 991c6ddd99
24 changed files with 578 additions and 120 deletions

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,56,0
PRODUCTVERSION 0,9,56,0
FILEVERSION 0,9,57,0
PRODUCTVERSION 0,9,57,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.56.0"
VALUE "FileVersion", "0.9.57.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.56.0"
VALUE "ProductVersion", "0.9.57.0"
END
END
BLOCK "VarFileInfo"

View file

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,56,0
PRODUCTVERSION 0,9,56,0
FILEVERSION 0,9,57,0
PRODUCTVERSION 0,9,57,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.9.56.0"
VALUE "FileVersion", "0.9.57.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.56.0"
VALUE "ProductVersion", "0.9.57.0"
END
END
BLOCK "VarFileInfo"

View file

@ -929,7 +929,7 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result)
if (d.vset.type() != mtpc_stickerSet) return;
const auto &s(d.vset.c_stickerSet());
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
auto it = sets.find(setId);
if (it == sets.cend()) return;
@ -937,7 +937,9 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result)
it->hash = s.vhash.v;
it->shortName = qs(s.vshort_name);
it->title = stickerSetTitle(s);
it->flags = s.vflags.v;
auto clientFlags = it->flags & (MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_not_loaded);
it->flags = s.vflags.v | clientFlags;
it->flags &= ~MTPDstickerSet_ClientFlag::f_not_loaded;
const auto &d_docs(d.vdocuments.c_vector().v);
auto custom = sets.find(Stickers::CustomSetId);

View file

@ -30,16 +30,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localstorage.h"
StickerSetInner::StickerSetInner(const MTPInputStickerSet &set) : TWidget()
, _loaded(false)
, _setId(0)
, _setAccess(0)
, _setCount(0)
, _setHash(0)
, _setFlags(0)
, _bottom(0)
, _input(set)
, _installRequest(0)
, _previewShown(-1) {
, _input(set) {
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
switch (set.type()) {
case mtpc_inputStickerSetID: _setId = set.c_inputStickerSetID().vid.v; _setAccess = set.c_inputStickerSetID().vaccess_hash.v; break;
@ -117,17 +108,20 @@ bool StickerSetInner::failedSet(const RPCError &error) {
}
void StickerSetInner::installDone(const MTPBool &result) {
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
_setFlags &= ~MTPDstickerSet::Flag::f_disabled;
_setFlags |= MTPDstickerSet::Flag::f_installed;
auto it = sets.find(_setId);
if (it == sets.cend()) {
it = sets.insert(_setId, Stickers::Set(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags));
} else {
it.value().flags = _setFlags;
}
it.value().stickers = _pack;
it.value().emoji = _emoji;
Stickers::Order &order(Global::RefStickerSetsOrder());
auto &order = Global::RefStickerSetsOrder();
int32 insertAtIndex = 0, currentIndex = order.indexOf(_setId);
if (currentIndex != insertAtIndex) {
if (currentIndex > 0) {
@ -257,7 +251,7 @@ bool StickerSetInner::loaded() const {
int32 StickerSetInner::notInstalled() const {
if (!_loaded) return 0;
auto it = Global::StickerSets().constFind(_setId);
if (it == Global::StickerSets().cend() || (it->flags & MTPDstickerSet::Flag::f_disabled)) return _pack.size();
if (it == Global::StickerSets().cend() || !(it->flags & MTPDstickerSet::Flag::f_installed) || (it->flags & MTPDstickerSet::Flag::f_disabled)) return _pack.size();
return 0;
}
@ -682,10 +676,10 @@ void StickersInner::rebuild() {
int32 namew = st::boxWideWidth - namex - st::contactsPadding.right() - st::contactsCheckPosition.x() - qMax(qMax(_returnWidth, _removeWidth), _restoreWidth);
clear();
const Stickers::Order &order(Global::StickerSetsOrder());
auto &order = Global::StickerSetsOrder();
_animStartTimes.reserve(order.size());
const Stickers::Sets &sets(Global::StickerSets());
auto &sets = Global::StickerSets();
for (int i = 0, l = order.size(); i < l; ++i) {
auto it = sets.constFind(order.at(i));
if (it != sets.cend()) {
@ -913,7 +907,7 @@ void StickersBox::onSave() {
bool writeRecent = false;
RecentStickerPack &recent(cGetRecentStickers());
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
QVector<uint64> reorder = _inner.getOrder(), disabled = _inner.getDisabledSets();
for (int32 i = 0, l = disabled.size(); i < l; ++i) {
@ -936,7 +930,9 @@ void StickersBox::onSave() {
_disenableRequests.insert(MTP::send(MTPmessages_UninstallStickerSet(setId), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType());
int removeIndex = Global::StickerSetsOrder().indexOf(it->id);
if (removeIndex >= 0) Global::RefStickerSetsOrder().removeAt(removeIndex);
sets.erase(it);
if (!(it->flags & MTPDstickerSet_ClientFlag::f_featured)) {
sets.erase(it);
}
}
}
}
@ -955,7 +951,10 @@ void StickersBox::onSave() {
}
}
for (auto it = sets.begin(); it != sets.cend();) {
if (it->id == Stickers::CustomSetId || it->id == Stickers::RecentSetId || order.contains(it->id)) {
if (it->id == Stickers::CustomSetId
|| it->id == Stickers::RecentSetId
|| (it->flags & MTPDstickerSet_ClientFlag::f_featured)
|| order.contains(it->id)) {
++it;
} else {
it = sets.erase(it);
@ -991,8 +990,8 @@ void StickersBox::showAll() {
int32 stickerPacksCount(bool includeDisabledOfficial) {
int32 result = 0;
const Stickers::Order &order(Global::StickerSetsOrder());
const Stickers::Sets &sets(Global::StickerSets());
auto &order = Global::StickerSetsOrder();
auto &sets = Global::StickerSets();
for (int i = 0, l = order.size(); i < l; ++i) {
auto it = sets.constFind(order.at(i));
if (it != sets.cend()) {

View file

@ -67,19 +67,21 @@ private:
StickerPack _pack;
StickersByEmojiMap _emoji;
bool _loaded;
uint64 _setId, _setAccess;
bool _loaded = false;
uint64 _setId = 0;
uint64 _setAccess = 0;
QString _title, _setTitle, _setShortName;
int32 _setCount, _setHash;
MTPDstickerSet::Flags _setFlags;
int32 _setCount = 0;
int32 _setHash = 0;
MTPDstickerSet::Flags _setFlags = 0;
int32 _bottom;
int32 _bottom = 0;
MTPInputStickerSet _input;
mtpRequestId _installRequest;
mtpRequestId _installRequest = 0;
QTimer _previewTimer;
int32 _previewShown;
int32 _previewShown = -1;
};
class StickerSetBox : public ScrollableBox, public RPCSender {

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 9056;
constexpr str_const AppVersionStr = "0.9.56";
constexpr bool AppAlphaVersion = false;
constexpr int AppVersion = 9057;
constexpr str_const AppVersionStr = "0.9.57";
constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View file

@ -1508,7 +1508,7 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) {
break;
}
}
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
auto it = sets.find(Stickers::CustomSetId);
if (it != sets.cend()) {
for (int32 i = 0, l = it->stickers.size(); i < l; ++i) {
@ -1628,8 +1628,8 @@ void StickerPanInner::hideFinish(bool completely) {
void StickerPanInner::refreshStickers() {
clearSelection(true);
const Stickers::Sets &sets(Global::StickerSets());
_sets.clear(); _sets.reserve(sets.size() + 1);
_sets.clear();
_sets.reserve(Global::StickerSetsOrder().size() + 1);
refreshRecentStickers(false);
for (auto i = Global::StickerSetsOrder().cbegin(), e = Global::StickerSetsOrder().cend(); i != e; ++i) {
@ -2085,7 +2085,7 @@ bool StickerPanInner::ui_isInlineItemBeingChosen() {
}
void StickerPanInner::appendSet(uint64 setId) {
const Stickers::Sets &sets(Global::StickerSets());
auto &sets = Global::StickerSets();
auto it = sets.constFind(setId);
if (it == sets.cend() || (it->flags & MTPDstickerSet::Flag::f_disabled) || it->stickers.isEmpty()) return;
@ -3584,7 +3584,7 @@ void EmojiPan::onSwitch() {
} else {
if (cShowingSavedGifs() && cSavedGifs().isEmpty()) {
s_inner.showStickerSet(Stickers::DefaultSetId);
} else if (!cShowingSavedGifs() && !cSavedGifs().isEmpty() && Global::StickerSets().isEmpty()) {
} else if (!cShowingSavedGifs() && !cSavedGifs().isEmpty() && Global::StickerSetsOrder().isEmpty()) {
s_inner.showStickerSet(Stickers::NoneSetId);
} else {
s_inner.updateShowingSavedGifs();
@ -3652,7 +3652,10 @@ void EmojiPan::onRemoveSetSure() {
++i;
}
}
Global::RefStickerSets().erase(it);
it->flags &= ~MTPDstickerSet::Flag::f_installed;
if (!(it->flags & MTPDstickerSet_ClientFlag::f_featured)) {
Global::RefStickerSets().erase(it);
}
int removeIndex = Global::StickerSetsOrder().indexOf(_removingSetId);
if (removeIndex >= 0) Global::RefStickerSetsOrder().removeAt(removeIndex);
refreshStickers();

View file

@ -560,6 +560,9 @@ struct Data {
Stickers::Sets StickerSets;
Stickers::Order StickerSetsOrder;
uint64 LastStickersUpdate = 0;
Stickers::Order FeaturedStickerSetsOrder;
Stickers::UnreadMap FeaturedUnreadSets;
uint64 LastFeaturedStickersUpdate = 0;
MTP::DcOptions DcOptions;
@ -626,6 +629,9 @@ DefineRefVar(Global, PendingItemsMap, PendingRepaintItems);
DefineVar(Global, Stickers::Sets, StickerSets);
DefineVar(Global, Stickers::Order, StickerSetsOrder);
DefineVar(Global, uint64, LastStickersUpdate);
DefineVar(Global, Stickers::Order, FeaturedStickerSetsOrder);
DefineVar(Global, Stickers::UnreadMap, FeaturedUnreadSets);
DefineVar(Global, uint64, LastFeaturedStickersUpdate);
DefineVar(Global, MTP::DcOptions, DcOptions);

View file

@ -181,7 +181,14 @@ static const uint64 DefaultSetId = 0; // for backward compatibility
static const uint64 CustomSetId = 0xFFFFFFFFFFFFFFFFULL, RecentSetId = 0xFFFFFFFFFFFFFFFEULL;
static const uint64 NoneSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel
struct Set {
Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags) : id(id), access(access), title(title), shortName(shortName), count(count), hash(hash), flags(flags) {
Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags)
: id(id)
, access(access)
, title(title)
, shortName(shortName)
, count(count)
, hash(hash)
, flags(flags) {
}
uint64 id, access;
QString title, shortName;
@ -192,6 +199,7 @@ struct Set {
};
using Sets = QMap<uint64, Set>;
using Order = QList<uint64>;
using UnreadMap = OrderedSet<uint64>;
} // namespace Stickers
@ -241,6 +249,9 @@ DeclareRefVar(PendingItemsMap, PendingRepaintItems);
DeclareVar(Stickers::Sets, StickerSets);
DeclareVar(Stickers::Order, StickerSetsOrder);
DeclareVar(uint64, LastStickersUpdate);
DeclareVar(Stickers::Order, FeaturedStickerSetsOrder);
DeclareVar(Stickers::UnreadMap, FeaturedUnreadSets);
DeclareVar(uint64, LastFeaturedStickersUpdate);
DeclareVar(MTP::DcOptions, DcOptions);

View file

@ -2868,7 +2868,9 @@ bool HistoryItem::unread() const {
if (id > 0) {
if (id < history()->outboxReadBefore) return false;
if (auto channel = history()->peer->asChannel()) {
if (auto user = history()->peer->asUser()) {
if (user->botInfo) return false;
} else if (auto channel = history()->peer->asChannel()) {
if (!channel->isMegagroup()) return false;
}
}

View file

@ -153,8 +153,8 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) {
StickerPack srows;
if (_emoji) {
QMap<uint64, uint64> setsToRequest;
Stickers::Sets &sets(Global::RefStickerSets());
const Stickers::Order &order(Global::StickerSetsOrder());
auto &sets = Global::RefStickerSets();
auto &order = Global::StickerSetsOrder();
for (int i = 0, l = order.size(); i < l; ++i) {
auto it = sets.find(order.at(i));
if (it != sets.cend()) {

View file

@ -33,6 +33,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "data/data_drafts.h"
#include "history/history_service_layout.h"
#include "profile/profile_members_widget.h"
#include "core/click_handler_types.h"
#include "lang.h"
#include "application.h"
#include "mainwidget.h"
@ -3519,12 +3520,18 @@ void HistoryWidget::onRecordUpdate(quint16 level, qint32 samples) {
}
void HistoryWidget::updateStickers() {
if (!Global::LastStickersUpdate() || getms(true) >= Global::LastStickersUpdate() + StickersUpdateTimeout) {
auto now = getms(true);
if (!Global::LastStickersUpdate() || now >= Global::LastStickersUpdate() + StickersUpdateTimeout) {
if (!_stickersUpdateRequest) {
_stickersUpdateRequest = MTP::send(MTPmessages_GetAllStickers(MTP_int(Local::countStickersHash(true))), rpcDone(&HistoryWidget::stickersGot), rpcFail(&HistoryWidget::stickersFailed));
}
}
if (!cLastSavedGifsUpdate() || getms(true) >= cLastSavedGifsUpdate() + StickersUpdateTimeout) {
if (!Global::LastFeaturedStickersUpdate() || now >= Global::LastFeaturedStickersUpdate() + StickersUpdateTimeout) {
if (!_featuredStickersUpdateRequest) {
_featuredStickersUpdateRequest = MTP::send(MTPmessages_GetFeaturedStickers(MTP_int(Local::countFeaturedStickersHash())), rpcDone(&HistoryWidget::featuredStickersGot), rpcFail(&HistoryWidget::featuredStickersFailed));
}
}
if (!cLastSavedGifsUpdate() || now >= cLastSavedGifsUpdate() + StickersUpdateTimeout) {
if (!_savedGifsUpdateRequest) {
_savedGifsUpdateRequest = MTP::send(MTPmessages_GetSavedGifs(MTP_int(Local::countSavedGifsHash())), rpcDone(&HistoryWidget::savedGifsGot), rpcFail(&HistoryWidget::savedGifsFailed));
}
@ -3641,17 +3648,17 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
const auto &d_sets(d.vsets.c_vector().v);
Stickers::Order &setsOrder(Global::RefStickerSetsOrder());
auto &setsOrder = Global::RefStickerSetsOrder();
setsOrder.clear();
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
QMap<uint64, uint64> setsToRequest;
for (auto i = sets.begin(), e = sets.end(); i != e; ++i) {
i->access = 0; // mark for removing
for (auto &set : sets) {
set.flags &= ~MTPDstickerSet::Flag::f_installed; // mark for removing
}
for (int i = 0, l = d_sets.size(); i != l; ++i) {
if (d_sets.at(i).type() == mtpc_stickerSet) {
const auto &set(d_sets.at(i).c_stickerSet());
for_const (auto &setData, d_sets) {
if (setData.type() == mtpc_stickerSet) {
const auto &set(setData.c_stickerSet());
auto it = sets.find(set.vid.v);
QString title = stickerSetTitle(set);
if (it == sets.cend()) {
@ -3660,7 +3667,8 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
it->access = set.vaccess_hash.v;
it->title = title;
it->shortName = qs(set.vshort_name);
it->flags = set.vflags.v;
auto clientFlags = it->flags & (MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_not_loaded);
it->flags = set.vflags.v | clientFlags;
if (it->count != set.vcount.v || it->hash != set.vhash.v || it->emoji.isEmpty()) {
it->count = set.vcount.v;
it->hash = set.vhash.v;
@ -3678,9 +3686,9 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
bool writeRecent = false;
RecentStickerPack &recent(cGetRecentStickers());
for (Stickers::Sets::iterator it = sets.begin(), e = sets.end(); it != e;) {
if (it->id == Stickers::CustomSetId || it->access != 0) {
++it;
} else {
bool installed = (it->flags & MTPDstickerSet::Flag::f_installed);
bool featured = (it->flags & MTPDstickerSet_ClientFlag::f_featured);
if (!installed) { // remove not mine sets from recent stickers
for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) {
if (it->stickers.indexOf(i->first) >= 0) {
i = recent.erase(i);
@ -3689,6 +3697,10 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
++i;
}
}
}
if (installed || featured) {
++it;
} else {
it = sets.erase(it);
}
}
@ -3720,6 +3732,90 @@ bool HistoryWidget::stickersFailed(const RPCError &error) {
return true;
}
void HistoryWidget::featuredStickersGot(const MTPmessages_FeaturedStickers &stickers) {
Global::SetLastFeaturedStickersUpdate(getms(true));
_featuredStickersUpdateRequest = 0;
if (stickers.type() != mtpc_messages_featuredStickers) return;
auto &d(stickers.c_messages_featuredStickers());
auto &d_sets(d.vsets.c_vector().v);
auto &setsOrder = Global::RefFeaturedStickerSetsOrder();
setsOrder.clear();
auto &sets = Global::RefStickerSets();
QMap<uint64, uint64> setsToRequest;
for (auto &set : sets) {
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_stickerSet) {
const auto &set(d_sets.at(i).c_stickerSet());
auto it = sets.find(set.vid.v);
QString title = stickerSetTitle(set);
if (it == sets.cend()) {
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 | MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_not_loaded));
} else {
it->access = set.vaccess_hash.v;
it->title = title;
it->shortName = qs(set.vshort_name);
auto clientFlags = it->flags & (MTPDstickerSet_ClientFlag::f_featured | MTPDstickerSet_ClientFlag::f_not_loaded);
it->flags = set.vflags.v | clientFlags | MTPDstickerSet_ClientFlag::f_featured;
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);
if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) {
setsToRequest.insert(set.vid.v, set.vaccess_hash.v);
}
}
}
for (Stickers::Sets::iterator it = sets.begin(), e = sets.end(); it != e;) {
bool installed = (it->flags & MTPDstickerSet::Flag::f_installed);
bool featured = (it->flags & MTPDstickerSet_ClientFlag::f_featured);
if (installed || featured) {
++it;
} else {
it = sets.erase(it);
}
}
auto &unreadFeatured = Global::RefFeaturedUnreadSets();
unreadFeatured.clear();
for_const (auto &unreadSetId, d.vunread.c_vector().v) {
unreadFeatured.insert(unreadSetId.v);
}
if (Local::countFeaturedStickersHash() != d.vhash.v) {
LOG(("API Error: received featured stickers hash %1 while counted hash is %2").arg(d.vhash.v).arg(Local::countFeaturedStickersHash()));
}
if (!setsToRequest.isEmpty() && App::api()) {
for (QMap<uint64, uint64>::const_iterator i = setsToRequest.cbegin(), e = setsToRequest.cend(); i != e; ++i) {
App::api()->scheduleStickerSetRequest(i.key(), i.value());
}
App::api()->requestStickerSets();
}
Local::writeStickers();
if (App::main()) emit App::main()->stickersUpdated();
}
bool HistoryWidget::featuredStickersFailed(const RPCError &error) {
if (MTP::isDefaultHandledError(error)) return false;
LOG(("App Fail: Failed to get featured stickers!"));
Global::SetLastFeaturedStickersUpdate(getms(true));
_featuredStickersUpdateRequest = 0;
return true;
}
void HistoryWidget::savedGifsGot(const MTPmessages_SavedGifs &gifs) {
cSetLastSavedGifsUpdate(getms(true));
_savedGifsUpdateRequest = 0;
@ -5592,6 +5688,8 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC
toast.text = qs(answerData.vmessage);
Ui::Toast::Show(App::wnd(), toast);
}
} else if (answerData.has_url()) {
UrlClickHandler::doOpen(qs(answerData.vurl));
}
}
}

View file

@ -1005,6 +1005,10 @@ private:
void stickersGot(const MTPmessages_AllStickers &stickers);
bool stickersFailed(const RPCError &error);
mtpRequestId _featuredStickersUpdateRequest = 0;
void featuredStickersGot(const MTPmessages_FeaturedStickers &stickers);
bool featuredStickersFailed(const RPCError &error);
mtpRequestId _savedGifsUpdateRequest = 0;
void savedGifsGot(const MTPmessages_SavedGifs &gifs);
bool savedGifsFailed(const RPCError &error);

View file

@ -3038,7 +3038,7 @@ namespace Local {
void writeStickers() {
if (!_working()) return;
const Stickers::Sets &sets(Global::StickerSets());
auto &sets = Global::StickerSets();
if (sets.isEmpty()) {
if (_stickersKey) {
clearKey(_stickersKey);
@ -3050,31 +3050,36 @@ namespace Local {
int32 setsCount = 0;
QByteArray hashToWrite;
quint32 size = sizeof(quint32) + Serialize::bytearraySize(hashToWrite);
for (auto i = sets.cbegin(); i != sets.cend(); ++i) {
bool notLoaded = (i->flags & MTPDstickerSet_ClientFlag::f_not_loaded);
for_const (auto &set, sets) {
bool notLoaded = (set.flags & MTPDstickerSet_ClientFlag::f_not_loaded);
if (notLoaded) {
if (!(i->flags & MTPDstickerSet::Flag::f_disabled) || (i->flags & MTPDstickerSet::Flag::f_official)) { // waiting to receive
if (!(set.flags & MTPDstickerSet::Flag::f_disabled)
|| (set.flags & MTPDstickerSet::Flag::f_official)
|| (set.flags & MTPDstickerSet_ClientFlag::f_featured)) { // waiting to receive
return;
}
} else {
if (i->stickers.isEmpty()) continue;
if (set.stickers.isEmpty()) continue;
}
// id + access + title + shortName + stickersCount + hash + flags
size += sizeof(quint64) * 2 + Serialize::stringSize(i->title) + Serialize::stringSize(i->shortName) + sizeof(quint32) + sizeof(qint32) * 2;
for (StickerPack::const_iterator j = i->stickers.cbegin(), e = i->stickers.cend(); j != e; ++j) {
size += Serialize::Document::sizeInStream(*j);
size += sizeof(quint64) * 2 + Serialize::stringSize(set.title) + Serialize::stringSize(set.shortName) + sizeof(quint32) + sizeof(qint32) * 2;
for_const (auto &sticker, set.stickers) {
size += Serialize::Document::sizeInStream(sticker);
}
if (AppVersion > 9018) {
size += sizeof(qint32); // emojiCount
for (StickersByEmojiMap::const_iterator j = i->emoji.cbegin(), e = i->emoji.cend(); j != e; ++j) {
for (auto j = set.emoji.cbegin(), e = set.emoji.cend(); j != e; ++j) {
size += Serialize::stringSize(emojiString(j.key())) + sizeof(qint32) + (j->size() * sizeof(quint64));
}
}
++setsCount;
}
size += sizeof(qint32) + (Global::StickerSetsOrder().size() * sizeof(quint64));
size += sizeof(qint32) + (Global::FeaturedStickerSetsOrder().size() * sizeof(quint64));
size += sizeof(qint32) + (Global::FeaturedUnreadSets().size() * sizeof(quint64));
if (!_stickersKey) {
_stickersKey = genKey();
@ -3083,10 +3088,17 @@ namespace Local {
}
EncryptedDescriptor data(size);
data.stream << quint32(setsCount) << hashToWrite;
_writeStickerSet(data.stream, Stickers::CustomSetId);
for (auto i = Global::StickerSetsOrder().cbegin(), e = Global::StickerSetsOrder().cend(); i != e; ++i) {
_writeStickerSet(data.stream, *i);
for_const (auto &set, sets) {
_writeStickerSet(data.stream, set.id);
}
data.stream << Global::StickerSetsOrder();
data.stream << Global::FeaturedStickerSetsOrder();
data.stream << qint32(Global::FeaturedUnreadSets().size());
for_const (auto setId, Global::FeaturedUnreadSets()) {
data.stream << quint64(setId);
}
FileWriteDescriptor file(_stickersKey);
file.writeEncrypted(data);
}
@ -3103,17 +3115,17 @@ namespace Local {
return;
}
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
sets.clear();
Stickers::Order &order(Global::RefStickerSetsOrder());
auto &order = Global::RefStickerSetsOrder();
order.clear();
RecentStickerPack &recent(cRefRecentStickers());
auto &recent = cRefRecentStickers();
recent.clear();
Stickers::Set &def(sets.insert(Stickers::DefaultSetId, Stickers::Set(Stickers::DefaultSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet::Flag::f_official)).value());
Stickers::Set &custom(sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)).value());
auto &def = sets.insert(Stickers::DefaultSetId, Stickers::Set(Stickers::DefaultSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet::Flag::f_official | MTPDstickerSet::Flag::f_installed)).value();
auto &custom = sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, MTPDstickerSet::Flag::f_installed)).value();
QMap<uint64, bool> read;
while (!stickers.stream.atEnd()) {
@ -3179,12 +3191,18 @@ namespace Local {
return;
}
Stickers::Sets &sets(Global::RefStickerSets());
auto &sets = Global::RefStickerSets();
sets.clear();
Stickers::Order &order(Global::RefStickerSetsOrder());
auto &order = Global::RefStickerSetsOrder();
order.clear();
auto &featuredOrder = Global::RefFeaturedStickerSetsOrder();
featuredOrder.clear();
auto &unreadFeatured = Global::RefFeaturedUnreadSets();
unreadFeatured.clear();
quint32 cnt;
QByteArray hash;
stickers.stream >> cnt >> hash; // ignore hash, it is counted
@ -3205,19 +3223,27 @@ namespace Local {
setFlags |= qFlags(MTPDstickerSet_ClientFlag::f_not_loaded);
}
}
if (stickers.version < 9057) {
setFlags |= qFlags(MTPDstickerSet::Flag::f_installed);
}
if (setId == Stickers::DefaultSetId) {
setTitle = lang(lng_stickers_default_set);
setFlags |= qFlags(MTPDstickerSet::Flag::f_official);
order.push_front(setId);
if (stickers.version < 9057) {
order.push_front(setId);
}
} else if (setId == Stickers::CustomSetId) {
setTitle = lang(lng_custom_stickers);
} else if (setId) {
order.push_back(setId);
if (stickers.version < 9057) {
order.push_back(setId);
}
} else {
continue;
}
Stickers::Set &set(sets.insert(setId, Stickers::Set(setId, setAccess, setTitle, setShortName, 0, setHash, MTPDstickerSet::Flags(setFlags))).value());
auto &set = sets.insert(setId, Stickers::Set(setId, setAccess, setTitle, setShortName, 0, setHash, MTPDstickerSet::Flags(setFlags))).value();
if (scnt < 0) { // disabled not loaded set
set.count = -scnt;
continue;
@ -3261,6 +3287,22 @@ namespace Local {
}
}
}
// Read orders of installed and featured stickers.
if (stickers.version >= 9057) {
stickers.stream >> order;
stickers.stream >> featuredOrder;
qint32 unreadCount = 0;
stickers.stream >> unreadCount;
for (int i = 0; i < unreadCount; ++i) {
quint64 setId = 0;
stickers.stream >> setId;
if (setId) {
unreadFeatured.insert(setId);
}
}
}
}
int32 countStickersHash(bool checkOfficial) {
@ -3284,6 +3326,19 @@ namespace Local {
return (!checkOfficial || (!foundBad && foundOfficial)) ? int32(acc & 0x7FFFFFFF) : 0;
}
int32 countFeaturedStickersHash() {
uint32 acc = 0;
auto &featured(Global::FeaturedStickerSetsOrder());
for_const (auto setId, featured) {
acc = (acc * 20261) + uint32(setId >> 32);
acc = (acc * 20261) + uint32(setId & 0xFFFFFFFF);
if (Global::FeaturedUnreadSets().contains(setId)) {
acc = (acc * 20261) + 1U;
}
}
return int32(acc & 0x7FFFFFFF);
}
int32 countSavedGifsHash() {
uint32 acc = 0;
const SavedGifs &saved(cSavedGifs());

View file

@ -156,6 +156,7 @@ namespace Local {
void writeStickers();
void readStickers();
int32 countStickersHash(bool checkOfficial = false);
int32 countFeaturedStickersHash();
void writeSavedGifs();
void readSavedGifs();

View file

@ -3700,7 +3700,7 @@ void MainWidget::incrementSticker(DocumentData *sticker) {
if (!found) {
Stickers::Sets::iterator it = sets.find(Stickers::CustomSetId);
if (it == sets.cend()) {
it = sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0));
it = sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, MTPDstickerSet::Flag::f_installed));
}
it->stickers.push_back(sticker);
++it->count;
@ -4646,7 +4646,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
Stickers::Sets &sets(Global::RefStickerSets());
auto it = sets.find(s.vid.v);
if (it == sets.cend()) {
it = sets.insert(s.vid.v, Stickers::Set(s.vid.v, s.vaccess_hash.v, stickerSetTitle(s), qs(s.vshort_name), s.vcount.v, s.vhash.v, s.vflags.v));
it = sets.insert(s.vid.v, Stickers::Set(s.vid.v, s.vaccess_hash.v, stickerSetTitle(s), qs(s.vshort_name), s.vcount.v, s.vhash.v, s.vflags.v | MTPDstickerSet::Flag::f_installed));
} else {
it->flags |= MTPDstickerSet::Flag::f_installed;
}
const auto &v(set.vdocuments.c_vector().v);
@ -4703,9 +4705,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
} break;
case mtpc_updateStickerSetsOrder: {
const auto &d(update.c_updateStickerSetsOrder());
const auto &order(d.vorder.c_vector().v);
const auto &sets(Global::StickerSets());
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()) {
@ -4728,6 +4730,12 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
App::main()->updateStickers();
} break;
case mtpc_updateReadFeaturedStickers: {
Global::RefFeaturedUnreadSets().clear();
Local::writeStickers();
emit stickersUpdated();
} break;
////// Cloud saved GIFs
case mtpc_updateSavedGifs: {
cSetLastSavedGifsUpdate(0);

View file

@ -1060,8 +1060,11 @@ enum class MTPDstickerSet_ClientFlag : int32 {
// sticker set is not yet loaded
f_not_loaded = (1 << 30),
// sticker set is one of featured (should be saved locally)
f_featured = (1 << 29),
// update this when adding new client side flags
MIN_FIELD = (1 << 30),
MIN_FIELD = (1 << 29),
};
DEFINE_MTP_CLIENT_FLAGS(MTPDstickerSet)

View file

@ -392,6 +392,7 @@ updateEditMessage#e40370a3 message:Message pts:int pts_count:int = Update;
updateInlineBotCallbackQuery#2cbd95af query_id:long user_id:int msg_id:InputBotInlineMessageID data:bytes = Update;
updateReadChannelOutbox#25d6c9c7 channel_id:int max_id:int = Update;
updateDraftMessage#ee2bb969 peer:Peer draft:DraftMessage = Update;
updateReadFeaturedStickers#571d2742 = Update;
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
@ -670,7 +671,7 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType;
auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType;
auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType;
messages.botCallbackAnswer#1264f1c6 flags:# alert:flags.1?true message:flags.0?string = messages.BotCallbackAnswer;
messages.botCallbackAnswer#31fde6e4 flags:# alert:flags.1?true allow_pip:flags.2?true message:flags.0?string url:flags.3?string = messages.BotCallbackAnswer;
messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData;
@ -696,6 +697,9 @@ contacts.topPeers#70b772a8 categories:Vector<TopPeerCategoryPeers> chats:Vector<
draftMessageEmpty#ba4baec5 = DraftMessage;
draftMessage#fd8e711f flags:# no_webpage:flags.1?true reply_to_msg_id:flags.0?int message:string entities:flags.3?Vector<MessageEntity> date:int = DraftMessage;
messages.featuredStickersNotModified#4ede3cf = messages.FeaturedStickers;
messages.featuredStickers#ed6392b7 hash:int sets:Vector<StickerSet> unread:Vector<long> = messages.FeaturedStickers;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -826,10 +830,12 @@ messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEdi
messages.editMessage#ce91e4ca flags:# no_webpage:flags.1?true peer:InputPeer id:int message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates;
messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Bool;
messages.getBotCallbackAnswer#a6e94f04 peer:InputPeer msg_id:int data:bytes = messages.BotCallbackAnswer;
messages.setBotCallbackAnswer#481c591a flags:# alert:flags.1?true query_id:long message:flags.0?string = Bool;
messages.setBotCallbackAnswer#70dc0fa3 flags:# alert:flags.1?true allow_pip:flags.2?true query_id:long message:flags.0?string url:flags.3?string = Bool;
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;
updates.getState#edd4882a = updates.State;
updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference;
@ -880,4 +886,4 @@ channels.exportMessageLink#c846d22d channel:InputChannel id:int = ExportedMessag
channels.toggleSignatures#1f69b606 channel:InputChannel enabled:Bool = Updates;
channels.updatePinnedMessage#a72ded52 flags:# silent:flags.0?true channel:InputChannel id:int = Updates;
// LAYER 53
// LAYER 54

View file

@ -3012,6 +3012,10 @@ void _serialize_updateDraftMessage(MTPStringLogger &to, int32 stage, int32 lev,
}
}
void _serialize_updateReadFeaturedStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
to.add("{ updateReadFeaturedStickers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
}
void _serialize_updates_state(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);
@ -5586,7 +5590,9 @@ void _serialize_messages_botCallbackAnswer(MTPStringLogger &to, int32 stage, int
switch (stage) {
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" 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;
case 2: to.add(" allow_pip: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_allow_pip) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break;
case 3: 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;
case 4: to.add(" url: "); ++stages.back(); if (flag & MTPDmessages_botCallbackAnswer::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
@ -5745,6 +5751,25 @@ void _serialize_draftMessage(MTPStringLogger &to, int32 stage, int32 lev, Types
}
}
void _serialize_messages_featuredStickersNotModified(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_featuredStickersNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
}
void _serialize_messages_featuredStickers(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_featuredStickers");
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;
case 1: to.add(" sets: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" unread: "); ++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_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);
@ -6335,8 +6360,10 @@ void _serialize_messages_setBotCallbackAnswer(MTPStringLogger &to, int32 stage,
switch (stage) {
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" 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;
case 2: to.add(" allow_pip: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::Flag::f_allow_pip) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break;
case 3: 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 4: 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;
case 5: to.add(" url: "); ++stages.back(); if (flag & MTPmessages_setBotCallbackAnswer::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
@ -6361,6 +6388,10 @@ 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();
}
void _serialize_upload_saveFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
if (stage) {
to.add(",\n").addSpaces(lev);
@ -8027,6 +8058,19 @@ void _serialize_messages_getPeerDialogs(MTPStringLogger &to, int32 stage, int32
}
}
void _serialize_messages_getFeaturedStickers(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_getFeaturedStickers");
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_updates_getState(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
}
@ -8484,6 +8528,7 @@ namespace {
_serializers.insert(mtpc_updateInlineBotCallbackQuery, _serialize_updateInlineBotCallbackQuery);
_serializers.insert(mtpc_updateReadChannelOutbox, _serialize_updateReadChannelOutbox);
_serializers.insert(mtpc_updateDraftMessage, _serialize_updateDraftMessage);
_serializers.insert(mtpc_updateReadFeaturedStickers, _serialize_updateReadFeaturedStickers);
_serializers.insert(mtpc_updates_state, _serialize_updates_state);
_serializers.insert(mtpc_updates_differenceEmpty, _serialize_updates_differenceEmpty);
_serializers.insert(mtpc_updates_difference, _serialize_updates_difference);
@ -8697,6 +8742,8 @@ namespace {
_serializers.insert(mtpc_contacts_topPeers, _serialize_contacts_topPeers);
_serializers.insert(mtpc_draftMessageEmpty, _serialize_draftMessageEmpty);
_serializers.insert(mtpc_draftMessage, _serialize_draftMessage);
_serializers.insert(mtpc_messages_featuredStickersNotModified, _serialize_messages_featuredStickersNotModified);
_serializers.insert(mtpc_messages_featuredStickers, _serialize_messages_featuredStickers);
_serializers.insert(mtpc_req_pq, _serialize_req_pq);
_serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params);
@ -8743,6 +8790,7 @@ namespace {
_serializers.insert(mtpc_messages_editInlineBotMessage, _serialize_messages_editInlineBotMessage);
_serializers.insert(mtpc_messages_setBotCallbackAnswer, _serialize_messages_setBotCallbackAnswer);
_serializers.insert(mtpc_messages_saveDraft, _serialize_messages_saveDraft);
_serializers.insert(mtpc_messages_readFeaturedStickers, _serialize_messages_readFeaturedStickers);
_serializers.insert(mtpc_upload_saveFilePart, _serialize_upload_saveFilePart);
_serializers.insert(mtpc_upload_saveBigFilePart, _serialize_upload_saveBigFilePart);
_serializers.insert(mtpc_help_saveAppLog, _serialize_help_saveAppLog);
@ -8861,6 +8909,7 @@ namespace {
_serializers.insert(mtpc_messages_getMessageEditData, _serialize_messages_getMessageEditData);
_serializers.insert(mtpc_messages_getBotCallbackAnswer, _serialize_messages_getBotCallbackAnswer);
_serializers.insert(mtpc_messages_getPeerDialogs, _serialize_messages_getPeerDialogs);
_serializers.insert(mtpc_messages_getFeaturedStickers, _serialize_messages_getFeaturedStickers);
_serializers.insert(mtpc_updates_getState, _serialize_updates_getState);
_serializers.insert(mtpc_updates_getDifference, _serialize_updates_getDifference);
_serializers.insert(mtpc_updates_getChannelDifference, _serialize_updates_getChannelDifference);

View file

@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
namespace MTP {
namespace internal {
static constexpr mtpPrime CurrentLayer = 53;
static constexpr mtpPrime CurrentLayer = 54;
class TypeCreator;
@ -288,6 +288,7 @@ enum {
mtpc_updateInlineBotCallbackQuery = 0x2cbd95af,
mtpc_updateReadChannelOutbox = 0x25d6c9c7,
mtpc_updateDraftMessage = 0xee2bb969,
mtpc_updateReadFeaturedStickers = 0x571d2742,
mtpc_updates_state = 0xa56c2a3e,
mtpc_updates_differenceEmpty = 0x5d75a138,
mtpc_updates_difference = 0xf49ca0,
@ -485,7 +486,7 @@ enum {
mtpc_auth_sentCodeTypeSms = 0xc000bba2,
mtpc_auth_sentCodeTypeCall = 0x5353e5a7,
mtpc_auth_sentCodeTypeFlashCall = 0xab03c6d9,
mtpc_messages_botCallbackAnswer = 0x1264f1c6,
mtpc_messages_botCallbackAnswer = 0x31fde6e4,
mtpc_messages_messageEditData = 0x26b5dde6,
mtpc_inputBotInlineMessageID = 0x890c3d89,
mtpc_inlineBotSwitchPM = 0x3c20629f,
@ -501,6 +502,8 @@ enum {
mtpc_contacts_topPeers = 0x70b772a8,
mtpc_draftMessageEmpty = 0xba4baec5,
mtpc_draftMessage = 0xfd8e711f,
mtpc_messages_featuredStickersNotModified = 0x4ede3cf,
mtpc_messages_featuredStickers = 0xed6392b7,
mtpc_invokeAfterMsg = 0xcb9f372d,
mtpc_invokeAfterMsgs = 0x3dc4b4f0,
mtpc_initConnection = 0x69796de9,
@ -624,10 +627,12 @@ enum {
mtpc_messages_editMessage = 0xce91e4ca,
mtpc_messages_editInlineBotMessage = 0x130c2c85,
mtpc_messages_getBotCallbackAnswer = 0xa6e94f04,
mtpc_messages_setBotCallbackAnswer = 0x481c591a,
mtpc_messages_setBotCallbackAnswer = 0x70dc0fa3,
mtpc_messages_getPeerDialogs = 0x2d9776b9,
mtpc_messages_saveDraft = 0xbc39e14b,
mtpc_messages_getAllDrafts = 0x6a3f8d65,
mtpc_messages_getFeaturedStickers = 0x2dacca4f,
mtpc_messages_readFeaturedStickers = 0xe21cbb,
mtpc_updates_getState = 0xedd4882a,
mtpc_updates_getDifference = 0xa041495,
mtpc_updates_getChannelDifference = 0xbb32d7c0,
@ -1353,6 +1358,9 @@ class MTPDcontacts_topPeers;
class MTPdraftMessage;
class MTPDdraftMessage;
class MTPmessages_featuredStickers;
class MTPDmessages_featuredStickers;
// Boxed types definitions
typedef MTPBoxed<MTPresPQ> MTPResPQ;
@ -1527,6 +1535,7 @@ typedef MTPBoxed<MTPtopPeerCategory> MTPTopPeerCategory;
typedef MTPBoxed<MTPtopPeerCategoryPeers> MTPTopPeerCategoryPeers;
typedef MTPBoxed<MTPcontacts_topPeers> MTPcontacts_TopPeers;
typedef MTPBoxed<MTPdraftMessage> MTPDraftMessage;
typedef MTPBoxed<MTPmessages_featuredStickers> MTPmessages_FeaturedStickers;
// Type classes definitions
@ -9532,6 +9541,43 @@ private:
};
typedef MTPBoxed<MTPdraftMessage> MTPDraftMessage;
class MTPmessages_featuredStickers : private mtpDataOwner {
public:
MTPmessages_featuredStickers() : mtpDataOwner(0), _type(0) {
}
MTPmessages_featuredStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) {
read(from, end, cons);
}
MTPDmessages_featuredStickers &_messages_featuredStickers() {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_messages_featuredStickers) throw mtpErrorWrongTypeId(_type, mtpc_messages_featuredStickers);
split();
return *(MTPDmessages_featuredStickers*)data;
}
const MTPDmessages_featuredStickers &c_messages_featuredStickers() const {
if (!data) throw mtpErrorUninitialized();
if (_type != mtpc_messages_featuredStickers) throw mtpErrorWrongTypeId(_type, mtpc_messages_featuredStickers);
return *(const MTPDmessages_featuredStickers*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons);
void write(mtpBuffer &to) const;
typedef void ResponseType;
private:
explicit MTPmessages_featuredStickers(mtpTypeId type);
explicit MTPmessages_featuredStickers(MTPDmessages_featuredStickers *_data);
friend class MTP::internal::TypeCreator;
mtpTypeId _type;
};
typedef MTPBoxed<MTPmessages_featuredStickers> MTPmessages_FeaturedStickers;
// Type constructors with data
class MTPDresPQ : public mtpDataImpl<MTPDresPQ> {
@ -14274,23 +14320,28 @@ class MTPDmessages_botCallbackAnswer : public mtpDataImpl<MTPDmessages_botCallba
public:
enum class Flag : int32 {
f_alert = (1 << 1),
f_allow_pip = (1 << 2),
f_message = (1 << 0),
f_url = (1 << 3),
MAX_FIELD = (1 << 1),
MAX_FIELD = (1 << 3),
};
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 is_allow_pip() const { return vflags.v & Flag::f_allow_pip; }
bool has_message() const { return vflags.v & Flag::f_message; }
bool has_url() const { return vflags.v & Flag::f_url; }
MTPDmessages_botCallbackAnswer() {
}
MTPDmessages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message) : vflags(_flags), vmessage(_message) {
MTPDmessages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message, const MTPstring &_url) : vflags(_flags), vmessage(_message), vurl(_url) {
}
MTPflags<MTPDmessages_botCallbackAnswer::Flags> vflags;
MTPstring vmessage;
MTPstring vurl;
};
class MTPDmessages_messageEditData : public mtpDataImpl<MTPDmessages_messageEditData> {
@ -14412,6 +14463,18 @@ public:
MTPint vdate;
};
class MTPDmessages_featuredStickers : public mtpDataImpl<MTPDmessages_featuredStickers> {
public:
MTPDmessages_featuredStickers() {
}
MTPDmessages_featuredStickers(MTPint _hash, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPlong> &_unread) : vhash(_hash), vsets(_sets), vunread(_unread) {
}
MTPint vhash;
MTPVector<MTPStickerSet> vsets;
MTPVector<MTPlong> vunread;
};
// RPC methods
class MTPreq_pq { // RPC method 'req_pq'
@ -20204,30 +20267,35 @@ class MTPmessages_setBotCallbackAnswer { // RPC method 'messages.setBotCallbackA
public:
enum class Flag : int32 {
f_alert = (1 << 1),
f_allow_pip = (1 << 2),
f_message = (1 << 0),
f_url = (1 << 3),
MAX_FIELD = (1 << 1),
MAX_FIELD = (1 << 3),
};
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 is_allow_pip() const { return vflags.v & Flag::f_allow_pip; }
bool has_message() const { return vflags.v & Flag::f_message; }
bool has_url() const { return vflags.v & Flag::f_url; }
MTPflags<MTPmessages_setBotCallbackAnswer::Flags> vflags;
MTPlong vquery_id;
MTPstring vmessage;
MTPstring vurl;
MTPmessages_setBotCallbackAnswer() {
}
MTPmessages_setBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setBotCallbackAnswer) {
read(from, end, cons);
}
MTPmessages_setBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message) : vflags(_flags), vquery_id(_query_id), vmessage(_message) {
MTPmessages_setBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url) : vflags(_flags), vquery_id(_query_id), vmessage(_message), vurl(_url) {
}
uint32 innerLength() const {
return vflags.innerLength() + vquery_id.innerLength() + (has_message() ? vmessage.innerLength() : 0);
return vflags.innerLength() + vquery_id.innerLength() + (has_message() ? vmessage.innerLength() : 0) + (has_url() ? vurl.innerLength() : 0);
}
mtpTypeId type() const {
return mtpc_messages_setBotCallbackAnswer;
@ -20236,11 +20304,13 @@ public:
vflags.read(from, end);
vquery_id.read(from, end);
if (has_message()) { vmessage.read(from, end); } else { vmessage = MTPstring(); }
if (has_url()) { vurl.read(from, end); } else { vurl = MTPstring(); }
}
void write(mtpBuffer &to) const {
vflags.write(to);
vquery_id.write(to);
if (has_message()) vmessage.write(to);
if (has_url()) vurl.write(to);
}
typedef MTPBool ResponseType;
@ -20255,7 +20325,7 @@ public:
}
MTPmessages_SetBotCallbackAnswer(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(from, end, cons) {
}
MTPmessages_SetBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(MTPmessages_setBotCallbackAnswer(_flags, _query_id, _message)) {
MTPmessages_SetBotCallbackAnswer(const MTPflags<MTPmessages_setBotCallbackAnswer::Flags> &_flags, const MTPlong &_query_id, const MTPstring &_message, const MTPstring &_url) : MTPBoxed<MTPmessages_setBotCallbackAnswer>(MTPmessages_setBotCallbackAnswer(_flags, _query_id, _message, _url)) {
}
};
@ -20396,6 +20466,76 @@ public:
}
};
class MTPmessages_getFeaturedStickers { // RPC method 'messages.getFeaturedStickers'
public:
MTPint vhash;
MTPmessages_getFeaturedStickers() {
}
MTPmessages_getFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getFeaturedStickers) {
read(from, end, cons);
}
MTPmessages_getFeaturedStickers(MTPint _hash) : vhash(_hash) {
}
uint32 innerLength() const {
return vhash.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_getFeaturedStickers;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getFeaturedStickers) {
vhash.read(from, end);
}
void write(mtpBuffer &to) const {
vhash.write(to);
}
typedef MTPmessages_FeaturedStickers ResponseType;
};
class MTPmessages_GetFeaturedStickers : public MTPBoxed<MTPmessages_getFeaturedStickers> {
public:
MTPmessages_GetFeaturedStickers() {
}
MTPmessages_GetFeaturedStickers(const MTPmessages_getFeaturedStickers &v) : MTPBoxed<MTPmessages_getFeaturedStickers>(v) {
}
MTPmessages_GetFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getFeaturedStickers>(from, end, cons) {
}
MTPmessages_GetFeaturedStickers(MTPint _hash) : MTPBoxed<MTPmessages_getFeaturedStickers>(MTPmessages_getFeaturedStickers(_hash)) {
}
};
class MTPmessages_readFeaturedStickers { // RPC method 'messages.readFeaturedStickers'
public:
MTPmessages_readFeaturedStickers() {
}
MTPmessages_readFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readFeaturedStickers) {
read(from, end, cons);
}
uint32 innerLength() const {
return 0;
}
mtpTypeId type() const {
return mtpc_messages_readFeaturedStickers;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_readFeaturedStickers) {
}
void write(mtpBuffer &to) const {
}
typedef MTPBool ResponseType;
};
class MTPmessages_ReadFeaturedStickers : public MTPBoxed<MTPmessages_readFeaturedStickers> {
public:
MTPmessages_ReadFeaturedStickers() {
}
MTPmessages_ReadFeaturedStickers(const MTPmessages_readFeaturedStickers &v) : MTPBoxed<MTPmessages_readFeaturedStickers>(v) {
}
MTPmessages_ReadFeaturedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_readFeaturedStickers>(from, end, cons) {
}
};
class MTPupdates_getState { // RPC method 'updates.getState'
public:
MTPupdates_getState() {
@ -22937,6 +23077,9 @@ public:
inline static MTPupdate new_updateDraftMessage(const MTPPeer &_peer, const MTPDraftMessage &_draft) {
return MTPupdate(new MTPDupdateDraftMessage(_peer, _draft));
}
inline static MTPupdate new_updateReadFeaturedStickers() {
return MTPupdate(mtpc_updateReadFeaturedStickers);
}
inline static MTPupdates_state new_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) {
return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count));
}
@ -23528,8 +23671,8 @@ public:
inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) {
return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern));
}
inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message) {
return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message));
inline static MTPmessages_botCallbackAnswer new_messages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message, const MTPstring &_url) {
return MTPmessages_botCallbackAnswer(new MTPDmessages_botCallbackAnswer(_flags, _message, _url));
}
inline static MTPmessages_messageEditData new_messages_messageEditData(const MTPflags<MTPDmessages_messageEditData::Flags> &_flags) {
return MTPmessages_messageEditData(new MTPDmessages_messageEditData(_flags));
@ -23576,6 +23719,12 @@ public:
inline static MTPdraftMessage new_draftMessage(const MTPflags<MTPDdraftMessage::Flags> &_flags, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPVector<MTPMessageEntity> &_entities, MTPint _date) {
return MTPdraftMessage(new MTPDdraftMessage(_flags, _reply_to_msg_id, _message, _entities, _date));
}
inline static MTPmessages_featuredStickers new_messages_featuredStickersNotModified() {
return MTPmessages_featuredStickers(mtpc_messages_featuredStickersNotModified);
}
inline static MTPmessages_featuredStickers new_messages_featuredStickers(MTPint _hash, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPlong> &_unread) {
return MTPmessages_featuredStickers(new MTPDmessages_featuredStickers(_hash, _sets, _unread));
}
};
} // namespace internal
@ -28793,6 +28942,7 @@ inline void MTPupdate::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI
v.vpeer.read(from, end);
v.vdraft.read(from, end);
} break;
case mtpc_updateReadFeaturedStickers: _type = cons; break;
default: throw mtpErrorUnexpected(cons, "MTPupdate");
}
}
@ -29126,6 +29276,7 @@ inline MTPupdate::MTPupdate(mtpTypeId type) : mtpDataOwner(0), _type(type) {
case mtpc_updateInlineBotCallbackQuery: setData(new MTPDupdateInlineBotCallbackQuery()); break;
case mtpc_updateReadChannelOutbox: setData(new MTPDupdateReadChannelOutbox()); break;
case mtpc_updateDraftMessage: setData(new MTPDupdateDraftMessage()); break;
case mtpc_updateReadFeaturedStickers: break;
default: throw mtpErrorBadTypeId(type, "MTPupdate");
}
}
@ -29373,6 +29524,9 @@ inline MTPupdate MTP_updateReadChannelOutbox(MTPint _channel_id, MTPint _max_id)
inline MTPupdate MTP_updateDraftMessage(const MTPPeer &_peer, const MTPDraftMessage &_draft) {
return MTP::internal::TypeCreator::new_updateDraftMessage(_peer, _draft);
}
inline MTPupdate MTP_updateReadFeaturedStickers() {
return MTP::internal::TypeCreator::new_updateReadFeaturedStickers();
}
inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) {
}
@ -34533,7 +34687,7 @@ inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer() : mtpDataO
inline uint32 MTPmessages_botCallbackAnswer::innerLength() const {
const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer());
return v.vflags.innerLength() + (v.has_message() ? v.vmessage.innerLength() : 0);
return v.vflags.innerLength() + (v.has_message() ? v.vmessage.innerLength() : 0) + (v.has_url() ? v.vurl.innerLength() : 0);
}
inline mtpTypeId MTPmessages_botCallbackAnswer::type() const {
return mtpc_messages_botCallbackAnswer;
@ -34545,17 +34699,19 @@ inline void MTPmessages_botCallbackAnswer::read(const mtpPrime *&from, const mtp
MTPDmessages_botCallbackAnswer &v(_messages_botCallbackAnswer());
v.vflags.read(from, end);
if (v.has_message()) { v.vmessage.read(from, end); } else { v.vmessage = MTPstring(); }
if (v.has_url()) { v.vurl.read(from, end); } else { v.vurl = MTPstring(); }
}
inline void MTPmessages_botCallbackAnswer::write(mtpBuffer &to) const {
const MTPDmessages_botCallbackAnswer &v(c_messages_botCallbackAnswer());
v.vflags.write(to);
if (v.has_message()) v.vmessage.write(to);
if (v.has_url()) v.vurl.write(to);
}
inline MTPmessages_botCallbackAnswer::MTPmessages_botCallbackAnswer(MTPDmessages_botCallbackAnswer *_data) : mtpDataOwner(_data) {
}
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botCallbackAnswer::Flags)
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_botCallbackAnswer MTP_messages_botCallbackAnswer(const MTPflags<MTPDmessages_botCallbackAnswer::Flags> &_flags, const MTPstring &_message, const MTPstring &_url) {
return MTP::internal::TypeCreator::new_messages_botCallbackAnswer(_flags, _message, _url);
}
inline MTPmessages_messageEditData::MTPmessages_messageEditData() : mtpDataOwner(new MTPDmessages_messageEditData()) {
@ -34896,6 +35052,59 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDdraftMessage::Flags)
inline MTPdraftMessage MTP_draftMessage(const MTPflags<MTPDdraftMessage::Flags> &_flags, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPVector<MTPMessageEntity> &_entities, MTPint _date) {
return MTP::internal::TypeCreator::new_draftMessage(_flags, _reply_to_msg_id, _message, _entities, _date);
}
inline uint32 MTPmessages_featuredStickers::innerLength() const {
switch (_type) {
case mtpc_messages_featuredStickers: {
const MTPDmessages_featuredStickers &v(c_messages_featuredStickers());
return v.vhash.innerLength() + v.vsets.innerLength() + v.vunread.innerLength();
}
}
return 0;
}
inline mtpTypeId MTPmessages_featuredStickers::type() const {
if (!_type) throw mtpErrorUninitialized();
return _type;
}
inline void MTPmessages_featuredStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != _type) setData(0);
switch (cons) {
case mtpc_messages_featuredStickersNotModified: _type = cons; break;
case mtpc_messages_featuredStickers: _type = cons; {
if (!data) setData(new MTPDmessages_featuredStickers());
MTPDmessages_featuredStickers &v(_messages_featuredStickers());
v.vhash.read(from, end);
v.vsets.read(from, end);
v.vunread.read(from, end);
} break;
default: throw mtpErrorUnexpected(cons, "MTPmessages_featuredStickers");
}
}
inline void MTPmessages_featuredStickers::write(mtpBuffer &to) const {
switch (_type) {
case mtpc_messages_featuredStickers: {
const MTPDmessages_featuredStickers &v(c_messages_featuredStickers());
v.vhash.write(to);
v.vsets.write(to);
v.vunread.write(to);
} break;
}
}
inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(mtpTypeId type) : mtpDataOwner(0), _type(type) {
switch (type) {
case mtpc_messages_featuredStickersNotModified: break;
case mtpc_messages_featuredStickers: setData(new MTPDmessages_featuredStickers()); break;
default: throw mtpErrorBadTypeId(type, "MTPmessages_featuredStickers");
}
}
inline MTPmessages_featuredStickers::MTPmessages_featuredStickers(MTPDmessages_featuredStickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_featuredStickers) {
}
inline MTPmessages_featuredStickers MTP_messages_featuredStickersNotModified() {
return MTP::internal::TypeCreator::new_messages_featuredStickersNotModified();
}
inline MTPmessages_featuredStickers MTP_messages_featuredStickers(MTPint _hash, const MTPVector<MTPStickerSet> &_sets, const MTPVector<MTPlong> &_unread) {
return MTP::internal::TypeCreator::new_messages_featuredStickers(_hash, _sets, _unread);
}
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

@ -890,13 +890,13 @@ bool StickerData::setInstalled() const {
switch (set.type()) {
case mtpc_inputStickerSetID: {
auto it = Global::StickerSets().constFind(set.c_inputStickerSetID().vid.v);
return (it != Global::StickerSets().cend()) && !(it->flags & MTPDstickerSet::Flag::f_disabled);
return (it != Global::StickerSets().cend()) && !(it->flags & MTPDstickerSet::Flag::f_disabled) && (it->flags & MTPDstickerSet::Flag::f_installed);
} break;
case mtpc_inputStickerSetShortName: {
QString name = qs(set.c_inputStickerSetShortName().vshort_name).toLower();
for (auto it = Global::StickerSets().cbegin(), e = Global::StickerSets().cend(); it != e; ++it) {
if (it->shortName.toLower() == name) {
return !(it->flags & MTPDstickerSet::Flag::f_disabled);
return !(it->flags & MTPDstickerSet::Flag::f_disabled) && (it->flags & MTPDstickerSet::Flag::f_installed);
}
}
} break;

View file

@ -291,7 +291,7 @@ inline bool chIsSpace(QChar ch, bool rich = false) {
return ch.isSpace() || (ch < 32 && !(rich && ch == TextCommand)) || (ch == QChar::ParagraphSeparator) || (ch == QChar::LineSeparator) || (ch == QChar::ObjectReplacementCharacter) || (ch == QChar::CarriageReturn) || (ch == QChar::Tabulation);
}
inline bool chIsDiac(QChar ch) { // diac and variation selectors
return (ch.category() == QChar::Mark_NonSpacing) || (ch.unicode() == 1652);
return (ch.category() == QChar::Mark_NonSpacing) || (ch == 1652) || (ch >= 64606 && ch <= 64611);
}
inline bool chIsBad(QChar ch) {
return (ch == 0) || (ch >= 8232 && ch < 8237) || (ch >= 65024 && ch < 65040 && ch != 65039) || (ch >= 127 && ch < 160 && ch != 156) || (cPlatform() == dbipMac && ch >= 0x0B00 && ch <= 0x0B7F && chIsDiac(ch) && cIsElCapitan()); // tmp hack see https://bugreports.qt.io/browse/QTBUG-48910

View file

@ -2375,7 +2375,7 @@
SDKROOT = macosx;
SYMROOT = ./../Mac;
TDESKTOP_MAJOR_VERSION = 0.9;
TDESKTOP_VERSION = 0.9.56;
TDESKTOP_VERSION = 0.9.57;
};
name = Release;
};
@ -2516,7 +2516,7 @@
SDKROOT = macosx;
SYMROOT = ./../Mac;
TDESKTOP_MAJOR_VERSION = 0.9;
TDESKTOP_VERSION = 0.9.56;
TDESKTOP_VERSION = 0.9.57;
};
name = Debug;
};

View file

@ -1,6 +1,6 @@
AppVersion 9056
AppVersion 9057
AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.56
AppVersionStr 0.9.56
AlphaChannel 0
AppVersionStrSmall 0.9.57
AppVersionStr 0.9.57
AlphaChannel 1
BetaVersion 0