diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-24 19:25:53 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-24 19:25:53 +0300 |
commit | b686512d72cd000ce769b424020bd26379403efe (patch) | |
tree | f7b99dfd574cc7c316df9b7f6f30542ef4706bdc /protocols | |
parent | e6414485ede3c6bb321e70b86c1560cddd2b3458 (diff) |
same check for animated stickers
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 250a3561d2..d646e96123 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -339,6 +339,17 @@ static const TD::photoSize* GetBiggestPhoto(const TD::photo *pPhoto) return nullptr;
}
+static bool checkStickerType(uint32_t ID)
+{
+ switch (ID) {
+ case TD::stickerTypeRegular::ID:
+ case TD::stickerFullTypeRegular::ID:
+ return true;
+ default:
+ return false;
+ }
+}
+
static const char *getFormattedText(TD::object_ptr<TD::formattedText> &pText)
{
if (pText->get_id() == TD::formattedText::ID)
@@ -416,8 +427,10 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg case TD::messageAnimatedEmoji::ID:
if (m_bSmileyAdd) {
auto *pSticker = ((TD::messageAnimatedEmoji *)pBody)->animated_emoji_->sticker_.get();
- if (pSticker->full_type_->get_id() != TD::stickerTypeRegular::ID)
+ if (!checkStickerType(pSticker->full_type_->get_id())) {
+ debugLogA("You received a sticker of unsupported type %d, ignored", pSticker->full_type_->get_id());
break;
+ }
const char *pwszFileExt;
switch (pSticker->thumbnail_->format_->get_id()) {
@@ -437,12 +450,7 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg case TD::messageSticker::ID:
{
auto *pSticker = ((TD::messageSticker *)pBody)->sticker_.get();
- switch(pSticker->full_type_->get_id()) {
- case TD::stickerTypeRegular::ID:
- case TD::stickerFullTypeRegular::ID:
- break;
-
- default:
+ if (!checkStickerType(pSticker->full_type_->get_id())) {
debugLogA("You received a sticker of unsupported type %d, ignored", pSticker->full_type_->get_id());
break;
}
|