Move StickerPhotoSize to separate files.
This commit is contained in:
parent
425bd0e364
commit
eade454791
@ -450,6 +450,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/SponsoredMessageManager.cpp
|
||||
td/telegram/StateManager.cpp
|
||||
td/telegram/StickerFormat.cpp
|
||||
td/telegram/StickerPhotoSize.cpp
|
||||
td/telegram/StickersManager.cpp
|
||||
td/telegram/StickerType.cpp
|
||||
td/telegram/StorageManager.cpp
|
||||
@ -720,6 +721,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/SponsoredMessageManager.h
|
||||
td/telegram/StateManager.h
|
||||
td/telegram/StickerFormat.h
|
||||
td/telegram/StickerPhotoSize.h
|
||||
td/telegram/StickerSetId.h
|
||||
td/telegram/StickersManager.h
|
||||
td/telegram/StickerType.h
|
||||
@ -789,6 +791,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/ScopeNotificationSettings.hpp
|
||||
td/telegram/SecureValue.hpp
|
||||
td/telegram/SendCodeHelper.hpp
|
||||
td/telegram/StickerPhotoSize.hpp
|
||||
td/telegram/StickerSetId.hpp
|
||||
td/telegram/StickersManager.hpp
|
||||
td/telegram/TranscriptionInfo.hpp
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "td/telegram/QueryMerger.h"
|
||||
#include "td/telegram/RestrictionReason.h"
|
||||
#include "td/telegram/SecretChatId.h"
|
||||
#include "td/telegram/StickerPhotoSize.h"
|
||||
#include "td/telegram/StickerSetId.h"
|
||||
#include "td/telegram/SuggestedAction.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "td/telegram/PhotoSize.h"
|
||||
#include "td/telegram/secret_api.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
#include "td/telegram/StickerPhotoSize.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "td/telegram/files/FileId.hpp"
|
||||
#include "td/telegram/Photo.h"
|
||||
#include "td/telegram/PhotoSize.hpp"
|
||||
#include "td/telegram/StickerPhotoSize.hpp"
|
||||
#include "td/telegram/Version.h"
|
||||
|
||||
#include "td/utils/tl_helpers.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#include "td/telegram/PhotoSize.h"
|
||||
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/files/FileLocation.h"
|
||||
#include "td/telegram/files/FileManager.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
@ -333,85 +334,6 @@ Variant<AnimationSize, StickerPhotoSize> get_animation_size(Td *td, PhotoSizeSou
|
||||
}
|
||||
}
|
||||
|
||||
StickerPhotoSize get_sticker_photo_size(Td *td, const td_api::object_ptr<td_api::chatPhotoSticker> &sticker) {
|
||||
if (sticker == nullptr || sticker->type_ == nullptr || sticker->background_fill_ == nullptr) {
|
||||
return {};
|
||||
}
|
||||
StickerPhotoSize result;
|
||||
switch (sticker->type_->get_id()) {
|
||||
case td_api::chatPhotoStickerTypeRegularOrMask::ID: {
|
||||
auto type = static_cast<const td_api::chatPhotoStickerTypeRegularOrMask *>(sticker->type_.get());
|
||||
result.type = StickerPhotoSize::Type::Sticker;
|
||||
result.sticker_set_id = StickerSetId(type->sticker_set_id_);
|
||||
result.sticker_id = type->sticker_id_;
|
||||
//if (!td->stickers_manager_->have_sticker(result.sticker_set_id, result.sticker_id)) {
|
||||
// return {};
|
||||
//}
|
||||
break;
|
||||
}
|
||||
case td_api::chatPhotoStickerTypeCustomEmoji::ID: {
|
||||
auto type = static_cast<const td_api::chatPhotoStickerTypeCustomEmoji *>(sticker->type_.get());
|
||||
result.type = StickerPhotoSize::Type::CustomEmoji;
|
||||
result.custom_emoji_id = CustomEmojiId(type->custom_emoji_id_);
|
||||
//if (!td->stickers_manager_->have_custom_emoji_id(result.custom_emoji_id)) {
|
||||
// return {};
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto fill = sticker->background_fill_.get();
|
||||
switch (fill->get_id()) {
|
||||
case td_api::backgroundFillSolid::ID: {
|
||||
auto solid = static_cast<const td_api::backgroundFillSolid *>(fill);
|
||||
result.background_colors.push_back(solid->color_);
|
||||
break;
|
||||
}
|
||||
case td_api::backgroundFillGradient::ID: {
|
||||
auto gradient = static_cast<const td_api::backgroundFillGradient *>(fill);
|
||||
result.background_colors.push_back(gradient->top_color_);
|
||||
result.background_colors.push_back(gradient->bottom_color_);
|
||||
break;
|
||||
}
|
||||
case td_api::backgroundFillFreeformGradient::ID: {
|
||||
auto freeform = static_cast<const td_api::backgroundFillFreeformGradient *>(fill);
|
||||
if (freeform->colors_.size() != 3 && freeform->colors_.size() != 4) {
|
||||
return {};
|
||||
}
|
||||
result.background_colors = freeform->colors_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
for (auto &color : result.background_colors) {
|
||||
color &= 0xFFFFFF;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::VideoSize> get_input_video_size_object(
|
||||
Td *td, const StickerPhotoSize &sticker_photo_size) {
|
||||
switch (sticker_photo_size.type) {
|
||||
case StickerPhotoSize::Type::Sticker:
|
||||
if (!sticker_photo_size.sticker_set_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::videoSizeStickerMarkup>(
|
||||
td->stickers_manager_->get_input_sticker_set(sticker_photo_size.sticker_set_id),
|
||||
sticker_photo_size.sticker_id, vector<int32>(sticker_photo_size.background_colors));
|
||||
case StickerPhotoSize::Type::CustomEmoji:
|
||||
if (!sticker_photo_size.custom_emoji_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::videoSizeEmojiMarkup>(
|
||||
sticker_photo_size.custom_emoji_id.get(), vector<int32>(sticker_photo_size.background_colors));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PhotoSize get_web_document_photo_size(FileManager *file_manager, FileType file_type, DialogId owner_dialog_id,
|
||||
tl_object_ptr<telegram_api::WebDocument> web_document_ptr) {
|
||||
if (web_document_ptr == nullptr) {
|
||||
@ -566,26 +488,4 @@ StringBuilder &operator<<(StringBuilder &string_builder, const AnimationSize &an
|
||||
<< animation_size.main_frame_timestamp;
|
||||
}
|
||||
|
||||
bool operator==(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs) {
|
||||
return lhs.type == rhs.type && lhs.sticker_set_id == rhs.sticker_set_id && lhs.sticker_id == rhs.sticker_id &&
|
||||
lhs.custom_emoji_id == rhs.custom_emoji_id && lhs.background_colors == rhs.background_colors;
|
||||
}
|
||||
|
||||
bool operator!=(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StickerPhotoSize &sticker_photo_size) {
|
||||
switch (sticker_photo_size.type) {
|
||||
case StickerPhotoSize::Type::Sticker:
|
||||
return string_builder << sticker_photo_size.sticker_id << " from " << sticker_photo_size.sticker_set_id << " on "
|
||||
<< sticker_photo_size.background_colors;
|
||||
case StickerPhotoSize::Type::CustomEmoji:
|
||||
return string_builder << sticker_photo_size.custom_emoji_id << " on " << sticker_photo_size.background_colors;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return string_builder;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -6,7 +6,6 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/Dimensions.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
@ -14,7 +13,7 @@
|
||||
#include "td/telegram/net/DcId.h"
|
||||
#include "td/telegram/PhotoFormat.h"
|
||||
#include "td/telegram/PhotoSizeSource.h"
|
||||
#include "td/telegram/StickerSetId.h"
|
||||
#include "td/telegram/StickerPhotoSize.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
@ -40,15 +39,6 @@ struct AnimationSize final : public PhotoSize {
|
||||
double main_frame_timestamp = 0.0;
|
||||
};
|
||||
|
||||
struct StickerPhotoSize {
|
||||
enum class Type : int32 { Sticker, CustomEmoji };
|
||||
Type type = Type::CustomEmoji;
|
||||
CustomEmojiId custom_emoji_id;
|
||||
StickerSetId sticker_set_id;
|
||||
int64 sticker_id = 0;
|
||||
vector<int32> background_colors;
|
||||
};
|
||||
|
||||
bool need_update_dialog_photo_minithumbnail(const string &from, const string &to);
|
||||
|
||||
td_api::object_ptr<td_api::minithumbnail> get_minithumbnail_object(const string &packed);
|
||||
@ -69,11 +59,6 @@ Variant<AnimationSize, StickerPhotoSize> get_animation_size(Td *td, PhotoSizeSou
|
||||
string file_reference, DcId dc_id, DialogId owner_dialog_id,
|
||||
tl_object_ptr<telegram_api::VideoSize> &&size_ptr);
|
||||
|
||||
StickerPhotoSize get_sticker_photo_size(Td *td, const td_api::object_ptr<td_api::chatPhotoSticker> &chat_photo_sticker);
|
||||
|
||||
telegram_api::object_ptr<telegram_api::VideoSize> get_input_video_size_object(
|
||||
Td *td, const StickerPhotoSize &sticker_photo_size);
|
||||
|
||||
PhotoSize get_web_document_photo_size(FileManager *file_manager, FileType file_type, DialogId owner_dialog_id,
|
||||
tl_object_ptr<telegram_api::WebDocument> web_document_ptr);
|
||||
|
||||
@ -92,9 +77,4 @@ bool operator!=(const AnimationSize &lhs, const AnimationSize &rhs);
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const AnimationSize &animation_size);
|
||||
|
||||
bool operator==(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs);
|
||||
bool operator!=(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs);
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StickerPhotoSize &sticker_photo_size);
|
||||
|
||||
} // namespace td
|
||||
|
@ -58,42 +58,4 @@ void parse(AnimationSize &animation_size, ParserT &parser) {
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
void store(const StickerPhotoSize &sticker_photo_size, StorerT &storer) {
|
||||
bool is_custom_emoji = sticker_photo_size.type == StickerPhotoSize::Type::CustomEmoji;
|
||||
bool is_sticker = sticker_photo_size.type == StickerPhotoSize::Type::Sticker;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_custom_emoji);
|
||||
STORE_FLAG(is_sticker);
|
||||
END_STORE_FLAGS();
|
||||
if (is_custom_emoji) {
|
||||
store(sticker_photo_size.custom_emoji_id, storer);
|
||||
} else if (is_sticker) {
|
||||
store(sticker_photo_size.sticker_set_id, storer);
|
||||
store(sticker_photo_size.sticker_id, storer);
|
||||
}
|
||||
store(sticker_photo_size.background_colors, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(StickerPhotoSize &sticker_photo_size, ParserT &parser) {
|
||||
bool is_custom_emoji;
|
||||
bool is_sticker;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_custom_emoji);
|
||||
PARSE_FLAG(is_sticker);
|
||||
END_PARSE_FLAGS();
|
||||
if (is_custom_emoji) {
|
||||
sticker_photo_size.type = StickerPhotoSize::Type::CustomEmoji;
|
||||
parse(sticker_photo_size.custom_emoji_id, parser);
|
||||
} else if (is_sticker) {
|
||||
sticker_photo_size.type = StickerPhotoSize::Type::Sticker;
|
||||
parse(sticker_photo_size.sticker_set_id, parser);
|
||||
parse(sticker_photo_size.sticker_id, parser);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
parse(sticker_photo_size.background_colors, parser);
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
115
td/telegram/StickerPhotoSize.cpp
Normal file
115
td/telegram/StickerPhotoSize.cpp
Normal file
@ -0,0 +1,115 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#include "td/telegram/StickerPhotoSize.h"
|
||||
|
||||
#include "td/telegram/StickersManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
StickerPhotoSize get_sticker_photo_size(Td *td, const td_api::object_ptr<td_api::chatPhotoSticker> &sticker) {
|
||||
if (sticker == nullptr || sticker->type_ == nullptr || sticker->background_fill_ == nullptr) {
|
||||
return {};
|
||||
}
|
||||
StickerPhotoSize result;
|
||||
switch (sticker->type_->get_id()) {
|
||||
case td_api::chatPhotoStickerTypeRegularOrMask::ID: {
|
||||
auto type = static_cast<const td_api::chatPhotoStickerTypeRegularOrMask *>(sticker->type_.get());
|
||||
result.type = StickerPhotoSize::Type::Sticker;
|
||||
result.sticker_set_id = StickerSetId(type->sticker_set_id_);
|
||||
result.sticker_id = type->sticker_id_;
|
||||
//if (!td->stickers_manager_->have_sticker(result.sticker_set_id, result.sticker_id)) {
|
||||
// return {};
|
||||
//}
|
||||
break;
|
||||
}
|
||||
case td_api::chatPhotoStickerTypeCustomEmoji::ID: {
|
||||
auto type = static_cast<const td_api::chatPhotoStickerTypeCustomEmoji *>(sticker->type_.get());
|
||||
result.type = StickerPhotoSize::Type::CustomEmoji;
|
||||
result.custom_emoji_id = CustomEmojiId(type->custom_emoji_id_);
|
||||
//if (!td->stickers_manager_->have_custom_emoji_id(result.custom_emoji_id)) {
|
||||
// return {};
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto fill = sticker->background_fill_.get();
|
||||
switch (fill->get_id()) {
|
||||
case td_api::backgroundFillSolid::ID: {
|
||||
auto solid = static_cast<const td_api::backgroundFillSolid *>(fill);
|
||||
result.background_colors.push_back(solid->color_);
|
||||
break;
|
||||
}
|
||||
case td_api::backgroundFillGradient::ID: {
|
||||
auto gradient = static_cast<const td_api::backgroundFillGradient *>(fill);
|
||||
result.background_colors.push_back(gradient->top_color_);
|
||||
result.background_colors.push_back(gradient->bottom_color_);
|
||||
break;
|
||||
}
|
||||
case td_api::backgroundFillFreeformGradient::ID: {
|
||||
auto freeform = static_cast<const td_api::backgroundFillFreeformGradient *>(fill);
|
||||
if (freeform->colors_.size() != 3 && freeform->colors_.size() != 4) {
|
||||
return {};
|
||||
}
|
||||
result.background_colors = freeform->colors_;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
for (auto &color : result.background_colors) {
|
||||
color &= 0xFFFFFF;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
telegram_api::object_ptr<telegram_api::VideoSize> get_input_video_size_object(
|
||||
Td *td, const StickerPhotoSize &sticker_photo_size) {
|
||||
switch (sticker_photo_size.type) {
|
||||
case StickerPhotoSize::Type::Sticker:
|
||||
if (!sticker_photo_size.sticker_set_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::videoSizeStickerMarkup>(
|
||||
td->stickers_manager_->get_input_sticker_set(sticker_photo_size.sticker_set_id),
|
||||
sticker_photo_size.sticker_id, vector<int32>(sticker_photo_size.background_colors));
|
||||
case StickerPhotoSize::Type::CustomEmoji:
|
||||
if (!sticker_photo_size.custom_emoji_id.is_valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return telegram_api::make_object<telegram_api::videoSizeEmojiMarkup>(
|
||||
sticker_photo_size.custom_emoji_id.get(), vector<int32>(sticker_photo_size.background_colors));
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool operator==(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs) {
|
||||
return lhs.type == rhs.type && lhs.sticker_set_id == rhs.sticker_set_id && lhs.sticker_id == rhs.sticker_id &&
|
||||
lhs.custom_emoji_id == rhs.custom_emoji_id && lhs.background_colors == rhs.background_colors;
|
||||
}
|
||||
|
||||
bool operator!=(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StickerPhotoSize &sticker_photo_size) {
|
||||
switch (sticker_photo_size.type) {
|
||||
case StickerPhotoSize::Type::Sticker:
|
||||
return string_builder << sticker_photo_size.sticker_id << " from " << sticker_photo_size.sticker_set_id << " on "
|
||||
<< sticker_photo_size.background_colors;
|
||||
case StickerPhotoSize::Type::CustomEmoji:
|
||||
return string_builder << sticker_photo_size.custom_emoji_id << " on " << sticker_photo_size.background_colors;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return string_builder;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
40
td/telegram/StickerPhotoSize.h
Normal file
40
td/telegram/StickerPhotoSize.h
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/StickerSetId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
class Td;
|
||||
|
||||
struct StickerPhotoSize {
|
||||
enum class Type : int32 { Sticker, CustomEmoji };
|
||||
Type type = Type::CustomEmoji;
|
||||
CustomEmojiId custom_emoji_id;
|
||||
StickerSetId sticker_set_id;
|
||||
int64 sticker_id = 0;
|
||||
vector<int32> background_colors;
|
||||
};
|
||||
|
||||
StickerPhotoSize get_sticker_photo_size(Td *td, const td_api::object_ptr<td_api::chatPhotoSticker> &chat_photo_sticker);
|
||||
|
||||
telegram_api::object_ptr<telegram_api::VideoSize> get_input_video_size_object(
|
||||
Td *td, const StickerPhotoSize &sticker_photo_size);
|
||||
|
||||
bool operator==(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs);
|
||||
bool operator!=(const StickerPhotoSize &lhs, const StickerPhotoSize &rhs);
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &string_builder, const StickerPhotoSize &sticker_photo_size);
|
||||
|
||||
} // namespace td
|
54
td/telegram/StickerPhotoSize.hpp
Normal file
54
td/telegram/StickerPhotoSize.hpp
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/StickerPhotoSize.h"
|
||||
#include "td/telegram/StickerSetId.hpp"
|
||||
|
||||
#include "td/utils/tl_helpers.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
template <class StorerT>
|
||||
void store(const StickerPhotoSize &sticker_photo_size, StorerT &storer) {
|
||||
bool is_custom_emoji = sticker_photo_size.type == StickerPhotoSize::Type::CustomEmoji;
|
||||
bool is_sticker = sticker_photo_size.type == StickerPhotoSize::Type::Sticker;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_custom_emoji);
|
||||
STORE_FLAG(is_sticker);
|
||||
END_STORE_FLAGS();
|
||||
if (is_custom_emoji) {
|
||||
store(sticker_photo_size.custom_emoji_id, storer);
|
||||
} else if (is_sticker) {
|
||||
store(sticker_photo_size.sticker_set_id, storer);
|
||||
store(sticker_photo_size.sticker_id, storer);
|
||||
}
|
||||
store(sticker_photo_size.background_colors, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(StickerPhotoSize &sticker_photo_size, ParserT &parser) {
|
||||
bool is_custom_emoji;
|
||||
bool is_sticker;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_custom_emoji);
|
||||
PARSE_FLAG(is_sticker);
|
||||
END_PARSE_FLAGS();
|
||||
if (is_custom_emoji) {
|
||||
sticker_photo_size.type = StickerPhotoSize::Type::CustomEmoji;
|
||||
parse(sticker_photo_size.custom_emoji_id, parser);
|
||||
} else if (is_sticker) {
|
||||
sticker_photo_size.type = StickerPhotoSize::Type::Sticker;
|
||||
parse(sticker_photo_size.sticker_set_id, parser);
|
||||
parse(sticker_photo_size.sticker_id, parser);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
parse(sticker_photo_size.background_colors, parser);
|
||||
}
|
||||
|
||||
} // namespace td
|
Loading…
Reference in New Issue
Block a user