Make ContactsManager struct declarations private.
This commit is contained in:
parent
dda1b62655
commit
3ae02a64c1
@ -14,6 +14,8 @@
|
|||||||
#include "td/telegram/ConfigShared.h"
|
#include "td/telegram/ConfigShared.h"
|
||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
#include "td/telegram/DeviceTokenManager.h"
|
#include "td/telegram/DeviceTokenManager.h"
|
||||||
|
#include "td/telegram/DialogInviteLink.h"
|
||||||
|
#include "td/telegram/DialogLocation.h"
|
||||||
#include "td/telegram/FileReferenceManager.h"
|
#include "td/telegram/FileReferenceManager.h"
|
||||||
#include "td/telegram/files/FileManager.h"
|
#include "td/telegram/files/FileManager.h"
|
||||||
#include "td/telegram/files/FileType.h"
|
#include "td/telegram/files/FileType.h"
|
||||||
@ -30,6 +32,7 @@
|
|||||||
#include "td/telegram/PasswordManager.h"
|
#include "td/telegram/PasswordManager.h"
|
||||||
#include "td/telegram/Photo.h"
|
#include "td/telegram/Photo.h"
|
||||||
#include "td/telegram/Photo.hpp"
|
#include "td/telegram/Photo.hpp"
|
||||||
|
#include "td/telegram/RestrictionReason.h"
|
||||||
#include "td/telegram/SecretChatActor.h"
|
#include "td/telegram/SecretChatActor.h"
|
||||||
#include "td/telegram/ServerMessageId.h"
|
#include "td/telegram/ServerMessageId.h"
|
||||||
#include "td/telegram/StickerSetId.hpp"
|
#include "td/telegram/StickerSetId.hpp"
|
||||||
@ -1670,7 +1673,7 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
|
|||||||
flags |= telegram_api::messages_getExportedChatInvites::OFFSET_LINK_MASK;
|
flags |= telegram_api::messages_getExportedChatInvites::OFFSET_LINK_MASK;
|
||||||
}
|
}
|
||||||
send_query(G()->net_query_creator().create(telegram_api::messages_getExportedChatInvites(
|
send_query(G()->net_query_creator().create(telegram_api::messages_getExportedChatInvites(
|
||||||
flags, std::move(input_peer), std::move(input_user), offset_invite_link, limit)));
|
flags, false /*ignored*/, std::move(input_peer), std::move(input_user), offset_invite_link, limit)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_result(uint64 id, BufferSlice packet) override {
|
void on_result(uint64 id, BufferSlice packet) override {
|
||||||
@ -3005,14 +3008,6 @@ class LoadAsyncGraphQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ContactsManager::UserFull::is_expired() const {
|
|
||||||
return expires_at < Time::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ContactsManager::ChannelFull::is_expired() const {
|
|
||||||
return expires_at < Time::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
class ContactsManager::UploadProfilePhotoCallback : public FileManager::UploadCallback {
|
class ContactsManager::UploadProfilePhotoCallback : public FileManager::UploadCallback {
|
||||||
public:
|
public:
|
||||||
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) override {
|
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) override {
|
||||||
@ -3031,6 +3026,344 @@ class ContactsManager::UploadProfilePhotoCallback : public FileManager::UploadCa
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ContactsManager::User {
|
||||||
|
string first_name;
|
||||||
|
string last_name;
|
||||||
|
string username;
|
||||||
|
string phone_number;
|
||||||
|
int64 access_hash = -1;
|
||||||
|
|
||||||
|
ProfilePhoto photo;
|
||||||
|
|
||||||
|
vector<RestrictionReason> restriction_reasons;
|
||||||
|
string inline_query_placeholder;
|
||||||
|
int32 bot_info_version = -1;
|
||||||
|
|
||||||
|
int32 was_online = 0;
|
||||||
|
int32 local_was_online = 0;
|
||||||
|
|
||||||
|
string language_code;
|
||||||
|
|
||||||
|
std::unordered_set<int64> photo_ids;
|
||||||
|
|
||||||
|
std::unordered_map<DialogId, int32, DialogIdHash> online_member_dialogs; // id -> time
|
||||||
|
|
||||||
|
static constexpr uint32 CACHE_VERSION = 3;
|
||||||
|
uint32 cache_version = 0;
|
||||||
|
|
||||||
|
bool is_min_access_hash = true;
|
||||||
|
bool is_received = false;
|
||||||
|
bool is_verified = false;
|
||||||
|
bool is_support = false;
|
||||||
|
bool is_deleted = true;
|
||||||
|
bool is_bot = true;
|
||||||
|
bool can_join_groups = true;
|
||||||
|
bool can_read_all_group_messages = true;
|
||||||
|
bool is_inline_bot = false;
|
||||||
|
bool need_location_bot = false;
|
||||||
|
bool is_scam = false;
|
||||||
|
bool is_contact = false;
|
||||||
|
bool is_mutual_contact = false;
|
||||||
|
bool need_apply_min_photo = false;
|
||||||
|
|
||||||
|
bool is_photo_inited = false;
|
||||||
|
|
||||||
|
bool is_repaired = false; // whether cached value is rechecked
|
||||||
|
|
||||||
|
bool is_name_changed = true;
|
||||||
|
bool is_username_changed = true;
|
||||||
|
bool is_photo_changed = true;
|
||||||
|
bool is_is_contact_changed = true;
|
||||||
|
bool is_is_deleted_changed = true;
|
||||||
|
bool is_default_permissions_changed = true;
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContactsManager::BotInfo {
|
||||||
|
int32 version = -1;
|
||||||
|
string description;
|
||||||
|
vector<std::pair<string, string>> commands;
|
||||||
|
bool is_changed = true;
|
||||||
|
|
||||||
|
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 ContactsManager::UserFull {
|
||||||
|
Photo photo;
|
||||||
|
|
||||||
|
string about;
|
||||||
|
|
||||||
|
int32 common_chat_count = 0;
|
||||||
|
|
||||||
|
bool is_blocked = false;
|
||||||
|
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;
|
||||||
|
|
||||||
|
bool is_common_chat_count_changed = true;
|
||||||
|
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
|
||||||
|
|
||||||
|
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 ContactsManager::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);
|
||||||
|
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false, false, false};
|
||||||
|
|
||||||
|
static constexpr uint32 CACHE_VERSION = 3;
|
||||||
|
uint32 cache_version = 0;
|
||||||
|
|
||||||
|
bool is_active = false;
|
||||||
|
|
||||||
|
bool is_title_changed = true;
|
||||||
|
bool is_photo_changed = true;
|
||||||
|
bool is_default_permissions_changed = true;
|
||||||
|
bool is_is_active_changed = true;
|
||||||
|
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 ContactsManager::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;
|
||||||
|
|
||||||
|
bool can_set_username = false;
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
template <class StorerT>
|
||||||
|
void store(StorerT &storer) const;
|
||||||
|
|
||||||
|
template <class ParserT>
|
||||||
|
void parse(ParserT &parser);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContactsManager::Channel {
|
||||||
|
int64 access_hash = 0;
|
||||||
|
string title;
|
||||||
|
DialogPhoto photo;
|
||||||
|
string username;
|
||||||
|
vector<RestrictionReason> restriction_reasons;
|
||||||
|
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
||||||
|
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false, false, false};
|
||||||
|
int32 date = 0;
|
||||||
|
int32 participant_count = 0;
|
||||||
|
|
||||||
|
static constexpr uint32 CACHE_VERSION = 6;
|
||||||
|
uint32 cache_version = 0;
|
||||||
|
|
||||||
|
bool has_linked_channel = false;
|
||||||
|
bool has_location = false;
|
||||||
|
bool sign_messages = false;
|
||||||
|
bool is_slow_mode_enabled = false;
|
||||||
|
|
||||||
|
bool is_megagroup = false;
|
||||||
|
bool is_verified = false;
|
||||||
|
bool is_scam = false;
|
||||||
|
|
||||||
|
bool is_title_changed = true;
|
||||||
|
bool is_username_changed = true;
|
||||||
|
bool is_photo_changed = true;
|
||||||
|
bool is_default_permissions_changed = true;
|
||||||
|
bool is_status_changed = true;
|
||||||
|
bool had_read_access = true;
|
||||||
|
bool was_member = false;
|
||||||
|
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 ContactsManager::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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
bool is_slow_mode_next_send_date_changed = true;
|
||||||
|
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
|
||||||
|
|
||||||
|
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 ContactsManager::SecretChat {
|
||||||
|
int64 access_hash = 0;
|
||||||
|
UserId user_id;
|
||||||
|
SecretChatState state;
|
||||||
|
string key_hash;
|
||||||
|
int32 ttl = 0;
|
||||||
|
int32 date = 0;
|
||||||
|
int32 layer = 0;
|
||||||
|
FolderId initial_folder_id;
|
||||||
|
|
||||||
|
bool is_outbound = false;
|
||||||
|
|
||||||
|
bool is_state_changed = true;
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContactsManager::InviteLinkInfo {
|
||||||
|
// known dialog
|
||||||
|
DialogId dialog_id;
|
||||||
|
|
||||||
|
// unknown dialog
|
||||||
|
string title;
|
||||||
|
Photo photo;
|
||||||
|
int32 participant_count = 0;
|
||||||
|
vector<UserId> participant_user_ids;
|
||||||
|
bool is_chat = false;
|
||||||
|
bool is_channel = false;
|
||||||
|
bool is_public = false;
|
||||||
|
bool is_megagroup = false;
|
||||||
|
};
|
||||||
|
|
||||||
ContactsManager::ContactsManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
ContactsManager::ContactsManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
|
||||||
upload_profile_photo_callback_ = std::make_shared<UploadProfilePhotoCallback>();
|
upload_profile_photo_callback_ = std::make_shared<UploadProfilePhotoCallback>();
|
||||||
|
|
||||||
@ -3094,6 +3427,8 @@ ContactsManager::ContactsManager(Td *td, ActorShared<> parent) : td_(td), parent
|
|||||||
invite_link_info_expire_timeout_.set_callback_data(static_cast<void *>(this));
|
invite_link_info_expire_timeout_.set_callback_data(static_cast<void *>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContactsManager::~ContactsManager() = default;
|
||||||
|
|
||||||
void ContactsManager::tear_down() {
|
void ContactsManager::tear_down() {
|
||||||
parent_.reset();
|
parent_.reset();
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
#include "td/telegram/Contact.h"
|
#include "td/telegram/Contact.h"
|
||||||
#include "td/telegram/DialogAdministrator.h"
|
#include "td/telegram/DialogAdministrator.h"
|
||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/DialogInviteLink.h"
|
|
||||||
#include "td/telegram/DialogLocation.h"
|
|
||||||
#include "td/telegram/DialogParticipant.h"
|
#include "td/telegram/DialogParticipant.h"
|
||||||
#include "td/telegram/files/FileId.h"
|
#include "td/telegram/files/FileId.h"
|
||||||
#include "td/telegram/files/FileSourceId.h"
|
#include "td/telegram/files/FileSourceId.h"
|
||||||
@ -28,7 +26,6 @@
|
|||||||
#include "td/telegram/Photo.h"
|
#include "td/telegram/Photo.h"
|
||||||
#include "td/telegram/PublicDialogType.h"
|
#include "td/telegram/PublicDialogType.h"
|
||||||
#include "td/telegram/QueryCombiner.h"
|
#include "td/telegram/QueryCombiner.h"
|
||||||
#include "td/telegram/RestrictionReason.h"
|
|
||||||
#include "td/telegram/SecretChatId.h"
|
#include "td/telegram/SecretChatId.h"
|
||||||
#include "td/telegram/StickerSetId.h"
|
#include "td/telegram/StickerSetId.h"
|
||||||
#include "td/telegram/UserId.h"
|
#include "td/telegram/UserId.h"
|
||||||
@ -54,6 +51,9 @@ namespace td {
|
|||||||
|
|
||||||
struct BinlogEvent;
|
struct BinlogEvent;
|
||||||
|
|
||||||
|
class DialogInviteLink;
|
||||||
|
class DialogLocation;
|
||||||
|
|
||||||
class Td;
|
class Td;
|
||||||
|
|
||||||
struct BotData {
|
struct BotData {
|
||||||
@ -77,6 +77,11 @@ struct CanTransferOwnershipResult {
|
|||||||
class ContactsManager : public Actor {
|
class ContactsManager : public Actor {
|
||||||
public:
|
public:
|
||||||
ContactsManager(Td *td, ActorShared<> parent);
|
ContactsManager(Td *td, ActorShared<> parent);
|
||||||
|
ContactsManager(const ContactsManager &) = delete;
|
||||||
|
ContactsManager &operator=(const ContactsManager &) = delete;
|
||||||
|
ContactsManager(ContactsManager &&) = delete;
|
||||||
|
ContactsManager &operator=(ContactsManager &&) = delete;
|
||||||
|
~ContactsManager() override;
|
||||||
|
|
||||||
static UserId load_my_id();
|
static UserId load_my_id();
|
||||||
|
|
||||||
@ -570,89 +575,17 @@ class ContactsManager : public Actor {
|
|||||||
tl_object_ptr<telegram_api::stats_messageStats> obj);
|
tl_object_ptr<telegram_api::stats_messageStats> obj);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct User {
|
struct User;
|
||||||
string first_name;
|
struct UserFull;
|
||||||
string last_name;
|
struct Chat;
|
||||||
string username;
|
struct ChatFull;
|
||||||
string phone_number;
|
struct Channel;
|
||||||
int64 access_hash = -1;
|
struct ChannelFull;
|
||||||
|
struct SecretChat;
|
||||||
|
|
||||||
ProfilePhoto photo;
|
struct BotInfo;
|
||||||
|
|
||||||
vector<RestrictionReason> restriction_reasons;
|
struct InviteLinkInfo;
|
||||||
string inline_query_placeholder;
|
|
||||||
int32 bot_info_version = -1;
|
|
||||||
|
|
||||||
int32 was_online = 0;
|
|
||||||
int32 local_was_online = 0;
|
|
||||||
|
|
||||||
string language_code;
|
|
||||||
|
|
||||||
std::unordered_set<int64> photo_ids;
|
|
||||||
|
|
||||||
std::unordered_map<DialogId, int32, DialogIdHash> online_member_dialogs; // id -> time
|
|
||||||
|
|
||||||
static constexpr uint32 CACHE_VERSION = 3;
|
|
||||||
uint32 cache_version = 0;
|
|
||||||
|
|
||||||
bool is_min_access_hash = true;
|
|
||||||
bool is_received = false;
|
|
||||||
bool is_verified = false;
|
|
||||||
bool is_support = false;
|
|
||||||
bool is_deleted = true;
|
|
||||||
bool is_bot = true;
|
|
||||||
bool can_join_groups = true;
|
|
||||||
bool can_read_all_group_messages = true;
|
|
||||||
bool is_inline_bot = false;
|
|
||||||
bool need_location_bot = false;
|
|
||||||
bool is_scam = false;
|
|
||||||
bool is_contact = false;
|
|
||||||
bool is_mutual_contact = false;
|
|
||||||
bool need_apply_min_photo = false;
|
|
||||||
|
|
||||||
bool is_photo_inited = false;
|
|
||||||
|
|
||||||
bool is_repaired = false; // whether cached value is rechecked
|
|
||||||
|
|
||||||
bool is_name_changed = true;
|
|
||||||
bool is_username_changed = true;
|
|
||||||
bool is_photo_changed = true;
|
|
||||||
bool is_is_contact_changed = true;
|
|
||||||
bool is_is_deleted_changed = true;
|
|
||||||
bool is_default_permissions_changed = true;
|
|
||||||
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);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BotInfo {
|
|
||||||
int32 version = -1;
|
|
||||||
string description;
|
|
||||||
vector<std::pair<string, string>> commands;
|
|
||||||
bool is_changed = true;
|
|
||||||
|
|
||||||
template <class StorerT>
|
|
||||||
void store(StorerT &storer) const;
|
|
||||||
|
|
||||||
template <class ParserT>
|
|
||||||
void parse(ParserT &parser);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UserPhotos {
|
struct UserPhotos {
|
||||||
vector<Photo> photos;
|
vector<Photo> photos;
|
||||||
@ -661,255 +594,6 @@ class ContactsManager : public Actor {
|
|||||||
bool getting_now = false;
|
bool getting_now = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// do not forget to update drop_user_full and on_get_user_full
|
|
||||||
struct UserFull {
|
|
||||||
Photo photo;
|
|
||||||
|
|
||||||
string about;
|
|
||||||
|
|
||||||
int32 common_chat_count = 0;
|
|
||||||
|
|
||||||
bool is_blocked = false;
|
|
||||||
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;
|
|
||||||
|
|
||||||
bool is_common_chat_count_changed = true;
|
|
||||||
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
|
|
||||||
|
|
||||||
double expires_at = 0.0;
|
|
||||||
|
|
||||||
bool is_expired() const;
|
|
||||||
|
|
||||||
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);
|
|
||||||
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false, false, false};
|
|
||||||
|
|
||||||
static constexpr uint32 CACHE_VERSION = 3;
|
|
||||||
uint32 cache_version = 0;
|
|
||||||
|
|
||||||
bool is_active = false;
|
|
||||||
|
|
||||||
bool is_title_changed = true;
|
|
||||||
bool is_photo_changed = true;
|
|
||||||
bool is_default_permissions_changed = true;
|
|
||||||
bool is_is_active_changed = true;
|
|
||||||
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;
|
|
||||||
|
|
||||||
bool can_set_username = false;
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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;
|
|
||||||
string username;
|
|
||||||
vector<RestrictionReason> restriction_reasons;
|
|
||||||
DialogParticipantStatus status = DialogParticipantStatus::Banned(0);
|
|
||||||
RestrictedRights default_permissions{false, false, false, false, false, false, false, false, false, false, false};
|
|
||||||
int32 date = 0;
|
|
||||||
int32 participant_count = 0;
|
|
||||||
|
|
||||||
static constexpr uint32 CACHE_VERSION = 6;
|
|
||||||
uint32 cache_version = 0;
|
|
||||||
|
|
||||||
bool has_linked_channel = false;
|
|
||||||
bool has_location = false;
|
|
||||||
bool sign_messages = false;
|
|
||||||
bool is_slow_mode_enabled = false;
|
|
||||||
|
|
||||||
bool is_megagroup = false;
|
|
||||||
bool is_verified = false;
|
|
||||||
bool is_scam = false;
|
|
||||||
|
|
||||||
bool is_title_changed = true;
|
|
||||||
bool is_username_changed = true;
|
|
||||||
bool is_photo_changed = true;
|
|
||||||
bool is_default_permissions_changed = true;
|
|
||||||
bool is_status_changed = true;
|
|
||||||
bool had_read_access = true;
|
|
||||||
bool was_member = false;
|
|
||||||
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;
|
|
||||||
|
|
||||||
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;
|
|
||||||
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;
|
|
||||||
|
|
||||||
bool is_slow_mode_next_send_date_changed = true;
|
|
||||||
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
|
|
||||||
|
|
||||||
double expires_at = 0.0;
|
|
||||||
bool is_expired() const;
|
|
||||||
|
|
||||||
template <class StorerT>
|
|
||||||
void store(StorerT &storer) const;
|
|
||||||
|
|
||||||
template <class ParserT>
|
|
||||||
void parse(ParserT &parser);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SecretChat {
|
|
||||||
int64 access_hash = 0;
|
|
||||||
UserId user_id;
|
|
||||||
SecretChatState state;
|
|
||||||
string key_hash;
|
|
||||||
int32 ttl = 0;
|
|
||||||
int32 date = 0;
|
|
||||||
int32 layer = 0;
|
|
||||||
FolderId initial_folder_id;
|
|
||||||
|
|
||||||
bool is_outbound = false;
|
|
||||||
|
|
||||||
bool is_state_changed = true;
|
|
||||||
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);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct InviteLinkInfo {
|
|
||||||
// known dialog
|
|
||||||
DialogId dialog_id;
|
|
||||||
|
|
||||||
// unknown dialog
|
|
||||||
string title;
|
|
||||||
Photo photo;
|
|
||||||
int32 participant_count = 0;
|
|
||||||
vector<UserId> participant_user_ids;
|
|
||||||
bool is_chat = false;
|
|
||||||
bool is_channel = false;
|
|
||||||
bool is_public = false;
|
|
||||||
bool is_megagroup = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DialogNearby {
|
struct DialogNearby {
|
||||||
DialogId dialog_id;
|
DialogId dialog_id;
|
||||||
int32 distance;
|
int32 distance;
|
||||||
|
Loading…
Reference in New Issue
Block a user