diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 5b66706fe..94f8555f6 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -1845,20 +1845,6 @@ stickersReorderFg: #777; stickersRowDisabledOpacity: 0.4; stickersRowDuration: 200; -stickersFeaturedHeight: 32px; -stickersFeaturedFont: contactsNameFont; -stickersFeaturedPosition: point(16px, 6px); -stickersFeaturedBadgeFont: semiboldFont; -stickersFeaturedBadgeSize: 21px; -stickersFeaturedPen: contactsNewItemFg; -stickersFeaturedUnreadBg: msgFileInBg; -stickersFeaturedUnreadSize: 5px; -stickersFeaturedUnreadSkip: 5px; -stickersFeaturedUnreadTop: 7px; -stickersFeaturedInstalled: icon { - { "mediaview_save_check", #40ace3 } -}; - emojiScroll: flatScroll(solidScroll) { deltat: 48px; } diff --git a/Telegram/Resources/icons/stickers_add.png b/Telegram/Resources/icons/stickers_add.png new file mode 100644 index 000000000..ac6c2a166 Binary files /dev/null and b/Telegram/Resources/icons/stickers_add.png differ diff --git a/Telegram/Resources/icons/stickers_add@2x.png b/Telegram/Resources/icons/stickers_add@2x.png new file mode 100644 index 000000000..de8948d66 Binary files /dev/null and b/Telegram/Resources/icons/stickers_add@2x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 35d1ebca2..bfbde65f1 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -682,7 +682,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_add_pack" = "Add stickers"; "lng_stickers_share_pack" = "Share Stickers"; "lng_stickers_not_found" = "Sticker pack not found."; -"lng_stickers_too_many_packs" = "You have too many sticker packs. Please remove some first."; +"lng_stickers_packs_archived" = "Some of your unused stickers have been archived to make room for the sets you've activated."; +"lng_stickers_archived" = "Archived stickers"; "lng_stickers_copied" = "Sticker pack link copied to clipboard."; "lng_stickers_default_set" = "Great Minds"; "lng_stickers_you_have" = "Manage and reorder sticker packs"; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 42c691542..54f43ec25 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -48,3 +48,22 @@ confirmInviteUserName: flatLabel(labelDefFlat) { maxHeight: 20px; } confirmInviteUserNameTop: 227px; + +stickersAddIcon: icon { + { "stickers_add", #ffffff }, +}; +stickersAddSize: size(30px, 24px); + +stickersFeaturedHeight: 32px; +stickersFeaturedFont: contactsNameFont; +stickersFeaturedPosition: point(16px, 6px); +stickersFeaturedBadgeFont: semiboldFont; +stickersFeaturedBadgeSize: 21px; +stickersFeaturedPen: contactsNewItemFg; +stickersFeaturedUnreadBg: msgFileInBg; +stickersFeaturedUnreadSize: 5px; +stickersFeaturedUnreadSkip: 5px; +stickersFeaturedUnreadTop: 7px; +stickersFeaturedInstalled: icon { + { "mediaview_save_check", #40ace3 } +}; diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index a55c26bb7..6f863e538 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -29,6 +29,40 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "apiwrap.h" #include "localstorage.h" #include "dialogs/dialogs_layout.h" +#include "styles/style_boxes.h" + +namespace Stickers { + +void applyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) { + auto &v = d.vsets.c_vector().v; + auto &sets = Global::RefStickerSets(); + auto &order = Global::RefStickerSetsOrder(); + Stickers::Order archived; + archived.reserve(v.size()); + QMap setsToRequest; + for_const (auto &stickerSet, v) { + if (stickerSet.type() == mtpc_stickerSet) { + auto set = Stickers::feedSet(stickerSet.c_stickerSet()); + if (set->stickers.isEmpty()) { + setsToRequest.insert(set->id, set->access); + } + auto index = order.indexOf(set->id); + if (index >= 0) { + order.removeAt(index); + } + archived.push_back(set->id); + } + } + if (!setsToRequest.isEmpty()) { + for (auto i = setsToRequest.cbegin(), e = setsToRequest.cend(); i != e; ++i) { + App::api()->scheduleStickerSetRequest(i.key(), i.value()); + } + App::api()->requestStickerSets(); + } + Ui::showLayer(new StickersBox(archived), KeepOtherLayers); +} + +} // namespace Stickers StickerSetInner::StickerSetInner(const MTPInputStickerSet &set) : TWidget() , _input(set) { @@ -117,10 +151,10 @@ bool StickerSetInner::failedSet(const RPCError &error) { return true; } -void StickerSetInner::installDone(const MTPBool &result) { +void StickerSetInner::installDone(const MTPmessages_StickerSetInstallResult &result) { auto &sets = Global::RefStickerSets(); - _setFlags &= ~MTPDstickerSet::Flag::f_disabled; + _setFlags &= ~MTPDstickerSet::Flag::f_archived; _setFlags |= MTPDstickerSet::Flag::f_installed; auto it = sets.find(_setId); if (it == sets.cend()) { @@ -150,6 +184,11 @@ void StickerSetInner::installDone(const MTPBool &result) { sets.erase(custom); } } + + if (result.type() == mtpc_messages_stickerSetInstallResultArchive) { + Stickers::applyArchivedResult(result.c_messages_stickerSetInstallResultArchive()); + } + Local::writeStickers(); emit App::main()->stickersUpdated(); emit installed(_setId); @@ -158,11 +197,7 @@ void StickerSetInner::installDone(const MTPBool &result) { bool StickerSetInner::installFail(const RPCError &error) { if (MTP::isDefaultHandledError(error)) return false; - if (error.type() == qstr("STICKERSETS_TOO_MUCH")) { - Ui::showLayer(new InformBox(lang(lng_stickers_too_many_packs)), KeepOtherLayers); - } else { - Ui::showLayer(new InformBox(lang(lng_stickers_not_found))); - } + Ui::showLayer(new InformBox(lang(lng_stickers_not_found))); return true; } @@ -265,7 +300,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_installed) || (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_archived)) return _pack.size(); return 0; } @@ -425,6 +460,26 @@ StickersInner::StickersInner(StickersBox::Section section) : TWidget() , _addText(lang(lng_stickers_add).toUpper()) , _addWidth(st::defaultActiveButton.font->width(_addText)) , _aboveShadow(st::boxShadow) { + setup(); +} + +StickersInner::StickersInner(const Stickers::Order &archivedIds) : TWidget() +, _section(StickersBox::Section::ArchivedPart) +, _archivedIds(archivedIds) +, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) +, _a_shifting(animation(this, &StickersInner::step_shifting)) +, _itemsTop(st::membersPadding.top()) +, _clearWidth(st::normalFont->width(lang(lng_stickers_clear_recent))) +, _removeWidth(st::normalFont->width(lang(lng_stickers_remove))) +, _returnWidth(st::normalFont->width(lang(lng_stickers_return))) +, _restoreWidth(st::normalFont->width(lang(lng_stickers_restore))) +, _addText(lang(lng_stickers_add).toUpper()) +, _addWidth(st::defaultActiveButton.font->width(_addText)) +, _aboveShadow(st::boxShadow) { + setup(); +} + +void StickersInner::setup() { connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update())); setMouseTracking(true); } @@ -520,26 +575,28 @@ void StickersInner::paintRow(Painter &p, int32 index) { p.fillRect(row, st::white); p.setOpacity(1); } - } else if (s->installed) { - int addw = _addWidth - st::defaultActiveButton.width; + } else if (s->installed && !s->disabled) { + int addw = st::stickersAddSize.width(); int checkx = width() - (st::contactsPadding.right() + st::contactsCheckPosition.x() + (addw + st::stickersFeaturedInstalled.width()) / 2); int checky = st::contactsPadding.top() + (st::contactsPhotoSize - st::stickersFeaturedInstalled.height()) / 2; st::stickersFeaturedInstalled.paint(p, QPoint(checkx, checky), width()); } else { - int addw = _addWidth - st::defaultActiveButton.width; + int addw = st::stickersAddSize.width(); int addx = width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - addw; - int addy = st::contactsPadding.top() + (st::contactsPhotoSize - st::defaultActiveButton.height) / 2; - QRect add(myrtlrect(addx, addy, addw, st::defaultActiveButton.height)); + int addy = st::contactsPadding.top() + (st::contactsPhotoSize - st::stickersAddSize.height()) / 2; + QRect add(myrtlrect(addx, addy, addw, st::stickersAddSize.height())); auto textBg = (_actionSel == index) ? st::defaultActiveButton.textBgOver : st::defaultActiveButton.textBg; App::roundRect(p, add, textBg, ImageRoundRadius::Small); - p.setFont(st::defaultActiveButton.font); - p.setPen(st::defaultActiveButton.textFg); - int textTop = (_actionSel == index && _actionDown == index) ? st::defaultActiveButton.downTextTop : st::defaultActiveButton.textTop; - p.drawTextLeft(addx - st::defaultActiveButton.width / 2, addy + textTop, width(), _addText, _addWidth); + int iconx = addx + (st::stickersAddSize.width() - st::stickersAddIcon.width()) / 2; + int icony = addy + (st::stickersAddSize.height() - st::stickersAddIcon.height()) / 2; + icony += (_actionSel == index && _actionDown == index) ? (st::defaultActiveButton.downTextTop - st::defaultActiveButton.textTop) : 0; + st::stickersAddIcon.paint(p, QPoint(iconx, icony), width()); } - if (s->disabled) p.setOpacity(st::stickersRowDisabledOpacity); + if (s->disabled && _section == Section::Installed) { + p.setOpacity(st::stickersRowDisabledOpacity); + } if (s->sticker) { s->sticker->thumb->load(); QPixmap pix(s->sticker->thumb->pix(s->pixw, s->pixh)); @@ -643,13 +700,13 @@ void StickersInner::onUpdateSelected() { int remw = _rows.at(selected)->recent ? _clearWidth : (_rows.at(selected)->disabled ? (_rows.at(selected)->official ? _restoreWidth : _returnWidth) : _removeWidth); QRect rem(myrtlrect(width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - remw, st::contactsPadding.top() + (st::contactsPhotoSize - st::normalFont->height) / 2, remw, st::normalFont->height)); actionSel = rem.contains(local.x(), local.y() - _itemsTop - selected * _rowHeight) ? selected : -1; - } else if (_rows.at(selected)->installed) { + } else if (_rows.at(selected)->installed && !_rows.at(selected)->disabled) { actionSel = -1; } else { - int addw = _addWidth - st::defaultActiveButton.width; + int addw = st::stickersAddSize.width(); int addx = width() - st::contactsPadding.right() - st::contactsCheckPosition.x() - addw; - int addy = st::contactsPadding.top() + (st::contactsPhotoSize - st::defaultActiveButton.height) / 2; - QRect add(myrtlrect(addx, addy, addw, st::defaultActiveButton.height)); + int addy = st::contactsPadding.top() + (st::contactsPhotoSize - st::stickersAddSize.height()) / 2; + QRect add(myrtlrect(addx, addy, addw, st::stickersAddSize.height())); actionSel = add.contains(local.x(), local.y() - _itemsTop - selected * _rowHeight) ? selected : -1; } } else if (_featuredHeight && QRect(0, st::membersPadding.top(), width(), _featuredHeight).contains(local)) { @@ -661,7 +718,7 @@ void StickersInner::onUpdateSelected() { if ((_selected == -1) != (selected == -1)) { update(); } - if (_section == Section::Featured && ((_selected >= 0 || _pressed >= 0) != (selected >= 0 || _pressed >= 0))) { + if (_section != Section::Installed && ((_selected >= 0 || _pressed >= 0) != (selected >= 0 || _pressed >= 0))) { setCursor((selected >= 0 || _pressed >= 0) ? style::cur_pointer : style::cur_default); } _selected = selected; @@ -711,7 +768,7 @@ void StickersInner::mouseReleaseEvent(QMouseEvent *e) { auto pressed = _pressed; _pressed = -2; - if (_section == Section::Featured && _selected < 0 && pressed >= 0) { + if (_section != Section::Installed && _selected < 0 && pressed >= 0) { setCursor(style::cur_default); } @@ -746,7 +803,7 @@ void StickersInner::mouseReleaseEvent(QMouseEvent *e) { if (_selected == -1) { _selected = -2; Ui::showLayer(new StickersBox(Section::Featured), KeepOtherLayers); - } else if (_selected >= 0 && _section == Section::Featured) { + } else if (_selected >= 0 && _section != Section::Installed) { auto &sets = Global::RefStickerSets(); auto it = sets.find(_rows.at(pressed)->id); if (it != sets.cend()) { @@ -774,9 +831,9 @@ void StickersInner::installSet(uint64 setId) { return; } - MTP::send(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_boolFalse()), RPCDoneHandlerPtr(), rpcFail(&StickersInner::installFail, setId)); + MTP::send(MTPmessages_InstallStickerSet(Stickers::inputSetId(*it), MTP_boolFalse()), rpcDone(&StickersInner::installDone), rpcFail(&StickersInner::installFail, setId)); - it->flags &= ~(MTPDstickerSet::Flag::f_disabled | MTPDstickerSet_ClientFlag::f_unread); + it->flags &= ~(MTPDstickerSet::Flag::f_archived | MTPDstickerSet_ClientFlag::f_unread); it->flags |= MTPDstickerSet::Flag::f_installed; auto &order = Global::RefStickerSetsOrder(); @@ -802,6 +859,24 @@ void StickersInner::installSet(uint64 setId) { emit App::main()->stickersUpdated(); } +void StickersInner::installDone(const MTPmessages_StickerSetInstallResult &result) { + if (result.type() == mtpc_messages_stickerSetInstallResultArchive) { + Stickers::applyArchivedResult(result.c_messages_stickerSetInstallResultArchive()); + Local::writeStickers(); + emit App::main()->stickersUpdated(); + } + + // TEST DATA ONLY + //MTPVector v = MTP_vector(0); + //for (auto &set : Global::RefStickerSets()) { + // if (rand() < RAND_MAX / 2) { + // set.flags |= MTPDstickerSet::Flag::f_archived; + // v._vector().v.push_back(MTP_stickerSet(MTP_flags(set.flags), MTP_long(set.id), MTP_long(set.access), MTP_string(set.title), MTP_string(set.shortName), MTP_int(set.count), MTP_int(set.hash))); + // } + //} + //Stickers::applyArchivedResult(MTP_messages_stickerSetInstallResultArchive(v).c_messages_stickerSetInstallResultArchive()); +} + bool StickersInner::installFail(uint64 setId, const RPCError &error) { if (MTP::isDefaultHandledError(error)) return false; @@ -823,11 +898,7 @@ bool StickersInner::installFail(uint64 setId, const RPCError &error) { Local::writeStickers(); emit App::main()->stickersUpdated(); - if (error.type() == qstr("STICKERSETS_TOO_MUCH")) { - Ui::showLayer(new InformBox(lang(lng_stickers_too_many_packs)), KeepOtherLayers); - } else { - Ui::showLayer(new InformBox(lang(lng_stickers_not_found)), KeepOtherLayers); - } + Ui::showLayer(new InformBox(lang(lng_stickers_not_found)), KeepOtherLayers); return true; } @@ -884,12 +955,12 @@ void StickersInner::clear() { _aboveShadowFadeStart = 0; _aboveShadowFadeOpacity = anim::fvalue(0, 0); _a_shifting.stop(); -_above = _dragging = _started = -1; -_selected = -2; -_pressed = -2; -_actionDown = -1; -setActionSel(-1); -update(); + _above = _dragging = _started = -1; + _selected = -2; + _pressed = -2; + _actionDown = -1; + setActionSel(-1); + update(); } void StickersInner::setActionSel(int32 actionSel) { @@ -922,50 +993,23 @@ void StickersInner::rebuild() { } clear(); - auto &order = (_section == Section::Installed) ? Global::StickerSetsOrder() : Global::FeaturedStickerSetsOrder(); - _animStartTimes.reserve(order.size()); + auto &order = ([this]() { + if (_section == Section::Installed) { + return Global::StickerSetsOrder(); + } else if (_section == Section::Featured) { + return Global::FeaturedStickerSetsOrder(); + } + return _archivedIds; + })(); + _rows.reserve(order.size() + 1); + _animStartTimes.reserve(order.size() + 1); auto &sets = Global::StickerSets(); - auto cloudIt = sets.constFind(Stickers::CloudRecentSetId); - if (cloudIt != sets.cend() && !cloudIt->stickers.isEmpty()) { - DocumentData *sticker = cloudIt->stickers.at(0); - int32 pixw = 0, pixh = 0; - if (sticker) { - pixw = sticker->thumb->width(); - pixh = sticker->thumb->height(); - if (pixw > st::contactsPhotoSize) { - if (pixw > pixh) { - pixh = (pixh * st::contactsPhotoSize) / pixw; - pixw = st::contactsPhotoSize; - } else { - pixw = (pixw * st::contactsPhotoSize) / pixh; - pixh = st::contactsPhotoSize; - } - } else if (pixh > st::contactsPhotoSize) { - pixw = (pixw * st::contactsPhotoSize) / pixh; - pixh = st::contactsPhotoSize; - } + if (_section == Section::Installed) { + auto cloudIt = sets.constFind(Stickers::CloudRecentSetId); + if (cloudIt != sets.cend() && !cloudIt->stickers.isEmpty()) { + rebuildAppendSet(cloudIt.value(), namew); } - QString title = cloudIt->title; - int32 titleWidth = st::contactsNameFont->width(title); - if (titleWidth > namew) { - title = st::contactsNameFont->elided(title, namew); - } - int count = cloudIt->stickers.size(); - int added = 0; - auto customIt = sets.constFind(Stickers::CustomSetId); - if (customIt != sets.cend()) { - added = customIt->stickers.size(); - for_const (auto &sticker, cGetRecentStickers()) { - if (customIt->stickers.indexOf(sticker.first) < 0) { - ++added; - } - } - } else { - added = cGetRecentStickers().size(); - } - rows.push_back(new StickerSetRow(cloudIt->id, cloudIt->stickers.front(), count + added, title, true, true, false, false, true, pixw, pixh)); - _animStartTimes.push_back(0); } for_const (auto setId, order) { auto it = sets.constFind(setId); @@ -973,47 +1017,13 @@ void StickersInner::rebuild() { continue; } - bool recent = false; - bool installed = (it->flags & MTPDstickerSet::Flag::f_installed); - bool disabled = (_section == Section::Installed) && (it->flags & MTPDstickerSet::Flag::f_disabled); - bool official = (it->flags & MTPDstickerSet::Flag::f_official); - bool unread = (_section == Section::Featured) && _unreadSets.contains(it->id); - if (!unread && _section == Section::Featured && (it->flags & MTPDstickerSet_ClientFlag::f_unread)) { - unread = true; - _unreadSets.insert(it->id); - } + rebuildAppendSet(it.value(), namew); - DocumentData *sticker = it->stickers.isEmpty() ? 0 : it->stickers.at(0); - int32 pixw = 0, pixh = 0; - if (sticker) { - pixw = sticker->thumb->width(); - pixh = sticker->thumb->height(); - if (pixw > st::contactsPhotoSize) { - if (pixw > pixh) { - pixh = (pixh * st::contactsPhotoSize) / pixw; - pixw = st::contactsPhotoSize; - } else { - pixw = (pixw * st::contactsPhotoSize) / pixh; - pixh = st::contactsPhotoSize; - } - } else if (pixh > st::contactsPhotoSize) { - pixw = (pixw * st::contactsPhotoSize) / pixh; - pixh = st::contactsPhotoSize; - } - } - QString title = it->title; - int32 titleWidth = st::contactsNameFont->width(title); - if (titleWidth > namew) { - title = st::contactsNameFont->elided(title, namew); - } - (disabled ? rowsDisabled : rows).push_back(new StickerSetRow(it->id, sticker, it->stickers.size(), title, installed, official, unread, disabled, recent, pixw, pixh)); - _animStartTimes.push_back(0); if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) { App::api()->scheduleStickerSetRequest(it->id, it->access); } } App::api()->requestStickerSets(); - _rows = rows + rowsDisabled; resize(width(), _itemsTop + _rows.size() * _rowHeight + st::membersPadding.bottom()); if (_section == Section::Featured && Global::FeaturedStickerSetsUnreadCount()) { @@ -1025,6 +1035,68 @@ void StickersInner::rebuild() { } } +void StickersInner::rebuildAppendSet(const Stickers::Set &set, int maxNameWidth) { + bool recent = (set.id == Stickers::CloudRecentSetId); + bool installed = true; + bool official = true; + bool unread = false; + bool disabled = false; + if (!recent) { + installed = (set.flags & MTPDstickerSet::Flag::f_installed); + official = (set.flags & MTPDstickerSet::Flag::f_official); + disabled = (set.flags & MTPDstickerSet::Flag::f_archived); + if (_section == Section::Featured) { + unread = _unreadSets.contains(set.id); + if (!unread && (set.flags & MTPDstickerSet_ClientFlag::f_unread)) { + unread = true; + _unreadSets.insert(set.id); + } + } else if (_section == Section::Installed && disabled) { + return; + } + } + + auto sticker = set.stickers.at(0); + int32 pixw = 0, pixh = 0; + if (sticker) { + pixw = sticker->thumb->width(); + pixh = sticker->thumb->height(); + if (pixw > st::contactsPhotoSize) { + if (pixw > pixh) { + pixh = (pixh * st::contactsPhotoSize) / pixw; + pixw = st::contactsPhotoSize; + } else { + pixw = (pixw * st::contactsPhotoSize) / pixh; + pixh = st::contactsPhotoSize; + } + } else if (pixh > st::contactsPhotoSize) { + pixw = (pixw * st::contactsPhotoSize) / pixh; + pixh = st::contactsPhotoSize; + } + } + QString title = set.title; + int32 titleWidth = st::contactsNameFont->width(title); + if (titleWidth > maxNameWidth) { + title = st::contactsNameFont->elided(title, maxNameWidth); + } + int count = set.stickers.size(), added = 0; + if (recent) { + auto customIt = Global::StickerSets().constFind(Stickers::CustomSetId); + if (customIt != Global::StickerSets().cend()) { + added = customIt->stickers.size(); + for_const (auto &sticker, cGetRecentStickers()) { + if (customIt->stickers.indexOf(sticker.first) < 0) { + ++added; + } + } + } else { + added = cGetRecentStickers().size(); + } + } + _rows.push_back(new StickerSetRow(set.id, sticker, count + added, title, installed, official, unread, disabled, recent, pixw, pixh)); + _animStartTimes.push_back(0); +} + void StickersInner::readFeaturedDone(const MTPBool &result) { Local::writeStickers(); emit App::main()->stickersUpdated(); @@ -1045,8 +1117,8 @@ bool StickersInner::readFeaturedFail(const RPCError &error) { return true; } -QVector StickersInner::getOrder() const { - QVector result; +Stickers::Order StickersInner::getOrder() const { + Stickers::Order result; result.reserve(_rows.size()); for (int32 i = 0, l = _rows.size(); i < l; ++i) { if (_rows.at(i)->disabled) { @@ -1063,8 +1135,8 @@ QVector StickersInner::getOrder() const { return result; } -QVector StickersInner::getDisabledSets() const { - QVector result; +Stickers::Order StickersInner::getDisabledSets() const { + Stickers::Order result; result.reserve(_rows.size()); for (int32 i = 0, l = _rows.size(); i < l; ++i) { if (_rows.at(i)->disabled) { @@ -1087,15 +1159,24 @@ StickersInner::~StickersInner() { StickersBox::StickersBox(Section section) : ItemListBox(st::boxScroll) , _section(section) , _inner(section) -, _reorderRequest(0) -, _topShadow(this, st::contactsAboutShadow) -, _scrollDelta(0) , _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.left()) , _about(st::boxTextFont, lang(lng_stickers_reorder), _defaultOptions, _aboutWidth) { + setup(); +} +StickersBox::StickersBox(const Stickers::Order &archivedIds) : ItemListBox(st::boxScroll) +, _section(Section::ArchivedPart) +, _inner(archivedIds) +, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPadding.left()) +, _about(st::boxTextFont, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) { + setup(); +} + +void StickersBox::setup() { int bottomSkip = st::boxPadding.bottom(); if (_section == Section::Installed) { _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); + _topShadow = new PlainShadow(this, st::contactsAboutShadow); _save = new BoxButton(this, lang(lng_settings_save), st::defaultBoxButton); connect(_save, SIGNAL(clicked()), this, SLOT(onSave())); @@ -1105,6 +1186,12 @@ StickersBox::StickersBox(Section section) : ItemListBox(st::boxScroll) _bottomShadow = new ScrollableBoxShadow(this); bottomSkip = st::boxButtonPadding.top() + _save->height() + st::boxButtonPadding.bottom(); + } else if (_section == Section::ArchivedPart) { + _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); + _topShadow = new PlainShadow(this, st::contactsAboutShadow); + + _save = new BoxButton(this, lang(lng_box_ok), st::defaultBoxButton); + connect(_save, SIGNAL(clicked()), this, SLOT(onClose())); } ItemListBox::init(_inner, bottomSkip, st::boxTitleHeight + _aboutHeight); setMaxHeight(snap(countHeight(), int32(st::sessionsHeight), int32(st::boxMaxListHeight))); @@ -1130,7 +1217,7 @@ int32 StickersBox::countHeight() const { return st::boxTitleHeight + _aboutHeight + _inner->height() + bottomSkip; } -void StickersBox::disenableDone(const MTPBool & result, mtpRequestId req) { +void StickersBox::disenableDone(const MTPmessages_StickerSetInstallResult &result, mtpRequestId req) { _disenableRequests.remove(req); if (_disenableRequests.isEmpty()) { saveOrder(); @@ -1178,7 +1265,15 @@ void StickersBox::paintEvent(QPaintEvent *e) { Painter p(this); if (paint(p)) return; - paintTitle(p, lang(lng_stickers_packs)); + auto title = ([this]() { + if (_section == Section::Installed) { + return lang(lng_stickers_packs); + } else if (_section == Section::Featured) { + return lang(lng_stickers_featured); + } + return lang(lng_stickers_archived); + })(); + paintTitle(p, title); p.translate(0, st::boxTitleHeight); if (_aboutHeight > 0) { @@ -1207,10 +1302,14 @@ void StickersBox::closePressed() { void StickersBox::resizeEvent(QResizeEvent *e) { ItemListBox::resizeEvent(e); _inner->resize(width(), _inner->height()); - _topShadow.setGeometry(0, st::boxTitleHeight + _aboutHeight, width(), st::lineWidth); _inner->setVisibleScrollbar((_scroll.scrollTopMax() > 0) ? (st::boxScroll.width - st::boxScroll.deltax) : 0); + if (_topShadow) { + _topShadow->setGeometry(0, st::boxTitleHeight + _aboutHeight, width(), st::lineWidth); + } if (_save) { _save->moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save->height()); + } + if (_cancel) { _cancel->moveToRight(st::boxButtonPadding.right() + _save->width() + st::boxButtonPadding.left(), _save->y()); _bottomShadow->setGeometry(0, height() - st::boxButtonPadding.bottom() - _save->height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth); } @@ -1255,7 +1354,7 @@ void StickersBox::onSave() { auto &recent = cGetRecentStickers(); auto &sets = Global::RefStickerSets(); - QVector reorder = _inner->getOrder(), disabled = _inner->getDisabledSets(); + auto reorder = _inner->getOrder(), disabled = _inner->getDisabledSets(); for (int32 i = 0, l = disabled.size(); i < l; ++i) { auto it = sets.find(disabled.at(i)); if (it != sets.cend()) { @@ -1267,11 +1366,11 @@ void StickersBox::onSave() { ++i; } } - if (!(it->flags & MTPDstickerSet::Flag::f_disabled)) { + if (!(it->flags & MTPDstickerSet::Flag::f_archived)) { MTPInputStickerSet setId = (it->id && it->access) ? MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)) : MTP_inputStickerSetShortName(MTP_string(it->shortName)); if (it->flags & MTPDstickerSet::Flag::f_official) { _disenableRequests.insert(MTP::send(MTPmessages_InstallStickerSet(setId, MTP_boolTrue()), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); - it->flags |= MTPDstickerSet::Flag::f_disabled; + it->flags |= MTPDstickerSet::Flag::f_archived; } else { _disenableRequests.insert(MTP::send(MTPmessages_UninstallStickerSet(setId), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); int removeIndex = Global::StickerSetsOrder().indexOf(it->id); @@ -1279,7 +1378,7 @@ void StickersBox::onSave() { if (!(it->flags & MTPDstickerSet_ClientFlag::f_featured) && !(it->flags & MTPDstickerSet_ClientFlag::f_special)) { sets.erase(it); } else { - it->flags &= ~(MTPDstickerSet::Flag::f_installed | MTPDstickerSet::Flag::f_disabled); + it->flags &= ~(MTPDstickerSet::Flag::f_installed | MTPDstickerSet::Flag::f_archived); } } } @@ -1296,10 +1395,10 @@ void StickersBox::onSave() { for (int i = 0, l = reorder.size(); i < l; ++i) { auto it = sets.find(reorder.at(i)); if (it != sets.cend()) { - if ((it->flags & MTPDstickerSet::Flag::f_disabled) && !disabled.contains(it->id)) { + if ((it->flags & MTPDstickerSet::Flag::f_archived) && !disabled.contains(it->id)) { MTPInputStickerSet setId = (it->id && it->access) ? MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)) : MTP_inputStickerSetShortName(MTP_string(it->shortName)); _disenableRequests.insert(MTP::send(MTPmessages_InstallStickerSet(setId, MTP_boolFalse()), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); - it->flags &= ~MTPDstickerSet::Flag::f_disabled; + it->flags &= ~MTPDstickerSet::Flag::f_archived; } order.push_back(reorder.at(i)); it->flags |= MTPDstickerSet::Flag::f_installed; @@ -1327,9 +1426,13 @@ void StickersBox::onSave() { } void StickersBox::hideAll() { - _topShadow.hide(); + if (_topShadow) { + _topShadow->hide(); + } if (_save) { _save->hide(); + } + if (_cancel) { _cancel->hide(); _bottomShadow->hide(); } @@ -1337,9 +1440,13 @@ void StickersBox::hideAll() { } void StickersBox::showAll() { - _topShadow.show(); + if (_topShadow) { + _topShadow->show(); + } if (_save) { _save->show(); + } + if (_cancel) { _cancel->show(); _bottomShadow->show(); } @@ -1353,7 +1460,7 @@ int32 stickerPacksCount(bool includeDisabledOfficial) { for (int i = 0, l = order.size(); i < l; ++i) { auto it = sets.constFind(order.at(i)); if (it != sets.cend()) { - if (!(it->flags & MTPDstickerSet::Flag::f_disabled) || ((it->flags & MTPDstickerSet::Flag::f_official) && includeDisabledOfficial)) { + if (!(it->flags & MTPDstickerSet::Flag::f_archived) || ((it->flags & MTPDstickerSet::Flag::f_official) && includeDisabledOfficial)) { ++result; } } diff --git a/Telegram/SourceFiles/boxes/stickersetbox.h b/Telegram/SourceFiles/boxes/stickersetbox.h index 70f65e3c3..44d60e770 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.h +++ b/Telegram/SourceFiles/boxes/stickersetbox.h @@ -64,7 +64,7 @@ private: void gotSet(const MTPmessages_StickerSet &set); bool failedSet(const RPCError &error); - void installDone(const MTPBool &result); + void installDone(const MTPmessages_StickerSetInstallResult &result); bool installFail(const RPCError &error); StickerPack _pack; @@ -130,19 +130,21 @@ class StickersBox : public ItemListBox, public RPCSender { Q_OBJECT public: - enum class Section { Installed, Featured, + Archived, + ArchivedPart, }; StickersBox(Section section = Section::Installed); + StickersBox(const Stickers::Order &archivedIds); + void resizeEvent(QResizeEvent *e); void paintEvent(QPaintEvent *e); void closePressed(); public slots: - void onStickersUpdated(); void onCheckDraggingScroll(int localY); @@ -152,15 +154,14 @@ public slots: void onSave(); protected: - void hideAll(); void showAll(); private: - + void setup(); int32 countHeight() const; - void disenableDone(const MTPBool &result, mtpRequestId req); + void disenableDone(const MTPmessages_StickerSetInstallResult &result, mtpRequestId req); bool disenableFail(const RPCError &error, mtpRequestId req); void reorderDone(const MTPBool &result); bool reorderFail(const RPCError &result); @@ -172,12 +173,12 @@ private: ChildWidget _save = { nullptr }; ChildWidget _cancel = { nullptr }; QMap _disenableRequests; - mtpRequestId _reorderRequest; - PlainShadow _topShadow; + mtpRequestId _reorderRequest = 0; + ChildWidget _topShadow = { nullptr }; ChildWidget _bottomShadow = { nullptr }; QTimer _scrollTimer; - int32 _scrollDelta; + int32 _scrollDelta = 0; int _aboutWidth = 0; Text _about; @@ -195,6 +196,7 @@ class StickersInner : public TWidget, public RPCSender { public: using Section = StickersBox::Section; StickersInner(Section section); + StickersInner(const Stickers::Order &archivedIds); void rebuild(); bool savingStart() { @@ -203,8 +205,8 @@ public: return true; } - QVector getOrder() const; - QVector getDisabledSets() const; + Stickers::Order getOrder() const; + Stickers::Order getDisabledSets() const; void setVisibleScrollbar(int32 width); @@ -227,6 +229,7 @@ public slots: void onClearBoxDestroyed(QObject *box); private: + void setup(); void paintFeaturedButton(Painter &p) const; void step_shifting(uint64 ms, bool timer); @@ -236,11 +239,13 @@ private: float64 aboveShadowOpacity() const; void installSet(uint64 setId); + void installDone(const MTPmessages_StickerSetInstallResult &result); bool installFail(uint64 setId, const RPCError &error); void readFeaturedDone(const MTPBool &result); bool readFeaturedFail(const RPCError &error); Section _section; + Stickers::Order _archivedIds; int32 _rowHeight; struct StickerSetRow { @@ -265,7 +270,10 @@ private: int32 pixw, pixh; anim::ivalue yadd; }; - typedef QList StickerSetRows; + using StickerSetRows = QList; + + void rebuildAppendSet(const Stickers::Set &set, int maxNameWidth); + StickerSetRows _rows; QList _animStartTimes; uint64 _aboveShadowFadeStart = 0; diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index 1c63f49ba..6d86f12d4 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -2088,7 +2088,7 @@ bool StickerPanInner::ui_isInlineItemBeingChosen() { void StickerPanInner::appendSet(uint64 setId) { auto &sets = Global::StickerSets(); auto it = sets.constFind(setId); - if (it == sets.cend() || (it->flags & MTPDstickerSet::Flag::f_disabled) || it->stickers.isEmpty()) return; + if (it == sets.cend() || (it->flags & MTPDstickerSet::Flag::f_archived) || it->stickers.isEmpty()) return; StickerPack pack; pack.reserve(it->stickers.size()); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index d4e7318c0..80c433527 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -520,6 +520,31 @@ DefineVar(Sandbox, ConnectionProxy, PreLaunchProxy); } // namespace Sandbox +namespace Stickers { + +Set *feedSet(const MTPDstickerSet &set) { + auto &sets = Global::RefStickerSets(); + auto it = sets.find(set.vid.v); + auto 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_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_unread | MTPDstickerSet_ClientFlag::f_not_loaded | MTPDstickerSet_ClientFlag::f_special); + 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; + it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; // need to request this set + } + } + return &it.value(); +} + +} // namespace Stickers + namespace Global { namespace internal { @@ -556,6 +581,7 @@ struct Data { int32 PushChatLimit = 2; int32 SavedGifsLimit = 200; int32 EditTimeLimit = 172800; + int32 StickersRecentLimit = 30; HiddenPinnedMessagesMap HiddenPinnedMessages; @@ -628,6 +654,7 @@ DefineVar(Global, int32, PushChatPeriod); DefineVar(Global, int32, PushChatLimit); DefineVar(Global, int32, SavedGifsLimit); DefineVar(Global, int32, EditTimeLimit); +DefineVar(Global, int32, StickersRecentLimit); DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages); diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index d0d09ff29..d99b54bb8 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -214,6 +214,8 @@ inline MTPInputStickerSet inputSetId(const Set &set) { return MTP_inputStickerSetShortName(MTP_string(set.shortName)); } +Set *feedSet(const MTPDstickerSet &set); + } // namespace Stickers namespace Global { @@ -254,6 +256,7 @@ DeclareVar(int32, PushChatPeriod); DeclareVar(int32, PushChatLimit); DeclareVar(int32, SavedGifsLimit); DeclareVar(int32, EditTimeLimit); +DeclareVar(int32, StickersRecentLimit); typedef QMap HiddenPinnedMessagesMap; DeclareVar(HiddenPinnedMessagesMap, HiddenPinnedMessages); diff --git a/Telegram/SourceFiles/history/field_autocomplete.cpp b/Telegram/SourceFiles/history/field_autocomplete.cpp index 49cb16fde..a2aebf4a2 100644 --- a/Telegram/SourceFiles/history/field_autocomplete.cpp +++ b/Telegram/SourceFiles/history/field_autocomplete.cpp @@ -161,7 +161,7 @@ void FieldAutocomplete::updateFiltered(bool resetScroll) { if (it->emoji.isEmpty()) { setsToRequest.insert(it->id, it->access); it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; - } else if (!(it->flags & MTPDstickerSet::Flag::f_disabled)) { + } else if (!(it->flags & MTPDstickerSet::Flag::f_archived)) { StickersByEmojiMap::const_iterator i = it->emoji.constFind(emojiGetNoColor(_emoji)); if (i != it->emoji.cend()) { srows += *i; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 08523d689..0e2bcfacb 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3667,27 +3667,11 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { } 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()) { - 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_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_unread | MTPDstickerSet_ClientFlag::f_not_loaded | MTPDstickerSet_ClientFlag::f_special); - 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; - it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; // need to request this set - } - } - if (!(it->flags & MTPDstickerSet::Flag::f_disabled) || (it->flags & MTPDstickerSet::Flag::f_official)) { - 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); + auto set = Stickers::feedSet(setData.c_stickerSet()); + if (!(set->flags & MTPDstickerSet::Flag::f_archived) || (set->flags & MTPDstickerSet::Flag::f_official)) { + setsOrder.push_back(set->id); + if (set->stickers.isEmpty() || (set->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) { + setsToRequest.insert(set->id, set->access); } } } diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index 68a443ca0..6ebdbea10 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -541,6 +541,7 @@ namespace { dbiHiddenPinnedMessages = 0x39, dbiDialogsMode = 0x40, dbiModerateMode = 0x41, + dbiStickersRecentLimit = 0x43, dbiEncryptedWithSalt = 333, dbiEncrypted = 444, @@ -834,6 +835,14 @@ namespace { Global::SetSavedGifsLimit(limit); } break; + case dbiStickersRecentLimit: { + qint32 limit; + stream >> limit; + if (!_checkStreamStatus(stream)) return false; + + Global::SetStickersRecentLimit(limit); + } break; + case dbiMegagroupSizeMax: { qint32 maxSize; stream >> maxSize; @@ -2175,12 +2184,13 @@ namespace Local { size += Serialize::stringSize(proxy.host) + sizeof(qint32) + Serialize::stringSize(proxy.user) + Serialize::stringSize(proxy.password); } - size += sizeof(quint32) + sizeof(qint32) * 6; + size += sizeof(quint32) + sizeof(qint32) * 7; EncryptedDescriptor data(size); data.stream << quint32(dbiChatSizeMax) << qint32(Global::ChatSizeMax()); data.stream << quint32(dbiMegagroupSizeMax) << qint32(Global::MegagroupSizeMax()); data.stream << quint32(dbiSavedGifsLimit) << qint32(Global::SavedGifsLimit()); + data.stream << quint32(dbiStickersRecentLimit) << qint32(Global::StickersRecentLimit()); data.stream << quint32(dbiAutoStart) << qint32(cAutoStart()); data.stream << quint32(dbiStartMinimized) << qint32(cStartMinimized()); data.stream << quint32(dbiSendToMenu) << qint32(cSendToMenu()); @@ -3053,7 +3063,7 @@ namespace Local { for_const (auto &set, sets) { bool notLoaded = (set.flags & MTPDstickerSet_ClientFlag::f_not_loaded); if (notLoaded && !(set.flags & MTPDstickerSet_ClientFlag::f_special)) { - if (!(set.flags & MTPDstickerSet::Flag::f_disabled) + if (!(set.flags & MTPDstickerSet::Flag::f_archived) || (set.flags & MTPDstickerSet::Flag::f_official) || (set.flags & MTPDstickerSet_ClientFlag::f_featured)) { // waiting to receive return; @@ -3155,7 +3165,9 @@ namespace Local { custom.stickers.push_back(doc); ++custom.count; } - if (recent.size() < StickerPanPerRow * StickerPanRowsPerPage && qAbs(value) > 1) recent.push_back(qMakePair(doc, qAbs(value))); + if (recent.size() < Global::StickersRecentLimit() && qAbs(value) > 1) { + recent.push_back(qMakePair(doc, qAbs(value))); + } } if (def.stickers.isEmpty()) { sets.remove(Stickers::DefaultSetId); @@ -3324,7 +3336,7 @@ namespace Local { } else if (j->flags & MTPDstickerSet::Flag::f_official) { foundOfficial = true; } - if (!(j->flags & MTPDstickerSet::Flag::f_disabled)) { + if (!(j->flags & MTPDstickerSet::Flag::f_archived)) { acc = (acc * 20261) + j->hash; } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 3391afaa2..9c5c00f3d 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3705,7 +3705,7 @@ void MainWidget::incrementSticker(DocumentData *sticker) { break; } } - while (!recent.isEmpty() && it->stickers.size() + recent.size() > StickerPanPerRow * StickerPanRowsPerPage) { + while (!recent.isEmpty() && it->stickers.size() + recent.size() > Global::StickersRecentLimit()) { writeRecent = true; recent.pop_back(); } diff --git a/Telegram/SourceFiles/mtproto/dcenter.cpp b/Telegram/SourceFiles/mtproto/dcenter.cpp index 7043e26b9..f15fd2fc4 100644 --- a/Telegram/SourceFiles/mtproto/dcenter.cpp +++ b/Telegram/SourceFiles/mtproto/dcenter.cpp @@ -170,6 +170,7 @@ namespace { Global::SetPushChatLimit(data.vpush_chat_limit.v); // ? Global::SetSavedGifsLimit(data.vsaved_gifs_limit.v); Global::SetEditTimeLimit(data.vedit_time_limit.v); // ? + Global::SetStickersRecentLimit(data.vstickers_recent_limit.v); configLoadedOnce = true; Local::writeSettings(); diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index 6f98b5891..168945f8d 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -418,7 +418,7 @@ upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true id:int ip_address:string port:int = DcOption; -config#c9411388 date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int disabled_features:Vector = Config; +config#f401a4bf date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int chat_big_size:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int rating_e_decay:int stickers_recent_limit:int disabled_features:Vector = Config; nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc; @@ -555,7 +555,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 disabled: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 id:long access_hash:long title:string short_name:string count:int hash:int = StickerSet; messages.stickerSet#b60a24a6 set:StickerSet packs:Vector documents:Vector = messages.StickerSet; @@ -672,7 +672,7 @@ auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; -messages.botCallbackAnswer#31fde6e4 flags:# alert:flags.1?true allow_pip:flags.2?true message:flags.0?string url:flags.3?string = messages.BotCallbackAnswer; +messages.botCallbackAnswer#31fde6e4 flags:# alert:flags.1?true message:flags.0?string url:flags.3?string = messages.BotCallbackAnswer; messages.messageEditData#26b5dde6 flags:# caption:flags.0?true = messages.MessageEditData; @@ -704,6 +704,11 @@ messages.featuredStickers#ed6392b7 hash:int sets:Vector unread:Vecto messages.recentStickersNotModified#b17f890 = messages.RecentStickers; messages.recentStickers#5ce20970 hash:int stickers:Vector = messages.RecentStickers; +messages.archivedStickers#f3475c0c count:int sets:Vector = messages.ArchivedStickers; + +messages.stickerSetInstallResultSuccess#38641628 = messages.StickerSetInstallResult; +messages.stickerSetInstallResultArchive#192c8a4e sets:Vector = messages.StickerSetInstallResult; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -814,7 +819,7 @@ messages.exportChatInvite#7d885289 chat_id:int = ExportedChatInvite; messages.checkChatInvite#3eadb1bb hash:string = ChatInvite; messages.importChatInvite#6c50051c hash:string = Updates; messages.getStickerSet#2619a90e stickerset:InputStickerSet = messages.StickerSet; -messages.installStickerSet#7b30c3a6 stickerset:InputStickerSet disabled:Bool = Bool; +messages.installStickerSet#c78fe460 stickerset:InputStickerSet archived:Bool = messages.StickerSetInstallResult; messages.uninstallStickerSet#f96e55de stickerset:InputStickerSet = Bool; messages.startBot#e6df7378 bot:InputUser peer:InputPeer random_id:long start_param:string = Updates; messages.getMessagesViews#c4c8a55d peer:InputPeer id:Vector increment:Bool = Vector; @@ -834,15 +839,17 @@ 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 = Updates; messages.editInlineBotMessage#130c2c85 flags:# no_webpage:flags.1?true id:InputBotInlineMessageID message:flags.11?string reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector = Bool; messages.getBotCallbackAnswer#a6e94f04 peer:InputPeer msg_id:int data:bytes = messages.BotCallbackAnswer; -messages.setBotCallbackAnswer#70dc0fa3 flags:# alert:flags.1?true allow_pip:flags.2?true query_id:long message:flags.0?string url:flags.3?string = Bool; +messages.setBotCallbackAnswer#70dc0fa3 flags:# alert:flags.1?true query_id:long message:flags.0?string url:flags.3?string = Bool; messages.getPeerDialogs#2d9776b9 peers:Vector = 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 = Bool; messages.getAllDrafts#6a3f8d65 = Updates; messages.getFeaturedStickers#2dacca4f hash:int = messages.FeaturedStickers; messages.readFeaturedStickers#e21cbb = Bool; messages.getRecentStickers#99197c2c hash:int = messages.RecentStickers; +messages.saveRecentSticker#348e39bf id:InputDocument unsave:Bool = Bool; messages.clearRecentStickers#ab02e5d2 = Bool; messages.getUnusedStickers#a978d356 limit:int = Vector; +messages.getArchivedStickers#906e241f offset_id:long limit:int = messages.ArchivedStickers; updates.getState#edd4882a = updates.State; updates.getDifference#a041495 pts:int date:int qts:int = updates.Difference; diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index 61c72b695..65e157812 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -3329,7 +3329,8 @@ void _serialize_config(MTPStringLogger &to, int32 stage, int32 lev, Types &types case 17: to.add(" saved_gifs_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 18: to.add(" edit_time_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 19: to.add(" rating_e_decay: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 20: to.add(" disabled_features: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 20: to.add(" stickers_recent_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 21: to.add(" disabled_features: "); ++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; } } @@ -4399,7 +4400,7 @@ void _serialize_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &t 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(" 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(" disabled: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_disabled) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 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; @@ -5599,9 +5600,8 @@ 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(" 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; + 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 3: 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; } } @@ -5797,6 +5797,37 @@ void _serialize_messages_recentStickers(MTPStringLogger &to, int32 stage, int32 } } +void _serialize_messages_archivedStickers(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_archivedStickers"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: 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 1: to.add(" sets: "); ++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_messages_stickerSetInstallResultSuccess(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_stickerSetInstallResultSuccess }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_messages_stickerSetInstallResultArchive(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_stickerSetInstallResultArchive"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" sets: "); ++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); @@ -6264,20 +6295,6 @@ void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage, } } -void _serialize_messages_installStickerSet(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_installStickerSet"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" disabled: "); ++stages.back(); types.push_back(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_uninstallStickerSet(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); @@ -6387,10 +6404,9 @@ 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(" 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; + 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 4: 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; } } @@ -6419,6 +6435,20 @@ void _serialize_messages_readFeaturedStickers(MTPStringLogger &to, int32 stage, to.add("{ messages_readFeaturedStickers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +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) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ messages_saveRecentSticker"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unsave: "); ++stages.back(); types.push_back(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_clearRecentStickers(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_clearRecentStickers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } @@ -7985,6 +8015,20 @@ void _serialize_messages_getStickerSet(MTPStringLogger &to, int32 stage, int32 l } } +void _serialize_messages_installStickerSet(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_installStickerSet"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" archived: "); ++stages.back(); types.push_back(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_getDocumentByHash(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); @@ -8128,6 +8172,20 @@ void _serialize_messages_getUnusedStickers(MTPStringLogger &to, int32 stage, int } } +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); + } else { + to.add("{ messages_getArchivedStickers"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" 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_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(); } @@ -8804,6 +8862,9 @@ namespace { _serializers.insert(mtpc_messages_featuredStickers, _serialize_messages_featuredStickers); _serializers.insert(mtpc_messages_recentStickersNotModified, _serialize_messages_recentStickersNotModified); _serializers.insert(mtpc_messages_recentStickers, _serialize_messages_recentStickers); + _serializers.insert(mtpc_messages_archivedStickers, _serialize_messages_archivedStickers); + _serializers.insert(mtpc_messages_stickerSetInstallResultSuccess, _serialize_messages_stickerSetInstallResultSuccess); + _serializers.insert(mtpc_messages_stickerSetInstallResultArchive, _serialize_messages_stickerSetInstallResultArchive); _serializers.insert(mtpc_req_pq, _serialize_req_pq); _serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params); @@ -8841,7 +8902,6 @@ namespace { _serializers.insert(mtpc_messages_discardEncryption, _serialize_messages_discardEncryption); _serializers.insert(mtpc_messages_setEncryptedTyping, _serialize_messages_setEncryptedTyping); _serializers.insert(mtpc_messages_readEncryptedHistory, _serialize_messages_readEncryptedHistory); - _serializers.insert(mtpc_messages_installStickerSet, _serialize_messages_installStickerSet); _serializers.insert(mtpc_messages_uninstallStickerSet, _serialize_messages_uninstallStickerSet); _serializers.insert(mtpc_messages_editChatAdmin, _serialize_messages_editChatAdmin); _serializers.insert(mtpc_messages_reorderStickerSets, _serialize_messages_reorderStickerSets); @@ -8851,6 +8911,7 @@ namespace { _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_messages_saveRecentSticker, _serialize_messages_saveRecentSticker); _serializers.insert(mtpc_messages_clearRecentStickers, _serialize_messages_clearRecentStickers); _serializers.insert(mtpc_upload_saveFilePart, _serialize_upload_saveFilePart); _serializers.insert(mtpc_upload_saveBigFilePart, _serialize_upload_saveBigFilePart); @@ -8963,6 +9024,7 @@ namespace { _serializers.insert(mtpc_channels_exportInvite, _serialize_channels_exportInvite); _serializers.insert(mtpc_messages_checkChatInvite, _serialize_messages_checkChatInvite); _serializers.insert(mtpc_messages_getStickerSet, _serialize_messages_getStickerSet); + _serializers.insert(mtpc_messages_installStickerSet, _serialize_messages_installStickerSet); _serializers.insert(mtpc_messages_getDocumentByHash, _serialize_messages_getDocumentByHash); _serializers.insert(mtpc_messages_searchGifs, _serialize_messages_searchGifs); _serializers.insert(mtpc_messages_getSavedGifs, _serialize_messages_getSavedGifs); @@ -8973,6 +9035,7 @@ namespace { _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); _serializers.insert(mtpc_updates_getChannelDifference, _serialize_updates_getChannelDifference); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index ce9c71234..3ad9425eb 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -306,7 +306,7 @@ enum { mtpc_photos_photo = 0x20212ca8, mtpc_upload_file = 0x96a18d5, mtpc_dcOption = 0x5d8c6cc, - mtpc_config = 0xc9411388, + mtpc_config = 0xf401a4bf, mtpc_nearestDc = 0x8e1a1775, mtpc_help_appUpdate = 0x8987f311, mtpc_help_noAppUpdate = 0xc45a6536, @@ -507,6 +507,9 @@ enum { mtpc_messages_featuredStickers = 0xed6392b7, mtpc_messages_recentStickersNotModified = 0xb17f890, mtpc_messages_recentStickers = 0x5ce20970, + mtpc_messages_archivedStickers = 0xf3475c0c, + mtpc_messages_stickerSetInstallResultSuccess = 0x38641628, + mtpc_messages_stickerSetInstallResultArchive = 0x192c8a4e, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_initConnection = 0x69796de9, @@ -610,7 +613,7 @@ enum { mtpc_messages_checkChatInvite = 0x3eadb1bb, mtpc_messages_importChatInvite = 0x6c50051c, mtpc_messages_getStickerSet = 0x2619a90e, - mtpc_messages_installStickerSet = 0x7b30c3a6, + mtpc_messages_installStickerSet = 0xc78fe460, mtpc_messages_uninstallStickerSet = 0xf96e55de, mtpc_messages_startBot = 0xe6df7378, mtpc_messages_getMessagesViews = 0xc4c8a55d, @@ -637,8 +640,10 @@ enum { mtpc_messages_getFeaturedStickers = 0x2dacca4f, mtpc_messages_readFeaturedStickers = 0xe21cbb, mtpc_messages_getRecentStickers = 0x99197c2c, + mtpc_messages_saveRecentSticker = 0x348e39bf, mtpc_messages_clearRecentStickers = 0xab02e5d2, mtpc_messages_getUnusedStickers = 0xa978d356, + mtpc_messages_getArchivedStickers = 0x906e241f, mtpc_updates_getState = 0xedd4882a, mtpc_updates_getDifference = 0xa041495, mtpc_updates_getChannelDifference = 0xbb32d7c0, @@ -1370,6 +1375,12 @@ class MTPDmessages_featuredStickers; class MTPmessages_recentStickers; class MTPDmessages_recentStickers; +class MTPmessages_archivedStickers; +class MTPDmessages_archivedStickers; + +class MTPmessages_stickerSetInstallResult; +class MTPDmessages_stickerSetInstallResultArchive; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1546,6 +1557,8 @@ typedef MTPBoxed MTPcontacts_TopPeers; typedef MTPBoxed MTPDraftMessage; typedef MTPBoxed MTPmessages_FeaturedStickers; typedef MTPBoxed MTPmessages_RecentStickers; +typedef MTPBoxed MTPmessages_ArchivedStickers; +typedef MTPBoxed MTPmessages_StickerSetInstallResult; // Type classes definitions @@ -9625,6 +9638,74 @@ private: }; typedef MTPBoxed MTPmessages_RecentStickers; +class MTPmessages_archivedStickers : private mtpDataOwner { +public: + MTPmessages_archivedStickers(); + MTPmessages_archivedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_archivedStickers) : mtpDataOwner(0) { + read(from, end, cons); + } + + MTPDmessages_archivedStickers &_messages_archivedStickers() { + if (!data) throw mtpErrorUninitialized(); + split(); + return *(MTPDmessages_archivedStickers*)data; + } + const MTPDmessages_archivedStickers &c_messages_archivedStickers() const { + if (!data) throw mtpErrorUninitialized(); + return *(const MTPDmessages_archivedStickers*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_archivedStickers); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPmessages_archivedStickers(MTPDmessages_archivedStickers *_data); + + friend class MTP::internal::TypeCreator; +}; +typedef MTPBoxed MTPmessages_ArchivedStickers; + +class MTPmessages_stickerSetInstallResult : private mtpDataOwner { +public: + MTPmessages_stickerSetInstallResult() : mtpDataOwner(0), _type(0) { + } + MTPmessages_stickerSetInstallResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDmessages_stickerSetInstallResultArchive &_messages_stickerSetInstallResultArchive() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messages_stickerSetInstallResultArchive) throw mtpErrorWrongTypeId(_type, mtpc_messages_stickerSetInstallResultArchive); + split(); + return *(MTPDmessages_stickerSetInstallResultArchive*)data; + } + const MTPDmessages_stickerSetInstallResultArchive &c_messages_stickerSetInstallResultArchive() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_messages_stickerSetInstallResultArchive) throw mtpErrorWrongTypeId(_type, mtpc_messages_stickerSetInstallResultArchive); + return *(const MTPDmessages_stickerSetInstallResultArchive*)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_stickerSetInstallResult(mtpTypeId type); + explicit MTPmessages_stickerSetInstallResult(MTPDmessages_stickerSetInstallResultArchive *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPmessages_StickerSetInstallResult; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -12362,7 +12443,7 @@ class MTPDconfig : public mtpDataImpl { public: MTPDconfig() { } - MTPDconfig(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, const MTPVector &_disabled_features) : vdate(_date), vexpires(_expires), vtest_mode(_test_mode), vthis_dc(_this_dc), vdc_options(_dc_options), vchat_size_max(_chat_size_max), vmegagroup_size_max(_megagroup_size_max), vforwarded_count_max(_forwarded_count_max), vonline_update_period_ms(_online_update_period_ms), voffline_blur_timeout_ms(_offline_blur_timeout_ms), voffline_idle_timeout_ms(_offline_idle_timeout_ms), vonline_cloud_timeout_ms(_online_cloud_timeout_ms), vnotify_cloud_delay_ms(_notify_cloud_delay_ms), vnotify_default_delay_ms(_notify_default_delay_ms), vchat_big_size(_chat_big_size), vpush_chat_period_ms(_push_chat_period_ms), vpush_chat_limit(_push_chat_limit), vsaved_gifs_limit(_saved_gifs_limit), vedit_time_limit(_edit_time_limit), vrating_e_decay(_rating_e_decay), vdisabled_features(_disabled_features) { + MTPDconfig(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, MTPint _stickers_recent_limit, const MTPVector &_disabled_features) : vdate(_date), vexpires(_expires), vtest_mode(_test_mode), vthis_dc(_this_dc), vdc_options(_dc_options), vchat_size_max(_chat_size_max), vmegagroup_size_max(_megagroup_size_max), vforwarded_count_max(_forwarded_count_max), vonline_update_period_ms(_online_update_period_ms), voffline_blur_timeout_ms(_offline_blur_timeout_ms), voffline_idle_timeout_ms(_offline_idle_timeout_ms), vonline_cloud_timeout_ms(_online_cloud_timeout_ms), vnotify_cloud_delay_ms(_notify_cloud_delay_ms), vnotify_default_delay_ms(_notify_default_delay_ms), vchat_big_size(_chat_big_size), vpush_chat_period_ms(_push_chat_period_ms), vpush_chat_limit(_push_chat_limit), vsaved_gifs_limit(_saved_gifs_limit), vedit_time_limit(_edit_time_limit), vrating_e_decay(_rating_e_decay), vstickers_recent_limit(_stickers_recent_limit), vdisabled_features(_disabled_features) { } MTPint vdate; @@ -12385,6 +12466,7 @@ public: MTPint vsaved_gifs_limit; MTPint vedit_time_limit; MTPint vrating_e_decay; + MTPint vstickers_recent_limit; MTPVector vdisabled_features; }; @@ -13195,7 +13277,7 @@ class MTPDstickerSet : public mtpDataImpl { public: enum class Flag : int32 { f_installed = (1 << 0), - f_disabled = (1 << 1), + f_archived = (1 << 1), f_official = (1 << 2), MAX_FIELD = (1 << 2), @@ -13204,7 +13286,7 @@ public: friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } bool is_installed() const { return vflags.v & Flag::f_installed; } - bool is_disabled() const { return vflags.v & Flag::f_disabled; } + bool is_archived() const { return vflags.v & Flag::f_archived; } bool is_official() const { return vflags.v & Flag::f_official; } MTPDstickerSet() { @@ -14374,7 +14456,6 @@ class MTPDmessages_botCallbackAnswer : public mtpDataImpl(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; } @@ -14540,6 +14620,27 @@ public: MTPVector vstickers; }; +class MTPDmessages_archivedStickers : public mtpDataImpl { +public: + MTPDmessages_archivedStickers() { + } + MTPDmessages_archivedStickers(MTPint _count, const MTPVector &_sets) : vcount(_count), vsets(_sets) { + } + + MTPint vcount; + MTPVector vsets; +}; + +class MTPDmessages_stickerSetInstallResultArchive : public mtpDataImpl { +public: + MTPDmessages_stickerSetInstallResultArchive() { + } + MTPDmessages_stickerSetInstallResultArchive(const MTPVector &_sets) : vsets(_sets) { + } + + MTPVector vsets; +}; + // RPC methods class MTPreq_pq { // RPC method 'req_pq' @@ -19336,32 +19437,32 @@ public: class MTPmessages_installStickerSet { // RPC method 'messages.installStickerSet' public: MTPInputStickerSet vstickerset; - MTPBool vdisabled; + MTPBool varchived; MTPmessages_installStickerSet() { } MTPmessages_installStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) { read(from, end, cons); } - MTPmessages_installStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _disabled) : vstickerset(_stickerset), vdisabled(_disabled) { + MTPmessages_installStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _archived) : vstickerset(_stickerset), varchived(_archived) { } uint32 innerLength() const { - return vstickerset.innerLength() + vdisabled.innerLength(); + return vstickerset.innerLength() + varchived.innerLength(); } mtpTypeId type() const { return mtpc_messages_installStickerSet; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_installStickerSet) { vstickerset.read(from, end); - vdisabled.read(from, end); + varchived.read(from, end); } void write(mtpBuffer &to) const { vstickerset.write(to); - vdisabled.write(to); + varchived.write(to); } - typedef MTPBool ResponseType; + typedef MTPmessages_StickerSetInstallResult ResponseType; }; class MTPmessages_InstallStickerSet : public MTPBoxed { public: @@ -19371,7 +19472,7 @@ public: } MTPmessages_InstallStickerSet(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_InstallStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _disabled) : MTPBoxed(MTPmessages_installStickerSet(_stickerset, _disabled)) { + MTPmessages_InstallStickerSet(const MTPInputStickerSet &_stickerset, MTPBool _archived) : MTPBoxed(MTPmessages_installStickerSet(_stickerset, _archived)) { } }; @@ -20332,7 +20433,6 @@ 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), @@ -20342,7 +20442,6 @@ public: friend inline Flags operator~(Flag v) { return QFlag(~static_cast(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; } @@ -20640,6 +20739,48 @@ public: } }; +class MTPmessages_saveRecentSticker { // RPC method 'messages.saveRecentSticker' +public: + MTPInputDocument vid; + MTPBool vunsave; + + MTPmessages_saveRecentSticker() { + } + MTPmessages_saveRecentSticker(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_saveRecentSticker) { + read(from, end, cons); + } + MTPmessages_saveRecentSticker(const MTPInputDocument &_id, MTPBool _unsave) : vid(_id), vunsave(_unsave) { + } + + uint32 innerLength() const { + return vid.innerLength() + vunsave.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_saveRecentSticker; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_saveRecentSticker) { + vid.read(from, end); + vunsave.read(from, end); + } + void write(mtpBuffer &to) const { + vid.write(to); + vunsave.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPmessages_SaveRecentSticker : public MTPBoxed { +public: + MTPmessages_SaveRecentSticker() { + } + MTPmessages_SaveRecentSticker(const MTPmessages_saveRecentSticker &v) : MTPBoxed(v) { + } + MTPmessages_SaveRecentSticker(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_SaveRecentSticker(const MTPInputDocument &_id, MTPBool _unsave) : MTPBoxed(MTPmessages_saveRecentSticker(_id, _unsave)) { + } +}; + class MTPmessages_clearRecentStickers { // RPC method 'messages.clearRecentStickers' public: MTPmessages_clearRecentStickers() { @@ -20710,6 +20851,48 @@ public: } }; +class MTPmessages_getArchivedStickers { // RPC method 'messages.getArchivedStickers' +public: + MTPlong voffset_id; + MTPint vlimit; + + MTPmessages_getArchivedStickers() { + } + MTPmessages_getArchivedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getArchivedStickers) { + read(from, end, cons); + } + MTPmessages_getArchivedStickers(const MTPlong &_offset_id, MTPint _limit) : voffset_id(_offset_id), vlimit(_limit) { + } + + uint32 innerLength() const { + return voffset_id.innerLength() + vlimit.innerLength(); + } + mtpTypeId type() const { + return mtpc_messages_getArchivedStickers; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getArchivedStickers) { + voffset_id.read(from, end); + vlimit.read(from, end); + } + void write(mtpBuffer &to) const { + voffset_id.write(to); + vlimit.write(to); + } + + typedef MTPmessages_ArchivedStickers ResponseType; +}; +class MTPmessages_GetArchivedStickers : public MTPBoxed { +public: + MTPmessages_GetArchivedStickers() { + } + MTPmessages_GetArchivedStickers(const MTPmessages_getArchivedStickers &v) : MTPBoxed(v) { + } + MTPmessages_GetArchivedStickers(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPmessages_GetArchivedStickers(const MTPlong &_offset_id, MTPint _limit) : MTPBoxed(MTPmessages_getArchivedStickers(_offset_id, _limit)) { + } +}; + class MTPupdates_getState { // RPC method 'updates.getState' public: MTPupdates_getState() { @@ -23305,8 +23488,8 @@ public: inline static MTPdcOption new_dcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { return MTPdcOption(new MTPDdcOption(_flags, _id, _ip_address, _port)); } - inline static MTPconfig new_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, const MTPVector &_disabled_features) { - return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _disabled_features)); + inline static MTPconfig new_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, MTPint _stickers_recent_limit, const MTPVector &_disabled_features) { + return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _stickers_recent_limit, _disabled_features)); } inline static MTPnearestDc new_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc) { return MTPnearestDc(new MTPDnearestDc(_country, _this_dc, _nearest_dc)); @@ -23908,6 +24091,15 @@ public: inline static MTPmessages_recentStickers new_messages_recentStickers(MTPint _hash, const MTPVector &_stickers) { return MTPmessages_recentStickers(new MTPDmessages_recentStickers(_hash, _stickers)); } + inline static MTPmessages_archivedStickers new_messages_archivedStickers(MTPint _count, const MTPVector &_sets) { + return MTPmessages_archivedStickers(new MTPDmessages_archivedStickers(_count, _sets)); + } + inline static MTPmessages_stickerSetInstallResult new_messages_stickerSetInstallResultSuccess() { + return MTPmessages_stickerSetInstallResult(mtpc_messages_stickerSetInstallResultSuccess); + } + inline static MTPmessages_stickerSetInstallResult new_messages_stickerSetInstallResultArchive(const MTPVector &_sets) { + return MTPmessages_stickerSetInstallResult(new MTPDmessages_stickerSetInstallResultArchive(_sets)); + } }; } // namespace internal @@ -30246,7 +30438,7 @@ inline MTPconfig::MTPconfig() : mtpDataOwner(new MTPDconfig()) { inline uint32 MTPconfig::innerLength() const { const MTPDconfig &v(c_config()); - return v.vdate.innerLength() + v.vexpires.innerLength() + v.vtest_mode.innerLength() + v.vthis_dc.innerLength() + v.vdc_options.innerLength() + v.vchat_size_max.innerLength() + v.vmegagroup_size_max.innerLength() + v.vforwarded_count_max.innerLength() + v.vonline_update_period_ms.innerLength() + v.voffline_blur_timeout_ms.innerLength() + v.voffline_idle_timeout_ms.innerLength() + v.vonline_cloud_timeout_ms.innerLength() + v.vnotify_cloud_delay_ms.innerLength() + v.vnotify_default_delay_ms.innerLength() + v.vchat_big_size.innerLength() + v.vpush_chat_period_ms.innerLength() + v.vpush_chat_limit.innerLength() + v.vsaved_gifs_limit.innerLength() + v.vedit_time_limit.innerLength() + v.vrating_e_decay.innerLength() + v.vdisabled_features.innerLength(); + return v.vdate.innerLength() + v.vexpires.innerLength() + v.vtest_mode.innerLength() + v.vthis_dc.innerLength() + v.vdc_options.innerLength() + v.vchat_size_max.innerLength() + v.vmegagroup_size_max.innerLength() + v.vforwarded_count_max.innerLength() + v.vonline_update_period_ms.innerLength() + v.voffline_blur_timeout_ms.innerLength() + v.voffline_idle_timeout_ms.innerLength() + v.vonline_cloud_timeout_ms.innerLength() + v.vnotify_cloud_delay_ms.innerLength() + v.vnotify_default_delay_ms.innerLength() + v.vchat_big_size.innerLength() + v.vpush_chat_period_ms.innerLength() + v.vpush_chat_limit.innerLength() + v.vsaved_gifs_limit.innerLength() + v.vedit_time_limit.innerLength() + v.vrating_e_decay.innerLength() + v.vstickers_recent_limit.innerLength() + v.vdisabled_features.innerLength(); } inline mtpTypeId MTPconfig::type() const { return mtpc_config; @@ -30276,6 +30468,7 @@ inline void MTPconfig::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeI v.vsaved_gifs_limit.read(from, end); v.vedit_time_limit.read(from, end); v.vrating_e_decay.read(from, end); + v.vstickers_recent_limit.read(from, end); v.vdisabled_features.read(from, end); } inline void MTPconfig::write(mtpBuffer &to) const { @@ -30300,12 +30493,13 @@ inline void MTPconfig::write(mtpBuffer &to) const { v.vsaved_gifs_limit.write(to); v.vedit_time_limit.write(to); v.vrating_e_decay.write(to); + v.vstickers_recent_limit.write(to); v.vdisabled_features.write(to); } inline MTPconfig::MTPconfig(MTPDconfig *_data) : mtpDataOwner(_data) { } -inline MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, const MTPVector &_disabled_features) { - return MTP::internal::TypeCreator::new_config(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _disabled_features); +inline MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, MTPint _rating_e_decay, MTPint _stickers_recent_limit, const MTPVector &_disabled_features) { + return MTP::internal::TypeCreator::new_config(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _rating_e_decay, _stickers_recent_limit, _disabled_features); } inline MTPnearestDc::MTPnearestDc() : mtpDataOwner(new MTPDnearestDc()) { @@ -35354,6 +35548,84 @@ inline MTPmessages_recentStickers MTP_messages_recentStickersNotModified() { inline MTPmessages_recentStickers MTP_messages_recentStickers(MTPint _hash, const MTPVector &_stickers) { return MTP::internal::TypeCreator::new_messages_recentStickers(_hash, _stickers); } + +inline MTPmessages_archivedStickers::MTPmessages_archivedStickers() : mtpDataOwner(new MTPDmessages_archivedStickers()) { +} + +inline uint32 MTPmessages_archivedStickers::innerLength() const { + const MTPDmessages_archivedStickers &v(c_messages_archivedStickers()); + return v.vcount.innerLength() + v.vsets.innerLength(); +} +inline mtpTypeId MTPmessages_archivedStickers::type() const { + return mtpc_messages_archivedStickers; +} +inline void MTPmessages_archivedStickers::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != mtpc_messages_archivedStickers) throw mtpErrorUnexpected(cons, "MTPmessages_archivedStickers"); + + if (!data) setData(new MTPDmessages_archivedStickers()); + MTPDmessages_archivedStickers &v(_messages_archivedStickers()); + v.vcount.read(from, end); + v.vsets.read(from, end); +} +inline void MTPmessages_archivedStickers::write(mtpBuffer &to) const { + const MTPDmessages_archivedStickers &v(c_messages_archivedStickers()); + v.vcount.write(to); + v.vsets.write(to); +} +inline MTPmessages_archivedStickers::MTPmessages_archivedStickers(MTPDmessages_archivedStickers *_data) : mtpDataOwner(_data) { +} +inline MTPmessages_archivedStickers MTP_messages_archivedStickers(MTPint _count, const MTPVector &_sets) { + return MTP::internal::TypeCreator::new_messages_archivedStickers(_count, _sets); +} + +inline uint32 MTPmessages_stickerSetInstallResult::innerLength() const { + switch (_type) { + case mtpc_messages_stickerSetInstallResultArchive: { + const MTPDmessages_stickerSetInstallResultArchive &v(c_messages_stickerSetInstallResultArchive()); + return v.vsets.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPmessages_stickerSetInstallResult::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPmessages_stickerSetInstallResult::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_messages_stickerSetInstallResultSuccess: _type = cons; break; + case mtpc_messages_stickerSetInstallResultArchive: _type = cons; { + if (!data) setData(new MTPDmessages_stickerSetInstallResultArchive()); + MTPDmessages_stickerSetInstallResultArchive &v(_messages_stickerSetInstallResultArchive()); + v.vsets.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPmessages_stickerSetInstallResult"); + } +} +inline void MTPmessages_stickerSetInstallResult::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_messages_stickerSetInstallResultArchive: { + const MTPDmessages_stickerSetInstallResultArchive &v(c_messages_stickerSetInstallResultArchive()); + v.vsets.write(to); + } break; + } +} +inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_messages_stickerSetInstallResultSuccess: break; + case mtpc_messages_stickerSetInstallResultArchive: setData(new MTPDmessages_stickerSetInstallResultArchive()); break; + default: throw mtpErrorBadTypeId(type, "MTPmessages_stickerSetInstallResult"); + } +} +inline MTPmessages_stickerSetInstallResult::MTPmessages_stickerSetInstallResult(MTPDmessages_stickerSetInstallResultArchive *_data) : mtpDataOwner(_data), _type(mtpc_messages_stickerSetInstallResultArchive) { +} +inline MTPmessages_stickerSetInstallResult MTP_messages_stickerSetInstallResultSuccess() { + return MTP::internal::TypeCreator::new_messages_stickerSetInstallResultSuccess(); +} +inline MTPmessages_stickerSetInstallResult MTP_messages_stickerSetInstallResultArchive(const MTPVector &_sets) { + return MTP::internal::TypeCreator::new_messages_stickerSetInstallResultArchive(_sets); +} inline MTPDmessage::Flags mtpCastFlags(MTPDmessageService::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } inline MTPDmessage::Flags mtpCastFlags(MTPflags flags) { return mtpCastFlags(flags.v); } inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index cd57d76aa..166952ee9 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -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) && (it->flags & MTPDstickerSet::Flag::f_installed); + return (it != Global::StickerSets().cend()) && !(it->flags & MTPDstickerSet::Flag::f_archived) && (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) && (it->flags & MTPDstickerSet::Flag::f_installed); + return !(it->flags & MTPDstickerSet::Flag::f_archived) && (it->flags & MTPDstickerSet::Flag::f_installed); } } } break;