2018-12-31 20:04:05 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2018-12-31 20:04:05 +01: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)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
#include "td/telegram/CustomEmojiId.h"
|
2021-10-21 11:51:16 +02:00
|
|
|
#include "td/telegram/DialogId.h"
|
2022-06-02 16:52:12 +02:00
|
|
|
#include "td/telegram/Dimensions.h"
|
2023-01-24 16:11:02 +01:00
|
|
|
#include "td/telegram/EmojiGroup.h"
|
2023-01-24 19:38:53 +01:00
|
|
|
#include "td/telegram/EmojiGroupType.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/files/FileId.h"
|
2019-02-02 11:30:49 +01:00
|
|
|
#include "td/telegram/files/FileSourceId.h"
|
2023-09-21 18:11:17 +02:00
|
|
|
#include "td/telegram/MessageFullId.h"
|
2022-04-09 22:21:07 +02:00
|
|
|
#include "td/telegram/PhotoFormat.h"
|
2022-04-10 00:15:49 +02:00
|
|
|
#include "td/telegram/PhotoSize.h"
|
2024-06-17 22:55:19 +02:00
|
|
|
#include "td/telegram/QuickReplyMessageFullId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/SecretInputMedia.h"
|
2020-04-19 15:30:04 +02:00
|
|
|
#include "td/telegram/SpecialStickerSetType.h"
|
2022-01-18 17:20:43 +01:00
|
|
|
#include "td/telegram/StickerFormat.h"
|
2023-10-19 14:12:26 +02:00
|
|
|
#include "td/telegram/StickerListType.h"
|
2023-02-09 18:15:21 +01:00
|
|
|
#include "td/telegram/StickerMaskPosition.h"
|
2019-09-18 05:55:43 +02:00
|
|
|
#include "td/telegram/StickerSetId.h"
|
2022-07-14 14:02:55 +02:00
|
|
|
#include "td/telegram/StickerType.h"
|
2021-09-18 23:47:05 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2022-10-12 14:59:58 +02:00
|
|
|
#include "td/telegram/UserId.h"
|
2021-09-18 23:47:05 +02:00
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
|
|
|
#include "td/actor/MultiPromise.h"
|
|
|
|
#include "td/actor/Timeout.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
#include "td/utils/buffer.h"
|
|
|
|
#include "td/utils/common.h"
|
2022-02-07 22:04:34 +01:00
|
|
|
#include "td/utils/FlatHashMap.h"
|
2022-03-11 19:38:48 +01:00
|
|
|
#include "td/utils/FlatHashSet.h"
|
2022-11-23 17:37:32 +01:00
|
|
|
#include "td/utils/HashTableUtils.h"
|
2018-03-05 23:44:11 +01:00
|
|
|
#include "td/utils/Hints.h"
|
2022-06-27 12:30:18 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2020-04-22 14:02:56 +02:00
|
|
|
#include "td/utils/Slice.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/utils/Status.h"
|
2022-08-03 21:42:52 +02:00
|
|
|
#include "td/utils/WaitFreeHashMap.h"
|
2022-08-20 23:20:57 +02:00
|
|
|
#include "td/utils/WaitFreeHashSet.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-10-12 14:59:58 +02:00
|
|
|
#include <map>
|
2018-12-31 20:04:05 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <tuple>
|
2022-02-10 16:03:03 +01:00
|
|
|
#include <unordered_map>
|
2018-12-31 20:04:05 +01:00
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2019-02-21 18:54:20 +01:00
|
|
|
class Td;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class StickersManager final : public Actor {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
2019-04-19 01:36:48 +02:00
|
|
|
static constexpr int64 GREAT_MINDS_SET_ID = 1842540969984001;
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
static vector<StickerSetId> convert_sticker_set_ids(const vector<int64> &sticker_set_ids);
|
|
|
|
static vector<int64> convert_sticker_set_ids(const vector<StickerSetId> &sticker_set_ids);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
StickersManager(Td *td, ActorShared<> parent);
|
2022-07-20 12:40:14 +02:00
|
|
|
StickersManager(const StickersManager &) = delete;
|
|
|
|
StickersManager &operator=(const StickersManager &) = delete;
|
|
|
|
StickersManager(StickersManager &&) = delete;
|
|
|
|
StickersManager &operator=(StickersManager &&) = delete;
|
|
|
|
~StickersManager() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-04-17 15:12:12 +02:00
|
|
|
void init();
|
|
|
|
|
2022-07-18 13:51:37 +02:00
|
|
|
StickerType get_sticker_type(FileId file_id) const;
|
2024-05-07 17:49:00 +02:00
|
|
|
|
|
|
|
StickerFormat get_sticker_format(FileId file_id) const;
|
2022-07-18 13:51:37 +02:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
bool is_premium_custom_emoji(CustomEmojiId custom_emoji_id, bool default_result) const;
|
2022-07-22 17:11:55 +02:00
|
|
|
|
2023-01-23 10:50:39 +01:00
|
|
|
bool have_sticker(StickerSetId sticker_set_id, int64 sticker_id);
|
|
|
|
|
|
|
|
bool have_custom_emoji(CustomEmojiId custom_emoji_id);
|
|
|
|
|
2021-10-13 23:18:44 +02:00
|
|
|
tl_object_ptr<td_api::sticker> get_sticker_object(FileId file_id, bool for_animated_emoji = false,
|
|
|
|
bool for_clicked_animated_emoji = false) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-09-20 21:25:09 +02:00
|
|
|
tl_object_ptr<td_api::stickers> get_stickers_object(const vector<FileId> &sticker_ids) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-04 15:17:36 +02:00
|
|
|
td_api::object_ptr<td_api::emojis> get_sticker_emojis_object(const vector<FileId> &sticker_ids,
|
|
|
|
bool return_only_main_emoji);
|
|
|
|
|
2023-02-09 20:47:44 +01:00
|
|
|
td_api::object_ptr<td_api::sticker> get_custom_emoji_sticker_object(CustomEmojiId custom_emoji_id);
|
|
|
|
|
2020-10-15 14:59:51 +02:00
|
|
|
tl_object_ptr<td_api::DiceStickers> get_dice_stickers_object(const string &emoji, int32 value) const;
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2020-04-21 18:08:01 +02:00
|
|
|
int32 get_dice_success_animation_frame_number(const string &emoji, int32 value) const;
|
2020-04-21 13:51:46 +02:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
tl_object_ptr<td_api::stickerSet> get_sticker_set_object(StickerSetId sticker_set_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
tl_object_ptr<td_api::stickerSets> get_sticker_sets_object(int32 total_count,
|
|
|
|
const vector<StickerSetId> &sticker_set_ids,
|
2018-09-20 21:25:09 +02:00
|
|
|
size_t covers_limit) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-22 14:01:44 +02:00
|
|
|
td_api::object_ptr<td_api::sticker> get_premium_gift_sticker_object(int32 month_count);
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
td_api::object_ptr<td_api::animatedEmoji> get_animated_emoji_object(const string &emoji,
|
|
|
|
CustomEmojiId custom_emoji_id);
|
2021-10-04 15:08:51 +02:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
tl_object_ptr<telegram_api::InputStickerSet> get_input_sticker_set(StickerSetId sticker_set_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void register_premium_gift(int32 months, MessageFullId message_full_id, const char *source);
|
2022-07-22 12:30:24 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void unregister_premium_gift(int32 months, MessageFullId message_full_id, const char *source);
|
2022-07-22 12:30:24 +02:00
|
|
|
|
2024-06-17 23:28:54 +02:00
|
|
|
void register_dice(const string &emoji, int32 value, MessageFullId message_full_id,
|
|
|
|
QuickReplyMessageFullId quick_reply_message_full_id, const char *source);
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2024-06-17 23:28:54 +02:00
|
|
|
void unregister_dice(const string &emoji, int32 value, MessageFullId message_full_id,
|
|
|
|
QuickReplyMessageFullId quick_reply_message_full_id, const char *source);
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void register_emoji(const string &emoji, CustomEmojiId custom_emoji_id, MessageFullId message_full_id,
|
2024-06-17 22:55:19 +02:00
|
|
|
QuickReplyMessageFullId quick_reply_message_full_id, const char *source);
|
2021-10-04 15:08:51 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void unregister_emoji(const string &emoji, CustomEmojiId custom_emoji_id, MessageFullId message_full_id,
|
2024-06-17 22:55:19 +02:00
|
|
|
QuickReplyMessageFullId quick_reply_message_full_id, const char *source);
|
2021-10-04 15:08:51 +02:00
|
|
|
|
2021-10-26 16:59:15 +02:00
|
|
|
void get_animated_emoji(string emoji, bool is_recursive,
|
|
|
|
Promise<td_api::object_ptr<td_api::animatedEmoji>> &&promise);
|
|
|
|
|
2022-05-23 13:05:35 +02:00
|
|
|
void get_all_animated_emojis(bool is_recursive, Promise<td_api::object_ptr<td_api::emojis>> &&promise);
|
|
|
|
|
2022-09-12 14:44:37 +02:00
|
|
|
void get_custom_emoji_reaction_generic_animations(bool is_recursive,
|
2022-09-30 14:55:46 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
2022-09-12 14:44:37 +02:00
|
|
|
|
2022-09-07 09:25:21 +02:00
|
|
|
void get_default_emoji_statuses(bool is_recursive, Promise<td_api::object_ptr<td_api::emojiStatuses>> &&promise);
|
2022-09-02 14:02:37 +02:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
bool is_default_emoji_status(CustomEmojiId custom_emoji_id);
|
2022-09-02 14:39:07 +02:00
|
|
|
|
2023-12-21 20:44:59 +01:00
|
|
|
void get_default_channel_emoji_statuses(bool is_recursive,
|
|
|
|
Promise<td_api::object_ptr<td_api::emojiStatuses>> &&promise);
|
|
|
|
|
2022-10-27 09:06:13 +02:00
|
|
|
void get_default_topic_icons(bool is_recursive, Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
2023-01-10 13:23:07 +01:00
|
|
|
void get_custom_emoji_stickers(vector<CustomEmojiId> custom_emoji_ids, bool use_database,
|
2022-07-25 22:04:53 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
2022-07-19 15:00:04 +02:00
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
void get_default_custom_emoji_stickers(StickerListType sticker_list_type, bool force_reload,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2023-12-24 00:30:49 +01:00
|
|
|
void get_sticker_list_emoji_statuses(StickerListType sticker_list_type, bool force_reload,
|
|
|
|
Promise<td_api::object_ptr<td_api::emojiStatuses>> &&promise);
|
|
|
|
|
2022-07-15 15:15:59 +02:00
|
|
|
void get_premium_gift_option_sticker(int32 month_count, bool is_recursive,
|
|
|
|
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void get_animated_emoji_click_sticker(const string &message_text, MessageFullId message_full_id,
|
2021-09-15 23:41:40 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
|
|
|
|
2021-09-19 00:52:56 +02:00
|
|
|
void on_send_animated_emoji_clicks(DialogId dialog_id, const string &emoji);
|
|
|
|
|
2022-05-12 17:02:27 +02:00
|
|
|
bool is_sent_animated_emoji_click(DialogId dialog_id, const string &emoji);
|
2021-09-19 00:52:56 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
Status on_animated_emoji_message_clicked(string &&emoji, MessageFullId message_full_id, string data);
|
2021-09-17 14:51:42 +02:00
|
|
|
|
2022-04-26 15:01:29 +02:00
|
|
|
void create_sticker(FileId file_id, FileId premium_animation_file_id, string minithumbnail, PhotoSize thumbnail,
|
|
|
|
Dimensions dimensions, tl_object_ptr<telegram_api::documentAttributeSticker> sticker,
|
2022-07-14 16:11:36 +02:00
|
|
|
tl_object_ptr<telegram_api::documentAttributeCustomEmoji> custom_emoji,
|
2022-04-26 15:01:29 +02:00
|
|
|
StickerFormat sticker_format, MultiPromiseActor *load_data_multipromise_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
bool has_input_media(FileId sticker_file_id, bool is_secret) const;
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::InputMedia> get_input_media(FileId file_id,
|
|
|
|
tl_object_ptr<telegram_api::InputFile> input_file,
|
2020-12-19 12:31:42 +01:00
|
|
|
tl_object_ptr<telegram_api::InputFile> input_thumbnail,
|
|
|
|
const string &emoji) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
SecretInputMedia get_secret_input_media(FileId sticker_file_id,
|
|
|
|
tl_object_ptr<telegram_api::InputEncryptedFile> input_file,
|
2022-05-11 06:46:06 +02:00
|
|
|
BufferSlice thumbnail, int32 layer) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-09-27 19:52:47 +02:00
|
|
|
vector<FileId> get_stickers(StickerType sticker_type, string query, int32 limit, DialogId dialog_id, bool force,
|
2022-08-05 13:06:06 +02:00
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void search_stickers(StickerType sticker_type, string emoji, int32 limit,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
2018-03-09 18:04:44 +01:00
|
|
|
|
2022-08-06 23:33:16 +02:00
|
|
|
void get_premium_stickers(int32 limit, Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
vector<StickerSetId> get_installed_sticker_sets(StickerType sticker_type, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-03-01 21:48:48 +01:00
|
|
|
static bool has_webp_thumbnail(const vector<tl_object_ptr<telegram_api::PhotoSize>> &thumbnails);
|
2018-06-01 00:23:07 +02:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSetId get_sticker_set_id(const tl_object_ptr<telegram_api::InputStickerSet> &set_ptr);
|
2018-06-01 00:23:07 +02:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSetId add_sticker_set(tl_object_ptr<telegram_api::InputStickerSet> &&set_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSetId get_sticker_set(StickerSetId set_id, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSetId search_sticker_set(const string &short_name_to_search, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
std::pair<int32, vector<StickerSetId>> search_installed_sticker_sets(StickerType sticker_type, const string &query,
|
|
|
|
int32 limit, Promise<Unit> &&promise);
|
2018-03-05 23:44:11 +01:00
|
|
|
|
2023-11-10 10:48:30 +01:00
|
|
|
vector<StickerSetId> search_sticker_sets(StickerType sticker_type, const string &query, Promise<Unit> &&promise);
|
2018-03-05 23:44:11 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void change_sticker_set(StickerSetId set_id, bool is_installed, bool is_archived, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void view_featured_sticker_sets(const vector<StickerSetId> &sticker_set_ids);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-05-12 15:34:13 +02:00
|
|
|
void reload_special_sticker_set_by_type(SpecialStickerSetType type, bool is_recursive = false);
|
|
|
|
|
2023-08-09 11:59:48 +02:00
|
|
|
std::pair<int64, FileId> on_get_sticker_document(tl_object_ptr<telegram_api::Document> &&document_ptr,
|
2024-06-06 11:29:55 +02:00
|
|
|
StickerFormat expected_format, const char *source);
|
2022-09-12 16:28:58 +02:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_get_installed_sticker_sets(StickerType sticker_type,
|
|
|
|
tl_object_ptr<telegram_api::messages_AllStickers> &&stickers_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_get_installed_sticker_sets_failed(StickerType sticker_type, Status error);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-11-21 20:18:29 +01:00
|
|
|
StickerSetId on_get_messages_sticker_set(StickerSetId sticker_set_id,
|
2021-11-09 17:07:55 +01:00
|
|
|
tl_object_ptr<telegram_api::messages_StickerSet> &&set_ptr, bool is_changed,
|
2019-12-29 02:59:34 +01:00
|
|
|
const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-12-29 02:59:34 +01:00
|
|
|
StickerSetId on_get_sticker_set(tl_object_ptr<telegram_api::stickerSet> &&set, bool is_changed, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-12-29 02:59:34 +01:00
|
|
|
StickerSetId on_get_sticker_set_covered(tl_object_ptr<telegram_api::StickerSetCovered> &&set_ptr, bool is_changed,
|
|
|
|
const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-04-19 23:41:26 +02:00
|
|
|
void on_get_special_sticker_set(const SpecialStickerSetType &type, StickerSetId sticker_set_id);
|
|
|
|
|
|
|
|
void on_load_special_sticker_set(const SpecialStickerSetType &type, Status result);
|
2019-11-21 20:18:29 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void on_load_sticker_set_fail(StickerSetId sticker_set_id, const Status &error);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void on_install_sticker_set(StickerSetId set_id, bool is_archived,
|
2018-12-31 20:04:05 +01:00
|
|
|
tl_object_ptr<telegram_api::messages_StickerSetInstallResult> &&result);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void on_uninstall_sticker_set(StickerSetId set_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-10-13 23:18:44 +02:00
|
|
|
void on_update_animated_emoji_zoom();
|
|
|
|
|
2021-10-05 16:17:29 +02:00
|
|
|
void on_update_disable_animated_emojis();
|
|
|
|
|
2020-04-19 10:17:51 +02:00
|
|
|
void on_update_dice_emojis();
|
|
|
|
|
2020-04-21 13:51:46 +02:00
|
|
|
void on_update_dice_success_values();
|
|
|
|
|
2021-10-05 22:20:49 +02:00
|
|
|
void on_update_emoji_sounds();
|
|
|
|
|
2022-08-23 17:24:21 +02:00
|
|
|
void on_update_sticker_sets(StickerType sticker_type);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_update_sticker_sets_order(StickerType sticker_type, const vector<StickerSetId> &sticker_set_ids);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-09-02 17:35:57 +02:00
|
|
|
void on_update_move_sticker_set_to_top(StickerType sticker_type, StickerSetId sticker_set_id);
|
|
|
|
|
2023-02-16 14:17:29 +01:00
|
|
|
void on_sticker_set_deleted(const string &short_name);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
std::pair<int32, vector<StickerSetId>> get_archived_sticker_sets(StickerType sticker_type,
|
|
|
|
StickerSetId offset_sticker_set_id, int32 limit,
|
|
|
|
bool force, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_get_archived_sticker_sets(StickerType sticker_type, StickerSetId offset_sticker_set_id,
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<tl_object_ptr<telegram_api::StickerSetCovered>> &&sticker_sets,
|
|
|
|
int32 total_count);
|
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
td_api::object_ptr<td_api::trendingStickerSets> get_featured_sticker_sets(StickerType sticker_type, int32 offset,
|
|
|
|
int32 limit, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_get_featured_sticker_sets(StickerType sticker_type, int32 offset, int32 limit, uint32 generation,
|
2020-04-18 00:55:54 +02:00
|
|
|
tl_object_ptr<telegram_api::messages_FeaturedStickers> &&sticker_sets_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_get_featured_sticker_sets_failed(StickerType sticker_type, int32 offset, int32 limit, uint32 generation,
|
|
|
|
Status error);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
vector<StickerSetId> get_attached_sticker_sets(FileId file_id, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_get_attached_sticker_sets(FileId file_id,
|
|
|
|
vector<tl_object_ptr<telegram_api::StickerSetCovered>> &&sticker_sets);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void reorder_installed_sticker_sets(StickerType sticker_type, const vector<StickerSetId> &sticker_set_ids,
|
2019-09-18 05:55:43 +02:00
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-09-04 20:35:11 +02:00
|
|
|
void move_sticker_set_to_top_by_sticker_id(FileId sticker_id);
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
void move_sticker_set_to_top_by_custom_emoji_ids(const vector<CustomEmojiId> &custom_emoji_ids);
|
2022-09-04 20:35:11 +02:00
|
|
|
|
2023-02-14 14:10:27 +01:00
|
|
|
FileId upload_sticker_file(UserId user_id, StickerFormat sticker_format,
|
|
|
|
const td_api::object_ptr<td_api::InputFile> &input_file, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
void get_suggested_sticker_set_name(string title, Promise<string> &&promise);
|
2021-06-17 19:38:03 +02:00
|
|
|
|
2021-06-18 02:06:20 +02:00
|
|
|
enum class CheckStickerSetNameResult : uint8 { Ok, Invalid, Occupied };
|
2021-06-17 20:29:07 +02:00
|
|
|
void check_sticker_set_name(const string &name, Promise<CheckStickerSetNameResult> &&promise);
|
|
|
|
|
|
|
|
static td_api::object_ptr<td_api::CheckStickerSetNameResult> get_check_sticker_set_name_result_object(
|
|
|
|
CheckStickerSetNameResult result);
|
|
|
|
|
2024-03-15 19:08:30 +01:00
|
|
|
void create_new_sticker_set(UserId user_id, string title, string short_name, StickerType sticker_type,
|
|
|
|
bool has_text_color, vector<td_api::object_ptr<td_api::inputSticker>> &&stickers,
|
|
|
|
string software, Promise<td_api::object_ptr<td_api::stickerSet>> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-02-16 17:50:52 +01:00
|
|
|
void add_sticker_to_set(UserId user_id, string short_name, td_api::object_ptr<td_api::inputSticker> &&sticker,
|
2024-03-20 11:49:01 +01:00
|
|
|
td_api::object_ptr<td_api::InputFile> &&old_sticker, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-03-15 19:08:30 +01:00
|
|
|
void set_sticker_set_thumbnail(UserId user_id, string short_name, td_api::object_ptr<td_api::InputFile> &&thumbnail,
|
|
|
|
StickerFormat format, Promise<Unit> &&promise);
|
2020-03-20 14:36:07 +01:00
|
|
|
|
2023-02-08 19:29:54 +01:00
|
|
|
void set_custom_emoji_sticker_set_thumbnail(string short_name, CustomEmojiId custom_emoji_id,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-02-08 19:43:09 +01:00
|
|
|
void set_sticker_set_title(string short_name, string title, Promise<Unit> &&promise);
|
|
|
|
|
2023-02-16 14:17:29 +01:00
|
|
|
void delete_sticker_set(string short_name, Promise<Unit> &&promise);
|
|
|
|
|
2023-02-09 18:42:09 +01:00
|
|
|
void set_sticker_position_in_set(const td_api::object_ptr<td_api::InputFile> &sticker, int32 position,
|
2018-12-31 20:04:05 +01:00
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-02-09 18:42:09 +01:00
|
|
|
void remove_sticker_from_set(const td_api::object_ptr<td_api::InputFile> &sticker, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void set_sticker_emojis(const td_api::object_ptr<td_api::InputFile> &sticker, const string &emojis,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-02-09 19:43:38 +01:00
|
|
|
void set_sticker_keywords(const td_api::object_ptr<td_api::InputFile> &sticker, vector<string> &&keywords,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-02-10 13:52:25 +01:00
|
|
|
void set_sticker_mask_position(const td_api::object_ptr<td_api::InputFile> &sticker,
|
|
|
|
td_api::object_ptr<td_api::maskPosition> &&mask_position, Promise<Unit> &&promise);
|
|
|
|
|
2024-03-20 13:41:49 +01:00
|
|
|
void get_created_sticker_sets(StickerSetId offset_sticker_set_id, int32 limit,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickerSets>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<FileId> get_recent_stickers(bool is_attached, Promise<Unit> &&promise);
|
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
void on_get_recent_stickers(bool is_repair, bool is_attached,
|
2019-02-02 11:30:49 +01:00
|
|
|
tl_object_ptr<telegram_api::messages_RecentStickers> &&stickers_ptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
void on_get_recent_stickers_failed(bool is_repair, bool is_attached, Status error);
|
2019-02-02 11:30:49 +01:00
|
|
|
|
2019-04-26 04:49:48 +02:00
|
|
|
FileSourceId get_recent_stickers_file_source_id(int is_attached);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void add_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void add_recent_sticker_by_id(bool is_attached, FileId sticker_id);
|
|
|
|
|
|
|
|
void remove_recent_sticker(bool is_attached, const tl_object_ptr<td_api::InputFile> &input_file,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2019-02-02 12:41:30 +01:00
|
|
|
void send_save_recent_sticker_query(bool is_attached, FileId sticker_id, bool unsave, Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void clear_recent_stickers(bool is_attached, Promise<Unit> &&promise);
|
|
|
|
|
2022-08-17 20:40:03 +02:00
|
|
|
void on_update_recent_stickers_limit();
|
2018-03-08 14:49:45 +01:00
|
|
|
|
2022-08-17 20:40:03 +02:00
|
|
|
void on_update_favorite_stickers_limit();
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void reload_favorite_stickers(bool force);
|
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
void repair_favorite_stickers(Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
void on_get_favorite_stickers(bool is_repair,
|
|
|
|
tl_object_ptr<telegram_api::messages_FavedStickers> &&favorite_stickers_ptr);
|
|
|
|
|
|
|
|
void on_get_favorite_stickers_failed(bool is_repair, Status error);
|
|
|
|
|
2021-10-08 12:41:22 +02:00
|
|
|
FileSourceId get_app_config_file_source_id();
|
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
FileSourceId get_favorite_stickers_file_source_id();
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
vector<FileId> get_favorite_stickers(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void add_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void add_favorite_sticker_by_id(FileId sticker_id);
|
|
|
|
|
|
|
|
void remove_favorite_sticker(const tl_object_ptr<td_api::InputFile> &input_file, Promise<Unit> &&promise);
|
|
|
|
|
2019-02-02 12:14:20 +01:00
|
|
|
void send_fave_sticker_query(FileId sticker_id, bool unsave, Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<FileId> get_attached_sticker_file_ids(const vector<int32> &int_file_ids);
|
|
|
|
|
|
|
|
vector<string> get_sticker_emojis(const tl_object_ptr<td_api::InputFile> &input_file, Promise<Unit> &&promise);
|
|
|
|
|
2024-01-05 13:21:35 +01:00
|
|
|
vector<std::pair<string, string>> search_emojis(const string &text, const vector<string> &input_language_codes,
|
|
|
|
bool force, Promise<Unit> &&promise);
|
2024-01-05 12:36:01 +01:00
|
|
|
|
|
|
|
vector<string> get_keyword_emojis(const string &text, const vector<string> &input_language_codes, bool force,
|
|
|
|
Promise<Unit> &&promise);
|
2019-05-21 17:48:35 +02:00
|
|
|
|
2019-05-21 21:44:13 +02:00
|
|
|
int64 get_emoji_suggestions_url(const string &language_code, Promise<Unit> &&promise);
|
|
|
|
|
2023-01-24 19:38:53 +01:00
|
|
|
void get_emoji_groups(EmojiGroupType group_type, Promise<td_api::object_ptr<td_api::emojiCategories>> &&promise);
|
2023-01-24 16:11:02 +01:00
|
|
|
|
2019-05-21 21:44:13 +02:00
|
|
|
td_api::object_ptr<td_api::httpUrl> get_emoji_suggestions_url_result(int64 random_id);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void reload_sticker_set(StickerSetId sticker_set_id, int64 access_hash, Promise<Unit> &&promise);
|
2019-07-30 17:43:29 +02:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void reload_installed_sticker_sets(StickerType sticker_type, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void reload_featured_sticker_sets(StickerType sticker_type, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void reload_recent_stickers(bool is_attached, bool force);
|
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
void repair_recent_stickers(bool is_attached, Promise<Unit> &&promise);
|
2019-02-02 11:30:49 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
FileId get_sticker_thumbnail_file_id(FileId file_id) const;
|
|
|
|
|
2019-02-02 11:30:49 +01:00
|
|
|
vector<FileId> get_sticker_file_ids(FileId file_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void delete_sticker_thumbnail(FileId file_id);
|
|
|
|
|
|
|
|
FileId dup_sticker(FileId new_id, FileId old_id);
|
|
|
|
|
2022-08-03 20:38:03 +02:00
|
|
|
void merge_stickers(FileId new_id, FileId old_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-21 18:54:20 +01:00
|
|
|
template <class StorerT>
|
2021-09-13 15:03:21 +02:00
|
|
|
void store_sticker(FileId file_id, bool in_sticker_set, StorerT &storer, const char *source) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-21 18:54:20 +01:00
|
|
|
template <class ParserT>
|
|
|
|
FileId parse_sticker(bool in_sticker_set, ParserT &parser);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-02-20 12:00:54 +01:00
|
|
|
void on_uploaded_sticker_file(FileId file_id, bool is_url, tl_object_ptr<telegram_api::MessageMedia> media,
|
2018-12-31 20:04:05 +01:00
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
void on_find_stickers_success(const string &emoji, tl_object_ptr<telegram_api::messages_Stickers> &&stickers);
|
2018-03-09 18:04:44 +01:00
|
|
|
|
|
|
|
void on_find_stickers_fail(const string &emoji, Status &&error);
|
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void on_find_custom_emojis_success(const string &emoji, tl_object_ptr<telegram_api::EmojiList> &&stickers);
|
|
|
|
|
|
|
|
void on_find_custom_emojis_fail(const string &emoji, Status &&error);
|
|
|
|
|
2023-11-10 10:48:30 +01:00
|
|
|
void on_find_sticker_sets_success(StickerType sticker_type, const string &query,
|
2018-03-05 23:44:11 +01:00
|
|
|
tl_object_ptr<telegram_api::messages_FoundStickerSets> &&sticker_sets);
|
|
|
|
|
2023-11-10 10:48:30 +01:00
|
|
|
void on_find_sticker_sets_fail(StickerType sticker_type, const string &query, Status &&error);
|
2018-03-05 23:44:11 +01:00
|
|
|
|
2019-01-24 20:41:05 +01:00
|
|
|
void send_get_attached_stickers_query(FileId file_id, Promise<Unit> &&promise);
|
|
|
|
|
2018-09-20 21:25:09 +02:00
|
|
|
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
|
|
|
|
2019-09-18 01:14:24 +02:00
|
|
|
template <class StorerT>
|
2019-09-18 05:55:43 +02:00
|
|
|
void store_sticker_set_id(StickerSetId sticker_set_id, StorerT &storer) const;
|
2019-09-18 01:14:24 +02:00
|
|
|
|
|
|
|
template <class ParserT>
|
2019-09-18 05:55:43 +02:00
|
|
|
void parse_sticker_set_id(StickerSetId &sticker_set_id, ParserT &parser);
|
2019-09-18 01:14:24 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
private:
|
|
|
|
static constexpr int32 MAX_FEATURED_STICKER_SET_VIEW_DELAY = 5;
|
2020-04-18 00:55:54 +02:00
|
|
|
static constexpr int32 OLD_FEATURED_STICKER_SET_SLICE_SIZE = 20;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-01-18 17:20:43 +01:00
|
|
|
static constexpr int32 MAX_FOUND_STICKERS = 100; // server side limit
|
|
|
|
static constexpr size_t MAX_STICKER_SET_TITLE_LENGTH = 64; // server side limit
|
|
|
|
static constexpr size_t MAX_STICKER_SET_SHORT_NAME_LENGTH = 64; // server side limit
|
2022-08-05 20:56:05 +02:00
|
|
|
static constexpr size_t MAX_GET_CUSTOM_EMOJI_STICKERS = 200; // server-side limit
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-05-21 19:42:41 +02:00
|
|
|
static constexpr int32 EMOJI_KEYWORDS_UPDATE_DELAY = 3600;
|
2021-09-17 18:59:31 +02:00
|
|
|
static constexpr double MIN_ANIMATED_EMOJI_CLICK_DELAY = 0.2;
|
2019-05-21 19:42:41 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
class Sticker {
|
|
|
|
public:
|
2022-08-07 18:47:50 +02:00
|
|
|
StickerSetId set_id_;
|
|
|
|
string alt_;
|
|
|
|
Dimensions dimensions_;
|
|
|
|
string minithumbnail_;
|
|
|
|
PhotoSize s_thumbnail_;
|
|
|
|
PhotoSize m_thumbnail_;
|
|
|
|
FileId premium_animation_file_id_;
|
|
|
|
FileId file_id_;
|
|
|
|
StickerFormat format_ = StickerFormat::Unknown;
|
|
|
|
StickerType type_ = StickerType::Regular;
|
|
|
|
bool is_premium_ = false;
|
2022-12-09 11:39:29 +01:00
|
|
|
bool has_text_color_ = false;
|
2022-08-07 18:47:50 +02:00
|
|
|
bool is_from_database_ = false;
|
|
|
|
bool is_being_reloaded_ = false;
|
2023-02-09 18:15:21 +01:00
|
|
|
StickerMaskPosition mask_position_;
|
2022-08-07 18:47:50 +02:00
|
|
|
int32 emoji_receive_date_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class StickerSet {
|
|
|
|
public:
|
2022-08-07 18:47:50 +02:00
|
|
|
bool is_inited_ = false; // basic information about the set
|
|
|
|
bool was_loaded_ = false;
|
|
|
|
bool is_loaded_ = false;
|
2023-12-23 23:23:15 +01:00
|
|
|
bool are_keywords_loaded_ = false; // stored in telegram_api::messages_stickerSet
|
|
|
|
bool is_sticker_has_text_color_loaded_ = false;
|
|
|
|
bool is_sticker_channel_emoji_status_loaded_ = false;
|
2024-03-16 21:54:05 +01:00
|
|
|
bool is_created_loaded_ = false;
|
2022-08-07 18:47:50 +02:00
|
|
|
|
|
|
|
StickerSetId id_;
|
|
|
|
int64 access_hash_ = 0;
|
|
|
|
string title_;
|
|
|
|
string short_name_;
|
|
|
|
StickerType sticker_type_ = StickerType::Regular;
|
|
|
|
int32 sticker_count_ = 0;
|
|
|
|
int32 hash_ = 0;
|
|
|
|
int32 expires_at_ = 0;
|
|
|
|
|
|
|
|
string minithumbnail_;
|
|
|
|
PhotoSize thumbnail_;
|
|
|
|
int64 thumbnail_document_id_ = 0;
|
|
|
|
|
|
|
|
vector<FileId> sticker_ids_;
|
2022-08-07 19:35:13 +02:00
|
|
|
vector<int32> premium_sticker_positions_;
|
2022-09-26 23:20:13 +02:00
|
|
|
FlatHashMap<string, vector<FileId>> emoji_stickers_map_; // emoji -> stickers
|
|
|
|
FlatHashMap<FileId, vector<string>, FileIdHash> sticker_emojis_map_; // sticker -> emojis
|
2022-09-27 17:29:10 +02:00
|
|
|
mutable std::map<string, vector<FileId>> keyword_stickers_map_; // keyword -> stickers
|
2022-09-26 23:20:13 +02:00
|
|
|
FlatHashMap<FileId, vector<string>, FileIdHash> sticker_keywords_map_; // sticker -> keywords
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-03-16 21:54:05 +01:00
|
|
|
bool is_created_ = false;
|
2022-08-07 18:47:50 +02:00
|
|
|
bool is_installed_ = false;
|
|
|
|
bool is_archived_ = false;
|
|
|
|
bool is_official_ = false;
|
2023-10-19 22:06:55 +02:00
|
|
|
bool has_text_color_ = false;
|
2023-12-23 23:23:15 +01:00
|
|
|
bool channel_emoji_status_ = false;
|
2022-08-07 18:47:50 +02:00
|
|
|
bool is_viewed_ = true;
|
2022-12-21 13:18:42 +01:00
|
|
|
bool is_thumbnail_reloaded_ = false; // stored in telegram_api::stickerSet
|
|
|
|
bool are_legacy_sticker_thumbnails_reloaded_ = false; // stored in telegram_api::stickerSet
|
|
|
|
mutable bool was_update_sent_ = false; // does the sticker set is known to the client
|
|
|
|
bool is_changed_ = true; // have new changes that need to be sent to the client and database
|
|
|
|
bool need_save_to_database_ = true; // have new changes that need only to be saved to the database
|
2022-08-07 18:47:50 +02:00
|
|
|
|
|
|
|
vector<uint32> load_requests_;
|
|
|
|
vector<uint32> load_without_stickers_requests_;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PendingNewStickerSet {
|
2022-08-07 18:47:50 +02:00
|
|
|
MultiPromiseActor upload_files_multipromise_{"UploadNewStickerSetFilesMultiPromiseActor"};
|
|
|
|
UserId user_id_;
|
|
|
|
string title_;
|
|
|
|
string short_name_;
|
|
|
|
StickerType sticker_type_ = StickerType::Regular;
|
2023-02-08 18:29:53 +01:00
|
|
|
bool has_text_color_ = false;
|
2022-08-07 18:47:50 +02:00
|
|
|
vector<FileId> file_ids_;
|
|
|
|
vector<tl_object_ptr<td_api::inputSticker>> stickers_;
|
|
|
|
string software_;
|
2022-08-08 16:24:01 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::stickerSet>> promise_;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PendingAddStickerToSet {
|
2022-08-07 18:47:50 +02:00
|
|
|
string short_name_;
|
|
|
|
FileId file_id_;
|
2024-03-20 11:49:01 +01:00
|
|
|
td_api::object_ptr<td_api::inputSticker> sticker_;
|
|
|
|
telegram_api::object_ptr<telegram_api::inputDocument> input_document_;
|
2023-02-16 17:50:52 +01:00
|
|
|
Promise<Unit> promise_;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
2020-03-20 14:36:07 +01:00
|
|
|
struct PendingSetStickerSetThumbnail {
|
2022-08-07 18:47:50 +02:00
|
|
|
string short_name_;
|
|
|
|
FileId file_id_;
|
2023-02-16 18:38:19 +01:00
|
|
|
Promise<Unit> promise_;
|
2020-03-20 14:36:07 +01:00
|
|
|
};
|
|
|
|
|
2021-09-15 23:41:40 +02:00
|
|
|
struct PendingGetAnimatedEmojiClickSticker {
|
|
|
|
string message_text_;
|
2023-09-21 18:11:17 +02:00
|
|
|
MessageFullId message_full_id_;
|
2021-09-15 23:41:40 +02:00
|
|
|
double start_time_ = 0;
|
|
|
|
Promise<td_api::object_ptr<td_api::sticker>> promise_;
|
|
|
|
};
|
|
|
|
|
2021-09-17 14:51:42 +02:00
|
|
|
struct PendingOnAnimatedEmojiClicked {
|
|
|
|
string emoji_;
|
2023-09-21 18:11:17 +02:00
|
|
|
MessageFullId message_full_id_;
|
2021-09-17 14:51:42 +02:00
|
|
|
vector<std::pair<int, double>> clicks_;
|
|
|
|
};
|
|
|
|
|
2020-03-14 01:47:19 +01:00
|
|
|
struct SpecialStickerSet {
|
|
|
|
StickerSetId id_;
|
|
|
|
int64 access_hash_ = 0;
|
2020-04-19 15:30:04 +02:00
|
|
|
string short_name_;
|
|
|
|
SpecialStickerSetType type_;
|
2020-04-19 23:41:26 +02:00
|
|
|
bool is_being_loaded_ = false;
|
2021-12-01 18:30:02 +01:00
|
|
|
bool is_being_reloaded_ = false;
|
2020-03-14 01:47:19 +01:00
|
|
|
};
|
|
|
|
|
2022-08-07 23:55:22 +02:00
|
|
|
struct FoundStickers {
|
|
|
|
vector<FileId> sticker_ids_;
|
|
|
|
int32 cache_time_ = 300;
|
|
|
|
double next_reload_time_ = 0;
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
2022-07-25 20:18:43 +02:00
|
|
|
class CustomEmojiLogEvent;
|
2023-01-10 13:23:07 +01:00
|
|
|
class CustomEmojiIdsLogEvent;
|
2018-12-31 20:04:05 +01:00
|
|
|
class StickerListLogEvent;
|
|
|
|
class StickerSetListLogEvent;
|
|
|
|
|
|
|
|
class UploadStickerFileCallback;
|
|
|
|
|
2023-01-23 10:18:51 +01:00
|
|
|
int64 get_sticker_id(FileId sticker_id) const;
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
CustomEmojiId get_custom_emoji_id(FileId sticker_id) const;
|
2022-07-22 17:27:12 +02:00
|
|
|
|
2021-03-01 02:19:50 +01:00
|
|
|
static vector<td_api::object_ptr<td_api::closedVectorPath>> get_sticker_minithumbnail(CSlice path,
|
2021-03-02 02:48:02 +01:00
|
|
|
StickerSetId sticker_set_id,
|
2021-10-14 00:06:12 +02:00
|
|
|
int64 document_id, double zoom);
|
2020-11-20 14:22:07 +01:00
|
|
|
|
2024-03-15 13:24:59 +01:00
|
|
|
PhotoFormat get_sticker_set_thumbnail_format(const StickerSet *sticker_set) const;
|
|
|
|
|
|
|
|
double get_sticker_set_minithumbnail_zoom(const StickerSet *sticker_set) const;
|
2022-02-11 16:07:56 +01:00
|
|
|
|
2022-07-16 14:45:30 +02:00
|
|
|
td_api::object_ptr<td_api::thumbnail> get_sticker_set_thumbnail_object(const StickerSet *sticker_set) const;
|
|
|
|
|
2022-06-17 07:59:54 +02:00
|
|
|
tl_object_ptr<td_api::stickerSetInfo> get_sticker_set_info_object(StickerSetId sticker_set_id, size_t covers_limit,
|
|
|
|
bool prefer_premium) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
Sticker *get_sticker(FileId file_id);
|
|
|
|
const Sticker *get_sticker(FileId file_id) const;
|
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
static string get_found_stickers_database_key(StickerType sticker_type, const string &emoji);
|
|
|
|
|
|
|
|
void reload_found_stickers(StickerType sticker_type, string &&emoji, int64 hash);
|
|
|
|
|
|
|
|
void on_load_found_stickers_from_database(StickerType sticker_type, string emoji, string value);
|
2022-08-07 23:55:22 +02:00
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void on_load_custom_emojis(string emoji, int64 hash, vector<CustomEmojiId> custom_emoji_ids,
|
|
|
|
Result<td_api::object_ptr<td_api::stickers>> &&result);
|
2023-01-23 17:58:34 +01:00
|
|
|
|
2023-02-01 01:48:06 +01:00
|
|
|
void get_custom_emoji_stickers_unlimited(vector<CustomEmojiId> custom_emoji_ids,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
|
|
|
void on_get_custom_emoji_stickers_unlimited(vector<CustomEmojiId> custom_emoji_ids,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void on_search_stickers_finished(StickerType sticker_type, const string &emoji, const FoundStickers &found_stickers);
|
2022-08-07 23:55:22 +02:00
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void on_search_stickers_succeeded(StickerType sticker_type, const string &emoji, vector<FileId> &&sticker_ids);
|
2022-08-07 23:55:22 +02:00
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
void on_search_stickers_failed(StickerType sticker_type, const string &emoji, Status &&error);
|
2023-01-14 20:01:35 +01:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
static string get_custom_emoji_database_key(CustomEmojiId custom_emoji_id);
|
2022-07-25 20:18:43 +02:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
void load_custom_emoji_sticker_from_database_force(CustomEmojiId custom_emoji_id);
|
2022-09-05 20:04:08 +02:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
void load_custom_emoji_sticker_from_database(CustomEmojiId custom_emoji_id, Promise<Unit> &&promise);
|
2022-07-25 22:04:53 +02:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
void on_load_custom_emoji_from_database(CustomEmojiId custom_emoji_id, string value);
|
2022-07-25 22:04:53 +02:00
|
|
|
|
2023-12-24 00:30:49 +01:00
|
|
|
void load_default_custom_emoji_ids(StickerListType sticker_list_type, bool force_reload);
|
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
void on_load_default_custom_emoji_ids_from_database(StickerListType sticker_list_type, bool force_reload,
|
|
|
|
string value);
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
void reload_default_custom_emoji_ids(StickerListType sticker_list_type);
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
void on_get_default_custom_emoji_ids(StickerListType sticker_list_type,
|
|
|
|
Result<telegram_api::object_ptr<telegram_api::EmojiList>> r_emoji_list);
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
void on_get_default_custom_emoji_ids_success(StickerListType sticker_list_type,
|
|
|
|
vector<CustomEmojiId> custom_emoji_ids, int64 hash);
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2018-09-27 03:19:03 +02:00
|
|
|
FileId on_get_sticker(unique_ptr<Sticker> new_sticker, bool replace);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSet *get_sticker_set(StickerSetId sticker_set_id);
|
2022-09-27 17:29:10 +02:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
const StickerSet *get_sticker_set(StickerSetId sticker_set_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSet *add_sticker_set(StickerSetId sticker_set_id, int64 access_hash);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static tl_object_ptr<telegram_api::InputStickerSet> get_input_sticker_set(const StickerSet *set);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
StickerSetId on_get_input_sticker_set(FileId sticker_file_id, tl_object_ptr<telegram_api::InputStickerSet> &&set_ptr,
|
|
|
|
MultiPromiseActor *load_data_multipromise_ptr = nullptr);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_resolve_sticker_set_short_name(FileId sticker_file_id, const string &short_name);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
int apply_installed_sticker_sets_order(StickerType sticker_type, const vector<StickerSetId> &sticker_set_ids);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-09-02 17:35:57 +02:00
|
|
|
int move_installed_sticker_set_to_top(StickerType sticker_type, StickerSetId sticker_set_id);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_sticker_set(StickerSet *sticker_set, bool is_installed, bool is_archived, bool is_changed,
|
|
|
|
bool from_database = false);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
static string get_sticker_set_database_key(StickerSetId set_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
static string get_full_sticker_set_database_key(StickerSetId set_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-11-14 08:19:03 +01:00
|
|
|
string get_sticker_set_database_value(const StickerSet *s, bool with_stickers, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-11-14 08:19:03 +01:00
|
|
|
void update_sticker_set(StickerSet *sticker_set, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void load_sticker_sets(vector<StickerSetId> &&sticker_set_ids, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void load_sticker_sets_without_stickers(vector<StickerSetId> &&sticker_set_ids, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void on_load_sticker_set_from_database(StickerSetId sticker_set_id, bool with_stickers, string value);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void update_load_requests(StickerSet *sticker_set, bool with_stickers, const Status &status);
|
|
|
|
|
|
|
|
void update_load_request(uint32 load_request_id, const Status &status);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void do_reload_sticker_set(StickerSetId sticker_set_id,
|
2021-11-19 11:56:12 +01:00
|
|
|
tl_object_ptr<telegram_api::InputStickerSet> &&input_sticker_set, int32 hash,
|
2022-12-21 15:07:21 +01:00
|
|
|
Promise<Unit> &&promise, const char *source);
|
|
|
|
|
|
|
|
void on_reload_sticker_set(StickerSetId sticker_set_id, Result<Unit> &&result);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-06 23:33:16 +02:00
|
|
|
void do_get_premium_stickers(int32 limit, Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static void read_featured_sticker_sets(void *td_void);
|
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_sticker_sets_hash(const vector<StickerSetId> &sticker_set_ids) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
int64 get_featured_sticker_sets_hash(StickerType sticker_type) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-03-08 11:40:06 +01:00
|
|
|
int64 get_recent_stickers_hash(const vector<FileId> &sticker_ids, const char *source) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void load_installed_sticker_sets(StickerType sticker_type, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void load_featured_sticker_sets(StickerType sticker_type, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void load_old_featured_sticker_sets(StickerType sticker_type, Promise<Unit> &&promise);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void load_recent_stickers(bool is_attached, Promise<Unit> &&promise);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_load_installed_sticker_sets_from_database(StickerType sticker_type, string value);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
void on_load_installed_sticker_sets_finished(StickerType sticker_type,
|
|
|
|
vector<StickerSetId> &&installed_sticker_set_ids,
|
2018-12-31 20:04:05 +01:00
|
|
|
bool from_database = false);
|
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_load_featured_sticker_sets_from_database(StickerType sticker_type, string value);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_load_featured_sticker_sets_finished(StickerType sticker_type, vector<StickerSetId> &&featured_sticker_set_ids,
|
|
|
|
bool is_premium);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_load_old_featured_sticker_sets_from_database(StickerType sticker_type, uint32 generation, string value);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_load_old_featured_sticker_sets_finished(StickerType sticker_type, uint32 generation,
|
2020-04-18 00:55:54 +02:00
|
|
|
vector<StickerSetId> &&old_featured_sticker_set_ids);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_load_recent_stickers_from_database(bool is_attached, string value);
|
|
|
|
|
|
|
|
void on_load_recent_stickers_finished(bool is_attached, vector<FileId> &&recent_sticker_ids,
|
|
|
|
bool from_database = false);
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
td_api::object_ptr<td_api::updateInstalledStickerSets> get_update_installed_sticker_sets_object(
|
|
|
|
StickerType sticker_type) const;
|
2018-09-20 21:25:09 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void send_update_installed_sticker_sets(bool from_database = false);
|
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void reload_old_featured_sticker_sets(StickerType sticker_type, uint32 generation = 0);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void on_old_featured_sticker_sets_invalidated(StickerType sticker_type);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void invalidate_old_featured_sticker_sets(StickerType sticker_type);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void set_old_featured_sticker_set_count(StickerType sticker_type, int32 count);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
|
|
|
// must be called after every call to set_old_featured_sticker_set_count or
|
|
|
|
// any change of old_featured_sticker_set_ids_ size
|
2022-07-17 21:39:22 +02:00
|
|
|
void fix_old_featured_sticker_set_count(StickerType sticker_type);
|
|
|
|
|
|
|
|
static size_t get_max_featured_sticker_count(StickerType sticker_type);
|
|
|
|
|
|
|
|
static Slice get_featured_sticker_suffix(StickerType sticker_type);
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-06-17 18:16:17 +02:00
|
|
|
td_api::object_ptr<td_api::trendingStickerSets> get_trending_sticker_sets_object(
|
2022-07-17 21:39:22 +02:00
|
|
|
StickerType sticker_type, const vector<StickerSetId> &sticker_set_ids) const;
|
2022-06-17 18:16:17 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
td_api::object_ptr<td_api::updateTrendingStickerSets> get_update_trending_sticker_sets_object(
|
|
|
|
StickerType sticker_type) const;
|
2018-09-20 21:25:09 +02:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
void send_update_featured_sticker_sets(StickerType sticker_type);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-09-20 21:25:09 +02:00
|
|
|
td_api::object_ptr<td_api::updateRecentStickers> get_update_recent_stickers_object(int is_attached) const;
|
|
|
|
|
2021-10-31 23:35:39 +01:00
|
|
|
void send_update_recent_stickers(bool is_attached, bool from_database = false);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-03-08 19:04:28 +01:00
|
|
|
void save_recent_stickers_to_database(bool is_attached);
|
|
|
|
|
2019-11-30 19:22:40 +01:00
|
|
|
void add_recent_sticker_impl(bool is_attached, FileId sticker_id, bool add_on_server, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_favorite_stickers_hash() const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-11-30 19:22:40 +01:00
|
|
|
void add_favorite_sticker_impl(FileId sticker_id, bool add_on_server, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void load_favorite_stickers(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_load_favorite_stickers_from_database(const string &value);
|
|
|
|
|
|
|
|
void on_load_favorite_stickers_finished(vector<FileId> &&favorite_sticker_ids, bool from_database = false);
|
|
|
|
|
2018-09-20 21:25:09 +02:00
|
|
|
td_api::object_ptr<td_api::updateFavoriteStickers> get_update_favorite_stickers_object() const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void send_update_favorite_stickers(bool from_database = false);
|
|
|
|
|
2018-03-08 19:04:28 +01:00
|
|
|
void save_favorite_stickers_to_database();
|
|
|
|
|
2019-02-21 18:54:20 +01:00
|
|
|
template <class StorerT>
|
2021-11-14 08:19:03 +01:00
|
|
|
void store_sticker_set(const StickerSet *sticker_set, bool with_stickers, StorerT &storer, const char *source) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-21 18:54:20 +01:00
|
|
|
template <class ParserT>
|
|
|
|
void parse_sticker_set(StickerSet *sticker_set, ParserT &parser);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-06-16 20:12:20 +02:00
|
|
|
std::pair<vector<FileId>, vector<FileId>> split_stickers_by_premium(const vector<FileId> &sticker_ids) const;
|
|
|
|
|
2022-08-07 20:10:15 +02:00
|
|
|
std::pair<vector<FileId>, vector<FileId>> split_stickers_by_premium(const StickerSet *sticker_set) const;
|
|
|
|
|
2023-02-14 12:59:03 +01:00
|
|
|
Result<std::tuple<FileId, bool, bool>> prepare_input_file(const tl_object_ptr<td_api::InputFile> &input_file,
|
|
|
|
StickerFormat sticker_format, StickerType sticker_type,
|
|
|
|
bool for_thumbnail);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-03-15 19:08:30 +01:00
|
|
|
Result<std::tuple<FileId, bool, bool>> prepare_input_sticker(td_api::inputSticker *sticker, StickerType sticker_type);
|
2020-03-23 16:03:13 +01:00
|
|
|
|
2022-01-25 14:56:10 +01:00
|
|
|
tl_object_ptr<telegram_api::inputStickerSetItem> get_input_sticker(const td_api::inputSticker *sticker,
|
2018-12-31 20:04:05 +01:00
|
|
|
FileId file_id) const;
|
|
|
|
|
|
|
|
void upload_sticker_file(UserId user_id, FileId file_id, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_upload_sticker_file(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file);
|
|
|
|
|
|
|
|
void on_upload_sticker_file_error(FileId file_id, Status status);
|
|
|
|
|
|
|
|
void do_upload_sticker_file(UserId user_id, FileId file_id, tl_object_ptr<telegram_api::InputFile> &&input_file,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_new_stickers_uploaded(int64 random_id, Result<Unit> result);
|
|
|
|
|
|
|
|
void on_added_sticker_uploaded(int64 random_id, Result<Unit> result);
|
|
|
|
|
2024-03-15 19:35:24 +01:00
|
|
|
StickerFormat guess_sticker_set_format(const StickerSet *sticker_set) const;
|
|
|
|
|
2023-02-16 17:50:52 +01:00
|
|
|
void do_add_sticker_to_set(UserId user_id, string short_name, td_api::object_ptr<td_api::inputSticker> &&sticker,
|
2024-03-20 11:49:01 +01:00
|
|
|
td_api::object_ptr<td_api::InputFile> &&old_sticker, Promise<Unit> &&promise);
|
2022-07-21 15:06:58 +02:00
|
|
|
|
2020-03-20 14:36:07 +01:00
|
|
|
void on_sticker_set_thumbnail_uploaded(int64 random_id, Result<Unit> result);
|
|
|
|
|
2024-03-15 19:08:30 +01:00
|
|
|
void do_set_sticker_set_thumbnail(UserId user_id, string short_name,
|
|
|
|
td_api::object_ptr<td_api::InputFile> &&thumbnail, StickerFormat format,
|
2023-02-16 18:38:19 +01:00
|
|
|
Promise<Unit> &&promise);
|
2020-03-23 16:03:13 +01:00
|
|
|
|
2023-02-08 19:29:54 +01:00
|
|
|
void do_set_custom_emoji_sticker_set_thumbnail(string short_name, CustomEmojiId custom_emoji_id,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-02-09 15:26:50 +01:00
|
|
|
struct StickerInputDocument {
|
|
|
|
string sticker_set_short_name_;
|
|
|
|
telegram_api::object_ptr<telegram_api::inputDocument> input_document_;
|
|
|
|
};
|
|
|
|
Result<StickerInputDocument> get_sticker_input_document(const tl_object_ptr<td_api::InputFile> &sticker) const;
|
|
|
|
|
2024-03-20 13:41:49 +01:00
|
|
|
void on_get_created_sticker_sets(Result<telegram_api::object_ptr<telegram_api::messages_myStickers>> r_my_stickers,
|
|
|
|
Promise<td_api::object_ptr<td_api::stickerSets>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool update_sticker_set_cache(const StickerSet *sticker_set, Promise<Unit> &promise);
|
|
|
|
|
2022-07-22 14:01:44 +02:00
|
|
|
const StickerSet *get_premium_gift_sticker_set();
|
|
|
|
|
|
|
|
static FileId get_premium_gift_option_sticker_id(const StickerSet *sticker_set, int32 month_count);
|
|
|
|
|
|
|
|
FileId get_premium_gift_option_sticker_id(int32 month_count);
|
|
|
|
|
|
|
|
void try_update_premium_gift_messages();
|
2022-07-15 15:15:59 +02:00
|
|
|
|
2021-10-05 17:06:05 +02:00
|
|
|
const StickerSet *get_animated_emoji_sticker_set();
|
|
|
|
|
2021-10-05 15:12:04 +02:00
|
|
|
static std::pair<FileId, int> get_animated_emoji_sticker(const StickerSet *sticker_set, const string &emoji);
|
|
|
|
|
|
|
|
std::pair<FileId, int> get_animated_emoji_sticker(const string &emoji);
|
|
|
|
|
2021-10-05 22:20:49 +02:00
|
|
|
FileId get_animated_emoji_sound_file_id(const string &emoji) const;
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
FileId get_custom_animated_emoji_sticker_id(CustomEmojiId custom_emoji_id) const;
|
2022-08-05 20:56:05 +02:00
|
|
|
|
2021-10-26 15:50:18 +02:00
|
|
|
td_api::object_ptr<td_api::animatedEmoji> get_animated_emoji_object(std::pair<FileId, int> animated_sticker,
|
2021-10-26 16:59:15 +02:00
|
|
|
FileId sound_file_id) const;
|
2021-10-26 15:50:18 +02:00
|
|
|
|
2021-10-05 16:17:29 +02:00
|
|
|
void try_update_animated_emoji_messages();
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
void try_update_custom_emoji_messages(CustomEmojiId custom_emoji_id);
|
2022-08-05 19:49:24 +02:00
|
|
|
|
2021-10-05 17:42:05 +02:00
|
|
|
static int get_emoji_number(Slice emoji);
|
|
|
|
|
2021-10-05 15:12:04 +02:00
|
|
|
vector<FileId> get_animated_emoji_click_stickers(const StickerSet *sticker_set, Slice emoji) const;
|
2021-09-17 15:58:20 +02:00
|
|
|
|
2022-05-12 17:02:27 +02:00
|
|
|
void choose_animated_emoji_click_sticker(const StickerSet *sticker_set, string message_text,
|
2023-09-21 18:11:17 +02:00
|
|
|
MessageFullId message_full_id, double start_time,
|
2021-09-15 23:41:40 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
|
|
|
|
2021-09-19 19:43:47 +02:00
|
|
|
void send_click_animated_emoji_message_response(FileId sticker_id,
|
|
|
|
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
|
|
|
|
2021-09-19 00:52:56 +02:00
|
|
|
void flush_sent_animated_emoji_clicks();
|
|
|
|
|
2021-09-16 22:22:34 +02:00
|
|
|
void flush_pending_animated_emoji_clicks();
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, Slice emoji, MessageFullId message_full_id,
|
2021-09-20 12:45:49 +02:00
|
|
|
vector<std::pair<int, double>> clicks);
|
2021-09-17 18:59:31 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void send_update_animated_emoji_clicked(MessageFullId message_full_id, FileId sticker_id);
|
2021-09-17 14:51:42 +02:00
|
|
|
|
2020-04-19 10:17:51 +02:00
|
|
|
td_api::object_ptr<td_api::updateDiceEmojis> get_update_dice_emojis_object() const;
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void start_up() final;
|
2019-11-21 20:18:29 +01:00
|
|
|
|
2021-09-16 22:22:34 +02:00
|
|
|
void timeout_expired() final;
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void tear_down() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-12-01 17:59:45 +01:00
|
|
|
SpecialStickerSet &add_special_sticker_set(const SpecialStickerSetType &type);
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2020-03-14 01:47:19 +01:00
|
|
|
static void init_special_sticker_set(SpecialStickerSet &sticker_set, int64 sticker_set_id, int64 access_hash,
|
|
|
|
string name);
|
|
|
|
|
2020-04-19 23:41:26 +02:00
|
|
|
void load_special_sticker_set_info_from_binlog(SpecialStickerSet &sticker_set);
|
|
|
|
|
2021-12-01 18:30:02 +01:00
|
|
|
void load_special_sticker_set_by_type(SpecialStickerSetType type);
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2020-03-14 01:47:19 +01:00
|
|
|
void load_special_sticker_set(SpecialStickerSet &sticker_set);
|
|
|
|
|
2021-12-01 18:30:02 +01:00
|
|
|
void reload_special_sticker_set(SpecialStickerSet &sticker_set, int32 hash);
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2023-12-24 00:38:17 +01:00
|
|
|
int is_custom_emoji_from_sticker_set(CustomEmojiId custom_emoji_id, StickerSetId sticker_set_id) const;
|
|
|
|
|
2019-07-15 03:01:26 +02:00
|
|
|
static void add_sticker_thumbnail(Sticker *s, PhotoSize thumbnail);
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
td_api::object_ptr<td_api::stickers> get_custom_emoji_stickers_object(const vector<CustomEmojiId> &custom_emoji_ids);
|
2022-07-26 17:48:18 +02:00
|
|
|
|
|
|
|
void on_get_custom_emoji_documents(Result<vector<telegram_api::object_ptr<telegram_api::Document>>> &&r_documents,
|
2022-10-03 00:26:32 +02:00
|
|
|
vector<CustomEmojiId> &&custom_emoji_ids,
|
2022-07-19 15:00:04 +02:00
|
|
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise);
|
|
|
|
|
2022-09-27 17:29:10 +02:00
|
|
|
static const std::map<string, vector<FileId>> &get_sticker_set_keywords(const StickerSet *sticker_set);
|
|
|
|
|
2024-03-16 20:39:50 +01:00
|
|
|
void find_sticker_set_stickers(const StickerSet *sticker_set, const vector<string> &emojis, const string &query,
|
|
|
|
vector<std::pair<bool, FileId>> &result) const;
|
2022-09-27 17:29:10 +02:00
|
|
|
|
2023-01-24 13:15:37 +01:00
|
|
|
bool can_find_sticker_by_query(FileId sticker_id, const vector<string> &emojis, const string &query) const;
|
2022-09-27 15:16:36 +02:00
|
|
|
|
2019-05-21 17:48:35 +02:00
|
|
|
static string get_emoji_language_code_version_database_key(const string &language_code);
|
|
|
|
|
2019-05-21 19:42:41 +02:00
|
|
|
static string get_emoji_language_code_last_difference_time_database_key(const string &language_code);
|
|
|
|
|
2019-05-21 17:48:35 +02:00
|
|
|
static string get_language_emojis_database_key(const string &language_code, const string &text);
|
|
|
|
|
|
|
|
static string get_emoji_language_codes_database_key(const vector<string> &language_codes);
|
|
|
|
|
2023-01-25 14:23:34 +01:00
|
|
|
static string get_emoji_groups_database_key(EmojiGroupType group_type);
|
|
|
|
|
2019-05-21 17:48:35 +02:00
|
|
|
int32 get_emoji_language_code_version(const string &language_code);
|
|
|
|
|
2019-05-21 19:42:41 +02:00
|
|
|
double get_emoji_language_code_last_difference_time(const string &language_code);
|
|
|
|
|
2023-01-24 16:11:02 +01:00
|
|
|
vector<string> get_used_language_codes(const vector<string> &input_language_codes, Slice text) const;
|
|
|
|
|
2023-01-25 18:25:23 +01:00
|
|
|
string get_used_language_codes_string() const;
|
|
|
|
|
2024-01-05 12:20:00 +01:00
|
|
|
struct SearchEmojiQuery {
|
|
|
|
string text_;
|
|
|
|
vector<string> language_codes_;
|
|
|
|
};
|
|
|
|
bool prepare_search_emoji_query(const string &text, const vector<string> &input_language_codes, bool force,
|
|
|
|
Promise<Unit> &promise, SearchEmojiQuery &query);
|
|
|
|
|
2020-04-22 14:17:53 +02:00
|
|
|
vector<string> get_emoji_language_codes(const vector<string> &input_language_codes, Slice text,
|
|
|
|
Promise<Unit> &promise);
|
2019-05-21 17:48:35 +02:00
|
|
|
|
|
|
|
void load_language_codes(vector<string> language_codes, string key, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_get_language_codes(const string &key, Result<vector<string>> &&result);
|
|
|
|
|
2024-01-05 13:21:35 +01:00
|
|
|
static vector<std::pair<string, string>> search_language_emojis(const string &language_code, const string &text);
|
2024-01-05 12:36:01 +01:00
|
|
|
|
|
|
|
static vector<string> get_keyword_language_emojis(const string &language_code, const string &text);
|
2019-05-21 17:48:35 +02:00
|
|
|
|
|
|
|
void load_emoji_keywords(const string &language_code, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_get_emoji_keywords(const string &language_code,
|
|
|
|
Result<telegram_api::object_ptr<telegram_api::emojiKeywordsDifference>> &&result);
|
|
|
|
|
2019-05-21 19:42:41 +02:00
|
|
|
void load_emoji_keywords_difference(const string &language_code);
|
|
|
|
|
|
|
|
void on_get_emoji_keywords_difference(
|
|
|
|
const string &language_code, int32 from_version,
|
|
|
|
Result<telegram_api::object_ptr<telegram_api::emojiKeywordsDifference>> &&result);
|
|
|
|
|
2021-12-12 21:50:05 +01:00
|
|
|
void finish_get_emoji_keywords_difference(string language_code, int32 version);
|
|
|
|
|
2019-05-21 21:44:13 +02:00
|
|
|
void on_get_emoji_suggestions_url(int64 random_id, Promise<Unit> &&promise,
|
|
|
|
Result<telegram_api::object_ptr<telegram_api::emojiURL>> &&r_emoji_url);
|
|
|
|
|
2023-01-25 14:23:34 +01:00
|
|
|
void on_load_emoji_groups_from_database(EmojiGroupType group_type, string used_language_codes, string value);
|
|
|
|
|
2023-02-09 20:47:44 +01:00
|
|
|
void on_load_emoji_group_icons(EmojiGroupType group_type, EmojiGroupList group_list);
|
|
|
|
|
2023-01-25 14:23:34 +01:00
|
|
|
void reload_emoji_groups(EmojiGroupType group_type, string used_language_codes);
|
|
|
|
|
2023-01-24 19:38:53 +01:00
|
|
|
void on_get_emoji_groups(EmojiGroupType group_type, string used_language_codes,
|
|
|
|
Result<telegram_api::object_ptr<telegram_api::messages_EmojiGroups>> r_emoji_groups);
|
2023-01-24 16:11:02 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
2020-06-04 00:19:37 +02:00
|
|
|
|
|
|
|
bool is_inited_ = false;
|
|
|
|
|
2023-06-19 16:48:12 +02:00
|
|
|
WaitFreeHashMap<FileId, unique_ptr<Sticker>, FileIdHash> stickers_;
|
2023-01-16 10:59:43 +01:00
|
|
|
WaitFreeHashMap<StickerSetId, unique_ptr<StickerSet>, StickerSetIdHash>
|
|
|
|
sticker_sets_; // sticker_set_id -> StickerSet
|
2022-08-03 21:42:52 +02:00
|
|
|
WaitFreeHashMap<string, StickerSetId> short_name_to_sticker_set_id_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
vector<StickerSetId> installed_sticker_set_ids_[MAX_STICKER_TYPE];
|
2022-07-17 21:39:22 +02:00
|
|
|
vector<StickerSetId> featured_sticker_set_ids_[MAX_STICKER_TYPE];
|
|
|
|
vector<StickerSetId> old_featured_sticker_set_ids_[MAX_STICKER_TYPE];
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<FileId> recent_sticker_ids_[2];
|
|
|
|
vector<FileId> favorite_sticker_ids_;
|
|
|
|
|
2022-07-14 15:42:27 +02:00
|
|
|
double next_installed_sticker_sets_load_time_[MAX_STICKER_TYPE] = {0, 0, 0};
|
2022-07-17 21:39:22 +02:00
|
|
|
double next_featured_sticker_sets_load_time_[MAX_STICKER_TYPE] = {0, 0, 0};
|
2020-11-23 18:33:35 +01:00
|
|
|
double next_recent_stickers_load_time_[2] = {0, 0};
|
|
|
|
double next_favorite_stickers_load_time_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:42:27 +02:00
|
|
|
int64 installed_sticker_sets_hash_[MAX_STICKER_TYPE] = {0, 0, 0};
|
2022-07-17 21:39:22 +02:00
|
|
|
int64 featured_sticker_sets_hash_[MAX_STICKER_TYPE] = {0, 0, 0};
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 recent_stickers_hash_[2] = {0, 0};
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
int32 old_featured_sticker_set_count_[MAX_STICKER_TYPE] = {-1, 0, 0};
|
|
|
|
uint32 old_featured_sticker_set_generation_[MAX_STICKER_TYPE] = {1, 0, 0};
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-14 15:42:27 +02:00
|
|
|
bool need_update_installed_sticker_sets_[MAX_STICKER_TYPE] = {false, false, false};
|
2022-07-17 21:39:22 +02:00
|
|
|
bool need_update_featured_sticker_sets_[MAX_STICKER_TYPE] = {false, false, false};
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:42:27 +02:00
|
|
|
bool are_installed_sticker_sets_loaded_[MAX_STICKER_TYPE] = {false, false, false};
|
2022-07-17 21:39:22 +02:00
|
|
|
bool are_featured_sticker_sets_loaded_[MAX_STICKER_TYPE] = {false, true, false};
|
2018-12-31 20:04:05 +01:00
|
|
|
bool are_recent_stickers_loaded_[2] = {false, false};
|
|
|
|
bool are_favorite_stickers_loaded_ = false;
|
|
|
|
|
2022-07-17 21:39:22 +02:00
|
|
|
bool are_featured_sticker_sets_premium_[MAX_STICKER_TYPE] = {false, false, false};
|
|
|
|
bool are_old_featured_sticker_sets_invalidated_[MAX_STICKER_TYPE] = {false, false, false};
|
2020-04-18 00:55:54 +02:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
vector<Promise<Unit>> load_installed_sticker_sets_queries_[MAX_STICKER_TYPE];
|
2022-07-17 21:39:22 +02:00
|
|
|
vector<Promise<Unit>> load_featured_sticker_sets_queries_[MAX_STICKER_TYPE];
|
2020-04-18 00:55:54 +02:00
|
|
|
vector<Promise<Unit>> load_old_featured_sticker_sets_queries_;
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Promise<Unit>> load_recent_stickers_queries_[2];
|
2019-02-02 11:54:40 +01:00
|
|
|
vector<Promise<Unit>> repair_recent_stickers_queries_[2];
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Promise<Unit>> load_favorite_stickers_queries_;
|
2019-02-02 11:54:40 +01:00
|
|
|
vector<Promise<Unit>> repair_favorite_stickers_queries_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-12-21 15:07:21 +01:00
|
|
|
struct StickerSetReloadQueries {
|
|
|
|
vector<Promise<Unit>> sent_promises_;
|
|
|
|
int32 sent_hash_ = 0;
|
|
|
|
vector<Promise<Unit>> pending_promises_;
|
|
|
|
int32 pending_hash_ = 0;
|
|
|
|
};
|
|
|
|
FlatHashMap<StickerSetId, unique_ptr<StickerSetReloadQueries>, StickerSetIdHash> sticker_set_reload_queries_;
|
|
|
|
|
2019-02-02 11:54:40 +01:00
|
|
|
vector<FileId> recent_sticker_file_ids_[2];
|
|
|
|
FileSourceId recent_stickers_file_source_id_[2];
|
|
|
|
vector<FileId> favorite_sticker_file_ids_;
|
|
|
|
FileSourceId favorite_stickers_file_source_id_;
|
2019-02-02 11:30:49 +01:00
|
|
|
|
2021-10-08 12:41:22 +02:00
|
|
|
FileSourceId app_config_file_source_id_;
|
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
vector<StickerSetId> archived_sticker_set_ids_[MAX_STICKER_TYPE];
|
2022-07-14 15:42:27 +02:00
|
|
|
int32 total_archived_sticker_set_count_[MAX_STICKER_TYPE] = {-1, -1, -1};
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<FileId, vector<StickerSetId>, FileIdHash> attached_sticker_sets_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-07-14 15:17:19 +02:00
|
|
|
Hints installed_sticker_sets_hints_[MAX_STICKER_TYPE]; // search installed sticker sets by their title and name
|
2018-03-05 23:44:11 +01:00
|
|
|
|
2023-01-23 19:07:42 +01:00
|
|
|
FlatHashMap<string, FoundStickers> found_stickers_[MAX_STICKER_TYPE];
|
|
|
|
FlatHashMap<string, vector<std::pair<int32, Promise<td_api::object_ptr<td_api::stickers>>>>>
|
|
|
|
search_stickers_queries_[MAX_STICKER_TYPE];
|
2018-03-09 18:04:44 +01:00
|
|
|
|
2023-11-10 10:48:30 +01:00
|
|
|
std::unordered_map<string, vector<StickerSetId>, Hash<string>> found_sticker_sets_[MAX_STICKER_TYPE];
|
|
|
|
std::unordered_map<string, vector<Promise<Unit>>, Hash<string>> search_sticker_sets_queries_[MAX_STICKER_TYPE];
|
2018-03-05 23:44:11 +01:00
|
|
|
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<StickerSetId, StickerSetIdHash> pending_viewed_featured_sticker_set_ids_;
|
2018-12-31 20:04:05 +01:00
|
|
|
Timeout pending_featured_sticker_set_views_timeout_;
|
|
|
|
|
2018-03-08 14:49:45 +01:00
|
|
|
int32 recent_stickers_limit_ = 200;
|
|
|
|
int32 favorite_stickers_limit_ = 5;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-11 17:27:32 +01:00
|
|
|
FlatHashMap<SpecialStickerSetType, unique_ptr<SpecialStickerSet>, SpecialStickerSetTypeHash> special_sticker_sets_;
|
2019-11-21 20:18:29 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
struct StickerSetLoadRequest {
|
2022-08-07 18:47:50 +02:00
|
|
|
Promise<Unit> promise_;
|
|
|
|
Status error_;
|
|
|
|
size_t left_queries_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<uint32, StickerSetLoadRequest> sticker_set_load_requests_;
|
2018-12-31 20:04:05 +01:00
|
|
|
uint32 current_sticker_set_load_request_ = 0;
|
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
FlatHashMap<CustomEmojiId, vector<Promise<Unit>>, CustomEmojiIdHash> custom_emoji_load_queries_;
|
2022-07-25 22:04:53 +02:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, unique_ptr<PendingNewStickerSet>> pending_new_sticker_sets_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, unique_ptr<PendingAddStickerToSet>> pending_add_sticker_to_sets_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, unique_ptr<PendingSetStickerSetThumbnail>> pending_set_sticker_set_thumbnails_;
|
2020-03-20 14:36:07 +01:00
|
|
|
|
2021-10-26 16:59:15 +02:00
|
|
|
vector<Promise<Unit>> pending_get_animated_emoji_queries_;
|
2022-07-15 15:15:59 +02:00
|
|
|
vector<Promise<Unit>> pending_get_premium_gift_option_sticker_queries_;
|
2022-09-12 14:44:37 +02:00
|
|
|
vector<Promise<Unit>> pending_get_generic_animations_queries_;
|
2022-09-02 14:02:37 +02:00
|
|
|
vector<Promise<Unit>> pending_get_default_statuses_queries_;
|
2023-12-21 20:44:59 +01:00
|
|
|
vector<Promise<Unit>> pending_get_default_channel_statuses_queries_;
|
2022-10-27 09:06:13 +02:00
|
|
|
vector<Promise<Unit>> pending_get_default_topic_icons_queries_;
|
2022-09-02 14:02:37 +02:00
|
|
|
|
2021-09-24 15:53:42 +02:00
|
|
|
double next_click_animated_emoji_message_time_ = 0;
|
|
|
|
double next_update_animated_emoji_clicked_time_ = 0;
|
2021-09-15 23:41:40 +02:00
|
|
|
vector<PendingGetAnimatedEmojiClickSticker> pending_get_animated_emoji_click_stickers_;
|
2021-09-17 14:51:42 +02:00
|
|
|
vector<PendingOnAnimatedEmojiClicked> pending_on_animated_emoji_message_clicked_;
|
2021-09-15 23:41:40 +02:00
|
|
|
|
2021-09-16 22:22:34 +02:00
|
|
|
string last_clicked_animated_emoji_;
|
2023-09-21 18:11:17 +02:00
|
|
|
MessageFullId last_clicked_animated_emoji_message_full_id_;
|
2021-09-16 22:22:34 +02:00
|
|
|
std::vector<std::pair<int, double>> pending_animated_emoji_clicks_;
|
|
|
|
|
2021-09-19 00:52:56 +02:00
|
|
|
struct SentAnimatedEmojiClicks {
|
2022-08-07 18:47:50 +02:00
|
|
|
double send_time_ = 0.0;
|
|
|
|
DialogId dialog_id_;
|
|
|
|
string emoji_;
|
2021-09-19 00:52:56 +02:00
|
|
|
};
|
|
|
|
std::vector<SentAnimatedEmojiClicks> sent_animated_emoji_clicks_;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
std::shared_ptr<UploadStickerFileCallback> upload_sticker_file_callback_;
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<FileId, std::pair<UserId, Promise<Unit>>, FileIdHash> being_uploaded_files_;
|
2019-05-21 17:48:35 +02:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<string, vector<string>> emoji_language_codes_;
|
|
|
|
FlatHashMap<string, int32> emoji_language_code_versions_;
|
|
|
|
FlatHashMap<string, double> emoji_language_code_last_difference_times_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<string> reloaded_emoji_keywords_;
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<string, vector<Promise<Unit>>> load_emoji_keywords_queries_;
|
|
|
|
FlatHashMap<string, vector<Promise<Unit>>> load_language_codes_queries_;
|
|
|
|
FlatHashMap<int64, string> emoji_suggestions_urls_;
|
2020-04-19 10:17:51 +02:00
|
|
|
|
2022-07-22 14:01:44 +02:00
|
|
|
struct GiftPremiumMessages {
|
2023-09-21 18:11:17 +02:00
|
|
|
FlatHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
2022-08-07 18:47:50 +02:00
|
|
|
FileId sticker_id_;
|
2022-07-22 14:01:44 +02:00
|
|
|
};
|
|
|
|
FlatHashMap<int32, unique_ptr<GiftPremiumMessages>> premium_gift_messages_;
|
2022-07-22 12:30:24 +02:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
FlatHashMap<string, WaitFreeHashSet<MessageFullId, MessageFullIdHash>> dice_messages_;
|
2024-06-17 23:28:54 +02:00
|
|
|
FlatHashMap<string, WaitFreeHashSet<QuickReplyMessageFullId, QuickReplyMessageFullIdHash>> dice_quick_reply_messages_;
|
2021-10-05 17:06:05 +02:00
|
|
|
|
|
|
|
struct EmojiMessages {
|
2023-09-21 18:11:17 +02:00
|
|
|
WaitFreeHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
2024-06-17 22:55:19 +02:00
|
|
|
WaitFreeHashSet<QuickReplyMessageFullId, QuickReplyMessageFullIdHash> quick_reply_message_full_ids_;
|
2022-08-07 18:47:50 +02:00
|
|
|
std::pair<FileId, int> animated_emoji_sticker_;
|
|
|
|
FileId sound_file_id_;
|
2021-10-05 17:06:05 +02:00
|
|
|
};
|
2022-02-11 17:27:32 +01:00
|
|
|
FlatHashMap<string, unique_ptr<EmojiMessages>> emoji_messages_;
|
2020-04-19 23:41:26 +02:00
|
|
|
|
2022-08-05 19:49:24 +02:00
|
|
|
struct CustomEmojiMessages {
|
2023-09-21 18:11:17 +02:00
|
|
|
WaitFreeHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
2024-06-17 22:55:19 +02:00
|
|
|
WaitFreeHashSet<QuickReplyMessageFullId, QuickReplyMessageFullIdHash> quick_reply_message_full_ids_;
|
2022-08-07 18:47:50 +02:00
|
|
|
FileId sticker_id_;
|
2022-08-05 19:49:24 +02:00
|
|
|
};
|
2022-10-03 00:26:32 +02:00
|
|
|
FlatHashMap<CustomEmojiId, unique_ptr<CustomEmojiMessages>, CustomEmojiIdHash> custom_emoji_messages_;
|
2022-08-05 19:49:24 +02:00
|
|
|
|
2020-04-19 15:30:04 +02:00
|
|
|
string dice_emojis_str_;
|
|
|
|
vector<string> dice_emojis_;
|
2020-04-21 13:51:46 +02:00
|
|
|
|
|
|
|
string dice_success_values_str_;
|
2020-04-21 18:08:01 +02:00
|
|
|
vector<std::pair<int32, int32>> dice_success_values_;
|
2021-10-05 16:17:29 +02:00
|
|
|
|
2021-10-05 22:20:49 +02:00
|
|
|
string emoji_sounds_str_;
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<string, FileId> emoji_sounds_;
|
2021-10-05 22:20:49 +02:00
|
|
|
|
2023-01-24 19:38:53 +01:00
|
|
|
EmojiGroupList emoji_group_list_[MAX_EMOJI_GROUP_TYPE];
|
|
|
|
vector<Promise<td_api::object_ptr<td_api::emojiCategories>>> emoji_group_load_queries_[MAX_EMOJI_GROUP_TYPE];
|
2023-01-24 16:11:02 +01:00
|
|
|
|
2023-10-19 14:12:26 +02:00
|
|
|
vector<CustomEmojiId> default_custom_emoji_ids_[MAX_STICKER_LIST_TYPE];
|
2023-12-24 00:30:49 +01:00
|
|
|
int64 default_custom_emoji_ids_hash_[MAX_STICKER_LIST_TYPE] = {0, 0, 0, 0};
|
2023-10-19 14:12:26 +02:00
|
|
|
vector<Promise<td_api::object_ptr<td_api::stickers>>> default_custom_emoji_ids_load_queries_[MAX_STICKER_LIST_TYPE];
|
2023-12-24 00:30:49 +01:00
|
|
|
vector<Promise<td_api::object_ptr<td_api::emojiStatuses>>>
|
|
|
|
default_emoji_statuses_load_queries_[MAX_STICKER_LIST_TYPE];
|
|
|
|
bool are_default_custom_emoji_ids_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false, false};
|
|
|
|
bool are_default_custom_emoji_ids_being_loaded_[MAX_STICKER_LIST_TYPE] = {false, false, false, false};
|
2023-01-10 13:23:07 +01:00
|
|
|
|
2022-10-03 00:26:32 +02:00
|
|
|
WaitFreeHashMap<CustomEmojiId, FileId, CustomEmojiIdHash> custom_emoji_to_sticker_id_;
|
2022-07-22 18:06:39 +02:00
|
|
|
|
2024-01-24 13:24:16 +01:00
|
|
|
double animated_emoji_zoom_ = 0.625;
|
2021-10-13 23:18:44 +02:00
|
|
|
|
2021-10-05 16:17:29 +02:00
|
|
|
bool disable_animated_emojis_ = false;
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|