Disallow emoji starting with # as reactions.

This commit is contained in:
levlam 2022-08-22 21:51:55 +03:00
parent fa07382e5b
commit c0f1a9850d

View File

@ -64,8 +64,13 @@ string get_message_reaction_string(const telegram_api::object_ptr<telegram_api::
switch (reaction->get_id()) { switch (reaction->get_id()) {
case telegram_api::reactionEmpty::ID: case telegram_api::reactionEmpty::ID:
return string(); return string();
case telegram_api::reactionEmoji::ID: case telegram_api::reactionEmoji::ID: {
return static_cast<const telegram_api::reactionEmoji *>(reaction.get())->emoticon_; const string &emoji = static_cast<const telegram_api::reactionEmoji *>(reaction.get())->emoticon_;
if (emoji[0] == '#') {
return string();
}
return emoji;
}
case telegram_api::reactionCustomEmoji::ID: case telegram_api::reactionCustomEmoji::ID:
return get_custom_emoji_string( return get_custom_emoji_string(
static_cast<const telegram_api::reactionCustomEmoji *>(reaction.get())->document_id_); static_cast<const telegram_api::reactionCustomEmoji *>(reaction.get())->document_id_);
@ -90,7 +95,7 @@ string get_message_reaction_string(const td_api::object_ptr<td_api::ReactionType
switch (type->get_id()) { switch (type->get_id()) {
case td_api::reactionTypeEmoji::ID: { case td_api::reactionTypeEmoji::ID: {
const string &emoji = static_cast<const td_api::reactionTypeEmoji *>(type.get())->emoji_; const string &emoji = static_cast<const td_api::reactionTypeEmoji *>(type.get())->emoji_;
if (!check_utf8(emoji)) { if (!check_utf8(emoji) || emoji[0] == '#') {
return string(); return string();
} }
return emoji; return emoji;