Remove OfflineInputStickerSet.

GitOrigin-RevId: 144f639f5c22e652a98505856fd4b6327f27deff
This commit is contained in:
levlam 2019-06-18 18:59:32 +03:00
parent 984ccd3d75
commit b9a1ceec05
4 changed files with 24 additions and 35 deletions

View File

@ -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:

View File

@ -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<telegram_api::InputStickerSet> get_input_sticker_set() const {
return make_tl_object<telegram_api::inputStickerSetID>(sticker_set_id, sticker_set_access_hash);
}
template <class StorerT>
void store(StorerT &storer) const;
template <class ParserT>
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<telegram_api::InputStickerSet> get_input_sticker_set() const {
return make_tl_object<telegram_api::inputStickerSetID>(sticker_set_id, sticker_set_access_hash);
}
template <class StorerT>
void store(StorerT &storer) const;
template <class ParserT>
void parse(ParserT &parser);
};
Variant<Thumbnail, DialogPhoto, StickerSetThumbnail> 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() {

View File

@ -18,14 +18,14 @@
namespace td {
template <class StorerT>
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 <class ParserT>
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;
}

View File

@ -422,8 +422,8 @@ class FullRemoteFileLocation {
}
case PhotoSizeSource::Type::StickerSetThumbnail: {
auto &sticker_set_thumbnail = photo().source_.sticker_set_thumbnail();
return make_tl_object<telegram_api::inputStickerSetThumb>(
sticker_set_thumbnail.input_sticker_set.get_input_sticker_set(), photo().volume_id_, photo().local_id_);
return make_tl_object<telegram_api::inputStickerSetThumb>(sticker_set_thumbnail.get_input_sticker_set(),
photo().volume_id_, photo().local_id_);
}
}
}