diff --git a/td/telegram/Photo.cpp b/td/telegram/Photo.cpp index 9297e3c91..e0bd62827 100644 --- a/td/telegram/Photo.cpp +++ b/td/telegram/Photo.cpp @@ -64,10 +64,8 @@ bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) { lhs.dialog_photo().input_peer.dialog_access_hash == rhs.dialog_photo().input_peer.dialog_access_hash && lhs.dialog_photo().is_big == rhs.dialog_photo().is_big; case PhotoSizeSource::Type::StickerSetThumbnail: - return lhs.sticker_set_thumbnail().input_sticker_set.sticker_set_id == - rhs.sticker_set_thumbnail().input_sticker_set.sticker_set_id && - lhs.sticker_set_thumbnail().input_sticker_set.sticker_set_access_hash == - rhs.sticker_set_thumbnail().input_sticker_set.sticker_set_access_hash; + return lhs.sticker_set_thumbnail().sticker_set_id == rhs.sticker_set_thumbnail().sticker_set_id && + lhs.sticker_set_thumbnail().sticker_set_access_hash == rhs.sticker_set_thumbnail().sticker_set_access_hash; case PhotoSizeSource::Type::Thumbnail: return lhs.thumbnail().thumbnail_type == rhs.thumbnail().thumbnail_type; case PhotoSizeSource::Type::Empty: diff --git a/td/telegram/Photo.h b/td/telegram/Photo.h index 66d34f859..937c01183 100644 --- a/td/telegram/Photo.h +++ b/td/telegram/Photo.h @@ -47,25 +47,6 @@ struct PhotoSize { FileId file_id; }; -struct OfflineInputStickerSet { - int64 sticker_set_id = 0; - int64 sticker_set_access_hash = 0; - - OfflineInputStickerSet() = default; - OfflineInputStickerSet(int64 sticker_set_id, int64 sticker_set_access_hash) - : sticker_set_id(sticker_set_id), sticker_set_access_hash(sticker_set_access_hash) { - } - - tl_object_ptr get_input_sticker_set() const { - return make_tl_object(sticker_set_id, sticker_set_access_hash); - } - - template - void store(StorerT &storer) const; - template - void parse(ParserT &parser); -}; - struct OfflineInputPeer { DialogId dialog_id; int64 dialog_access_hash = 0; @@ -106,10 +87,22 @@ struct PhotoSizeSource { }; // for sticker set thumbnails struct StickerSetThumbnail { + int64 sticker_set_id = 0; + int64 sticker_set_access_hash = 0; + StickerSetThumbnail() = default; - explicit StickerSetThumbnail(OfflineInputStickerSet input_sticker_set) : input_sticker_set(input_sticker_set) { + StickerSetThumbnail(int64 sticker_set_id, int64 sticker_set_access_hash) + : sticker_set_id(sticker_set_id), sticker_set_access_hash(sticker_set_access_hash) { } - OfflineInputStickerSet input_sticker_set; + + tl_object_ptr get_input_sticker_set() const { + return make_tl_object(sticker_set_id, sticker_set_access_hash); + } + + template + void store(StorerT &storer) const; + template + void parse(ParserT &parser); }; Variant variant; @@ -126,7 +119,7 @@ struct PhotoSizeSource { PhotoSizeSource(int64 sticker_set_id, int64 sticker_set_access_hash) : type(Type::StickerSetThumbnail) , file_type(FileType::Thumbnail) - , variant(StickerSetThumbnail(OfflineInputStickerSet(sticker_set_id, sticker_set_access_hash))) { + , variant(StickerSetThumbnail(sticker_set_id, sticker_set_access_hash)) { } Thumbnail &thumbnail() { diff --git a/td/telegram/Photo.hpp b/td/telegram/Photo.hpp index 0587480c8..de46e0ef4 100644 --- a/td/telegram/Photo.hpp +++ b/td/telegram/Photo.hpp @@ -18,14 +18,14 @@ namespace td { template -void OfflineInputStickerSet::store(StorerT &storer) const { +void PhotoSizeSource::StickerSetThumbnail::store(StorerT &storer) const { using td::store; store(sticker_set_id, storer); store(sticker_set_access_hash, storer); } template -void OfflineInputStickerSet::parse(ParserT &parser) { +void PhotoSizeSource::StickerSetThumbnail::parse(ParserT &parser) { using td::parse; parse(sticker_set_id, parser); parse(sticker_set_access_hash, parser); @@ -65,11 +65,9 @@ void PhotoSizeSource::store(StorerT &storer) const { store(dialog_photo.is_big, storer); break; } - case Type::StickerSetThumbnail: { - auto &sticker_set_thumbnail = this->sticker_set_thumbnail(); - store(sticker_set_thumbnail.input_sticker_set, storer); + case Type::StickerSetThumbnail: + store(sticker_set_thumbnail(), storer); break; - } case Type::Thumbnail: { auto &thumbnail = this->thumbnail(); store(thumbnail.thumbnail_type, storer); @@ -95,7 +93,7 @@ void PhotoSizeSource::parse(ParserT &parser) { } case Type::StickerSetThumbnail: { StickerSetThumbnail sticker_set_thumbnail; - parse(sticker_set_thumbnail.input_sticker_set, parser); + parse(sticker_set_thumbnail, parser); variant = sticker_set_thumbnail; break; } diff --git a/td/telegram/files/FileLocation.h b/td/telegram/files/FileLocation.h index 3c693f104..422f58dbf 100644 --- a/td/telegram/files/FileLocation.h +++ b/td/telegram/files/FileLocation.h @@ -422,8 +422,8 @@ class FullRemoteFileLocation { } case PhotoSizeSource::Type::StickerSetThumbnail: { auto &sticker_set_thumbnail = photo().source_.sticker_set_thumbnail(); - return make_tl_object( - sticker_set_thumbnail.input_sticker_set.get_input_sticker_set(), photo().volume_id_, photo().local_id_); + return make_tl_object(sticker_set_thumbnail.get_input_sticker_set(), + photo().volume_id_, photo().local_id_); } } }