From 3f2cb8f8c94275f46231ccd17e635df6da7178ea Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 17 Jul 2024 14:30:19 +0300 Subject: [PATCH] Added file origin to sticker pack for gifts. --- .../SourceFiles/chat_helpers/stickers_gift_box_pack.cpp | 6 ++++++ Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp index f54b1f1d3..2e810dd6c 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "data/data_document.h" +#include "data/data_file_origin.h" #include "data/data_session.h" #include "main/main_session.h" @@ -38,6 +39,10 @@ DocumentData *GiftBoxPack::lookup(int months) const { return (index >= _documents.size()) ? fallback : _documents[index]; } +Data::FileOrigin GiftBoxPack::origin() const { + return Data::FileOriginStickerSet(_setId, _accessHash); +} + void GiftBoxPack::load() { if (_requestId || !_documents.empty()) { return; @@ -59,6 +64,7 @@ void GiftBoxPack::load() { void GiftBoxPack::applySet(const MTPDmessages_stickerSet &data) { _setId = data.vset().data().vid().v; + _accessHash = data.vset().data().vaccess_hash().v; auto documents = base::flat_map>(); for (const auto &sticker : data.vdocuments().v) { const auto document = _session->data().processDocument(sticker); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h index e722c1979..4c480fba3 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.h @@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL class DocumentData; +namespace Data { +struct FileOrigin; +} // namespace Data + namespace Main { class Session; } // namespace Main @@ -22,6 +26,7 @@ public: void load(); [[nodiscard]] DocumentData *lookup(int months) const; + [[nodiscard]] Data::FileOrigin origin() const; private: using SetId = uint64; @@ -32,6 +37,7 @@ private: std::vector _documents; SetId _setId = 0; + uint64 _accessHash = 0; mtpRequestId _requestId = 0; };