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
|
|
|
|
|
2023-10-17 13:23:42 +02:00
|
|
|
#include "td/telegram/AccentColorId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/AccessRights.h"
|
2021-06-21 01:08:11 +02:00
|
|
|
#include "td/telegram/BotCommand.h"
|
2022-04-07 16:20:26 +02:00
|
|
|
#include "td/telegram/BotMenuButton.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/ChannelId.h"
|
2022-04-04 14:35:09 +02:00
|
|
|
#include "td/telegram/ChannelType.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/ChatId.h"
|
|
|
|
#include "td/telegram/Contact.h"
|
2023-10-18 14:59:25 +02:00
|
|
|
#include "td/telegram/CustomEmojiId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/DialogId.h"
|
2021-02-12 14:53:40 +01:00
|
|
|
#include "td/telegram/DialogInviteLink.h"
|
|
|
|
#include "td/telegram/DialogLocation.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/DialogParticipant.h"
|
2022-03-19 19:37:46 +01:00
|
|
|
#include "td/telegram/DialogParticipantFilter.h"
|
2022-08-30 15:02:25 +02:00
|
|
|
#include "td/telegram/EmojiStatus.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/files/FileId.h"
|
2019-01-20 04:34:47 +01:00
|
|
|
#include "td/telegram/files/FileSourceId.h"
|
2020-06-30 11:11:22 +02:00
|
|
|
#include "td/telegram/FolderId.h"
|
2019-10-16 20:55:16 +02:00
|
|
|
#include "td/telegram/Location.h"
|
2023-09-21 18:11:17 +02:00
|
|
|
#include "td/telegram/MessageFullId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/MessageId.h"
|
2024-01-10 15:09:09 +01:00
|
|
|
#include "td/telegram/MessageTtl.h"
|
2020-03-13 23:56:47 +01:00
|
|
|
#include "td/telegram/net/DcId.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/Photo.h"
|
2022-07-01 14:57:38 +02:00
|
|
|
#include "td/telegram/PremiumGiftOption.h"
|
2019-10-22 12:40:24 +02:00
|
|
|
#include "td/telegram/PublicDialogType.h"
|
2019-02-25 04:08:18 +01:00
|
|
|
#include "td/telegram/QueryCombiner.h"
|
2023-01-13 12:29:47 +01:00
|
|
|
#include "td/telegram/QueryMerger.h"
|
2021-02-12 14:53:40 +01:00
|
|
|
#include "td/telegram/RestrictionReason.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/SecretChatId.h"
|
2019-09-18 05:55:43 +02:00
|
|
|
#include "td/telegram/StickerSetId.h"
|
2023-07-07 17:06:14 +02:00
|
|
|
#include "td/telegram/StoryId.h"
|
2021-02-22 16:06:18 +01:00
|
|
|
#include "td/telegram/SuggestedAction.h"
|
2021-09-18 23:47:05 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/UserId.h"
|
2022-10-12 20:04:18 +02:00
|
|
|
#include "td/telegram/Usernames.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-01-06 20:11:02 +01:00
|
|
|
#include "td/actor/actor.h"
|
|
|
|
#include "td/actor/MultiPromise.h"
|
2022-07-02 22:32:18 +02:00
|
|
|
#include "td/actor/MultiTimeout.h"
|
2019-01-06 20:11:02 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
#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-12-31 20:04:05 +01:00
|
|
|
#include "td/utils/Hints.h"
|
2022-06-27 12:30:18 +02:00
|
|
|
#include "td/utils/Promise.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/utils/Status.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
2021-02-25 13:56:26 +01:00
|
|
|
#include "td/utils/Time.h"
|
2022-08-04 15:18:41 +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
|
|
|
|
2019-01-31 03:05:40 +01:00
|
|
|
#include <functional>
|
2018-12-31 20:04:05 +01:00
|
|
|
#include <memory>
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2019-01-06 20:11:02 +01:00
|
|
|
struct BinlogEvent;
|
|
|
|
|
2022-03-19 19:53:33 +01:00
|
|
|
class ChannelParticipantFilter;
|
|
|
|
|
2021-12-22 14:09:34 +01:00
|
|
|
struct MinChannel;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
class Td;
|
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class ContactsManager final : public Actor {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
|
|
|
ContactsManager(Td *td, ActorShared<> parent);
|
2021-01-16 17:23:57 +01:00
|
|
|
ContactsManager(const ContactsManager &) = delete;
|
|
|
|
ContactsManager &operator=(const ContactsManager &) = delete;
|
|
|
|
ContactsManager(ContactsManager &&) = delete;
|
|
|
|
ContactsManager &operator=(ContactsManager &&) = delete;
|
2021-07-03 22:51:36 +02:00
|
|
|
~ContactsManager() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-03-08 22:42:25 +01:00
|
|
|
static UserId load_my_id();
|
|
|
|
|
2018-02-28 23:08:45 +01:00
|
|
|
static UserId get_user_id(const tl_object_ptr<telegram_api::User> &user);
|
|
|
|
static ChatId get_chat_id(const tl_object_ptr<telegram_api::Chat> &chat);
|
|
|
|
static ChannelId get_channel_id(const tl_object_ptr<telegram_api::Chat> &chat);
|
2022-04-30 20:13:01 +02:00
|
|
|
static DialogId get_dialog_id(const tl_object_ptr<telegram_api::Chat> &chat);
|
2018-02-28 23:08:45 +01:00
|
|
|
|
2023-09-14 17:59:30 +02:00
|
|
|
vector<ChannelId> get_channel_ids(vector<tl_object_ptr<telegram_api::Chat>> &&chats, const char *source);
|
|
|
|
|
2021-12-16 20:46:03 +01:00
|
|
|
Result<tl_object_ptr<telegram_api::InputUser>> get_input_user(UserId user_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-03-22 16:18:35 +01:00
|
|
|
tl_object_ptr<telegram_api::InputUser> get_input_user_force(UserId user_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
// TODO get_input_chat ???
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::InputChannel> get_input_channel(ChannelId channel_id) const;
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::InputPeer> get_input_peer_user(UserId user_id, AccessRights access_rights) const;
|
|
|
|
bool have_input_peer_user(UserId user_id, AccessRights access_rights) const;
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::InputPeer> get_input_peer_chat(ChatId chat_id, AccessRights access_rights) const;
|
|
|
|
bool have_input_peer_chat(ChatId chat_id, AccessRights access_rights) const;
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::InputPeer> get_input_peer_channel(ChannelId channel_id, AccessRights access_rights) const;
|
|
|
|
bool have_input_peer_channel(ChannelId channel_id, AccessRights access_rights) const;
|
|
|
|
|
|
|
|
tl_object_ptr<telegram_api::inputEncryptedChat> get_input_encrypted_chat(SecretChatId secret_chat_id,
|
|
|
|
AccessRights access_rights) const;
|
|
|
|
bool have_input_encrypted_peer(SecretChatId secret_chat_id, AccessRights access_rights) const;
|
|
|
|
|
2018-06-08 16:13:54 +02:00
|
|
|
const DialogPhoto *get_user_dialog_photo(UserId user_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
const DialogPhoto *get_chat_dialog_photo(ChatId chat_id) const;
|
|
|
|
const DialogPhoto *get_channel_dialog_photo(ChannelId channel_id) const;
|
2018-06-08 16:13:54 +02:00
|
|
|
const DialogPhoto *get_secret_chat_dialog_photo(SecretChatId secret_chat_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-10-17 14:09:57 +02:00
|
|
|
AccentColorId get_channel_accent_color_id(ChannelId channel_id) const;
|
2023-11-02 20:32:59 +01:00
|
|
|
|
|
|
|
int32 get_user_accent_color_id_object(UserId user_id) const;
|
|
|
|
int32 get_chat_accent_color_id_object(ChatId chat_id) const;
|
|
|
|
int32 get_channel_accent_color_id_object(ChannelId channel_id) const;
|
|
|
|
int32 get_secret_chat_accent_color_id_object(SecretChatId secret_chat_id) const;
|
2023-10-17 14:09:57 +02:00
|
|
|
|
2023-10-18 14:59:25 +02:00
|
|
|
CustomEmojiId get_user_background_custom_emoji_id(UserId user_id) const;
|
|
|
|
CustomEmojiId get_chat_background_custom_emoji_id(ChatId chat_id) const;
|
|
|
|
CustomEmojiId get_channel_background_custom_emoji_id(ChannelId channel_id) const;
|
|
|
|
CustomEmojiId get_secret_chat_background_custom_emoji_id(SecretChatId secret_chat_id) const;
|
|
|
|
|
2023-12-17 20:54:55 +01:00
|
|
|
int32 get_user_profile_accent_color_id_object(UserId user_id) const;
|
|
|
|
int32 get_chat_profile_accent_color_id_object(ChatId chat_id) const;
|
|
|
|
int32 get_channel_profile_accent_color_id_object(ChannelId channel_id) const;
|
|
|
|
int32 get_secret_chat_profile_accent_color_id_object(SecretChatId secret_chat_id) const;
|
|
|
|
|
|
|
|
CustomEmojiId get_user_profile_background_custom_emoji_id(UserId user_id) const;
|
|
|
|
CustomEmojiId get_chat_profile_background_custom_emoji_id(ChatId chat_id) const;
|
|
|
|
CustomEmojiId get_channel_profile_background_custom_emoji_id(ChannelId channel_id) const;
|
|
|
|
CustomEmojiId get_secret_chat_profile_background_custom_emoji_id(SecretChatId secret_chat_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
string get_user_title(UserId user_id) const;
|
|
|
|
string get_chat_title(ChatId chat_id) const;
|
|
|
|
string get_channel_title(ChannelId channel_id) const;
|
|
|
|
string get_secret_chat_title(SecretChatId secret_chat_id) const;
|
|
|
|
|
2019-03-20 13:28:06 +01:00
|
|
|
RestrictedRights get_user_default_permissions(UserId user_id) const;
|
|
|
|
RestrictedRights get_chat_default_permissions(ChatId chat_id) const;
|
|
|
|
RestrictedRights get_channel_default_permissions(ChannelId channel_id) const;
|
|
|
|
RestrictedRights get_secret_chat_default_permissions(SecretChatId secret_chat_id) const;
|
|
|
|
|
2023-12-21 18:01:26 +01:00
|
|
|
td_api::object_ptr<td_api::emojiStatus> get_user_emoji_status_object(UserId user_id) const;
|
|
|
|
td_api::object_ptr<td_api::emojiStatus> get_chat_emoji_status_object(ChatId chat_id) const;
|
|
|
|
td_api::object_ptr<td_api::emojiStatus> get_channel_emoji_status_object(ChannelId channel_id) const;
|
|
|
|
td_api::object_ptr<td_api::emojiStatus> get_secret_chat_emoji_status_object(SecretChatId secret_chat_id) const;
|
|
|
|
|
2021-12-06 19:43:55 +01:00
|
|
|
bool get_chat_has_protected_content(ChatId chat_id) const;
|
|
|
|
bool get_channel_has_protected_content(ChannelId channel_id) const;
|
2021-11-24 18:03:38 +01:00
|
|
|
|
2023-06-28 15:09:44 +02:00
|
|
|
bool get_user_stories_hidden(UserId user_id) const;
|
2023-09-05 17:17:45 +02:00
|
|
|
bool get_channel_stories_hidden(ChannelId channel_id) const;
|
2023-06-28 15:09:44 +02:00
|
|
|
|
2021-11-22 09:17:28 +01:00
|
|
|
string get_user_private_forward_name(UserId user_id);
|
2024-01-09 12:56:32 +01:00
|
|
|
|
2022-07-17 16:15:15 +02:00
|
|
|
bool get_user_voice_messages_forbidden(UserId user_id) const;
|
2021-11-22 09:17:28 +01:00
|
|
|
|
2024-01-09 12:56:32 +01:00
|
|
|
bool get_user_read_dates_private(UserId user_id);
|
|
|
|
|
2021-03-06 23:54:45 +01:00
|
|
|
string get_dialog_about(DialogId dialog_id);
|
|
|
|
|
2022-10-11 19:35:35 +02:00
|
|
|
string get_dialog_search_text(DialogId dialog_id) const;
|
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
void for_each_secret_chat_with_user(UserId user_id, const std::function<void(SecretChatId)> &f);
|
2019-12-18 22:31:01 +01:00
|
|
|
|
2022-10-12 20:04:18 +02:00
|
|
|
string get_user_first_username(UserId user_id) const;
|
|
|
|
string get_channel_first_username(ChannelId channel_id) const;
|
2024-01-08 17:14:41 +01:00
|
|
|
string get_channel_editable_username(ChannelId channel_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
int32 get_secret_chat_date(SecretChatId secret_chat_id) const;
|
|
|
|
int32 get_secret_chat_ttl(SecretChatId secret_chat_id) const;
|
|
|
|
UserId get_secret_chat_user_id(SecretChatId secret_chat_id) const;
|
2018-12-04 17:40:12 +01:00
|
|
|
bool get_secret_chat_is_outbound(SecretChatId secret_chat_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
SecretChatState get_secret_chat_state(SecretChatId secret_chat_id) const;
|
|
|
|
int32 get_secret_chat_layer(SecretChatId secret_chat_id) const;
|
2020-06-30 11:11:22 +02:00
|
|
|
FolderId get_secret_chat_initial_folder_id(SecretChatId secret_chat_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-19 20:14:03 +01:00
|
|
|
void can_send_message_to_user(UserId user_id, bool force,
|
|
|
|
Promise<td_api::object_ptr<td_api::CanSendMessageToUserResult>> &&promise);
|
2024-01-19 13:35:57 +01:00
|
|
|
|
2024-01-25 18:56:10 +01:00
|
|
|
void allow_send_message_to_user(UserId user_id);
|
|
|
|
|
2021-11-12 05:37:53 +01:00
|
|
|
void on_imported_contacts(int64 random_id, Result<tl_object_ptr<telegram_api::contacts_importedContacts>> result);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_deleted_contacts(const vector<UserId> &deleted_contact_user_ids);
|
|
|
|
|
|
|
|
void on_get_contacts(tl_object_ptr<telegram_api::contacts_Contacts> &&new_contacts);
|
|
|
|
|
|
|
|
void on_get_contacts_failed(Status error);
|
|
|
|
|
|
|
|
void on_get_contacts_statuses(vector<tl_object_ptr<telegram_api::contactStatus>> &&statuses);
|
|
|
|
|
|
|
|
void reload_contacts(bool force);
|
|
|
|
|
2023-06-23 17:22:58 +02:00
|
|
|
void on_get_user(tl_object_ptr<telegram_api::User> &&user, const char *source);
|
2019-01-12 04:48:39 +01:00
|
|
|
void on_get_users(vector<tl_object_ptr<telegram_api::User>> &&users, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-19 19:55:24 +01:00
|
|
|
void on_get_is_premium_required_to_contact_users(vector<UserId> &&user_ids, vector<bool> &&is_premium_required,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_binlog_user_event(BinlogEvent &&event);
|
|
|
|
void on_binlog_chat_event(BinlogEvent &&event);
|
|
|
|
void on_binlog_channel_event(BinlogEvent &&event);
|
|
|
|
void on_binlog_secret_chat_event(BinlogEvent &&event);
|
|
|
|
|
2021-02-20 20:20:02 +01:00
|
|
|
void on_get_user_full(tl_object_ptr<telegram_api::userFull> &&user);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_get_user_photos(UserId user_id, int32 offset, int32 limit, int32 total_count,
|
|
|
|
vector<tl_object_ptr<telegram_api::Photo>> photos);
|
|
|
|
|
2019-01-12 04:48:39 +01:00
|
|
|
void on_get_chat(tl_object_ptr<telegram_api::Chat> &&chat, const char *source);
|
|
|
|
void on_get_chats(vector<tl_object_ptr<telegram_api::Chat>> &&chats, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-11-11 20:07:12 +01:00
|
|
|
void on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&chat_full, Promise<Unit> &&promise);
|
2021-04-12 03:20:43 +02:00
|
|
|
void on_get_chat_full_failed(ChatId chat_id);
|
|
|
|
void on_get_channel_full_failed(ChannelId channel_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_update_profile_success(int32 flags, const string &first_name, const string &last_name, const string &about);
|
2023-12-17 21:12:03 +01:00
|
|
|
void on_update_accent_color_success(bool for_profile, AccentColorId accent_color_id,
|
|
|
|
CustomEmojiId background_custom_emoji_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-10-12 20:04:18 +02:00
|
|
|
void on_update_user_name(UserId user_id, string &&first_name, string &&last_name, Usernames &&usernames);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_user_phone_number(UserId user_id, string &&phone_number);
|
2022-08-30 15:02:25 +02:00
|
|
|
void on_update_user_emoji_status(UserId user_id, tl_object_ptr<telegram_api::EmojiStatus> &&emoji_status);
|
2023-08-11 12:12:46 +02:00
|
|
|
void on_update_user_story_ids(UserId user_id, StoryId max_active_story_id, StoryId max_read_story_id);
|
2023-07-07 17:35:47 +02:00
|
|
|
void on_update_user_max_read_story_id(UserId user_id, StoryId max_read_story_id);
|
2023-06-05 15:07:44 +02:00
|
|
|
void on_update_user_stories_hidden(UserId user_id, bool stories_hidden);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_user_online(UserId user_id, tl_object_ptr<telegram_api::UserStatus> &&status);
|
2019-03-15 00:29:36 +01:00
|
|
|
void on_update_user_local_was_online(UserId user_id, int32 local_was_online);
|
2023-12-25 15:30:26 +01:00
|
|
|
// use on_update_dialog_is_blocked instead
|
2023-07-28 15:19:05 +02:00
|
|
|
void on_update_user_is_blocked(UserId user_id, bool is_blocked, bool is_blocked_for_stories);
|
2023-06-15 19:53:58 +02:00
|
|
|
void on_update_user_has_pinned_stories(UserId user_id, bool has_pinned_stories);
|
2019-04-01 21:38:17 +02:00
|
|
|
void on_update_user_common_chat_count(UserId user_id, int32 common_chat_count);
|
2019-10-10 23:18:34 +02:00
|
|
|
void on_update_user_need_phone_number_privacy_exception(UserId user_id, bool need_phone_number_privacy_exception);
|
2023-11-23 21:08:53 +01:00
|
|
|
void on_update_user_wallpaper_overridden(UserId user_id, bool wallpaper_overridden);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-12-15 15:44:26 +01:00
|
|
|
void on_set_profile_photo(UserId user_id, tl_object_ptr<telegram_api::photos_photo> &&photo, bool is_fallback,
|
2023-04-06 23:53:13 +02:00
|
|
|
int64 old_photo_id, Promise<Unit> &&promise);
|
2022-12-13 12:16:49 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_delete_profile_photo(int64 profile_photo_id, Promise<Unit> promise);
|
|
|
|
|
2019-12-20 14:11:58 +01:00
|
|
|
void on_ignored_restriction_reasons_changed();
|
|
|
|
|
2019-06-12 23:21:30 +02:00
|
|
|
void on_get_chat_participants(tl_object_ptr<telegram_api::ChatParticipants> &&participants, bool from_update);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_chat_add_user(ChatId chat_id, UserId inviter_user_id, UserId user_id, int32 date, int32 version);
|
2019-03-18 03:24:25 +01:00
|
|
|
void on_update_chat_description(ChatId chat_id, string &&description);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_chat_edit_administrator(ChatId chat_id, UserId user_id, bool is_administrator, int32 version);
|
|
|
|
void on_update_chat_delete_user(ChatId chat_id, UserId user_id, int32 version);
|
2019-03-20 14:32:27 +01:00
|
|
|
void on_update_chat_default_permissions(ChatId chat_id, RestrictedRights default_permissions, int32 version);
|
2019-05-12 20:19:03 +02:00
|
|
|
void on_update_chat_pinned_message(ChatId chat_id, MessageId pinned_message_id, int32 version);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-21 13:05:40 +02:00
|
|
|
void on_update_channel_participant_count(ChannelId channel_id, int32 participant_count);
|
2022-10-17 12:12:02 +02:00
|
|
|
void on_update_channel_editable_username(ChannelId channel_id, string &&username);
|
2022-10-12 20:04:18 +02:00
|
|
|
void on_update_channel_usernames(ChannelId channel_id, Usernames &&usernames);
|
2023-09-05 15:50:41 +02:00
|
|
|
void on_update_channel_story_ids(ChannelId channel_id, StoryId max_active_story_id, StoryId max_read_story_id);
|
|
|
|
void on_update_channel_max_read_story_id(ChannelId channel_id, StoryId max_read_story_id);
|
2023-09-05 17:17:45 +02:00
|
|
|
void on_update_channel_stories_hidden(ChannelId channel_id, bool stories_hidden);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_channel_description(ChannelId channel_id, string &&description);
|
2019-09-18 05:55:43 +02:00
|
|
|
void on_update_channel_sticker_set(ChannelId channel_id, StickerSetId sticker_set_id);
|
2019-09-14 04:35:56 +02:00
|
|
|
void on_update_channel_linked_channel_id(ChannelId channel_id, ChannelId group_channel_id);
|
2019-10-14 18:07:31 +02:00
|
|
|
void on_update_channel_location(ChannelId channel_id, const DialogLocation &location);
|
2020-12-21 20:06:52 +01:00
|
|
|
void on_update_channel_slow_mode_delay(ChannelId channel_id, int32 slow_mode_delay, Promise<Unit> &&promise);
|
2019-11-21 00:41:53 +01:00
|
|
|
void on_update_channel_slow_mode_next_send_date(ChannelId channel_id, int32 slow_mode_next_send_date);
|
2020-12-21 20:06:52 +01:00
|
|
|
void on_update_channel_is_all_history_available(ChannelId channel_id, bool is_all_history_available,
|
|
|
|
Promise<Unit> &&promise);
|
2022-12-20 13:51:37 +01:00
|
|
|
void on_update_channel_has_hidden_participants(ChannelId channel_id, bool has_hidden_participants,
|
|
|
|
Promise<Unit> &&promise);
|
2022-12-27 17:14:37 +01:00
|
|
|
void on_update_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id, bool has_aggressive_anti_spam_enabled,
|
|
|
|
Promise<Unit> &&promise);
|
2023-09-05 17:34:06 +02:00
|
|
|
void on_update_channel_has_pinned_stories(ChannelId channel_id, bool has_pinned_stories);
|
2019-03-20 14:32:27 +01:00
|
|
|
void on_update_channel_default_permissions(ChannelId channel_id, RestrictedRights default_permissions);
|
2019-11-11 17:14:32 +01:00
|
|
|
void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count);
|
2021-02-19 00:16:50 +01:00
|
|
|
|
2020-02-14 13:44:56 +01:00
|
|
|
int32 on_update_peer_located(vector<tl_object_ptr<telegram_api::PeerLocated>> &&peers, bool from_update);
|
2019-10-16 20:55:16 +02:00
|
|
|
|
2021-06-28 17:32:29 +02:00
|
|
|
void on_update_bot_commands(DialogId dialog_id, UserId bot_user_id,
|
|
|
|
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands);
|
|
|
|
|
2022-04-06 19:24:54 +02:00
|
|
|
void on_update_bot_menu_button(UserId bot_user_id, tl_object_ptr<telegram_api::BotMenuButton> &&bot_menu_button);
|
|
|
|
|
2019-03-12 15:52:10 +01:00
|
|
|
void speculative_add_channel_participants(ChannelId channel_id, const vector<UserId> &added_user_ids,
|
|
|
|
UserId inviter_user_id, int32 date, bool by_me);
|
2019-03-12 14:20:53 +01:00
|
|
|
|
|
|
|
void speculative_delete_channel_participant(ChannelId channel_id, UserId deleted_user_id, bool by_me);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-11-17 12:01:08 +01:00
|
|
|
void invalidate_channel_full(ChannelId channel_id, bool need_drop_slow_mode_delay, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-11-17 12:18:11 +01:00
|
|
|
bool on_get_channel_error(ChannelId channel_id, const Status &status, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-01-26 21:59:09 +01:00
|
|
|
void on_get_permanent_dialog_invite_link(DialogId dialog_id, const DialogInviteLink &invite_link);
|
|
|
|
|
2019-10-22 12:40:24 +02:00
|
|
|
void on_get_created_public_channels(PublicDialogType type, vector<tl_object_ptr<telegram_api::Chat>> &&chats);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-13 19:25:17 +02:00
|
|
|
void on_get_dialogs_for_discussion(vector<tl_object_ptr<telegram_api::Chat>> &&chats);
|
|
|
|
|
2022-09-21 17:55:21 +02:00
|
|
|
void on_get_inactive_channels(vector<tl_object_ptr<telegram_api::Chat>> &&chats, Promise<Unit> &&promise);
|
2019-12-13 15:27:44 +01:00
|
|
|
|
2019-12-13 15:57:00 +01:00
|
|
|
void remove_inactive_channel(ChannelId channel_id);
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void register_message_users(MessageFullId message_full_id, vector<UserId> user_ids);
|
2023-03-17 16:51:04 +01:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void register_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids);
|
2023-03-17 16:51:04 +01:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void unregister_message_users(MessageFullId message_full_id, vector<UserId> user_ids);
|
2023-03-17 16:51:04 +01:00
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
void unregister_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids);
|
2023-03-17 16:51:04 +01:00
|
|
|
|
2023-10-17 00:25:58 +02:00
|
|
|
bool can_use_premium_custom_emoji() const;
|
|
|
|
|
2018-10-08 16:21:56 +02:00
|
|
|
UserId get_my_id() const;
|
2018-03-26 23:21:53 +02:00
|
|
|
|
2018-03-10 15:10:23 +01:00
|
|
|
void set_my_online_status(bool is_online, bool send_update, bool is_local);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-11-15 16:58:33 +01:00
|
|
|
struct MyOnlineStatusInfo {
|
|
|
|
bool is_online_local = false;
|
|
|
|
bool is_online_remote = false;
|
|
|
|
int32 was_online_local = 0;
|
|
|
|
int32 was_online_remote = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
MyOnlineStatusInfo get_my_online_status() const;
|
|
|
|
|
2020-09-24 22:04:32 +02:00
|
|
|
static UserId get_service_notifications_user_id();
|
|
|
|
|
|
|
|
UserId add_service_notifications_user();
|
2018-03-26 23:21:53 +02:00
|
|
|
|
2020-09-24 00:28:04 +02:00
|
|
|
static UserId get_replies_bot_user_id();
|
|
|
|
|
2020-10-04 22:33:21 +02:00
|
|
|
static UserId get_anonymous_bot_user_id();
|
|
|
|
|
2021-12-09 14:36:27 +01:00
|
|
|
static UserId get_channel_bot_user_id();
|
|
|
|
|
2022-11-30 11:36:44 +01:00
|
|
|
static UserId get_anti_spam_bot_user_id();
|
|
|
|
|
2020-10-04 22:33:21 +02:00
|
|
|
UserId add_anonymous_bot_user();
|
|
|
|
|
2021-12-09 14:36:27 +01:00
|
|
|
UserId add_channel_bot_user();
|
|
|
|
|
2024-01-23 17:05:39 +01:00
|
|
|
static ChannelId get_unsupported_channel_id();
|
2023-09-17 00:34:13 +02:00
|
|
|
|
2023-03-30 15:41:03 +02:00
|
|
|
void on_update_username_is_active(UserId user_id, string &&username, bool is_active, Promise<Unit> &&promise);
|
2022-10-17 13:04:22 +02:00
|
|
|
|
2023-03-30 15:41:03 +02:00
|
|
|
void on_update_active_usernames_order(UserId user_id, vector<string> &&usernames, Promise<Unit> &&promise);
|
2023-03-30 14:34:27 +02:00
|
|
|
|
2022-10-17 13:04:22 +02:00
|
|
|
void on_update_channel_username_is_active(ChannelId channel_id, string &&username, bool is_active,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2022-10-17 13:58:47 +02:00
|
|
|
void on_deactivate_channel_usernames(ChannelId channel_id, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-14 14:32:54 +02:00
|
|
|
void on_update_channel_active_usernames_order(ChannelId channel_id, vector<string> &&usernames,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_online_status_privacy();
|
|
|
|
|
2020-05-01 00:21:02 +02:00
|
|
|
void on_update_phone_number_privacy();
|
|
|
|
|
2020-07-10 20:56:28 +02:00
|
|
|
void invalidate_user_full(UserId user_id);
|
|
|
|
|
2021-09-30 12:53:16 +02:00
|
|
|
void add_contact(Contact contact, bool share_phone_number, Promise<Unit> &&promise);
|
2019-10-08 17:12:15 +02:00
|
|
|
|
2021-09-30 13:18:01 +02:00
|
|
|
std::pair<vector<UserId>, vector<int32>> import_contacts(const vector<Contact> &contacts, int64 &random_id,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
std::pair<int32, vector<UserId>> search_contacts(const string &query, int32 limit, Promise<Unit> &&promise);
|
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
void remove_contacts(const vector<UserId> &user_ids, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-01-02 23:39:21 +01:00
|
|
|
void remove_contacts_by_phone_number(vector<string> user_phone_numbers, vector<UserId> user_ids,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 get_imported_contact_count(Promise<Unit> &&promise);
|
|
|
|
|
2021-09-30 13:18:01 +02:00
|
|
|
std::pair<vector<UserId>, vector<int32>> change_imported_contacts(vector<Contact> &contacts, int64 &random_id,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void clear_imported_contacts(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_update_contacts_reset();
|
|
|
|
|
2023-05-03 19:42:47 +02:00
|
|
|
vector<UserId> get_close_friends(Promise<Unit> &&promise);
|
|
|
|
|
2023-05-04 17:42:18 +02:00
|
|
|
void set_close_friends(vector<UserId> user_ids, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_set_close_friends(const vector<UserId> &user_ids, Promise<Unit> &&promise);
|
2023-05-04 17:27:03 +02:00
|
|
|
|
2022-02-18 16:13:10 +01:00
|
|
|
UserId search_user_by_phone_number(string phone_number, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_resolved_phone_number(const string &phone_number, UserId user_id);
|
|
|
|
|
2019-10-11 16:59:04 +02:00
|
|
|
void share_phone_number(UserId user_id, Promise<Unit> &&promise);
|
|
|
|
|
2019-10-16 20:55:16 +02:00
|
|
|
void search_dialogs_nearby(const Location &location, Promise<td_api::object_ptr<td_api::chatsNearby>> &&promise);
|
|
|
|
|
2020-02-14 14:17:45 +01:00
|
|
|
void set_location(const Location &location, Promise<Unit> &&promise);
|
|
|
|
|
2022-08-19 13:16:53 +02:00
|
|
|
static void set_location_visibility(Td *td);
|
2020-02-14 13:44:56 +01:00
|
|
|
|
2021-10-12 21:05:14 +02:00
|
|
|
void get_is_location_visible(Promise<Unit> &&promise);
|
|
|
|
|
2022-12-23 11:19:56 +01:00
|
|
|
void register_suggested_profile_photo(const Photo &photo);
|
|
|
|
|
2020-07-08 18:40:23 +02:00
|
|
|
FileId get_profile_photo_file_id(int64 photo_id) const;
|
|
|
|
|
2023-03-29 20:49:54 +02:00
|
|
|
void set_bot_profile_photo(UserId bot_user_id, const td_api::object_ptr<td_api::InputChatPhoto> &input_photo,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-01-29 22:35:14 +01:00
|
|
|
void set_profile_photo(const td_api::object_ptr<td_api::InputChatPhoto> &input_photo, bool is_fallback,
|
2022-12-15 15:44:26 +01:00
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-12-13 12:16:49 +01:00
|
|
|
void set_user_profile_photo(UserId user_id, const td_api::object_ptr<td_api::InputChatPhoto> &input_photo,
|
2022-12-15 16:12:30 +01:00
|
|
|
bool only_suggest, Promise<Unit> &&promise);
|
2022-12-13 12:16:49 +01:00
|
|
|
|
2023-03-29 20:49:54 +02:00
|
|
|
void send_update_profile_photo_query(UserId user_id, FileId file_id, int64 old_photo_id, bool is_fallback,
|
|
|
|
Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-12-23 13:11:00 +01:00
|
|
|
void delete_profile_photo(int64 profile_photo_id, bool is_recursive, Promise<Unit> &&promise);
|
2019-01-29 00:32:26 +01:00
|
|
|
|
2023-10-18 16:56:45 +02:00
|
|
|
void set_accent_color(AccentColorId accent_color_id, CustomEmojiId background_custom_emoji_id,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2023-11-28 14:12:21 +01:00
|
|
|
void set_profile_accent_color(AccentColorId accent_color_id, CustomEmojiId background_custom_emoji_id,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_name(const string &first_name, const string &last_name, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void set_bio(const string &bio, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void set_username(const string &username, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-17 13:04:22 +02:00
|
|
|
void toggle_username_is_active(string &&username, bool is_active, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-14 14:32:54 +02:00
|
|
|
void reorder_usernames(vector<string> &&usernames, Promise<Unit> &&promise);
|
|
|
|
|
2023-03-30 14:34:27 +02:00
|
|
|
void toggle_bot_username_is_active(UserId bot_user_id, string &&username, bool is_active, Promise<Unit> &&promise);
|
|
|
|
|
2023-03-30 15:41:03 +02:00
|
|
|
void reorder_bot_usernames(UserId bot_user_id, vector<string> &&usernames, Promise<Unit> &&promise);
|
|
|
|
|
2023-12-25 12:49:22 +01:00
|
|
|
void set_emoji_status(const EmojiStatus &emoji_status, Promise<Unit> &&promise);
|
2022-08-09 14:49:47 +02:00
|
|
|
|
2019-03-18 03:24:25 +01:00
|
|
|
void set_chat_description(ChatId chat_id, const string &description, Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_channel_username(ChannelId channel_id, const string &username, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-17 13:04:22 +02:00
|
|
|
void toggle_channel_username_is_active(ChannelId channel_id, string &&username, bool is_active,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2022-10-17 13:58:47 +02:00
|
|
|
void disable_all_channel_usernames(ChannelId channel_id, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-14 14:32:54 +02:00
|
|
|
void reorder_channel_usernames(ChannelId channel_id, vector<string> &&usernames, Promise<Unit> &&promise);
|
|
|
|
|
2023-10-18 18:43:14 +02:00
|
|
|
void set_channel_accent_color(ChannelId channel_id, AccentColorId accent_color_id,
|
|
|
|
CustomEmojiId background_custom_emoji_id, Promise<Unit> &&promise);
|
|
|
|
|
2023-12-17 21:34:58 +01:00
|
|
|
void set_channel_profile_accent_color(ChannelId channel_id, AccentColorId profile_accent_color_id,
|
|
|
|
CustomEmojiId profile_background_custom_emoji_id, Promise<Unit> &&promise);
|
|
|
|
|
2023-12-25 12:49:22 +01:00
|
|
|
void set_channel_emoji_status(ChannelId channel_id, const EmojiStatus &emoji_status, Promise<Unit> &&promise);
|
|
|
|
|
2019-09-18 05:55:43 +02:00
|
|
|
void set_channel_sticker_set(ChannelId channel_id, StickerSetId sticker_set_id, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void toggle_channel_sign_messages(ChannelId channel_id, bool sign_messages, Promise<Unit> &&promise);
|
|
|
|
|
2022-04-29 17:25:29 +02:00
|
|
|
void toggle_channel_join_to_send(ChannelId channel_id, bool joint_to_send, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void toggle_channel_join_request(ChannelId channel_id, bool join_request, Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void toggle_channel_is_all_history_available(ChannelId channel_id, bool is_all_history_available,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2022-12-20 13:51:37 +01:00
|
|
|
void toggle_channel_has_hidden_participants(ChannelId channel_id, bool has_hidden_participants,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2022-12-27 17:14:37 +01:00
|
|
|
void toggle_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id, bool has_aggressive_anti_spam_enabled,
|
|
|
|
Promise<Unit> &&promise);
|
2022-11-25 14:06:04 +01:00
|
|
|
|
2022-10-25 10:52:45 +02:00
|
|
|
void toggle_channel_is_forum(ChannelId channel_id, bool is_forum, Promise<Unit> &&promise);
|
|
|
|
|
2021-02-16 23:06:35 +01:00
|
|
|
void convert_channel_to_gigagroup(ChannelId channel_id, Promise<Unit> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_channel_description(ChannelId channel_id, const string &description, Promise<Unit> &&promise);
|
|
|
|
|
2019-09-14 04:35:56 +02:00
|
|
|
void set_channel_discussion_group(DialogId dialog_id, DialogId discussion_dialog_id, Promise<Unit> &&promise);
|
|
|
|
|
2019-10-14 18:07:31 +02:00
|
|
|
void set_channel_location(DialogId dialog_id, const DialogLocation &location, Promise<Unit> &&promise);
|
|
|
|
|
2019-11-15 14:48:01 +01:00
|
|
|
void set_channel_slow_mode_delay(DialogId dialog_id, int32 slow_mode_delay, Promise<Unit> &&promise);
|
|
|
|
|
2021-11-19 15:12:38 +01:00
|
|
|
void report_channel_spam(ChannelId channel_id, const vector<MessageId> &message_ids, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-11-25 14:38:00 +01:00
|
|
|
void report_channel_anti_spam_false_positive(ChannelId channel_id, MessageId message_id, Promise<Unit> &&promise);
|
|
|
|
|
2024-01-07 23:27:49 +01:00
|
|
|
void delete_chat(ChatId chat_id, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void delete_channel(ChannelId channel_id, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-09-24 08:07:38 +02:00
|
|
|
void get_channel_statistics_dc_id(DialogId dialog_id, bool for_full_statistics, Promise<DcId> &&promise);
|
|
|
|
|
2020-10-31 13:28:55 +01:00
|
|
|
bool can_get_channel_message_statistics(DialogId dialog_id) const;
|
2020-08-01 04:19:54 +02:00
|
|
|
|
2023-11-17 12:58:51 +01:00
|
|
|
bool can_get_channel_story_statistics(DialogId dialog_id) const;
|
|
|
|
|
2021-06-18 02:06:20 +02:00
|
|
|
struct CanTransferOwnershipResult {
|
|
|
|
enum class Type : uint8 { Ok, PasswordNeeded, PasswordTooFresh, SessionTooFresh };
|
|
|
|
Type type = Type::Ok;
|
|
|
|
int32 retry_after = 0;
|
|
|
|
};
|
2019-10-17 18:43:41 +02:00
|
|
|
void can_transfer_ownership(Promise<CanTransferOwnershipResult> &&promise);
|
|
|
|
|
|
|
|
static td_api::object_ptr<td_api::CanTransferOwnershipResult> get_can_transfer_ownership_result_object(
|
|
|
|
CanTransferOwnershipResult result);
|
|
|
|
|
2019-10-17 16:05:01 +02:00
|
|
|
void transfer_dialog_ownership(DialogId dialog_id, UserId user_id, const string &password, Promise<Unit> &&promise);
|
|
|
|
|
2024-01-10 13:57:19 +01:00
|
|
|
void migrate_dialog_to_megagroup(DialogId dialog_id, Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-11-29 13:31:33 +01:00
|
|
|
void get_channel_recommendations(DialogId dialog_id, bool return_local,
|
|
|
|
Promise<td_api::object_ptr<td_api::chats>> &&chats_promise,
|
|
|
|
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
|
2023-11-20 20:03:21 +01:00
|
|
|
|
2021-12-03 18:10:30 +01:00
|
|
|
void get_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
|
|
|
bool from_binlog);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-12-26 19:24:04 +01:00
|
|
|
void open_channel_recommended_channel(DialogId dialog_id, DialogId opened_dialog_id, Promise<Unit> &&promise);
|
|
|
|
|
2019-10-22 13:06:46 +02:00
|
|
|
void check_created_public_dialogs_limit(PublicDialogType type, Promise<Unit> &&promise);
|
|
|
|
|
2022-05-12 15:34:13 +02:00
|
|
|
void reload_created_public_dialogs(PublicDialogType type, Promise<td_api::object_ptr<td_api::chats>> &&promise);
|
|
|
|
|
2019-09-13 19:25:17 +02:00
|
|
|
vector<DialogId> get_dialogs_for_discussion(Promise<Unit> &&promise);
|
|
|
|
|
2019-12-13 15:27:44 +01:00
|
|
|
vector<DialogId> get_inactive_channels(Promise<Unit> &&promise);
|
|
|
|
|
2021-11-26 12:48:43 +01:00
|
|
|
void dismiss_dialog_suggested_action(SuggestedAction action, Promise<Unit> &&promise);
|
2021-02-22 16:06:18 +01:00
|
|
|
|
2021-01-21 14:49:41 +01:00
|
|
|
bool is_user_contact(UserId user_id, bool is_mutual = false) const;
|
2019-05-12 20:49:21 +02:00
|
|
|
|
2022-06-03 16:31:48 +02:00
|
|
|
bool is_user_premium(UserId user_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool is_user_deleted(UserId user_id) const;
|
|
|
|
|
2020-10-09 14:42:57 +02:00
|
|
|
bool is_user_support(UserId user_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool is_user_bot(UserId user_id) const;
|
2021-06-18 02:06:20 +02:00
|
|
|
|
|
|
|
struct BotData {
|
|
|
|
string username;
|
2023-03-28 15:26:42 +02:00
|
|
|
bool can_be_edited;
|
2021-06-18 02:06:20 +02:00
|
|
|
bool can_join_groups;
|
|
|
|
bool can_read_all_group_messages;
|
|
|
|
bool is_inline;
|
|
|
|
bool need_location;
|
2022-03-25 11:02:01 +01:00
|
|
|
bool can_be_added_to_attach_menu;
|
2021-06-18 02:06:20 +02:00
|
|
|
};
|
2018-12-31 20:04:05 +01:00
|
|
|
Result<BotData> get_bot_data(UserId user_id) const TD_WARN_UNUSED_RESULT;
|
|
|
|
|
2024-01-05 10:33:53 +01:00
|
|
|
bool is_user_online(UserId user_id, int32 tolerance = 0, int32 unix_time = 07) const;
|
2020-10-09 14:42:57 +02:00
|
|
|
|
2019-12-18 16:57:21 +01:00
|
|
|
bool is_user_status_exact(UserId user_id) const;
|
|
|
|
|
2019-03-17 16:09:28 +01:00
|
|
|
bool can_report_user(UserId user_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool have_user(UserId user_id) const;
|
|
|
|
bool have_min_user(UserId user_id) const;
|
2023-07-20 19:38:25 +02:00
|
|
|
bool have_user_force(UserId user_id, const char *source);
|
2018-03-09 01:27:39 +01:00
|
|
|
|
2020-04-29 21:28:57 +02:00
|
|
|
bool is_dialog_info_received_from_server(DialogId dialog_id) const;
|
|
|
|
|
2018-03-09 01:52:12 +01:00
|
|
|
static void send_get_me_query(Td *td, Promise<Unit> &&promise);
|
2018-03-09 01:27:39 +01:00
|
|
|
UserId get_me(Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_user(UserId user_id, int left_tries, Promise<Unit> &&promise);
|
2023-11-08 21:48:27 +01:00
|
|
|
void reload_user(UserId user_id, Promise<Unit> &&promise, const char *source);
|
2021-09-23 17:52:39 +02:00
|
|
|
void load_user_full(UserId user_id, bool force, Promise<Unit> &&promise, const char *source);
|
2022-08-06 12:42:35 +02:00
|
|
|
FileSourceId get_user_full_file_source_id(UserId user_id);
|
2023-07-17 17:22:41 +02:00
|
|
|
void reload_user_full(UserId user_id, Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-03-15 11:33:41 +01:00
|
|
|
void get_user_profile_photos(UserId user_id, int32 offset, int32 limit,
|
|
|
|
Promise<td_api::object_ptr<td_api::chatPhotos>> &&promise);
|
2019-01-14 21:04:53 +01:00
|
|
|
void reload_user_profile_photo(UserId user_id, int64 photo_id, Promise<Unit> &&promise);
|
2019-01-30 22:37:38 +01:00
|
|
|
FileSourceId get_user_profile_photo_file_source_id(UserId user_id, int64 photo_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-10 15:09:09 +01:00
|
|
|
void create_new_chat(const vector<UserId> &user_ids, const string &title, MessageTtl message_ttl,
|
|
|
|
Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool have_chat(ChatId chat_id) const;
|
2023-09-21 17:56:13 +02:00
|
|
|
bool have_chat_force(ChatId chat_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_chat(ChatId chat_id, int left_tries, Promise<Unit> &&promise);
|
2023-11-08 21:48:27 +01:00
|
|
|
void reload_chat(ChatId chat_id, Promise<Unit> &&promise, const char *source);
|
2021-09-23 17:52:39 +02:00
|
|
|
void load_chat_full(ChatId chat_id, bool force, Promise<Unit> &&promise, const char *source);
|
2020-07-06 14:26:29 +02:00
|
|
|
FileSourceId get_chat_full_file_source_id(ChatId chat_id);
|
2023-07-17 17:22:41 +02:00
|
|
|
void reload_chat_full(ChatId chat_id, Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-04-08 14:35:21 +02:00
|
|
|
int32 get_chat_date(ChatId chat_id) const;
|
2021-10-19 17:11:16 +02:00
|
|
|
int32 get_chat_participant_count(ChatId chat_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_chat_is_active(ChatId chat_id) const;
|
2020-10-12 10:33:16 +02:00
|
|
|
ChannelId get_chat_migrated_to_channel_id(ChatId chat_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
DialogParticipantStatus get_chat_status(ChatId chat_id) const;
|
2019-03-22 13:23:44 +01:00
|
|
|
DialogParticipantStatus get_chat_permissions(ChatId chat_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
bool is_appointed_chat_administrator(ChatId chat_id) const;
|
|
|
|
|
2024-01-10 15:09:09 +01:00
|
|
|
void create_new_channel(const string &title, bool is_forum, bool is_megagroup, const string &description,
|
|
|
|
const DialogLocation &location, bool for_import, MessageTtl message_ttl,
|
|
|
|
Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool have_min_channel(ChannelId channel_id) const;
|
2021-12-22 14:09:34 +01:00
|
|
|
const MinChannel *get_min_channel(ChannelId channel_id) const;
|
2021-12-22 18:15:18 +01:00
|
|
|
void add_min_channel(ChannelId channel_id, const MinChannel &min_channel);
|
2021-12-22 14:09:34 +01:00
|
|
|
|
|
|
|
bool have_channel(ChannelId channel_id) const;
|
2023-09-21 17:56:13 +02:00
|
|
|
bool have_channel_force(ChannelId channel_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise);
|
2023-11-08 21:48:27 +01:00
|
|
|
void reload_channel(ChannelId channel_id, Promise<Unit> &&promise, const char *source);
|
2021-09-23 17:52:39 +02:00
|
|
|
void load_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise, const char *source);
|
2020-07-06 14:26:29 +02:00
|
|
|
FileSourceId get_channel_full_file_source_id(ChannelId channel_id);
|
|
|
|
void reload_channel_full(ChannelId channel_id, Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-13 19:58:32 +02:00
|
|
|
bool is_channel_public(ChannelId channel_id) const;
|
|
|
|
|
2024-01-10 13:20:16 +01:00
|
|
|
void create_new_secret_chat(UserId user_id, Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool have_secret_chat(SecretChatId secret_chat_id) const;
|
2023-09-21 17:56:13 +02:00
|
|
|
bool have_secret_chat_force(SecretChatId secret_chat_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_secret_chat(SecretChatId secret_chat_id, bool force, Promise<Unit> &&promise);
|
|
|
|
bool get_secret_chat_full(SecretChatId secret_chat_id, Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
ChannelType get_channel_type(ChannelId channel_id) const;
|
2022-04-04 14:48:33 +02:00
|
|
|
bool is_broadcast_channel(ChannelId channel_id) const;
|
|
|
|
bool is_megagroup_channel(ChannelId channel_id) const;
|
2022-10-24 17:22:43 +02:00
|
|
|
bool is_forum_channel(ChannelId channel_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 get_channel_date(ChannelId channel_id) const;
|
|
|
|
DialogParticipantStatus get_channel_status(ChannelId channel_id) const;
|
2019-03-22 13:23:44 +01:00
|
|
|
DialogParticipantStatus get_channel_permissions(ChannelId channel_id) const;
|
2022-10-04 16:53:56 +02:00
|
|
|
bool get_channel_is_verified(ChannelId channel_id) const;
|
2024-01-08 11:25:31 +01:00
|
|
|
bool get_channel_is_scam(ChannelId channel_id) const;
|
|
|
|
bool get_channel_is_fake(ChannelId channel_id) const;
|
2019-03-12 20:05:33 +01:00
|
|
|
int32 get_channel_participant_count(ChannelId channel_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
bool get_channel_sign_messages(ChannelId channel_id) const;
|
2020-08-31 12:42:27 +02:00
|
|
|
bool get_channel_has_linked_channel(ChannelId channel_id) const;
|
2023-04-09 20:54:40 +02:00
|
|
|
bool get_channel_join_request(ChannelId channel_id) const;
|
2022-05-15 11:48:22 +02:00
|
|
|
bool get_channel_can_be_deleted(ChannelId channel_id) const;
|
2023-04-09 22:47:47 +02:00
|
|
|
ChannelId get_channel_linked_channel_id(ChannelId channel_id, const char *source);
|
|
|
|
int32 get_channel_slow_mode_delay(ChannelId channel_id, const char *source);
|
|
|
|
bool get_channel_effective_has_hidden_participants(ChannelId channel_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-08 16:15:21 +01:00
|
|
|
void add_chat_participant(ChatId chat_id, UserId user_id, int32 forward_limit, Promise<Unit> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-08 16:15:21 +01:00
|
|
|
void set_chat_participant_status(ChatId chat_id, UserId user_id, DialogParticipantStatus status,
|
|
|
|
Promise<Unit> &&promise);
|
2023-04-02 10:46:38 +02:00
|
|
|
|
2024-01-08 16:15:21 +01:00
|
|
|
void delete_chat_participant(ChatId chat_id, UserId user_id, bool revoke_messages, Promise<Unit> &&promise);
|
|
|
|
|
2024-01-08 15:35:24 +01:00
|
|
|
void get_chat_participant(ChatId chat_id, UserId user_id, Promise<DialogParticipant> &&promise);
|
|
|
|
|
2024-01-08 16:44:13 +01:00
|
|
|
void speculative_add_channel_user(ChannelId channel_id, UserId user_id, const DialogParticipantStatus &new_status,
|
|
|
|
const DialogParticipantStatus &old_status);
|
|
|
|
|
2022-03-19 19:37:46 +01:00
|
|
|
void search_dialog_participants(DialogId dialog_id, const string &query, int32 limit, DialogParticipantFilter filter,
|
2021-06-21 03:14:29 +02:00
|
|
|
Promise<DialogParticipants> &&promise);
|
2021-01-27 00:16:17 +01:00
|
|
|
|
|
|
|
void get_channel_participants(ChannelId channel_id, tl_object_ptr<td_api::SupergroupMembersFilter> &&filter,
|
|
|
|
string additional_query, int32 offset, int32 limit, int32 additional_limit,
|
2021-06-21 03:14:29 +02:00
|
|
|
Promise<DialogParticipants> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_user_id_object(UserId user_id, const char *source) const;
|
2018-01-26 20:53:20 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
tl_object_ptr<td_api::user> get_user_object(UserId user_id) const;
|
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
vector<int64> get_user_ids_object(const vector<UserId> &user_ids, const char *source) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-01-26 20:53:20 +01:00
|
|
|
tl_object_ptr<td_api::users> get_users_object(int32 total_count, const vector<UserId> &user_ids) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
tl_object_ptr<td_api::userFullInfo> get_user_full_info_object(UserId user_id) const;
|
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_basic_group_id_object(ChatId chat_id, const char *source) const;
|
2018-01-27 14:57:59 +01:00
|
|
|
|
2018-02-03 00:48:50 +01:00
|
|
|
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(ChatId chat_id) const;
|
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_supergroup_id_object(ChannelId channel_id, const char *source) const;
|
2018-01-27 14:57:59 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
tl_object_ptr<td_api::supergroup> get_supergroup_object(ChannelId channel_id) const;
|
|
|
|
|
2018-09-20 20:37:35 +02:00
|
|
|
tl_object_ptr<td_api::supergroupFullInfo> get_supergroup_full_info_object(ChannelId channel_id) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-02-03 00:05:11 +01:00
|
|
|
int32 get_secret_chat_id_object(SecretChatId secret_chat_id, const char *source) const;
|
2018-01-27 14:57:59 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
tl_object_ptr<td_api::secretChat> get_secret_chat_object(SecretChatId secret_chat_id);
|
|
|
|
|
|
|
|
void on_update_secret_chat(SecretChatId secret_chat_id, int64 access_hash, UserId user_id, SecretChatState state,
|
2020-06-30 11:11:22 +02:00
|
|
|
bool is_outbound, int32 ttl, int32 date, string key_hash, int32 layer,
|
|
|
|
FolderId initial_folder_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-10-24 14:17:18 +02:00
|
|
|
tl_object_ptr<td_api::chatMember> get_chat_member_object(const DialogParticipant &dialog_participant,
|
|
|
|
const char *source) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-05-14 17:54:21 +02:00
|
|
|
void get_support_user(Promise<td_api::object_ptr<td_api::user>> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-05 16:41:33 +02:00
|
|
|
void on_view_dialog_active_stories(vector<DialogId> dialog_ids);
|
2023-07-18 12:53:22 +02:00
|
|
|
|
2023-09-05 16:41:33 +02:00
|
|
|
void on_get_dialog_max_active_story_ids(const vector<DialogId> &dialog_ids, const vector<int32> &max_story_ids);
|
2023-07-18 12:53:22 +02:00
|
|
|
|
2019-02-26 16:24:46 +01:00
|
|
|
void repair_chat_participants(ChatId chat_id);
|
|
|
|
|
2018-09-21 09:34:15 +02:00
|
|
|
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
2018-09-20 20:37:35 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
private:
|
2021-02-12 14:53:40 +01:00
|
|
|
struct User {
|
|
|
|
string first_name;
|
|
|
|
string last_name;
|
2022-10-12 20:04:18 +02:00
|
|
|
Usernames usernames;
|
2021-02-12 14:53:40 +01:00
|
|
|
string phone_number;
|
|
|
|
int64 access_hash = -1;
|
2022-08-30 15:02:25 +02:00
|
|
|
EmojiStatus emoji_status;
|
2023-07-06 19:14:42 +02:00
|
|
|
EmojiStatus last_sent_emoji_status;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
ProfilePhoto photo;
|
|
|
|
|
|
|
|
vector<RestrictionReason> restriction_reasons;
|
|
|
|
string inline_query_placeholder;
|
|
|
|
int32 bot_info_version = -1;
|
|
|
|
|
2023-10-17 13:23:42 +02:00
|
|
|
AccentColorId accent_color_id;
|
2023-10-18 14:59:25 +02:00
|
|
|
CustomEmojiId background_custom_emoji_id;
|
2023-11-28 13:45:39 +01:00
|
|
|
AccentColorId profile_accent_color_id;
|
|
|
|
CustomEmojiId profile_background_custom_emoji_id;
|
2023-10-17 13:23:42 +02:00
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
int32 was_online = 0;
|
|
|
|
int32 local_was_online = 0;
|
|
|
|
|
2023-07-17 19:05:35 +02:00
|
|
|
double max_active_story_id_next_reload_time = 0.0;
|
2023-07-07 17:06:14 +02:00
|
|
|
StoryId max_active_story_id;
|
2023-07-07 17:25:24 +02:00
|
|
|
StoryId max_read_story_id;
|
2023-07-07 17:06:14 +02:00
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
string language_code;
|
|
|
|
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<int64> photo_ids;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
static constexpr uint32 CACHE_VERSION = 4;
|
|
|
|
uint32 cache_version = 0;
|
|
|
|
|
|
|
|
bool is_min_access_hash = true;
|
|
|
|
bool is_received = false;
|
|
|
|
bool is_verified = false;
|
2022-05-02 15:23:48 +02:00
|
|
|
bool is_premium = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_support = false;
|
|
|
|
bool is_deleted = true;
|
|
|
|
bool is_bot = true;
|
|
|
|
bool can_join_groups = true;
|
|
|
|
bool can_read_all_group_messages = true;
|
2023-03-28 15:26:42 +02:00
|
|
|
bool can_be_edited_bot = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_inline_bot = false;
|
|
|
|
bool need_location_bot = false;
|
|
|
|
bool is_scam = false;
|
|
|
|
bool is_fake = false;
|
|
|
|
bool is_contact = false;
|
|
|
|
bool is_mutual_contact = false;
|
2023-05-03 19:22:16 +02:00
|
|
|
bool is_close_friend = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool need_apply_min_photo = false;
|
2022-03-25 11:02:01 +01:00
|
|
|
bool can_be_added_to_attach_menu = false;
|
2022-05-11 18:30:35 +02:00
|
|
|
bool attach_menu_enabled = false;
|
2023-06-05 14:20:24 +02:00
|
|
|
bool stories_hidden = false;
|
2024-01-19 12:35:37 +01:00
|
|
|
bool contact_require_premium = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
bool is_photo_inited = false;
|
|
|
|
|
|
|
|
bool is_repaired = false; // whether cached value is rechecked
|
|
|
|
|
2023-07-18 12:53:22 +02:00
|
|
|
bool is_max_active_story_id_being_reloaded = false;
|
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_name_changed = true;
|
|
|
|
bool is_username_changed = true;
|
|
|
|
bool is_photo_changed = true;
|
2023-12-16 09:49:26 +01:00
|
|
|
bool is_accent_color_changed = true;
|
2022-02-28 20:43:17 +01:00
|
|
|
bool is_phone_number_changed = true;
|
2023-07-16 12:56:28 +02:00
|
|
|
bool is_emoji_status_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_is_contact_changed = true;
|
2023-08-07 22:09:35 +02:00
|
|
|
bool is_is_mutual_contact_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_is_deleted_changed = true;
|
2023-06-30 13:41:39 +02:00
|
|
|
bool is_is_premium_changed = true;
|
2023-06-28 15:09:44 +02:00
|
|
|
bool is_stories_hidden_changed = true;
|
2023-04-03 20:04:22 +02:00
|
|
|
bool is_full_info_changed = false;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
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
|
|
|
|
bool is_status_changed = true;
|
|
|
|
bool is_online_status_changed = true; // whether online/offline has changed
|
|
|
|
bool is_update_user_sent = false;
|
|
|
|
|
|
|
|
bool is_saved = false; // is current user version being saved/is saved to the database
|
|
|
|
bool is_being_saved = false; // is current user being saved to the database
|
|
|
|
bool is_status_saved = false; // is current user status being saved/is saved to the database
|
|
|
|
|
|
|
|
bool is_received_from_server = false; // true, if the user was received from the server and not the database
|
|
|
|
|
|
|
|
uint64 log_event_id = 0;
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
// do not forget to update drop_user_full and on_get_user_full
|
|
|
|
struct UserFull {
|
|
|
|
Photo photo;
|
2022-12-15 15:17:42 +01:00
|
|
|
Photo fallback_photo;
|
2022-12-09 16:46:57 +01:00
|
|
|
Photo personal_photo;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
string about;
|
2021-11-20 20:48:44 +01:00
|
|
|
string private_forward_name;
|
2022-04-19 21:56:58 +02:00
|
|
|
string description;
|
|
|
|
Photo description_photo;
|
|
|
|
FileId description_animation_file_id;
|
2022-08-06 12:42:35 +02:00
|
|
|
vector<FileId> registered_file_ids;
|
|
|
|
FileSourceId file_source_id;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
2022-07-01 14:57:38 +02:00
|
|
|
vector<PremiumGiftOption> premium_gift_options;
|
|
|
|
|
2022-04-06 19:24:54 +02:00
|
|
|
unique_ptr<BotMenuButton> menu_button;
|
2021-06-21 01:36:04 +02:00
|
|
|
vector<BotCommand> commands;
|
2022-03-22 12:52:27 +01:00
|
|
|
AdministratorRights group_administrator_rights;
|
|
|
|
AdministratorRights broadcast_administrator_rights;
|
2021-06-21 01:36:04 +02:00
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
int32 common_chat_count = 0;
|
|
|
|
|
|
|
|
bool is_blocked = false;
|
2023-07-28 15:19:05 +02:00
|
|
|
bool is_blocked_for_stories = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool can_be_called = false;
|
|
|
|
bool supports_video_calls = false;
|
|
|
|
bool has_private_calls = false;
|
|
|
|
bool can_pin_messages = true;
|
|
|
|
bool need_phone_number_privacy_exception = false;
|
2023-11-23 21:08:53 +01:00
|
|
|
bool wallpaper_overridden = false;
|
2022-07-17 15:59:12 +02:00
|
|
|
bool voice_messages_forbidden = false;
|
2023-06-15 19:53:58 +02:00
|
|
|
bool has_pinned_stories = false;
|
2024-01-09 12:56:32 +01:00
|
|
|
bool read_dates_private = false;
|
2024-01-19 13:01:07 +01:00
|
|
|
bool contact_require_premium = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
bool is_common_chat_count_changed = true;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_changed = true; // have new changes that need to be sent to the client and database
|
|
|
|
bool need_send_update = true; // have new changes that need only to be sent to the client
|
|
|
|
bool need_save_to_database = true; // have new changes that need only to be saved to the database
|
2021-09-07 17:20:34 +02:00
|
|
|
bool is_update_user_full_sent = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
double expires_at = 0.0;
|
|
|
|
|
|
|
|
bool is_expired() const {
|
|
|
|
return expires_at < Time::now();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Chat {
|
|
|
|
string title;
|
|
|
|
DialogPhoto photo;
|
|
|
|
int32 participant_count = 0;
|
|
|
|
int32 date = 0;
|
|
|
|
int32 version = -1;
|
|
|
|
int32 default_permissions_version = -1;
|
|
|
|
int32 pinned_message_version = -1;
|
|
|
|
ChannelId migrated_to_channel_id;
|
|
|
|
|
|
|
|
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
2023-01-06 12:16:34 +01:00
|
|
|
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false,
|
2023-10-19 21:37:44 +02:00
|
|
|
false, false, false, false, false, false, false, false, ChannelType::Unknown};
|
2021-02-12 14:53:40 +01:00
|
|
|
|
2021-11-25 09:45:42 +01:00
|
|
|
static constexpr uint32 CACHE_VERSION = 4;
|
2021-02-12 14:53:40 +01:00
|
|
|
uint32 cache_version = 0;
|
|
|
|
|
|
|
|
bool is_active = false;
|
2021-11-25 09:45:42 +01:00
|
|
|
bool noforwards = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
bool is_title_changed = true;
|
|
|
|
bool is_photo_changed = true;
|
|
|
|
bool is_default_permissions_changed = true;
|
2021-10-12 18:39:03 +02:00
|
|
|
bool is_status_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_is_active_changed = true;
|
2021-11-25 09:44:51 +01:00
|
|
|
bool is_noforwards_changed = true;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
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
|
|
|
|
bool is_update_basic_group_sent = false;
|
|
|
|
|
|
|
|
bool is_repaired = false; // whether cached value is rechecked
|
|
|
|
|
|
|
|
bool is_saved = false; // is current chat version being saved/is saved to the database
|
|
|
|
bool is_being_saved = false; // is current chat being saved to the database
|
|
|
|
|
|
|
|
bool is_received_from_server = false; // true, if the chat was received from the server and not the database
|
|
|
|
|
|
|
|
uint64 log_event_id = 0;
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
// do not forget to update drop_chat_full and on_get_chat_full
|
|
|
|
struct ChatFull {
|
|
|
|
int32 version = -1;
|
|
|
|
UserId creator_user_id;
|
|
|
|
vector<DialogParticipant> participants;
|
|
|
|
|
|
|
|
Photo photo;
|
|
|
|
vector<FileId> registered_photo_file_ids;
|
|
|
|
FileSourceId file_source_id;
|
|
|
|
|
|
|
|
string description;
|
|
|
|
|
|
|
|
DialogInviteLink invite_link;
|
|
|
|
|
2021-06-21 03:01:13 +02:00
|
|
|
vector<BotCommands> bot_commands;
|
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
bool can_set_username = false;
|
|
|
|
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_changed = true; // have new changes that need to be sent to the client and database
|
|
|
|
bool need_send_update = true; // have new changes that need only to be sent to the client
|
|
|
|
bool need_save_to_database = true; // have new changes that need only to be saved to the database
|
2021-09-07 17:20:34 +02:00
|
|
|
bool is_update_chat_full_sent = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Channel {
|
|
|
|
int64 access_hash = 0;
|
|
|
|
string title;
|
|
|
|
DialogPhoto photo;
|
2023-12-21 19:05:42 +01:00
|
|
|
EmojiStatus emoji_status;
|
|
|
|
EmojiStatus last_sent_emoji_status;
|
2023-10-17 14:20:50 +02:00
|
|
|
AccentColorId accent_color_id;
|
2023-10-18 14:59:25 +02:00
|
|
|
CustomEmojiId background_custom_emoji_id;
|
2023-12-17 20:54:55 +01:00
|
|
|
AccentColorId profile_accent_color_id;
|
|
|
|
CustomEmojiId profile_background_custom_emoji_id;
|
2022-10-12 20:04:18 +02:00
|
|
|
Usernames usernames;
|
2021-02-12 14:53:40 +01:00
|
|
|
vector<RestrictionReason> restriction_reasons;
|
|
|
|
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
2023-01-06 12:16:34 +01:00
|
|
|
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false,
|
2023-10-19 21:37:44 +02:00
|
|
|
false, false, false, false, false, false, false, false, ChannelType::Unknown};
|
2021-02-12 14:53:40 +01:00
|
|
|
int32 date = 0;
|
|
|
|
int32 participant_count = 0;
|
2023-12-21 18:08:30 +01:00
|
|
|
int32 boost_level = 0;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
2023-09-05 15:50:41 +02:00
|
|
|
double max_active_story_id_next_reload_time = 0.0;
|
|
|
|
StoryId max_active_story_id;
|
|
|
|
StoryId max_read_story_id;
|
|
|
|
|
2022-10-30 10:17:47 +01:00
|
|
|
static constexpr uint32 CACHE_VERSION = 10;
|
2021-02-12 14:53:40 +01:00
|
|
|
uint32 cache_version = 0;
|
|
|
|
|
|
|
|
bool has_linked_channel = false;
|
|
|
|
bool has_location = false;
|
|
|
|
bool sign_messages = false;
|
|
|
|
bool is_slow_mode_enabled = false;
|
2021-11-25 09:45:42 +01:00
|
|
|
bool noforwards = false;
|
2022-05-15 11:48:22 +02:00
|
|
|
bool can_be_deleted = false;
|
2022-04-29 16:54:28 +02:00
|
|
|
bool join_to_send = false;
|
|
|
|
bool join_request = false;
|
2023-09-05 17:17:45 +02:00
|
|
|
bool stories_hidden = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
bool is_megagroup = false;
|
2021-02-16 16:27:17 +01:00
|
|
|
bool is_gigagroup = false;
|
2022-10-18 13:23:09 +02:00
|
|
|
bool is_forum = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_verified = false;
|
|
|
|
bool is_scam = false;
|
|
|
|
bool is_fake = false;
|
|
|
|
|
2023-09-05 16:41:33 +02:00
|
|
|
bool is_max_active_story_id_being_reloaded = false;
|
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_title_changed = true;
|
|
|
|
bool is_username_changed = true;
|
|
|
|
bool is_photo_changed = true;
|
2023-12-21 19:05:42 +01:00
|
|
|
bool is_emoji_status_changed = true;
|
2023-12-16 09:49:26 +01:00
|
|
|
bool is_accent_color_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_default_permissions_changed = true;
|
|
|
|
bool is_status_changed = true;
|
2023-09-05 17:17:45 +02:00
|
|
|
bool is_stories_hidden_changed = true;
|
2021-12-02 15:12:33 +01:00
|
|
|
bool is_has_location_changed = true;
|
2021-11-25 09:44:51 +01:00
|
|
|
bool is_noforwards_changed = true;
|
2021-12-02 16:10:14 +01:00
|
|
|
bool is_creator_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool had_read_access = true;
|
|
|
|
bool was_member = false;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
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
|
|
|
|
bool is_update_supergroup_sent = false;
|
|
|
|
|
|
|
|
bool is_repaired = false; // whether cached value is rechecked
|
|
|
|
|
|
|
|
bool is_saved = false; // is current channel version being saved/is saved to the database
|
|
|
|
bool is_being_saved = false; // is current channel being saved to the database
|
|
|
|
|
|
|
|
bool is_received_from_server = false; // true, if the channel was received from the server and not the database
|
|
|
|
|
|
|
|
uint64 log_event_id = 0;
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
// do not forget to update invalidate_channel_full and on_get_chat_full
|
|
|
|
struct ChannelFull {
|
|
|
|
Photo photo;
|
|
|
|
vector<FileId> registered_photo_file_ids;
|
|
|
|
FileSourceId file_source_id;
|
|
|
|
|
|
|
|
string description;
|
|
|
|
int32 participant_count = 0;
|
|
|
|
int32 administrator_count = 0;
|
|
|
|
int32 restricted_count = 0;
|
|
|
|
int32 banned_count = 0;
|
|
|
|
|
|
|
|
DialogInviteLink invite_link;
|
|
|
|
|
2021-06-21 03:01:13 +02:00
|
|
|
vector<BotCommands> bot_commands;
|
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
uint32 speculative_version = 1;
|
|
|
|
uint32 repair_request_version = 0;
|
|
|
|
|
|
|
|
StickerSetId sticker_set_id;
|
|
|
|
|
|
|
|
ChannelId linked_channel_id;
|
|
|
|
|
|
|
|
DialogLocation location;
|
|
|
|
|
|
|
|
DcId stats_dc_id;
|
|
|
|
|
|
|
|
int32 slow_mode_delay = 0;
|
|
|
|
int32 slow_mode_next_send_date = 0;
|
|
|
|
|
|
|
|
MessageId migrated_from_max_message_id;
|
|
|
|
ChatId migrated_from_chat_id;
|
|
|
|
|
|
|
|
vector<UserId> bot_user_ids;
|
|
|
|
|
|
|
|
bool can_get_participants = false;
|
2022-12-19 18:29:33 +01:00
|
|
|
bool has_hidden_participants = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool can_set_username = false;
|
|
|
|
bool can_set_sticker_set = false;
|
|
|
|
bool can_set_location = false;
|
|
|
|
bool can_view_statistics = false;
|
|
|
|
bool is_can_view_statistics_inited = false;
|
|
|
|
bool is_all_history_available = true;
|
2022-12-27 17:14:37 +01:00
|
|
|
bool has_aggressive_anti_spam_enabled = false;
|
2022-03-29 11:14:21 +02:00
|
|
|
bool can_be_deleted = false;
|
2023-09-05 17:34:06 +02:00
|
|
|
bool has_pinned_stories = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
bool is_slow_mode_next_send_date_changed = true;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_changed = true; // have new changes that need to be sent to the client and database
|
|
|
|
bool need_send_update = true; // have new changes that need only to be sent to the client
|
|
|
|
bool need_save_to_database = true; // have new changes that need only to be saved to the database
|
2021-09-07 17:20:34 +02:00
|
|
|
bool is_update_channel_full_sent = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
|
|
|
|
double expires_at = 0.0;
|
|
|
|
|
|
|
|
bool is_expired() const {
|
|
|
|
return expires_at < Time::now();
|
|
|
|
}
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
2019-09-18 01:14:24 +02:00
|
|
|
|
2021-02-12 14:53:40 +01:00
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SecretChat {
|
|
|
|
int64 access_hash = 0;
|
|
|
|
UserId user_id;
|
2021-11-11 15:39:09 +01:00
|
|
|
SecretChatState state = SecretChatState::Unknown;
|
2021-02-12 14:53:40 +01:00
|
|
|
string key_hash;
|
|
|
|
int32 ttl = 0;
|
|
|
|
int32 date = 0;
|
|
|
|
int32 layer = 0;
|
|
|
|
FolderId initial_folder_id;
|
|
|
|
|
|
|
|
bool is_outbound = false;
|
|
|
|
|
2021-02-09 15:35:48 +01:00
|
|
|
bool is_ttl_changed = true;
|
2021-02-12 14:53:40 +01:00
|
|
|
bool is_state_changed = true;
|
2023-08-07 22:19:28 +02:00
|
|
|
bool is_being_updated = false;
|
2021-02-12 14:53:40 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
bool is_saved = false; // is current secret chat version being saved/is saved to the database
|
|
|
|
bool is_being_saved = false; // is current secret chat being saved to the database
|
|
|
|
|
|
|
|
uint64 log_event_id = 0;
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
2023-03-15 11:33:41 +01:00
|
|
|
struct PendingGetPhotoRequest {
|
|
|
|
int32 offset = 0;
|
|
|
|
int32 limit = 0;
|
2023-03-15 11:51:35 +01:00
|
|
|
int32 retry_count = 0;
|
2023-03-15 11:33:41 +01:00
|
|
|
Promise<td_api::object_ptr<td_api::chatPhotos>> promise;
|
|
|
|
};
|
|
|
|
|
2019-10-17 22:31:00 +02:00
|
|
|
struct UserPhotos {
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Photo> photos;
|
2019-10-17 22:41:16 +02:00
|
|
|
int32 count = -1;
|
|
|
|
int32 offset = -1;
|
2023-03-15 11:33:41 +01:00
|
|
|
|
|
|
|
vector<PendingGetPhotoRequest> pending_requests;
|
2019-10-17 22:31:00 +02:00
|
|
|
};
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-16 20:55:16 +02:00
|
|
|
struct DialogNearby {
|
|
|
|
DialogId dialog_id;
|
|
|
|
int32 distance;
|
|
|
|
|
|
|
|
DialogNearby(DialogId dialog_id, int32 distance) : dialog_id(dialog_id), distance(distance) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator<(const DialogNearby &other) const {
|
|
|
|
return distance < other.distance || (distance == other.distance && dialog_id.get() < other.dialog_id.get());
|
|
|
|
}
|
2019-10-17 20:35:32 +02:00
|
|
|
|
|
|
|
bool operator==(const DialogNearby &other) const {
|
|
|
|
return distance == other.distance && dialog_id == other.dialog_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const DialogNearby &other) const {
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
2019-10-16 20:55:16 +02:00
|
|
|
};
|
|
|
|
|
2023-11-21 11:39:32 +01:00
|
|
|
struct RecommendedDialogs {
|
2023-11-24 11:53:10 +01:00
|
|
|
int32 total_count_ = 0;
|
2023-11-21 11:39:32 +01:00
|
|
|
vector<DialogId> dialog_ids_;
|
|
|
|
double next_reload_time_ = 0.0;
|
2023-11-21 12:13:06 +01:00
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
2023-11-21 11:39:32 +01:00
|
|
|
};
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
class UserLogEvent;
|
|
|
|
class ChatLogEvent;
|
|
|
|
class ChannelLogEvent;
|
|
|
|
class SecretChatLogEvent;
|
|
|
|
|
2019-03-25 18:40:28 +01:00
|
|
|
static constexpr int32 MAX_GET_PROFILE_PHOTOS = 100; // server side limit
|
|
|
|
static constexpr size_t MAX_NAME_LENGTH = 64; // server side limit for first/last name
|
2024-01-10 15:09:09 +01:00
|
|
|
static constexpr size_t MAX_TITLE_LENGTH = 128; // server side limit for chat title
|
2019-03-18 03:24:25 +01:00
|
|
|
static constexpr size_t MAX_DESCRIPTION_LENGTH = 255; // server side limit for chat/channel description
|
2019-03-25 18:40:28 +01:00
|
|
|
static constexpr int32 MAX_GET_CHANNEL_PARTICIPANTS = 200; // server side limit
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-11-20 21:12:42 +01:00
|
|
|
static constexpr int32 MAX_ACTIVE_STORY_ID_RELOAD_TIME = 3600; // some reasonable limit
|
|
|
|
static constexpr int32 CHANNEL_RECOMMENDATIONS_CACHE_TIME = 86400; // some reasonable limit
|
2021-06-12 22:53:14 +02:00
|
|
|
|
2023-06-23 17:22:58 +02:00
|
|
|
// the True fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 USER_FLAG_HAS_ACCESS_HASH = 1 << 0;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_FIRST_NAME = 1 << 1;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_LAST_NAME = 1 << 2;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_USERNAME = 1 << 3;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_PHONE_NUMBER = 1 << 4;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_PHOTO = 1 << 5;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_STATUS = 1 << 6;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_BOT_INFO_VERSION = 1 << 14;
|
|
|
|
static constexpr int32 USER_FLAG_IS_ME = 1 << 10;
|
|
|
|
static constexpr int32 USER_FLAG_IS_CONTACT = 1 << 11;
|
|
|
|
static constexpr int32 USER_FLAG_IS_MUTUAL_CONTACT = 1 << 12;
|
|
|
|
static constexpr int32 USER_FLAG_IS_DELETED = 1 << 13;
|
|
|
|
static constexpr int32 USER_FLAG_IS_BOT = 1 << 14;
|
|
|
|
static constexpr int32 USER_FLAG_IS_BOT_WITH_PRIVACY_DISABLED = 1 << 15;
|
|
|
|
static constexpr int32 USER_FLAG_IS_PRIVATE_BOT = 1 << 16;
|
|
|
|
static constexpr int32 USER_FLAG_IS_VERIFIED = 1 << 17;
|
|
|
|
static constexpr int32 USER_FLAG_IS_RESTRICTED = 1 << 18;
|
|
|
|
static constexpr int32 USER_FLAG_IS_INLINE_BOT = 1 << 19;
|
|
|
|
static constexpr int32 USER_FLAG_IS_INACCESSIBLE = 1 << 20;
|
|
|
|
static constexpr int32 USER_FLAG_NEED_LOCATION_BOT = 1 << 21;
|
|
|
|
static constexpr int32 USER_FLAG_HAS_LANGUAGE_CODE = 1 << 22;
|
2019-03-01 03:35:01 +01:00
|
|
|
static constexpr int32 USER_FLAG_IS_SUPPORT = 1 << 23;
|
2019-06-18 15:41:53 +02:00
|
|
|
static constexpr int32 USER_FLAG_IS_SCAM = 1 << 24;
|
2020-07-28 01:57:23 +02:00
|
|
|
static constexpr int32 USER_FLAG_NEED_APPLY_MIN_PHOTO = 1 << 25;
|
2021-01-21 11:40:22 +01:00
|
|
|
static constexpr int32 USER_FLAG_IS_FAKE = 1 << 26;
|
2022-03-25 11:02:01 +01:00
|
|
|
static constexpr int32 USER_FLAG_IS_ATTACH_MENU_BOT = 1 << 27;
|
2022-05-02 15:23:48 +02:00
|
|
|
static constexpr int32 USER_FLAG_IS_PREMIUM = 1 << 28;
|
2022-05-11 18:30:35 +02:00
|
|
|
static constexpr int32 USER_FLAG_ATTACH_MENU_ENABLED = 1 << 29;
|
2022-08-08 22:41:06 +02:00
|
|
|
static constexpr int32 USER_FLAG_HAS_EMOJI_STATUS = 1 << 30;
|
2022-10-12 20:04:18 +02:00
|
|
|
static constexpr int32 USER_FLAG_HAS_USERNAMES = 1 << 0;
|
2023-03-28 15:26:42 +02:00
|
|
|
static constexpr int32 USER_FLAG_CAN_BE_EDITED_BOT = 1 << 1;
|
2023-05-03 19:22:16 +02:00
|
|
|
static constexpr int32 USER_FLAG_IS_CLOSE_FRIEND = 1 << 2;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static constexpr int32 USER_FULL_FLAG_IS_BLOCKED = 1 << 0;
|
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_ABOUT = 1 << 1;
|
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_PHOTO = 1 << 2;
|
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_BOT_INFO = 1 << 3;
|
2019-02-01 13:19:32 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_PINNED_MESSAGE = 1 << 6;
|
|
|
|
static constexpr int32 USER_FULL_FLAG_CAN_PIN_MESSAGE = 1 << 7;
|
2019-08-19 03:51:03 +02:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
2019-11-25 17:11:24 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 12;
|
2021-02-09 15:35:48 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 14;
|
2021-11-20 20:48:44 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_PRIVATE_FORWARD_NAME = 1 << 16;
|
2022-03-22 12:52:27 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_GROUP_ADMINISTRATOR_RIGHTS = 1 << 17;
|
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_BROADCAST_ADMINISTRATOR_RIGHTS = 1 << 18;
|
2022-07-17 15:59:12 +02:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_VOICE_MESSAGES_FORBIDDEN = 1 << 20;
|
2022-12-09 16:46:57 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_PERSONAL_PHOTO = 1 << 21;
|
2022-12-15 15:17:42 +01:00
|
|
|
static constexpr int32 USER_FULL_FLAG_HAS_FALLBACK_PHOTO = 1 << 22;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static constexpr int32 CHAT_FLAG_USER_IS_CREATOR = 1 << 0;
|
|
|
|
static constexpr int32 CHAT_FLAG_USER_HAS_LEFT = 1 << 2;
|
2019-03-15 14:52:55 +01:00
|
|
|
// static constexpr int32 CHAT_FLAG_ADMINISTRATORS_ENABLED = 1 << 3;
|
|
|
|
// static constexpr int32 CHAT_FLAG_IS_ADMINISTRATOR = 1 << 4;
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 CHAT_FLAG_IS_DEACTIVATED = 1 << 5;
|
|
|
|
static constexpr int32 CHAT_FLAG_WAS_MIGRATED = 1 << 6;
|
2020-12-14 15:33:02 +01:00
|
|
|
static constexpr int32 CHAT_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 23;
|
|
|
|
static constexpr int32 CHAT_FLAG_IS_GROUP_CALL_NON_EMPTY = 1 << 24;
|
2021-12-12 13:12:19 +01:00
|
|
|
static constexpr int32 CHAT_FLAG_NOFORWARDS = 1 << 25;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-02-01 13:19:32 +01:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_PINNED_MESSAGE = 1 << 6;
|
2019-11-25 17:11:24 +01:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 8;
|
2019-08-19 03:51:03 +02:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
2020-12-14 15:33:02 +01:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 12;
|
2021-02-09 15:35:48 +01:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 14;
|
2021-10-12 17:11:17 +02:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_PENDING_REQUEST_COUNT = 1 << 17;
|
2022-01-04 14:35:48 +01:00
|
|
|
static constexpr int32 CHAT_FULL_FLAG_HAS_AVAILABLE_REACTIONS = 1 << 18;
|
2019-02-01 13:19:32 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_USER_IS_CREATOR = 1 << 0;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_USER_HAS_LEFT = 1 << 2;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_BROADCAST = 1 << 5;
|
2022-10-12 20:04:18 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_USERNAME = 1 << 6;
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_VERIFIED = 1 << 7;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_MEGAGROUP = 1 << 8;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_RESTRICTED = 1 << 9;
|
2019-03-15 14:52:55 +01:00
|
|
|
// static constexpr int32 CHANNEL_FLAG_ANYONE_CAN_INVITE = 1 << 10;
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_SIGN_MESSAGES = 1 << 11;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_MIN = 1 << 12;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_ACCESS_HASH = 1 << 13;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_ADMIN_RIGHTS = 1 << 14;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_BANNED_RIGHTS = 1 << 15;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_UNBAN_DATE = 1 << 16;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_PARTICIPANT_COUNT = 1 << 17;
|
2019-06-18 15:41:53 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_SCAM = 1 << 19;
|
2019-09-13 03:11:21 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_LINKED_CHAT = 1 << 20;
|
2019-10-13 19:58:32 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_LOCATION = 1 << 21;
|
2019-11-15 13:46:12 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_SLOW_MODE_ENABLED = 1 << 22;
|
2020-11-25 15:04:32 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 23;
|
2020-12-05 19:28:57 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_GROUP_CALL_NON_EMPTY = 1 << 24;
|
2021-01-21 11:40:22 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_FAKE = 1 << 25;
|
2021-02-16 16:27:17 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_GIGAGROUP = 1 << 26;
|
2021-12-12 13:12:19 +01:00
|
|
|
static constexpr int32 CHANNEL_FLAG_NOFORWARDS = 1 << 27;
|
2022-04-29 16:54:28 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_JOIN_TO_SEND = 1 << 28;
|
|
|
|
static constexpr int32 CHANNEL_FLAG_JOIN_REQUEST = 1 << 29;
|
2022-10-18 13:23:09 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_IS_FORUM = 1 << 30;
|
2022-10-12 20:04:18 +02:00
|
|
|
static constexpr int32 CHANNEL_FLAG_HAS_USERNAMES = 1 << 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PARTICIPANT_COUNT = 1 << 0;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_ADMINISTRATOR_COUNT = 1 << 1;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_BANNED_COUNT = 1 << 2;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_CAN_GET_PARTICIPANTS = 1 << 3;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_MIGRATED_FROM = 1 << 4;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PINNED_MESSAGE = 1 << 5;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_CAN_SET_USERNAME = 1 << 6;
|
2019-10-13 20:41:09 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_CAN_SET_STICKER_SET = 1 << 7;
|
2018-12-31 20:04:05 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_STICKER_SET = 1 << 8;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_AVAILABLE_MIN_MESSAGE_ID = 1 << 9;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_IS_ALL_HISTORY_HIDDEN = 1 << 10;
|
2019-08-19 03:51:03 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
2020-07-28 01:57:23 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_STATISTICS_DC_ID = 1 << 12;
|
2019-02-26 01:24:33 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_ONLINE_MEMBER_COUNT = 1 << 13;
|
2019-10-13 20:41:09 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_LINKED_CHANNEL_ID = 1 << 14;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_LOCATION = 1 << 15;
|
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_CAN_SET_LOCATION = 1 << 16;
|
2019-11-15 14:48:01 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SLOW_MODE_DELAY = 1 << 17;
|
2019-11-20 19:25:00 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SLOW_MODE_NEXT_SEND_DATE = 1 << 18;
|
2019-11-25 17:11:24 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 19;
|
2020-07-28 01:57:23 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_CAN_VIEW_STATISTICS = 1 << 20;
|
2020-11-25 15:04:32 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 21;
|
2020-09-19 13:43:37 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_IS_BLOCKED = 1 << 22;
|
2021-01-12 15:05:25 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_EXPORTED_INVITE = 1 << 23;
|
2021-02-09 15:35:48 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 24;
|
2021-10-12 17:11:17 +02:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PENDING_REQUEST_COUNT = 1 << 28;
|
2021-11-12 14:15:19 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_DEFAULT_SEND_AS = 1 << 29;
|
2022-01-04 14:35:48 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG_HAS_AVAILABLE_REACTIONS = 1 << 30;
|
2022-11-25 13:16:37 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG2_HAS_ANTISPAM = 1 << 1;
|
2022-12-19 18:29:33 +01:00
|
|
|
static constexpr int32 CHANNEL_FULL_FLAG2_ARE_PARTICIPANTS_HIDDEN = 1 << 2;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static constexpr int32 USER_FULL_EXPIRE_TIME = 60;
|
|
|
|
static constexpr int32 CHANNEL_FULL_EXPIRE_TIME = 60;
|
|
|
|
|
|
|
|
static constexpr int32 ACCOUNT_UPDATE_FIRST_NAME = 1 << 0;
|
|
|
|
static constexpr int32 ACCOUNT_UPDATE_LAST_NAME = 1 << 1;
|
|
|
|
static constexpr int32 ACCOUNT_UPDATE_ABOUT = 1 << 2;
|
|
|
|
|
2023-03-17 16:51:04 +01:00
|
|
|
bool have_input_peer_user(const User *u, UserId user_id, AccessRights access_rights) const;
|
2019-06-17 00:35:12 +02:00
|
|
|
static bool have_input_peer_chat(const Chat *c, AccessRights access_rights);
|
2019-09-13 04:40:02 +02:00
|
|
|
bool have_input_peer_channel(const Channel *c, ChannelId channel_id, AccessRights access_rights,
|
|
|
|
bool from_linked = false) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
static bool have_input_encrypted_peer(const SecretChat *secret_chat, AccessRights access_rights);
|
|
|
|
|
2023-03-17 16:51:04 +01:00
|
|
|
tl_object_ptr<telegram_api::InputPeer> get_simple_input_peer(DialogId dialog_id) const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
const User *get_user(UserId user_id) const;
|
|
|
|
User *get_user(UserId user_id);
|
2023-07-20 19:38:25 +02:00
|
|
|
User *get_user_force(UserId user_id, const char *source);
|
|
|
|
User *get_user_force_impl(UserId user_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-07-26 14:32:35 +02:00
|
|
|
User *add_user(UserId user_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
const UserFull *get_user_full(UserId user_id) const;
|
|
|
|
UserFull *get_user_full(UserId user_id);
|
2024-01-15 12:12:00 +01:00
|
|
|
UserFull *get_user_full_force(UserId user_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-21 16:03:23 +02:00
|
|
|
UserFull *add_user_full(UserId user_id);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void send_get_user_full_query(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&input_user,
|
2019-09-15 04:06:11 +02:00
|
|
|
Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
const Chat *get_chat(ChatId chat_id) const;
|
|
|
|
Chat *get_chat(ChatId chat_id);
|
2023-09-21 17:56:13 +02:00
|
|
|
Chat *get_chat_force(ChatId chat_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
Chat *add_chat(ChatId chat_id);
|
|
|
|
|
|
|
|
const ChatFull *get_chat_full(ChatId chat_id) const;
|
|
|
|
ChatFull *get_chat_full(ChatId chat_id);
|
2021-01-16 10:30:48 +01:00
|
|
|
ChatFull *get_chat_full_force(ChatId chat_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-21 16:03:23 +02:00
|
|
|
ChatFull *add_chat_full(ChatId chat_id);
|
|
|
|
|
2019-09-15 04:06:11 +02:00
|
|
|
void send_get_chat_full_query(ChatId chat_id, Promise<Unit> &&promise, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-10 13:57:19 +01:00
|
|
|
void on_migrate_chat_to_megagroup(ChatId chat_id, Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
const Channel *get_channel(ChannelId channel_id) const;
|
|
|
|
Channel *get_channel(ChannelId channel_id);
|
2023-09-21 17:56:13 +02:00
|
|
|
Channel *get_channel_force(ChannelId channel_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-07-08 15:32:05 +02:00
|
|
|
Channel *add_channel(ChannelId channel_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
const ChannelFull *get_channel_full(ChannelId channel_id) const;
|
2020-10-31 13:47:40 +01:00
|
|
|
const ChannelFull *get_channel_full_const(ChannelId channel_id) const;
|
2021-08-23 10:10:46 +02:00
|
|
|
ChannelFull *get_channel_full(ChannelId channel_id, bool only_local, const char *source);
|
|
|
|
ChannelFull *get_channel_full_force(ChannelId channel_id, bool only_local, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-21 16:03:23 +02:00
|
|
|
ChannelFull *add_channel_full(ChannelId channel_id);
|
|
|
|
|
2020-07-06 14:26:29 +02:00
|
|
|
void send_get_channel_full_query(ChannelFull *channel_full, ChannelId channel_id, Promise<Unit> &&promise,
|
2019-11-11 20:07:12 +01:00
|
|
|
const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-10 13:20:16 +01:00
|
|
|
void on_create_new_secret_chat(SecretChatId secret_chat_id, Promise<td_api::object_ptr<td_api::chat>> &&promise);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
const SecretChat *get_secret_chat(SecretChatId secret_chat_id) const;
|
|
|
|
SecretChat *get_secret_chat(SecretChatId secret_chat_id);
|
2023-09-21 17:56:13 +02:00
|
|
|
SecretChat *get_secret_chat_force(SecretChatId secret_chat_id, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
SecretChat *add_secret_chat(SecretChatId secret_chat_id);
|
|
|
|
|
2022-10-11 19:35:35 +02:00
|
|
|
string get_user_search_text(UserId user_id) const;
|
|
|
|
static string get_user_search_text(const User *u);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static DialogParticipantStatus get_chat_status(const Chat *c);
|
2019-03-22 16:32:06 +01:00
|
|
|
DialogParticipantStatus get_chat_permissions(const Chat *c) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static ChannelType get_channel_type(const Channel *c);
|
|
|
|
static DialogParticipantStatus get_channel_status(const Channel *c);
|
2019-03-22 16:32:06 +01:00
|
|
|
DialogParticipantStatus get_channel_permissions(const Channel *c) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
static bool get_channel_sign_messages(const Channel *c);
|
2020-08-31 12:42:27 +02:00
|
|
|
static bool get_channel_has_linked_channel(const Channel *c);
|
2022-05-15 11:48:22 +02:00
|
|
|
static bool get_channel_can_be_deleted(const Channel *c);
|
2022-05-02 14:45:35 +02:00
|
|
|
static bool get_channel_join_to_send(const Channel *c);
|
|
|
|
static bool get_channel_join_request(const Channel *c);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-10-11 19:35:35 +02:00
|
|
|
string get_channel_search_text(ChannelId channel_id) const;
|
|
|
|
static string get_channel_search_text(const Channel *c);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_my_id(UserId my_id);
|
|
|
|
|
2022-08-30 15:02:25 +02:00
|
|
|
void on_set_emoji_status(EmojiStatus emoji_status, Promise<Unit> &&promise);
|
2022-08-09 14:49:47 +02:00
|
|
|
|
2022-10-14 14:32:54 +02:00
|
|
|
void on_update_user_name(User *u, UserId user_id, string &&first_name, string &&last_name);
|
|
|
|
void on_update_user_usernames(User *u, UserId user_id, Usernames &&usernames);
|
2022-02-18 15:22:27 +01:00
|
|
|
void on_update_user_phone_number(User *u, UserId user_id, string &&phone_number);
|
2019-06-17 02:39:00 +02:00
|
|
|
void on_update_user_photo(User *u, UserId user_id, tl_object_ptr<telegram_api::UserProfilePhoto> &&photo,
|
|
|
|
const char *source);
|
2023-10-17 14:09:57 +02:00
|
|
|
void on_update_user_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id);
|
2023-10-18 14:59:25 +02:00
|
|
|
void on_update_user_background_custom_emoji_id(User *u, UserId user_id, CustomEmojiId background_custom_emoji_id);
|
2023-11-28 13:45:39 +01:00
|
|
|
void on_update_user_profile_accent_color_id(User *u, UserId user_id, AccentColorId accent_color_id);
|
|
|
|
void on_update_user_profile_background_custom_emoji_id(User *u, UserId user_id,
|
|
|
|
CustomEmojiId background_custom_emoji_id);
|
2022-08-30 15:02:25 +02:00
|
|
|
void on_update_user_emoji_status(User *u, UserId user_id, EmojiStatus emoji_status);
|
2023-08-07 22:04:23 +02:00
|
|
|
void on_update_user_story_ids_impl(User *u, UserId user_id, StoryId max_active_story_id, StoryId max_read_story_id);
|
2023-07-07 17:35:47 +02:00
|
|
|
void on_update_user_max_read_story_id(User *u, UserId user_id, StoryId max_read_story_id);
|
2023-06-05 15:07:44 +02:00
|
|
|
void on_update_user_stories_hidden(User *u, UserId user_id, bool stories_hidden);
|
2023-05-03 19:22:16 +02:00
|
|
|
void on_update_user_is_contact(User *u, UserId user_id, bool is_contact, bool is_mutual_contact,
|
|
|
|
bool is_close_friend);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_user_online(User *u, UserId user_id, tl_object_ptr<telegram_api::UserStatus> &&status);
|
2019-03-15 00:29:36 +01:00
|
|
|
void on_update_user_local_was_online(User *u, UserId user_id, int32 local_was_online);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-06-17 02:39:00 +02:00
|
|
|
void do_update_user_photo(User *u, UserId user_id, tl_object_ptr<telegram_api::UserProfilePhoto> &&photo,
|
|
|
|
const char *source);
|
2021-10-19 17:11:16 +02:00
|
|
|
void do_update_user_photo(User *u, UserId user_id, ProfilePhoto &&new_photo, bool invalidate_photo_cache,
|
2020-07-20 20:10:40 +02:00
|
|
|
const char *source);
|
2022-04-29 10:23:27 +02:00
|
|
|
void apply_pending_user_photo(User *u, UserId user_id);
|
2018-06-08 16:13:54 +02:00
|
|
|
|
2022-12-13 12:16:49 +01:00
|
|
|
void set_profile_photo_impl(UserId user_id, const td_api::object_ptr<td_api::InputChatPhoto> &input_photo,
|
2023-01-29 22:35:14 +01:00
|
|
|
bool is_fallback, bool only_suggest, Promise<Unit> &&promise);
|
2022-12-13 12:16:49 +01:00
|
|
|
|
2023-01-29 22:35:14 +01:00
|
|
|
void upload_profile_photo(UserId user_id, FileId file_id, bool is_fallback, bool only_suggest, bool is_animation,
|
|
|
|
double main_frame_timestamp, Promise<Unit> &&promise, int reupload_count = 0,
|
|
|
|
vector<int> bad_parts = {});
|
2020-06-28 16:44:56 +02:00
|
|
|
|
|
|
|
void on_upload_profile_photo(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file);
|
|
|
|
void on_upload_profile_photo_error(FileId file_id, Status status);
|
|
|
|
|
2020-06-27 20:59:10 +02:00
|
|
|
void register_user_photo(User *u, UserId user_id, const Photo &photo);
|
2019-01-22 16:07:21 +01:00
|
|
|
|
2023-07-28 15:19:05 +02:00
|
|
|
static void on_update_user_full_is_blocked(UserFull *user_full, UserId user_id, bool is_blocked,
|
|
|
|
bool is_blocked_for_stories);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_user_full_common_chat_count(UserFull *user_full, UserId user_id, int32 common_chat_count);
|
|
|
|
static void on_update_user_full_commands(UserFull *user_full, UserId user_id,
|
|
|
|
vector<tl_object_ptr<telegram_api::botCommand>> &&bot_commands);
|
2022-04-06 19:24:54 +02:00
|
|
|
static void on_update_user_full_menu_button(UserFull *user_full, UserId user_id,
|
|
|
|
tl_object_ptr<telegram_api::BotMenuButton> &&bot_menu_button);
|
2019-10-10 23:18:34 +02:00
|
|
|
void on_update_user_full_need_phone_number_privacy_exception(UserFull *user_full, UserId user_id,
|
2021-10-19 17:11:16 +02:00
|
|
|
bool need_phone_number_privacy_exception) const;
|
2023-11-23 21:08:53 +01:00
|
|
|
void on_update_user_full_wallpaper_overridden(UserFull *user_full, UserId user_id, bool wallpaper_overridden) const;
|
2020-07-20 16:05:49 +02:00
|
|
|
|
2022-11-20 21:16:21 +01:00
|
|
|
UserPhotos *add_user_photos(UserId user_id);
|
2023-03-15 11:33:41 +01:00
|
|
|
void send_get_user_photos_query(UserId user_id, const UserPhotos *user_photos);
|
|
|
|
void on_get_user_profile_photos(UserId user_id, Result<Unit> &&result);
|
2022-12-15 13:27:22 +01:00
|
|
|
int64 get_user_full_profile_photo_id(const UserFull *user_full);
|
2022-12-15 15:44:26 +01:00
|
|
|
void add_set_profile_photo_to_cache(UserId user_id, Photo &&photo, bool is_fallback);
|
2022-12-26 19:40:04 +01:00
|
|
|
bool delete_my_profile_photo_from_cache(int64 profile_photo_id);
|
2022-12-23 15:16:02 +01:00
|
|
|
void drop_user_full_photos(UserFull *user_full, UserId user_id, int64 expected_photo_id, const char *source);
|
2022-12-22 20:38:30 +01:00
|
|
|
void drop_user_photos(UserId user_id, bool is_empty, const char *source);
|
2019-09-18 01:21:29 +02:00
|
|
|
void drop_user_full(UserId user_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-03-19 16:13:16 +01:00
|
|
|
void on_update_chat_status(Chat *c, ChatId chat_id, DialogParticipantStatus status);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_chat_default_permissions(Chat *c, ChatId chat_id, RestrictedRights default_permissions,
|
|
|
|
int32 version);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_chat_participant_count(Chat *c, ChatId chat_id, int32 participant_count, int32 version,
|
|
|
|
const string &debug_str);
|
|
|
|
void on_update_chat_photo(Chat *c, ChatId chat_id, tl_object_ptr<telegram_api::ChatPhoto> &&chat_photo_ptr);
|
2022-05-06 11:41:55 +02:00
|
|
|
void on_update_chat_photo(Chat *c, ChatId chat_id, DialogPhoto &&photo, bool invalidate_photo_cache);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_chat_title(Chat *c, ChatId chat_id, string &&title);
|
|
|
|
static void on_update_chat_active(Chat *c, ChatId chat_id, bool is_active);
|
|
|
|
static void on_update_chat_migrated_to_channel_id(Chat *c, ChatId chat_id, ChannelId migrated_to_channel_id);
|
2021-11-25 09:44:51 +01:00
|
|
|
static void on_update_chat_noforwards(Chat *c, ChatId chat_id, bool noforwards);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-07-06 14:26:29 +02:00
|
|
|
void on_update_chat_full_photo(ChatFull *chat_full, ChatId chat_id, Photo photo);
|
2018-12-31 20:04:05 +01:00
|
|
|
bool on_update_chat_full_participants_short(ChatFull *chat_full, ChatId chat_id, int32 version);
|
|
|
|
void on_update_chat_full_participants(ChatFull *chat_full, ChatId chat_id, vector<DialogParticipant> participants,
|
2019-06-12 23:21:30 +02:00
|
|
|
int32 version, bool from_update);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_chat_full_invite_link(ChatFull *chat_full,
|
2022-04-19 16:43:24 +02:00
|
|
|
tl_object_ptr<telegram_api::ExportedChatInvite> &&invite_link);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void on_update_channel_photo(Channel *c, ChannelId channel_id,
|
|
|
|
tl_object_ptr<telegram_api::ChatPhoto> &&chat_photo_ptr);
|
2022-05-06 11:41:55 +02:00
|
|
|
void on_update_channel_photo(Channel *c, ChannelId channel_id, DialogPhoto &&photo, bool invalidate_photo_cache);
|
2023-12-21 19:05:42 +01:00
|
|
|
void on_update_channel_emoji_status(Channel *c, ChannelId channel_id, EmojiStatus emoji_status);
|
2023-10-17 14:20:50 +02:00
|
|
|
void on_update_channel_accent_color_id(Channel *c, ChannelId channel_id, AccentColorId accent_color_id);
|
2023-10-18 14:59:25 +02:00
|
|
|
void on_update_channel_background_custom_emoji_id(Channel *c, ChannelId channel_id,
|
|
|
|
CustomEmojiId background_custom_emoji_id);
|
2023-12-17 20:54:55 +01:00
|
|
|
void on_update_channel_profile_accent_color_id(Channel *c, ChannelId channel_id,
|
|
|
|
AccentColorId profile_accent_color_id);
|
|
|
|
void on_update_channel_profile_background_custom_emoji_id(Channel *c, ChannelId channel_id,
|
|
|
|
CustomEmojiId profile_background_custom_emoji_id);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_channel_title(Channel *c, ChannelId channel_id, string &&title);
|
2022-10-12 20:04:18 +02:00
|
|
|
void on_update_channel_usernames(Channel *c, ChannelId channel_id, Usernames &&usernames);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_channel_status(Channel *c, ChannelId channel_id, DialogParticipantStatus &&status);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_channel_default_permissions(Channel *c, ChannelId channel_id,
|
|
|
|
RestrictedRights default_permissions);
|
2021-12-02 15:12:33 +01:00
|
|
|
static void on_update_channel_has_location(Channel *c, ChannelId channel_id, bool has_location);
|
2021-11-25 09:44:51 +01:00
|
|
|
static void on_update_channel_noforwards(Channel *c, ChannelId channel_id, bool noforwards);
|
2023-09-05 17:17:45 +02:00
|
|
|
void on_update_channel_stories_hidden(Channel *c, ChannelId channel_id, bool stories_hidden);
|
2023-09-05 15:50:41 +02:00
|
|
|
void on_update_channel_story_ids_impl(Channel *c, ChannelId channel_id, StoryId max_active_story_id,
|
|
|
|
StoryId max_read_story_id);
|
|
|
|
void on_update_channel_max_read_story_id(Channel *c, ChannelId channel_id, StoryId max_read_story_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-21 22:39:46 +02:00
|
|
|
void on_update_channel_bot_user_ids(ChannelId channel_id, vector<UserId> &&bot_user_ids);
|
|
|
|
|
2020-07-06 14:26:29 +02:00
|
|
|
void on_update_channel_full_photo(ChannelFull *channel_full, ChannelId channel_id, Photo photo);
|
2018-12-31 20:04:05 +01:00
|
|
|
void on_update_channel_full_invite_link(ChannelFull *channel_full,
|
2022-04-19 16:43:24 +02:00
|
|
|
tl_object_ptr<telegram_api::ExportedChatInvite> &&invite_link);
|
2019-09-13 03:11:21 +02:00
|
|
|
void on_update_channel_full_linked_channel_id(ChannelFull *channel_full, ChannelId channel_id,
|
|
|
|
ChannelId linked_channel_id);
|
2019-10-14 18:07:31 +02:00
|
|
|
void on_update_channel_full_location(ChannelFull *channel_full, ChannelId channel_id, const DialogLocation &location);
|
2019-11-20 19:25:00 +01:00
|
|
|
void on_update_channel_full_slow_mode_delay(ChannelFull *channel_full, ChannelId channel_id, int32 slow_mode_delay,
|
|
|
|
int32 slow_mode_next_send_date);
|
2021-10-19 17:11:16 +02:00
|
|
|
static void on_update_channel_full_slow_mode_next_send_date(ChannelFull *channel_full,
|
|
|
|
int32 slow_mode_next_send_date);
|
|
|
|
static void on_update_channel_full_bot_user_ids(ChannelFull *channel_full, ChannelId channel_id,
|
|
|
|
vector<UserId> &&bot_user_ids);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-10-17 13:04:22 +02:00
|
|
|
void toggle_username_is_active_impl(string &&username, bool is_active, Promise<Unit> &&promise);
|
|
|
|
|
2022-10-14 14:32:54 +02:00
|
|
|
void reorder_usernames_impl(vector<string> &&usernames, Promise<Unit> &&promise);
|
|
|
|
|
2021-12-02 16:10:14 +01:00
|
|
|
void on_channel_status_changed(Channel *c, ChannelId channel_id, const DialogParticipantStatus &old_status,
|
2020-07-07 15:34:47 +02:00
|
|
|
const DialogParticipantStatus &new_status);
|
2022-10-12 20:04:18 +02:00
|
|
|
void on_channel_usernames_changed(const Channel *c, ChannelId channel_id, const Usernames &old_usernames,
|
|
|
|
const Usernames &new_usernames);
|
2020-07-07 15:34:47 +02:00
|
|
|
|
2019-12-23 16:37:11 +01:00
|
|
|
void remove_linked_channel_id(ChannelId channel_id);
|
|
|
|
ChannelId get_linked_channel_id(ChannelId channel_id) const;
|
|
|
|
|
2021-01-05 13:18:15 +01:00
|
|
|
static bool speculative_add_count(int32 &count, int32 delta_count, int32 min_count = 0);
|
2019-03-12 12:52:37 +01:00
|
|
|
|
2021-03-29 21:35:27 +02:00
|
|
|
void speculative_add_channel_participant_count(ChannelId channel_id, int32 delta_participant_count, bool by_me);
|
2019-03-12 14:20:53 +01:00
|
|
|
|
2019-09-18 01:21:29 +02:00
|
|
|
void drop_chat_full(ChatId chat_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-12-01 21:31:10 +01:00
|
|
|
void do_invalidate_channel_full(ChannelFull *channel_full, ChannelId channel_id, bool need_drop_slow_mode_delay);
|
2021-05-09 02:21:18 +02:00
|
|
|
|
2024-01-05 10:33:53 +01:00
|
|
|
void update_user_online_member_count(UserId user_id);
|
2019-03-05 13:49:10 +01:00
|
|
|
void update_chat_online_member_count(const ChatFull *chat_full, ChatId chat_id, bool is_from_server);
|
2019-03-12 12:52:37 +01:00
|
|
|
void update_channel_online_member_count(ChannelId channel_id, bool is_from_server);
|
2019-03-12 01:46:44 +01:00
|
|
|
void update_dialog_online_member_count(const vector<DialogParticipant> &participants, DialogId dialog_id,
|
|
|
|
bool is_from_server);
|
2019-03-05 13:49:10 +01:00
|
|
|
|
2023-09-21 13:53:33 +02:00
|
|
|
void on_get_chat_empty(telegram_api::chatEmpty &chat, const char *source);
|
|
|
|
void on_get_chat(telegram_api::chat &chat, const char *source);
|
|
|
|
void on_get_chat_forbidden(telegram_api::chatForbidden &chat, const char *source);
|
|
|
|
void on_get_channel(telegram_api::channel &channel, const char *source);
|
|
|
|
void on_get_channel_forbidden(telegram_api::channelForbidden &channel, const char *source);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void save_user(User *u, UserId user_id, bool from_binlog);
|
|
|
|
static string get_user_database_key(UserId user_id);
|
|
|
|
static string get_user_database_value(const User *u);
|
|
|
|
void save_user_to_database(User *u, UserId user_id);
|
|
|
|
void save_user_to_database_impl(User *u, UserId user_id, string value);
|
|
|
|
void on_save_user_to_database(UserId user_id, bool success);
|
|
|
|
void load_user_from_database(User *u, UserId user_id, Promise<Unit> promise);
|
|
|
|
void load_user_from_database_impl(UserId user_id, Promise<Unit> promise);
|
2021-07-19 03:27:44 +02:00
|
|
|
void on_load_user_from_database(UserId user_id, string value, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void save_chat(Chat *c, ChatId chat_id, bool from_binlog);
|
|
|
|
static string get_chat_database_key(ChatId chat_id);
|
|
|
|
static string get_chat_database_value(const Chat *c);
|
|
|
|
void save_chat_to_database(Chat *c, ChatId chat_id);
|
|
|
|
void save_chat_to_database_impl(Chat *c, ChatId chat_id, string value);
|
|
|
|
void on_save_chat_to_database(ChatId chat_id, bool success);
|
|
|
|
void load_chat_from_database(Chat *c, ChatId chat_id, Promise<Unit> promise);
|
|
|
|
void load_chat_from_database_impl(ChatId chat_id, Promise<Unit> promise);
|
2021-07-19 03:27:44 +02:00
|
|
|
void on_load_chat_from_database(ChatId chat_id, string value, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void save_channel(Channel *c, ChannelId channel_id, bool from_binlog);
|
|
|
|
static string get_channel_database_key(ChannelId channel_id);
|
|
|
|
static string get_channel_database_value(const Channel *c);
|
|
|
|
void save_channel_to_database(Channel *c, ChannelId channel_id);
|
|
|
|
void save_channel_to_database_impl(Channel *c, ChannelId channel_id, string value);
|
|
|
|
void on_save_channel_to_database(ChannelId channel_id, bool success);
|
|
|
|
void load_channel_from_database(Channel *c, ChannelId channel_id, Promise<Unit> promise);
|
|
|
|
void load_channel_from_database_impl(ChannelId channel_id, Promise<Unit> promise);
|
2021-07-19 03:27:44 +02:00
|
|
|
void on_load_channel_from_database(ChannelId channel_id, string value, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void save_secret_chat(SecretChat *c, SecretChatId secret_chat_id, bool from_binlog);
|
|
|
|
static string get_secret_chat_database_key(SecretChatId secret_chat_id);
|
|
|
|
static string get_secret_chat_database_value(const SecretChat *c);
|
|
|
|
void save_secret_chat_to_database(SecretChat *c, SecretChatId secret_chat_id);
|
|
|
|
void save_secret_chat_to_database_impl(SecretChat *c, SecretChatId secret_chat_id, string value);
|
|
|
|
void on_save_secret_chat_to_database(SecretChatId secret_chat_id, bool success);
|
|
|
|
void load_secret_chat_from_database(SecretChat *c, SecretChatId secret_chat_id, Promise<Unit> promise);
|
|
|
|
void load_secret_chat_from_database_impl(SecretChatId secret_chat_id, Promise<Unit> promise);
|
2021-07-19 03:27:44 +02:00
|
|
|
void on_load_secret_chat_from_database(SecretChatId secret_chat_id, string value, bool force);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-10-21 11:51:16 +02:00
|
|
|
static void save_user_full(const UserFull *user_full, UserId user_id);
|
2019-09-18 01:14:24 +02:00
|
|
|
static string get_user_full_database_key(UserId user_id);
|
|
|
|
static string get_user_full_database_value(const UserFull *user_full);
|
2019-09-19 03:21:40 +02:00
|
|
|
void on_load_user_full_from_database(UserId user_id, string value);
|
2019-09-18 01:14:24 +02:00
|
|
|
|
2021-10-21 11:51:16 +02:00
|
|
|
static void save_chat_full(const ChatFull *chat_full, ChatId chat_id);
|
2019-09-18 01:14:24 +02:00
|
|
|
static string get_chat_full_database_key(ChatId chat_id);
|
|
|
|
static string get_chat_full_database_value(const ChatFull *chat_full);
|
2019-09-19 02:58:54 +02:00
|
|
|
void on_load_chat_full_from_database(ChatId chat_id, string value);
|
2019-09-18 01:14:24 +02:00
|
|
|
|
2021-10-21 11:51:16 +02:00
|
|
|
static void save_channel_full(const ChannelFull *channel_full, ChannelId channel_id);
|
2019-09-18 01:14:24 +02:00
|
|
|
static string get_channel_full_database_key(ChannelId channel_id);
|
|
|
|
static string get_channel_full_database_value(const ChannelFull *channel_full);
|
2021-04-12 03:51:01 +02:00
|
|
|
void on_load_channel_full_from_database(ChannelId channel_id, string value, const char *source);
|
2019-09-18 01:14:24 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void update_user(User *u, UserId user_id, bool from_binlog = false, bool from_database = false);
|
|
|
|
void update_chat(Chat *c, ChatId chat_id, bool from_binlog = false, bool from_database = false);
|
|
|
|
void update_channel(Channel *c, ChannelId channel_id, bool from_binlog = false, bool from_database = false);
|
|
|
|
void update_secret_chat(SecretChat *c, SecretChatId secret_chat_id, bool from_binlog = false,
|
|
|
|
bool from_database = false);
|
|
|
|
|
2021-09-07 16:41:56 +02:00
|
|
|
void update_user_full(UserFull *user_full, UserId user_id, const char *source, bool from_database = false);
|
|
|
|
void update_chat_full(ChatFull *chat_full, ChatId chat_id, const char *source, bool from_database = false);
|
|
|
|
void update_channel_full(ChannelFull *channel_full, ChannelId channel_id, const char *source,
|
|
|
|
bool from_database = false);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-06-20 17:40:13 +02:00
|
|
|
bool is_chat_full_outdated(const ChatFull *chat_full, const Chat *c, ChatId chat_id, bool only_participants) const;
|
2019-03-14 22:57:09 +01:00
|
|
|
|
2021-01-21 14:49:41 +01:00
|
|
|
bool is_user_contact(const User *u, UserId user_id, bool is_mutual) const;
|
2019-05-04 02:15:49 +02:00
|
|
|
|
2023-04-03 19:43:25 +02:00
|
|
|
static bool is_user_premium(const User *u);
|
|
|
|
|
|
|
|
static bool is_user_deleted(const User *u);
|
|
|
|
|
|
|
|
static bool is_user_support(const User *u);
|
|
|
|
|
|
|
|
static bool is_user_bot(const User *u);
|
|
|
|
|
2023-10-04 11:24:58 +02:00
|
|
|
int32 get_user_was_online(const User *u, UserId user_id, int32 unix_time) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-09-03 11:27:59 +02:00
|
|
|
int64 get_contacts_hash();
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
void update_contacts_hints(const User *u, UserId user_id, bool from_database);
|
|
|
|
|
|
|
|
void save_next_contacts_sync_date();
|
|
|
|
|
|
|
|
void save_contacts_to_database();
|
|
|
|
|
|
|
|
void load_contacts(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_load_contacts_from_database(string value);
|
|
|
|
|
|
|
|
void on_get_contacts_finished(size_t expected_contact_count);
|
|
|
|
|
2021-11-11 19:57:09 +01:00
|
|
|
void do_import_contacts(vector<Contact> contacts, int64 random_id, Promise<Unit> &&promise);
|
|
|
|
|
2021-11-12 05:37:53 +01:00
|
|
|
void on_import_contacts_finished(int64 random_id, vector<UserId> imported_contact_user_ids,
|
|
|
|
vector<int32> unimported_contact_invites);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void load_imported_contacts(Promise<Unit> &&promise);
|
|
|
|
|
|
|
|
void on_load_imported_contacts_from_database(string value);
|
|
|
|
|
|
|
|
void on_load_imported_contacts_finished();
|
|
|
|
|
|
|
|
void on_clear_imported_contacts(vector<Contact> &&contacts, vector<size_t> contacts_unique_id,
|
|
|
|
std::pair<vector<size_t>, vector<Contact>> &&to_add, Promise<Unit> &&promise);
|
|
|
|
|
2023-04-13 21:41:22 +02:00
|
|
|
vector<td_api::object_ptr<td_api::chatNearby>> get_chats_nearby_object(
|
|
|
|
const vector<DialogNearby> &dialogs_nearby) const;
|
2019-10-16 20:55:16 +02:00
|
|
|
|
|
|
|
void send_update_users_nearby() const;
|
|
|
|
|
|
|
|
void on_get_dialogs_nearby(Result<tl_object_ptr<telegram_api::Updates>> result,
|
|
|
|
Promise<td_api::object_ptr<td_api::chatsNearby>> &&promise);
|
|
|
|
|
2020-02-14 13:44:56 +01:00
|
|
|
void try_send_set_location_visibility_query();
|
|
|
|
|
|
|
|
void on_set_location_visibility_expire_date(int32 set_expire_date, int32 error_code);
|
|
|
|
|
|
|
|
void set_location_visibility_expire_date(int32 expire_date);
|
|
|
|
|
2021-10-12 21:05:14 +02:00
|
|
|
void on_get_is_location_visible(Result<tl_object_ptr<telegram_api::Updates>> &&result, Promise<Unit> &&promise);
|
|
|
|
|
2020-02-14 13:44:56 +01:00
|
|
|
void update_is_location_visible();
|
|
|
|
|
2023-11-20 20:03:21 +01:00
|
|
|
bool is_suitable_recommended_channel(DialogId dialog_id) const;
|
|
|
|
|
|
|
|
bool is_suitable_recommended_channel(ChannelId channel_id) const;
|
|
|
|
|
2023-11-21 11:39:32 +01:00
|
|
|
bool are_suitable_recommended_dialogs(const RecommendedDialogs &recommended_dialogs) const;
|
|
|
|
|
2023-11-21 12:13:06 +01:00
|
|
|
static string get_channel_recommendations_database_key(ChannelId channel_id);
|
|
|
|
|
2023-11-29 13:31:33 +01:00
|
|
|
void load_channel_recommendations(ChannelId channel_id, bool use_database, bool return_local,
|
|
|
|
Promise<td_api::object_ptr<td_api::chats>> &&chats_promise,
|
|
|
|
Promise<td_api::object_ptr<td_api::count>> &&count_promise);
|
2023-11-21 12:13:06 +01:00
|
|
|
|
2023-11-29 13:04:21 +01:00
|
|
|
void fail_load_channel_recommendations_queries(ChannelId channel_id, Status &&error);
|
|
|
|
|
2023-11-29 13:11:55 +01:00
|
|
|
void finish_load_channel_recommendations_queries(ChannelId channel_id, int32 total_count,
|
|
|
|
vector<DialogId> dialog_ids);
|
|
|
|
|
2023-11-21 12:13:06 +01:00
|
|
|
void on_load_channel_recommendations_from_database(ChannelId channel_id, string value);
|
|
|
|
|
|
|
|
void reload_channel_recommendations(ChannelId channel_id);
|
2023-11-20 20:03:21 +01:00
|
|
|
|
|
|
|
void on_get_channel_recommendations(ChannelId channel_id,
|
2023-11-24 11:53:10 +01:00
|
|
|
Result<std::pair<int32, vector<tl_object_ptr<telegram_api::Chat>>>> &&r_chats);
|
2023-11-20 20:03:21 +01:00
|
|
|
|
2019-10-13 19:58:32 +02:00
|
|
|
static bool is_channel_public(const Channel *c);
|
|
|
|
|
2023-09-20 18:51:17 +02:00
|
|
|
static bool is_suitable_created_public_channel(PublicDialogType type, const Channel *c);
|
|
|
|
|
2021-12-03 13:40:39 +01:00
|
|
|
static void return_created_public_dialogs(Promise<td_api::object_ptr<td_api::chats>> &&promise,
|
|
|
|
const vector<ChannelId> &channel_ids);
|
|
|
|
|
|
|
|
void finish_get_created_public_dialogs(PublicDialogType type, Result<Unit> &&result);
|
|
|
|
|
2021-12-02 15:12:33 +01:00
|
|
|
void update_created_public_channels(Channel *c, ChannelId channel_id);
|
|
|
|
|
2021-12-03 18:10:30 +01:00
|
|
|
void save_created_public_channels(PublicDialogType type);
|
|
|
|
|
2021-12-03 10:28:33 +01:00
|
|
|
void update_created_public_broadcasts();
|
|
|
|
|
2021-01-26 21:59:09 +01:00
|
|
|
bool update_permanent_invite_link(DialogInviteLink &invite_link, DialogInviteLink new_invite_link);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-06-21 03:01:13 +02:00
|
|
|
vector<BotCommands> get_bot_commands(vector<tl_object_ptr<telegram_api::botInfo>> &&bot_infos,
|
|
|
|
const vector<DialogParticipant> *participants);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
const DialogParticipant *get_chat_participant(ChatId chat_id, UserId user_id) const;
|
|
|
|
|
2021-03-26 00:39:24 +01:00
|
|
|
static const DialogParticipant *get_chat_full_participant(const ChatFull *chat_full, DialogId dialog_id);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-03-26 00:39:24 +01:00
|
|
|
std::pair<int32, vector<DialogId>> search_among_dialogs(const vector<DialogId> &dialog_ids, const string &query,
|
|
|
|
int32 limit) const;
|
2021-01-27 00:16:17 +01:00
|
|
|
|
|
|
|
DialogParticipants search_private_chat_participants(UserId my_user_id, UserId peer_user_id, const string &query,
|
2022-03-19 19:37:46 +01:00
|
|
|
int32 limit, DialogParticipantFilter filter) const;
|
2021-01-27 00:16:17 +01:00
|
|
|
|
2021-07-19 03:17:29 +02:00
|
|
|
void finish_get_chat_participant(ChatId chat_id, UserId user_id, Promise<DialogParticipant> &&promise);
|
|
|
|
|
2021-02-22 17:38:40 +01:00
|
|
|
void remove_dialog_suggested_action(SuggestedAction action);
|
|
|
|
|
|
|
|
void on_dismiss_suggested_action(SuggestedAction action, Result<Unit> &&result);
|
|
|
|
|
2023-09-05 15:50:41 +02:00
|
|
|
bool need_poll_user_active_stories(const User *u, UserId user_id) const;
|
2023-07-21 14:23:28 +02:00
|
|
|
|
2023-09-05 15:38:06 +02:00
|
|
|
static bool get_user_has_unread_stories(const User *u);
|
2023-07-07 17:25:24 +02:00
|
|
|
|
2023-03-17 19:42:34 +01:00
|
|
|
td_api::object_ptr<td_api::updateUser> get_update_user_object(UserId user_id, const User *u) const;
|
|
|
|
|
2023-03-17 16:51:04 +01:00
|
|
|
td_api::object_ptr<td_api::updateUser> get_update_unknown_user_object(UserId user_id) const;
|
2020-07-07 17:48:17 +02:00
|
|
|
|
2023-10-04 11:24:58 +02:00
|
|
|
td_api::object_ptr<td_api::UserStatus> get_user_status_object(UserId user_id, const User *u, int32 unix_time) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
tl_object_ptr<td_api::user> get_user_object(UserId user_id, const User *u) const;
|
|
|
|
|
|
|
|
tl_object_ptr<td_api::userFullInfo> get_user_full_info_object(UserId user_id, const UserFull *user_full) const;
|
|
|
|
|
2023-03-17 19:42:34 +01:00
|
|
|
td_api::object_ptr<td_api::updateBasicGroup> get_update_basic_group_object(ChatId chat_id, const Chat *c);
|
|
|
|
|
2020-07-07 17:48:17 +02:00
|
|
|
static td_api::object_ptr<td_api::updateBasicGroup> get_update_unknown_basic_group_object(ChatId chat_id);
|
|
|
|
|
2019-10-13 19:58:32 +02:00
|
|
|
tl_object_ptr<td_api::basicGroup> get_basic_group_object(ChatId chat_id, const Chat *c);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-13 19:58:32 +02:00
|
|
|
tl_object_ptr<td_api::basicGroup> get_basic_group_object_const(ChatId chat_id, const Chat *c) const;
|
2018-09-21 09:34:15 +02:00
|
|
|
|
2022-12-20 09:17:51 +01:00
|
|
|
tl_object_ptr<td_api::basicGroupFullInfo> get_basic_group_full_info_object(ChatId chat_id,
|
|
|
|
const ChatFull *chat_full) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-09-05 15:50:41 +02:00
|
|
|
bool need_poll_channel_active_stories(const Channel *c, ChannelId channel_id) const;
|
|
|
|
|
|
|
|
static bool get_channel_has_unread_stories(const Channel *c);
|
|
|
|
|
2023-03-17 19:42:34 +01:00
|
|
|
td_api::object_ptr<td_api::updateSupergroup> get_update_supergroup_object(ChannelId channel_id,
|
|
|
|
const Channel *c) const;
|
|
|
|
|
2021-12-22 14:48:23 +01:00
|
|
|
td_api::object_ptr<td_api::updateSupergroup> get_update_unknown_supergroup_object(ChannelId channel_id) const;
|
2020-07-07 17:48:17 +02:00
|
|
|
|
2021-10-19 17:11:16 +02:00
|
|
|
static tl_object_ptr<td_api::supergroup> get_supergroup_object(ChannelId channel_id, const Channel *c);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-12-20 09:17:51 +01:00
|
|
|
Status can_hide_chat_participants(ChatId chat_id) const;
|
|
|
|
|
2022-12-20 09:04:00 +01:00
|
|
|
Status can_hide_channel_participants(ChannelId channel_id, const ChannelFull *channel_full) const;
|
|
|
|
|
2022-12-20 09:17:51 +01:00
|
|
|
Status can_toggle_chat_aggressive_anti_spam(ChatId chat_id) const;
|
|
|
|
|
2022-12-19 11:59:09 +01:00
|
|
|
Status can_toggle_channel_aggressive_anti_spam(ChannelId channel_id, const ChannelFull *channel_full) const;
|
|
|
|
|
2022-12-20 09:27:38 +01:00
|
|
|
tl_object_ptr<td_api::supergroupFullInfo> get_supergroup_full_info_object(ChannelId channel_id,
|
|
|
|
const ChannelFull *channel_full) const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
static tl_object_ptr<td_api::SecretChatState> get_secret_chat_state_object(SecretChatState state);
|
|
|
|
|
2023-03-17 19:42:34 +01:00
|
|
|
td_api::object_ptr<td_api::updateSecretChat> get_update_secret_chat_object(SecretChatId secret_chat_id,
|
|
|
|
const SecretChat *secret_chat);
|
|
|
|
|
2021-09-14 16:09:40 +02:00
|
|
|
static td_api::object_ptr<td_api::updateSecretChat> get_update_unknown_secret_chat_object(
|
|
|
|
SecretChatId secret_chat_id);
|
2020-07-07 17:48:17 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
tl_object_ptr<td_api::secretChat> get_secret_chat_object(SecretChatId secret_chat_id, const SecretChat *secret_chat);
|
|
|
|
|
2018-09-21 09:34:15 +02:00
|
|
|
tl_object_ptr<td_api::secretChat> get_secret_chat_object_const(SecretChatId secret_chat_id,
|
|
|
|
const SecretChat *secret_chat) const;
|
|
|
|
|
2019-09-13 19:25:17 +02:00
|
|
|
vector<DialogId> get_dialog_ids(vector<tl_object_ptr<telegram_api::Chat>> &&chats, const char *source);
|
|
|
|
|
2022-09-21 17:55:21 +02:00
|
|
|
void on_create_inactive_channels(vector<ChannelId> &&channel_ids, Promise<Unit> &&promise);
|
|
|
|
|
2019-09-13 19:58:09 +02:00
|
|
|
void update_dialogs_for_discussion(DialogId dialog_id, bool is_suitable);
|
|
|
|
|
2021-09-24 09:20:50 +02:00
|
|
|
void send_edit_chat_admin_query(ChatId chat_id, UserId user_id, bool is_administrator, Promise<Unit> &&promise);
|
|
|
|
|
2022-03-19 19:37:46 +01:00
|
|
|
void search_chat_participants(ChatId chat_id, const string &query, int32 limit, DialogParticipantFilter filter,
|
2021-01-27 00:16:17 +01:00
|
|
|
Promise<DialogParticipants> &&promise);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-03-19 19:37:46 +01:00
|
|
|
void do_search_chat_participants(ChatId chat_id, const string &query, int32 limit, DialogParticipantFilter filter,
|
2021-01-25 15:26:04 +01:00
|
|
|
Promise<DialogParticipants> &&promise);
|
|
|
|
|
2022-03-19 19:53:33 +01:00
|
|
|
void on_get_channel_participants(ChannelId channel_id, ChannelParticipantFilter &&filter, int32 offset, int32 limit,
|
2021-01-25 15:26:04 +01:00
|
|
|
string additional_query, int32 additional_limit,
|
|
|
|
tl_object_ptr<telegram_api::channels_channelParticipants> &&channel_participants,
|
|
|
|
Promise<DialogParticipants> &&promise);
|
|
|
|
|
2019-10-17 16:05:01 +02:00
|
|
|
void transfer_channel_ownership(ChannelId channel_id, UserId user_id,
|
|
|
|
tl_object_ptr<telegram_api::InputCheckPasswordSRP> input_check_password,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2020-07-28 01:57:23 +02:00
|
|
|
void get_channel_statistics_dc_id_impl(ChannelId channel_id, bool for_full_statistics, Promise<DcId> &&promise);
|
2020-04-07 22:11:44 +02:00
|
|
|
|
2022-05-14 17:54:21 +02:00
|
|
|
void on_get_support_user(UserId user_id, Promise<td_api::object_ptr<td_api::user>> &&promise);
|
2022-05-14 17:29:34 +02:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static void on_user_online_timeout_callback(void *contacts_manager_ptr, int64 user_id_long);
|
|
|
|
|
2022-09-01 21:26:04 +02:00
|
|
|
static void on_user_emoji_status_timeout_callback(void *contacts_manager_ptr, int64 user_id_long);
|
|
|
|
|
2023-12-21 19:05:42 +01:00
|
|
|
static void on_channel_emoji_status_timeout_callback(void *contacts_manager_ptr, int64 channel_id_long);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
static void on_channel_unban_timeout_callback(void *contacts_manager_ptr, int64 channel_id_long);
|
|
|
|
|
2019-10-16 20:55:16 +02:00
|
|
|
static void on_user_nearby_timeout_callback(void *contacts_manager_ptr, int64 user_id_long);
|
|
|
|
|
2019-11-20 22:40:34 +01:00
|
|
|
static void on_slow_mode_delay_timeout_callback(void *contacts_manager_ptr, int64 channel_id_long);
|
|
|
|
|
2019-08-29 01:17:52 +02:00
|
|
|
void on_user_online_timeout(UserId user_id);
|
|
|
|
|
2022-09-01 21:26:04 +02:00
|
|
|
void on_user_emoji_status_timeout(UserId user_id);
|
|
|
|
|
2023-12-21 19:05:42 +01:00
|
|
|
void on_channel_emoji_status_timeout(ChannelId channel_id);
|
|
|
|
|
2021-06-10 20:56:05 +02:00
|
|
|
void on_channel_unban_timeout(ChannelId channel_id);
|
|
|
|
|
2019-11-20 22:40:34 +01:00
|
|
|
void on_user_nearby_timeout(UserId user_id);
|
|
|
|
|
|
|
|
void on_slow_mode_delay_timeout(ChannelId channel_id);
|
|
|
|
|
2022-08-19 13:16:53 +02:00
|
|
|
void start_up() final;
|
|
|
|
|
2021-07-03 22:51:36 +02:00
|
|
|
void tear_down() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
UserId my_id_;
|
|
|
|
UserId support_user_id_;
|
2018-03-10 15:10:23 +01:00
|
|
|
int32 my_was_online_local_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<UserId, unique_ptr<User>, UserIdHash> users_;
|
|
|
|
WaitFreeHashMap<UserId, unique_ptr<UserFull>, UserIdHash> users_full_;
|
2022-11-20 21:16:21 +01:00
|
|
|
WaitFreeHashMap<UserId, unique_ptr<UserPhotos>, UserIdHash> user_photos_;
|
2022-03-11 19:38:48 +01:00
|
|
|
mutable FlatHashSet<UserId, UserIdHash> unknown_users_;
|
2022-11-20 20:48:01 +01:00
|
|
|
WaitFreeHashMap<UserId, tl_object_ptr<telegram_api::UserProfilePhoto>, UserIdHash> pending_user_photos_;
|
2019-01-30 22:37:38 +01:00
|
|
|
struct UserIdPhotoIdHash {
|
2022-11-23 17:37:32 +01:00
|
|
|
uint32 operator()(const std::pair<UserId, int64> &pair) const {
|
2023-07-27 18:05:15 +02:00
|
|
|
return combine_hashes(UserIdHash()(pair.first), Hash<int64>()(pair.second));
|
2019-01-30 22:37:38 +01:00
|
|
|
}
|
|
|
|
};
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<std::pair<UserId, int64>, FileSourceId, UserIdPhotoIdHash> user_profile_photo_file_source_ids_;
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, FileId> my_photo_file_id_;
|
2022-08-06 12:42:35 +02:00
|
|
|
WaitFreeHashMap<UserId, FileSourceId, UserIdHash> user_full_file_source_ids_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<ChatId, unique_ptr<Chat>, ChatIdHash> chats_;
|
|
|
|
WaitFreeHashMap<ChatId, unique_ptr<ChatFull>, ChatIdHash> chats_full_;
|
2022-03-11 19:38:48 +01:00
|
|
|
mutable FlatHashSet<ChatId, ChatIdHash> unknown_chats_;
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<ChatId, FileSourceId, ChatIdHash> chat_full_file_source_ids_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<ChannelId, unique_ptr<MinChannel>, ChannelIdHash> min_channels_;
|
|
|
|
WaitFreeHashMap<ChannelId, unique_ptr<Channel>, ChannelIdHash> channels_;
|
|
|
|
WaitFreeHashMap<ChannelId, unique_ptr<ChannelFull>, ChannelIdHash> channels_full_;
|
2022-03-11 19:38:48 +01:00
|
|
|
mutable FlatHashSet<ChannelId, ChannelIdHash> unknown_channels_;
|
2022-08-20 23:20:57 +02:00
|
|
|
WaitFreeHashSet<ChannelId, ChannelIdHash> invalidated_channels_full_;
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<ChannelId, FileSourceId, ChannelIdHash> channel_full_file_source_ids_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<SecretChatId, unique_ptr<SecretChat>, SecretChatIdHash> secret_chats_;
|
2022-03-11 19:38:48 +01:00
|
|
|
mutable FlatHashSet<SecretChatId, SecretChatIdHash> unknown_secret_chats_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<UserId, vector<SecretChatId>, UserIdHash> secret_chats_with_user_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-11-20 21:12:42 +01:00
|
|
|
FlatHashMap<ChannelId, RecommendedDialogs, ChannelIdHash> channel_recommended_dialogs_;
|
2023-11-20 20:03:21 +01:00
|
|
|
FlatHashMap<ChannelId, vector<Promise<td_api::object_ptr<td_api::chats>>>, ChannelIdHash>
|
|
|
|
get_channel_recommendations_queries_;
|
2023-11-29 13:31:33 +01:00
|
|
|
FlatHashMap<ChannelId, vector<Promise<td_api::object_ptr<td_api::count>>>, ChannelIdHash>
|
|
|
|
get_channel_recommendation_count_queries_[2];
|
2023-11-20 20:03:21 +01:00
|
|
|
|
2019-10-22 12:40:24 +02:00
|
|
|
bool created_public_channels_inited_[2] = {false, false};
|
|
|
|
vector<ChannelId> created_public_channels_[2];
|
2021-12-03 13:40:39 +01:00
|
|
|
vector<Promise<td_api::object_ptr<td_api::chats>>> get_created_public_channels_queries_[2];
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-09-13 19:25:17 +02:00
|
|
|
bool dialogs_for_discussion_inited_ = false;
|
|
|
|
vector<DialogId> dialogs_for_discussion_;
|
|
|
|
|
2022-09-21 17:55:21 +02:00
|
|
|
bool inactive_channel_ids_inited_ = false;
|
|
|
|
vector<ChannelId> inactive_channel_ids_;
|
2019-12-13 15:27:44 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<UserId, vector<Promise<Unit>>, UserIdHash> load_user_from_database_queries_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<UserId, UserIdHash> loaded_from_database_users_;
|
|
|
|
FlatHashSet<UserId, UserIdHash> unavailable_user_fulls_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<ChatId, vector<Promise<Unit>>, ChatIdHash> load_chat_from_database_queries_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<ChatId, ChatIdHash> loaded_from_database_chats_;
|
|
|
|
FlatHashSet<ChatId, ChatIdHash> unavailable_chat_fulls_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<ChannelId, vector<Promise<Unit>>, ChannelIdHash> load_channel_from_database_queries_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<ChannelId, ChannelIdHash> loaded_from_database_channels_;
|
|
|
|
FlatHashSet<ChannelId, ChannelIdHash> unavailable_channel_fulls_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<SecretChatId, vector<Promise<Unit>>, SecretChatIdHash> load_secret_chat_from_database_queries_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<SecretChatId, SecretChatIdHash> loaded_from_database_secret_chats_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-01-13 12:29:47 +01:00
|
|
|
QueryMerger get_user_queries_{"GetUserMerger", 3, 50};
|
2023-01-13 12:45:53 +01:00
|
|
|
QueryMerger get_chat_queries_{"GetChatMerger", 3, 50};
|
2023-01-13 13:42:15 +01:00
|
|
|
QueryMerger get_channel_queries_{"GetChannelMerger", 100, 1}; // can't merge getChannel queries without access hash
|
2023-01-13 12:29:47 +01:00
|
|
|
|
2024-01-19 19:55:24 +01:00
|
|
|
QueryMerger get_is_premium_required_to_contact_queries_{"GetIsPremiumRequiredToContactMerger", 3, 100};
|
|
|
|
|
2019-02-25 18:44:28 +01:00
|
|
|
QueryCombiner get_user_full_queries_{"GetUserFullCombiner", 2.0};
|
|
|
|
QueryCombiner get_chat_full_queries_{"GetChatFullCombiner", 2.0};
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<DialogId, vector<SuggestedAction>, DialogIdHash> dialog_suggested_actions_;
|
|
|
|
FlatHashMap<DialogId, vector<Promise<Unit>>, DialogIdHash> dismiss_suggested_action_queries_;
|
2021-02-22 17:38:40 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
class UploadProfilePhotoCallback;
|
|
|
|
std::shared_ptr<UploadProfilePhotoCallback> upload_profile_photo_callback_;
|
|
|
|
|
2020-06-28 16:44:56 +02:00
|
|
|
struct UploadedProfilePhoto {
|
2022-12-13 12:16:49 +01:00
|
|
|
UserId user_id;
|
2022-12-15 15:44:26 +01:00
|
|
|
bool is_fallback;
|
2022-12-15 16:12:30 +01:00
|
|
|
bool only_suggest;
|
2020-07-07 19:56:54 +02:00
|
|
|
double main_frame_timestamp;
|
2020-06-28 16:44:56 +02:00
|
|
|
bool is_animation;
|
2021-10-01 18:19:14 +02:00
|
|
|
int reupload_count;
|
2020-06-28 16:44:56 +02:00
|
|
|
Promise<Unit> promise;
|
|
|
|
|
2023-01-29 22:35:14 +01:00
|
|
|
UploadedProfilePhoto(UserId user_id, bool is_fallback, bool only_suggest, double main_frame_timestamp,
|
|
|
|
bool is_animation, int32 reupload_count, Promise<Unit> promise)
|
2022-12-13 12:16:49 +01:00
|
|
|
: user_id(user_id)
|
2022-12-15 15:44:26 +01:00
|
|
|
, is_fallback(is_fallback)
|
2022-12-15 16:12:30 +01:00
|
|
|
, only_suggest(only_suggest)
|
2022-12-13 12:16:49 +01:00
|
|
|
, main_frame_timestamp(main_frame_timestamp)
|
2020-07-07 19:56:54 +02:00
|
|
|
, is_animation(is_animation)
|
2021-10-01 18:19:14 +02:00
|
|
|
, reupload_count(reupload_count)
|
2020-07-07 19:56:54 +02:00
|
|
|
, promise(std::move(promise)) {
|
2020-06-28 16:44:56 +02:00
|
|
|
}
|
|
|
|
};
|
2023-06-19 16:48:12 +02:00
|
|
|
FlatHashMap<FileId, UploadedProfilePhoto, FileIdHash> uploaded_profile_photos_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2021-11-12 05:37:53 +01:00
|
|
|
struct ImportContactsTask {
|
|
|
|
Promise<Unit> promise_;
|
|
|
|
vector<Contact> input_contacts_;
|
|
|
|
vector<UserId> imported_user_ids_;
|
|
|
|
vector<int32> unimported_contact_invites_;
|
|
|
|
};
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, unique_ptr<ImportContactsTask>> import_contact_tasks_;
|
2021-11-12 05:37:53 +01:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, std::pair<vector<UserId>, vector<int32>>> imported_contacts_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2024-01-05 10:33:53 +01:00
|
|
|
struct UserOnlineMemberDialogs {
|
|
|
|
FlatHashMap<DialogId, int32, DialogIdHash> online_member_dialogs_; // dialog_id -> time
|
|
|
|
};
|
|
|
|
FlatHashMap<UserId, unique_ptr<UserOnlineMemberDialogs>, UserIdHash> user_online_member_dialogs_;
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<ChannelId, vector<DialogParticipant>, ChannelIdHash> cached_channel_participants_;
|
2019-03-12 12:52:37 +01:00
|
|
|
|
2022-02-18 15:22:27 +01:00
|
|
|
FlatHashMap<string, UserId> resolved_phone_numbers_;
|
|
|
|
|
2023-09-21 18:11:17 +02:00
|
|
|
FlatHashMap<UserId, FlatHashSet<MessageFullId, MessageFullIdHash>, UserIdHash> user_messages_;
|
|
|
|
FlatHashMap<ChannelId, FlatHashSet<MessageFullId, MessageFullIdHash>, ChannelIdHash> channel_messages_;
|
2023-03-17 16:51:04 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool are_contacts_loaded_ = false;
|
|
|
|
int32 next_contacts_sync_date_ = 0;
|
2022-10-12 20:04:18 +02:00
|
|
|
Hints contacts_hints_; // search contacts by first name, last name and usernames
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Promise<Unit>> load_contacts_queries_;
|
2018-12-12 00:48:56 +01:00
|
|
|
MultiPromiseActor load_contact_users_multipromise_{"LoadContactUsersMultiPromiseActor"};
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 saved_contact_count_ = -1;
|
|
|
|
|
2018-11-15 23:48:56 +01:00
|
|
|
int32 was_online_local_ = 0;
|
|
|
|
int32 was_online_remote_ = 0;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
bool are_imported_contacts_loaded_ = false;
|
|
|
|
vector<Promise<Unit>> load_imported_contacts_queries_;
|
2018-12-12 00:48:56 +01:00
|
|
|
MultiPromiseActor load_imported_contact_users_multipromise_{"LoadImportedContactUsersMultiPromiseActor"};
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Contact> all_imported_contacts_;
|
|
|
|
bool are_imported_contacts_changing_ = false;
|
2018-05-24 23:37:43 +02:00
|
|
|
bool need_clear_imported_contacts_ = false;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-10-16 20:55:16 +02:00
|
|
|
vector<DialogNearby> users_nearby_;
|
|
|
|
vector<DialogNearby> channels_nearby_;
|
2022-03-11 19:38:48 +01:00
|
|
|
FlatHashSet<UserId, UserIdHash> all_users_nearby_;
|
2019-10-16 20:55:16 +02:00
|
|
|
|
2020-02-14 13:44:56 +01:00
|
|
|
int32 location_visibility_expire_date_ = 0;
|
|
|
|
int32 pending_location_visibility_expire_date_ = -1;
|
|
|
|
bool is_set_location_visibility_request_sent_ = false;
|
|
|
|
Location last_user_location_;
|
|
|
|
|
2024-01-19 19:55:24 +01:00
|
|
|
FlatHashMap<UserId, bool, UserIdHash> user_full_contact_require_premium_;
|
|
|
|
|
2022-08-04 15:18:41 +02:00
|
|
|
WaitFreeHashMap<ChannelId, ChannelId, ChannelIdHash> linked_channel_ids_;
|
2019-12-23 16:37:11 +01:00
|
|
|
|
2022-08-20 23:20:57 +02:00
|
|
|
WaitFreeHashSet<UserId, UserIdHash> restricted_user_ids_;
|
|
|
|
WaitFreeHashSet<ChannelId, ChannelIdHash> restricted_channel_ids_;
|
2019-12-20 14:11:58 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
vector<Contact> next_all_imported_contacts_;
|
|
|
|
vector<size_t> imported_contacts_unique_id_;
|
|
|
|
vector<size_t> imported_contacts_pos_;
|
|
|
|
|
|
|
|
vector<UserId> imported_contact_user_ids_; // result of change_imported_contacts
|
|
|
|
vector<int32> unimported_contact_invites_; // result of change_imported_contacts
|
|
|
|
|
2018-08-01 19:31:20 +02:00
|
|
|
MultiTimeout user_online_timeout_{"UserOnlineTimeout"};
|
2022-09-01 21:26:04 +02:00
|
|
|
MultiTimeout user_emoji_status_timeout_{"UserEmojiStatusTimeout"};
|
2023-12-21 19:05:42 +01:00
|
|
|
MultiTimeout channel_emoji_status_timeout_{"ChannelEmojiStatusTimeout"};
|
2018-08-01 19:31:20 +02:00
|
|
|
MultiTimeout channel_unban_timeout_{"ChannelUnbanTimeout"};
|
2019-11-20 22:40:34 +01:00
|
|
|
MultiTimeout user_nearby_timeout_{"UserNearbyTimeout"};
|
|
|
|
MultiTimeout slow_mode_delay_timeout_{"SlowModeDelayTimeout"};
|
2018-12-31 20:04:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|