Rename stickerTypeEmoji to stickerTypeCustomEmoji.

This commit is contained in:
levlam 2022-07-19 14:51:29 +03:00
parent 219d5ecf87
commit ba3f24ed8d
10 changed files with 37 additions and 37 deletions

View File

@ -261,7 +261,7 @@ stickerTypeRegular = StickerType;
stickerTypeMask = StickerType; stickerTypeMask = StickerType;
//@description The sticker is a custom emoji to be used inside message text and caption //@description The sticker is a custom emoji to be used inside message text and caption
stickerTypeEmoji = StickerType; stickerTypeCustomEmoji = StickerType;
//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands //@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands

View File

@ -1169,8 +1169,8 @@ tl_object_ptr<td_api::StickerType> copy(const td_api::StickerType &obj) {
return td_api::make_object<td_api::stickerTypeRegular>(); return td_api::make_object<td_api::stickerTypeRegular>();
case td_api::stickerTypeMask::ID: case td_api::stickerTypeMask::ID:
return td_api::make_object<td_api::stickerTypeMask>(); return td_api::make_object<td_api::stickerTypeMask>();
case td_api::stickerTypeEmoji::ID: case td_api::stickerTypeCustomEmoji::ID:
return td_api::make_object<td_api::stickerTypeEmoji>(); return td_api::make_object<td_api::stickerTypeCustomEmoji>();
default: default:
UNREACHABLE(); UNREACHABLE();
} }

View File

@ -2716,7 +2716,7 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
return Status::Error(400, "Not enough rights to send stickers to the chat"); return Status::Error(400, "Not enough rights to send stickers to the chat");
} }
if (td->stickers_manager_->get_sticker_type(static_cast<const MessageSticker *>(content)->file_id) == if (td->stickers_manager_->get_sticker_type(static_cast<const MessageSticker *>(content)->file_id) ==
StickerType::Emoji) { StickerType::CustomEmoji) {
return Status::Error(400, "Can't send emoji stickers in messages"); return Status::Error(400, "Can't send emoji stickers in messages");
} }
break; break;

View File

@ -147,7 +147,7 @@ bool is_sticker_format_vector(StickerFormat sticker_format) {
} }
int64 get_max_sticker_file_size(StickerFormat sticker_format, StickerType sticker_type, bool for_thumbnail) { int64 get_max_sticker_file_size(StickerFormat sticker_format, StickerType sticker_type, bool for_thumbnail) {
bool is_emoji = sticker_type == StickerType::Emoji; bool is_emoji = sticker_type == StickerType::CustomEmoji;
switch (sticker_format) { switch (sticker_format) {
case StickerFormat::Unknown: case StickerFormat::Unknown:
case StickerFormat::Webp: case StickerFormat::Webp:

View File

@ -17,8 +17,8 @@ StickerType get_sticker_type(const td_api::object_ptr<td_api::StickerType> &type
return StickerType::Regular; return StickerType::Regular;
case td_api::stickerTypeMask::ID: case td_api::stickerTypeMask::ID:
return StickerType::Mask; return StickerType::Mask;
case td_api::stickerTypeEmoji::ID: case td_api::stickerTypeCustomEmoji::ID:
return StickerType::Emoji; return StickerType::CustomEmoji;
default: default:
UNREACHABLE(); UNREACHABLE();
return StickerType::Regular; return StickerType::Regular;
@ -31,8 +31,8 @@ td_api::object_ptr<td_api::StickerType> get_sticker_type_object(StickerType stic
return td_api::make_object<td_api::stickerTypeRegular>(); return td_api::make_object<td_api::stickerTypeRegular>();
case StickerType::Mask: case StickerType::Mask:
return td_api::make_object<td_api::stickerTypeMask>(); return td_api::make_object<td_api::stickerTypeMask>();
case StickerType::Emoji: case StickerType::CustomEmoji:
return td_api::make_object<td_api::stickerTypeEmoji>(); return td_api::make_object<td_api::stickerTypeCustomEmoji>();
default: default:
UNREACHABLE(); UNREACHABLE();
return nullptr; return nullptr;
@ -45,8 +45,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, StickerType sticker_typ
return string_builder << "Regular"; return string_builder << "Regular";
case StickerType::Mask: case StickerType::Mask:
return string_builder << "Mask"; return string_builder << "Mask";
case StickerType::Emoji: case StickerType::CustomEmoji:
return string_builder << "Emoji"; return string_builder << "CustomEmoji";
default: default:
UNREACHABLE(); UNREACHABLE();
return string_builder; return string_builder;

View File

@ -14,7 +14,7 @@
namespace td { namespace td {
// update store_sticker/store_sticker_set when this type changes // update store_sticker/store_sticker_set when this type changes
enum class StickerType : int32 { Regular, Mask, Emoji }; enum class StickerType : int32 { Regular, Mask, CustomEmoji };
static constexpr int32 MAX_STICKER_TYPE = 3; static constexpr int32 MAX_STICKER_TYPE = 3;

View File

@ -102,7 +102,7 @@ class GetAllStickersQuery final : public Td::ResultHandler {
return send_query(G()->net_query_creator().create(telegram_api::messages_getAllStickers(hash))); return send_query(G()->net_query_creator().create(telegram_api::messages_getAllStickers(hash)));
case StickerType::Mask: case StickerType::Mask:
return send_query(G()->net_query_creator().create(telegram_api::messages_getMaskStickers(hash))); return send_query(G()->net_query_creator().create(telegram_api::messages_getMaskStickers(hash)));
case StickerType::Emoji: case StickerType::CustomEmoji:
return send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiStickers(hash))); return send_query(G()->net_query_creator().create(telegram_api::messages_getEmojiStickers(hash)));
default: default:
UNREACHABLE(); UNREACHABLE();
@ -283,7 +283,7 @@ class GetArchivedStickerSetsQuery final : public Td::ResultHandler {
if (sticker_type_ == StickerType::Mask) { if (sticker_type_ == StickerType::Mask) {
flags |= telegram_api::messages_getArchivedStickers::MASKS_MASK; flags |= telegram_api::messages_getArchivedStickers::MASKS_MASK;
} }
if (sticker_type_ == StickerType::Emoji) { if (sticker_type_ == StickerType::CustomEmoji) {
flags |= telegram_api::messages_getArchivedStickers::EMOJIS_MASK; flags |= telegram_api::messages_getArchivedStickers::EMOJIS_MASK;
} }
send_query(G()->net_query_creator().create(telegram_api::messages_getArchivedStickers( send_query(G()->net_query_creator().create(telegram_api::messages_getArchivedStickers(
@ -319,7 +319,7 @@ class GetFeaturedStickerSetsQuery final : public Td::ResultHandler {
case StickerType::Regular: case StickerType::Regular:
send_query(G()->net_query_creator().create(telegram_api::messages_getFeaturedStickers(hash))); send_query(G()->net_query_creator().create(telegram_api::messages_getFeaturedStickers(hash)));
break; break;
case StickerType::Emoji: case StickerType::CustomEmoji:
send_query(G()->net_query_creator().create(telegram_api::messages_getFeaturedEmojiStickers(hash))); send_query(G()->net_query_creator().create(telegram_api::messages_getFeaturedEmojiStickers(hash)));
break; break;
default: default:
@ -675,7 +675,7 @@ class ReorderStickerSetsQuery final : public Td::ResultHandler {
if (sticker_type == StickerType::Mask) { if (sticker_type == StickerType::Mask) {
flags |= telegram_api::messages_reorderStickerSets::MASKS_MASK; flags |= telegram_api::messages_reorderStickerSets::MASKS_MASK;
} }
if (sticker_type == StickerType::Emoji) { if (sticker_type == StickerType::CustomEmoji) {
flags |= telegram_api::messages_reorderStickerSets::EMOJIS_MASK; flags |= telegram_api::messages_reorderStickerSets::EMOJIS_MASK;
} }
send_query(G()->net_query_creator().create(telegram_api::messages_reorderStickerSets( send_query(G()->net_query_creator().create(telegram_api::messages_reorderStickerSets(
@ -1039,9 +1039,9 @@ class CreateNewStickerSetQuery final : public Td::ResultHandler {
if (sticker_type == StickerType::Mask) { if (sticker_type == StickerType::Mask) {
flags |= telegram_api::stickers_createStickerSet::MASKS_MASK; flags |= telegram_api::stickers_createStickerSet::MASKS_MASK;
} }
if (sticker_type == StickerType::Emoji) { if (sticker_type == StickerType::CustomEmoji) {
// flags |= telegram_api::stickers_createStickerSet::EMOJIS_MASK; // flags |= telegram_api::stickers_createStickerSet::EMOJIS_MASK;
return on_error(Status::Error(400, "Can't create emoji sets")); return on_error(Status::Error(400, "Can't create custom emoji sets"));
} }
if (sticker_format == StickerFormat::Tgs) { if (sticker_format == StickerFormat::Tgs) {
flags |= telegram_api::stickers_createStickerSet::ANIMATED_MASK; flags |= telegram_api::stickers_createStickerSet::ANIMATED_MASK;
@ -1935,7 +1935,7 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
} }
} }
} }
} else if (sticker->type == StickerType::Emoji) { } else if (sticker->type == StickerType::CustomEmoji) {
auto sticker_file_view = td_->file_manager_->get_file_view(sticker->file_id); auto sticker_file_view = td_->file_manager_->get_file_view(sticker->file_id);
if (!sticker_file_view.is_encrypted() && sticker_file_view.has_remote_location() && if (!sticker_file_view.is_encrypted() && sticker_file_view.has_remote_location() &&
sticker_file_view.remote_location().is_document()) { sticker_file_view.remote_location().is_document()) {
@ -2067,7 +2067,7 @@ double StickersManager::get_sticker_set_minithumbnail_zoom(const StickerSet *sti
td_api::object_ptr<td_api::thumbnail> StickersManager::get_sticker_set_thumbnail_object( td_api::object_ptr<td_api::thumbnail> StickersManager::get_sticker_set_thumbnail_object(
const StickerSet *sticker_set) const { const StickerSet *sticker_set) const {
CHECK(sticker_set != nullptr); CHECK(sticker_set != nullptr);
if (sticker_set->thumbnail_document_id != 0 && sticker_set->sticker_type == StickerType::Emoji) { if (sticker_set->thumbnail_document_id != 0 && sticker_set->sticker_type == StickerType::CustomEmoji) {
for (auto sticker_id : sticker_set->sticker_ids) { for (auto sticker_id : sticker_set->sticker_ids) {
auto file_view = td_->file_manager_->get_file_view(sticker_id); auto file_view = td_->file_manager_->get_file_view(sticker_id);
if (file_view.has_remote_location() && !file_view.remote_location().is_web() && if (file_view.has_remote_location() && !file_view.remote_location().is_web() &&
@ -2876,7 +2876,7 @@ void StickersManager::create_sticker(FileId file_id, FileId premium_animation_fi
} else if (custom_emoji != nullptr) { } else if (custom_emoji != nullptr) {
s->set_id = on_get_input_sticker_set(file_id, std::move(custom_emoji->stickerset_), load_data_multipromise_ptr); s->set_id = on_get_input_sticker_set(file_id, std::move(custom_emoji->stickerset_), load_data_multipromise_ptr);
s->alt = std::move(custom_emoji->alt_); s->alt = std::move(custom_emoji->alt_);
s->type = StickerType::Emoji; s->type = StickerType::CustomEmoji;
s->is_premium = !custom_emoji->free_; s->is_premium = !custom_emoji->free_;
} }
s->format = format; s->format = format;
@ -3059,7 +3059,7 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
StickerFormat sticker_format = StickerFormat sticker_format =
set->videos_ ? StickerFormat::Webm : (set->animated_ ? StickerFormat::Tgs : StickerFormat::Webp); set->videos_ ? StickerFormat::Webm : (set->animated_ ? StickerFormat::Tgs : StickerFormat::Webp);
StickerType sticker_type = StickerType sticker_type =
set->emojis_ ? StickerType::Emoji : (set->masks_ ? StickerType::Mask : StickerType::Regular); set->emojis_ ? StickerType::CustomEmoji : (set->masks_ ? StickerType::Mask : StickerType::Regular);
PhotoSize thumbnail; PhotoSize thumbnail;
string minithumbnail; string minithumbnail;
@ -6696,8 +6696,8 @@ vector<FileId> StickersManager::get_attached_sticker_file_ids(const vector<int32
// only stickers from sticker sets can be attached to files // only stickers from sticker sets can be attached to files
continue; continue;
} }
if (s->type == StickerType::Emoji) { if (s->type == StickerType::CustomEmoji) {
// emoji stickers can't can be attached to files // custom emoji stickers can't can be attached to files
continue; continue;
} }
@ -6796,7 +6796,7 @@ size_t StickersManager::get_max_featured_sticker_count(StickerType sticker_type)
return 5; return 5;
case StickerType::Mask: case StickerType::Mask:
return 5; return 5;
case StickerType::Emoji: case StickerType::CustomEmoji:
return 16; return 16;
default: default:
UNREACHABLE(); UNREACHABLE();
@ -6810,7 +6810,7 @@ Slice StickersManager::get_featured_sticker_suffix(StickerType sticker_type) {
return Slice(); return Slice();
case StickerType::Mask: case StickerType::Mask:
return Slice("1"); return Slice("1");
case StickerType::Emoji: case StickerType::CustomEmoji:
return Slice("2"); return Slice("2");
default: default:
UNREACHABLE(); UNREACHABLE();
@ -7096,8 +7096,8 @@ void StickersManager::add_recent_sticker_impl(bool is_attached, FileId sticker_i
if (!sticker->set_id.is_valid()) { if (!sticker->set_id.is_valid()) {
return promise.set_error(Status::Error(400, "Stickers without sticker set can't be added to recent")); return promise.set_error(Status::Error(400, "Stickers without sticker set can't be added to recent"));
} }
if (sticker->type == StickerType::Emoji) { if (sticker->type == StickerType::CustomEmoji) {
return promise.set_error(Status::Error(400, "Emoji stickers can't be added to recent")); return promise.set_error(Status::Error(400, "Custom emoji stickers can't be added to recent"));
} }
auto file_view = td_->file_manager_->get_file_view(sticker_id); auto file_view = td_->file_manager_->get_file_view(sticker_id);
@ -7481,8 +7481,8 @@ void StickersManager::add_favorite_sticker_impl(FileId sticker_id, bool add_on_s
if (!sticker->set_id.is_valid()) { if (!sticker->set_id.is_valid()) {
return promise.set_error(Status::Error(400, "Stickers without sticker set can't be added to favorite")); return promise.set_error(Status::Error(400, "Stickers without sticker set can't be added to favorite"));
} }
if (sticker->type == StickerType::Emoji) { if (sticker->type == StickerType::CustomEmoji) {
return promise.set_error(Status::Error(400, "Emoji stickers can't be added to favorite")); return promise.set_error(Status::Error(400, "Custom emoji stickers can't be added to favorite"));
} }
auto file_view = td_->file_manager_->get_file_view(sticker_id); auto file_view = td_->file_manager_->get_file_view(sticker_id);

View File

@ -35,7 +35,7 @@ void StickersManager::store_sticker(FileId file_id, bool in_sticker_set, StorerT
bool is_webm = sticker->format == StickerFormat::Webm; bool is_webm = sticker->format == StickerFormat::Webm;
bool has_premium_animation = sticker->premium_animation_file_id.is_valid(); bool has_premium_animation = sticker->premium_animation_file_id.is_valid();
bool is_mask = sticker->type == StickerType::Mask; bool is_mask = sticker->type == StickerType::Mask;
bool is_emoji = sticker->type == StickerType::Emoji; bool is_emoji = sticker->type == StickerType::CustomEmoji;
BEGIN_STORE_FLAGS(); BEGIN_STORE_FLAGS();
STORE_FLAG(is_mask); STORE_FLAG(is_mask);
STORE_FLAG(has_sticker_set_access_hash); STORE_FLAG(has_sticker_set_access_hash);
@ -108,7 +108,7 @@ FileId StickersManager::parse_sticker(bool in_sticker_set, ParserT &parser) {
sticker->format = StickerFormat::Webp; sticker->format = StickerFormat::Webp;
} }
if (is_emoji) { if (is_emoji) {
sticker->type = StickerType::Emoji; sticker->type = StickerType::CustomEmoji;
} else if (is_mask) { } else if (is_mask) {
sticker->type = StickerType::Mask; sticker->type = StickerType::Mask;
} else { } else {
@ -179,7 +179,7 @@ void StickersManager::store_sticker_set(const StickerSet *sticker_set, bool with
bool is_tgs = sticker_set->sticker_format == StickerFormat::Tgs; bool is_tgs = sticker_set->sticker_format == StickerFormat::Tgs;
bool is_webm = sticker_set->sticker_format == StickerFormat::Webm; bool is_webm = sticker_set->sticker_format == StickerFormat::Webm;
bool is_masks = sticker_set->sticker_type == StickerType::Mask; bool is_masks = sticker_set->sticker_type == StickerType::Mask;
bool is_emojis = sticker_set->sticker_type == StickerType::Emoji; bool is_emojis = sticker_set->sticker_type == StickerType::CustomEmoji;
bool has_thumbnail_document_id = sticker_set->thumbnail_document_id != 0; bool has_thumbnail_document_id = sticker_set->thumbnail_document_id != 0;
BEGIN_STORE_FLAGS(); BEGIN_STORE_FLAGS();
STORE_FLAG(sticker_set->is_inited); STORE_FLAG(sticker_set->is_inited);
@ -293,7 +293,7 @@ void StickersManager::parse_sticker_set(StickerSet *sticker_set, ParserT &parser
} }
StickerType sticker_type = StickerType::Regular; StickerType sticker_type = StickerType::Regular;
if (is_emojis) { if (is_emojis) {
sticker_type = StickerType::Emoji; sticker_type = StickerType::CustomEmoji;
} else if (is_masks) { } else if (is_masks) {
sticker_type = StickerType::Mask; sticker_type = StickerType::Mask;
} }

View File

@ -3320,7 +3320,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStickerSets> up
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStickerSetsOrder> update, Promise<Unit> &&promise) { void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateStickerSetsOrder> update, Promise<Unit> &&promise) {
StickerType sticker_type = StickerType::Regular; StickerType sticker_type = StickerType::Regular;
if (update->emojis_) { if (update->emojis_) {
sticker_type = StickerType::Emoji; sticker_type = StickerType::CustomEmoji;
} else if (update->masks_) { } else if (update->masks_) {
sticker_type = StickerType::Mask; sticker_type = StickerType::Mask;
} }
@ -3337,7 +3337,7 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadFeaturedSti
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadFeaturedEmojiStickers> update, void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateReadFeaturedEmojiStickers> update,
Promise<Unit> &&promise) { Promise<Unit> &&promise) {
td_->stickers_manager_->reload_featured_sticker_sets(StickerType::Emoji, true); td_->stickers_manager_->reload_featured_sticker_sets(StickerType::CustomEmoji, true);
promise.set_value(Unit()); promise.set_value(Unit());
} }

View File

@ -548,7 +548,7 @@ class CliClient final : public Actor {
static td_api::object_ptr<td_api::StickerType> as_sticker_type(string sticker_type) { static td_api::object_ptr<td_api::StickerType> as_sticker_type(string sticker_type) {
if (!sticker_type.empty() && sticker_type.back() == 'e') { if (!sticker_type.empty() && sticker_type.back() == 'e') {
return td_api::make_object<td_api::stickerTypeEmoji>(); return td_api::make_object<td_api::stickerTypeCustomEmoji>();
} }
if (!sticker_type.empty() && sticker_type.back() == 'm') { if (!sticker_type.empty() && sticker_type.back() == 'm') {
return td_api::make_object<td_api::stickerTypeMask>(); return td_api::make_object<td_api::stickerTypeMask>();