From 2fc43a44a42e0a7005645e7fabb0e7f4d4421954 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 4 Jul 2022 11:18:05 +0400 Subject: [PATCH] Don't paste custom emoji for non-premium users. --- .../SourceFiles/chat_helpers/message_field.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 71307e2c0..efe20aac4 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -75,13 +75,19 @@ QString FieldTagMimeProcessor::operator()(QStringView mimeTag) { if (TextUtilities::IsMentionLink(tag) && TextUtilities::MentionNameDataToFields(tag).selfId != id) { i = all.erase(i); - } else if (Ui::InputField::IsCustomEmojiLink(tag) - && Data::ParseCustomEmojiData( - Ui::InputField::CustomEmojiEntityData(tag)).selfId != id) { - i = all.erase(i); - } else { - ++i; + continue; + } else if (Ui::InputField::IsCustomEmojiLink(tag)) { + if (!_session->premium()) { + i = all.erase(i); + continue; + } + const auto data = Ui::InputField::CustomEmojiEntityData(tag); + if (Data::ParseCustomEmojiData(data).selfId != id) { + i = all.erase(i); + continue; + } } + ++i; } return TextUtilities::JoinTag(all); }