2022-07-14 14:02:55 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2022-07-14 14:02:55 +02:00
|
|
|
//
|
|
|
|
// 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/StickerType.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2022-09-02 17:18:18 +02:00
|
|
|
StickerType get_sticker_type(bool is_mask, bool is_custom_emoji) {
|
|
|
|
if (is_custom_emoji) {
|
|
|
|
return StickerType::CustomEmoji;
|
|
|
|
}
|
|
|
|
if (is_mask) {
|
|
|
|
return StickerType::Mask;
|
|
|
|
}
|
|
|
|
return StickerType::Regular;
|
|
|
|
}
|
|
|
|
|
2022-07-14 14:02:55 +02:00
|
|
|
StickerType get_sticker_type(const td_api::object_ptr<td_api::StickerType> &type) {
|
|
|
|
if (type == nullptr) {
|
|
|
|
return StickerType::Regular;
|
|
|
|
}
|
|
|
|
switch (type->get_id()) {
|
|
|
|
case td_api::stickerTypeRegular::ID:
|
|
|
|
return StickerType::Regular;
|
|
|
|
case td_api::stickerTypeMask::ID:
|
|
|
|
return StickerType::Mask;
|
2022-07-19 13:51:29 +02:00
|
|
|
case td_api::stickerTypeCustomEmoji::ID:
|
|
|
|
return StickerType::CustomEmoji;
|
2022-07-14 14:02:55 +02:00
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
return StickerType::Regular;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
td_api::object_ptr<td_api::StickerType> get_sticker_type_object(StickerType sticker_type) {
|
|
|
|
switch (sticker_type) {
|
|
|
|
case StickerType::Regular:
|
|
|
|
return td_api::make_object<td_api::stickerTypeRegular>();
|
|
|
|
case StickerType::Mask:
|
|
|
|
return td_api::make_object<td_api::stickerTypeMask>();
|
2022-07-19 13:51:29 +02:00
|
|
|
case StickerType::CustomEmoji:
|
|
|
|
return td_api::make_object<td_api::stickerTypeCustomEmoji>();
|
2022-07-14 14:02:55 +02:00
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, StickerType sticker_type) {
|
|
|
|
switch (sticker_type) {
|
|
|
|
case StickerType::Regular:
|
|
|
|
return string_builder << "Regular";
|
|
|
|
case StickerType::Mask:
|
|
|
|
return string_builder << "Mask";
|
2022-07-19 13:51:29 +02:00
|
|
|
case StickerType::CustomEmoji:
|
|
|
|
return string_builder << "CustomEmoji";
|
2022-07-14 14:02:55 +02:00
|
|
|
default:
|
|
|
|
UNREACHABLE();
|
|
|
|
return string_builder;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|