diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index edaec341f..575b6cdfe 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -8494,6 +8494,9 @@ getDefaultChatPhotoCustomEmojiStickers = Stickers; //@description Returns default list of custom emoji stickers for placing on a profile photo getDefaultProfilePhotoCustomEmojiStickers = Stickers; +//@description Returns default list of custom emoji stickers for reply background +getDefaultBackgroundCustomEmojiStickers = Stickers; + //@description Returns saved animations getSavedAnimations = Animations; diff --git a/td/telegram/StickerListType.cpp b/td/telegram/StickerListType.cpp index e6385de1f..049f5bce3 100644 --- a/td/telegram/StickerListType.cpp +++ b/td/telegram/StickerListType.cpp @@ -14,6 +14,8 @@ string get_sticker_list_type_database_key(StickerListType sticker_list_type) { return "default_dialog_photo_custom_emoji_ids"; case StickerListType::UserProfilePhoto: return "default_profile_photo_custom_emoji_ids"; + case StickerListType::Background: + return "default_background_custom_emoji_ids"; default: UNREACHABLE(); return string(); @@ -26,6 +28,8 @@ StringBuilder &operator<<(StringBuilder &string_builder, StickerListType sticker return string_builder << "default chat photo custom emoji identifiers"; case StickerListType::UserProfilePhoto: return string_builder << "default user profile photo custom emoji identifiers"; + case StickerListType::Background: + return string_builder << "default background custom emoji identifiers"; default: UNREACHABLE(); return string_builder; diff --git a/td/telegram/StickerListType.h b/td/telegram/StickerListType.h index fb7dff851..16afdb99b 100644 --- a/td/telegram/StickerListType.h +++ b/td/telegram/StickerListType.h @@ -11,9 +11,9 @@ namespace td { -enum class StickerListType : int32 { DialogPhoto, UserProfilePhoto }; +enum class StickerListType : int32 { DialogPhoto, UserProfilePhoto, Background }; -static constexpr int32 MAX_STICKER_LIST_TYPE = 2; +static constexpr int32 MAX_STICKER_LIST_TYPE = 3; string get_sticker_list_type_database_key(StickerListType sticker_list_type); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 8dff29998..a4076a30a 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1454,6 +1454,9 @@ class GetDefaultDialogPhotoEmojisQuery final : public Td::ResultHandler { case StickerListType::UserProfilePhoto: send_query(G()->net_query_creator().create(telegram_api::account_getDefaultProfilePhotoEmojis(hash))); break; + case StickerListType::Background: + send_query(G()->net_query_creator().create(telegram_api::account_getDefaultBackgroundEmojis(hash))); + break; default: UNREACHABLE(); break; @@ -1464,6 +1467,9 @@ class GetDefaultDialogPhotoEmojisQuery final : public Td::ResultHandler { static_assert(std::is_same::value, ""); + static_assert(std::is_same::value, + ""); auto result_ptr = fetch_result(packet); if (result_ptr.is_error()) { return on_error(result_ptr.move_as_error()); diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index e0f597196..097662010 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -1123,10 +1123,10 @@ class StickersManager final : public Actor { vector>> emoji_group_load_queries_[MAX_EMOJI_GROUP_TYPE]; vector default_custom_emoji_ids_[MAX_STICKER_LIST_TYPE]; - int64 default_custom_emoji_ids_hash_[MAX_STICKER_LIST_TYPE] = {0, 0}; + int64 default_custom_emoji_ids_hash_[MAX_STICKER_LIST_TYPE] = {0, 0, 0}; vector>> default_custom_emoji_ids_load_queries_[MAX_STICKER_LIST_TYPE]; - bool are_default_custom_emoji_ids_loaded_[MAX_STICKER_LIST_TYPE] = {false, false}; - bool are_default_custom_emoji_ids_being_loaded_[MAX_STICKER_LIST_TYPE] = {false, false}; + bool are_default_custom_emoji_ids_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false}; + bool are_default_custom_emoji_ids_being_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false}; WaitFreeHashMap custom_emoji_to_sticker_id_; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 1aff7a4d4..bf996247f 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -8001,6 +8001,12 @@ void Td::on_request(uint64 id, const td_api::getDefaultProfilePhotoCustomEmojiSt stickers_manager_->get_default_custom_emoji_stickers(StickerListType::UserProfilePhoto, false, std::move(promise)); } +void Td::on_request(uint64 id, const td_api::getDefaultBackgroundCustomEmojiStickers &request) { + CHECK_IS_USER(); + CREATE_REQUEST_PROMISE(); + stickers_manager_->get_default_custom_emoji_stickers(StickerListType::Background, false, std::move(promise)); +} + void Td::on_request(uint64 id, const td_api::getSavedAnimations &request) { CHECK_IS_USER(); CREATE_NO_ARGS_REQUEST(GetSavedAnimationsRequest); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index a73dc6d72..ea99d67bf 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -1401,6 +1401,8 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::getDefaultProfilePhotoCustomEmojiStickers &request); + void on_request(uint64 id, const td_api::getDefaultBackgroundCustomEmojiStickers &request); + void on_request(uint64 id, const td_api::getFavoriteStickers &request); void on_request(uint64 id, td_api::addFavoriteSticker &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index f13f1c476..262fbd0c4 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3434,6 +3434,8 @@ class CliClient final : public Actor { send_request(td_api::make_object()); } else if (op == "gdppces") { send_request(td_api::make_object()); + } else if (op == "gdbces") { + send_request(td_api::make_object()); } else if (op == "gsan") { send_request(td_api::make_object()); } else if (op == "asan") {