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
|
|
|
|
|
|
|
|
#include "td/telegram/DhConfig.h"
|
2018-06-25 23:10:53 +02:00
|
|
|
#include "td/telegram/net/DcId.h"
|
2022-05-23 19:04:36 +02:00
|
|
|
#include "td/telegram/net/MtprotoHeader.h"
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/telegram/net/NetQueryCreator.h"
|
|
|
|
|
2021-09-18 23:47:05 +02:00
|
|
|
#include "td/net/NetStats.h"
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
#include "td/actor/actor.h"
|
|
|
|
#include "td/actor/SchedulerLocalStorage.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
2022-02-07 22:04:34 +01:00
|
|
|
#include "td/utils/FlatHashMap.h"
|
2019-04-08 00:09:54 +02:00
|
|
|
#include "td/utils/logging.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/Slice.h"
|
|
|
|
#include "td/utils/Status.h"
|
|
|
|
#include "td/utils/Time.h"
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
namespace td {
|
2022-03-11 22:50:04 +01:00
|
|
|
|
2023-09-08 15:19:30 +02:00
|
|
|
class AccountManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class AnimationsManager;
|
2022-08-10 20:12:05 +02:00
|
|
|
class AttachMenuManager;
|
2022-08-17 19:01:03 +02:00
|
|
|
class AuthManager;
|
2023-02-03 08:41:31 +01:00
|
|
|
class AutosaveManager;
|
2019-05-07 04:51:56 +02:00
|
|
|
class BackgroundManager;
|
2023-10-19 15:25:51 +02:00
|
|
|
class BoostManager;
|
2024-07-18 17:06:17 +02:00
|
|
|
class BotInfoManager;
|
2024-03-07 13:44:15 +01:00
|
|
|
class BusinessConnectionManager;
|
2024-03-04 14:39:30 +01:00
|
|
|
class BusinessManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class CallManager;
|
2024-04-02 12:06:22 +02:00
|
|
|
class ChatManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class ConfigManager;
|
|
|
|
class ConnectionCreator;
|
2024-01-06 22:46:36 +01:00
|
|
|
class DialogActionManager;
|
2023-03-27 10:27:17 +02:00
|
|
|
class DialogFilterManager;
|
2024-01-08 10:43:31 +01:00
|
|
|
class DialogInviteLinkManager;
|
2024-01-03 21:07:50 +01:00
|
|
|
class DialogManager;
|
2024-01-08 16:57:44 +01:00
|
|
|
class DialogParticipantManager;
|
2022-03-03 16:58:51 +01:00
|
|
|
class DownloadManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class FileManager;
|
2019-01-03 16:26:44 +01:00
|
|
|
class FileReferenceManager;
|
2022-10-25 14:03:35 +02:00
|
|
|
class ForumTopicManager;
|
2021-09-07 09:02:44 +02:00
|
|
|
class GameManager;
|
2020-11-25 15:04:32 +01:00
|
|
|
class GroupCallManager;
|
2024-05-29 11:48:40 +02:00
|
|
|
class InlineMessageManager;
|
2018-07-17 04:58:34 +02:00
|
|
|
class LanguagePackManager;
|
2021-05-25 01:39:29 +02:00
|
|
|
class LinkManager;
|
2024-01-06 20:06:52 +01:00
|
|
|
class MessageImportManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class MessagesManager;
|
|
|
|
class NetQueryDispatcher;
|
2018-11-11 13:58:52 +01:00
|
|
|
class NotificationManager;
|
2022-04-14 13:31:18 +02:00
|
|
|
class NotificationSettingsManager;
|
2024-08-01 15:07:38 +02:00
|
|
|
class OnlineManager;
|
2021-12-15 23:45:43 +01:00
|
|
|
class OptionManager;
|
2018-03-27 15:11:15 +02:00
|
|
|
class PasswordManager;
|
2024-03-10 23:08:29 +01:00
|
|
|
class PeopleNearbyManager;
|
2024-08-01 12:57:39 +02:00
|
|
|
class PromoDataManager;
|
2024-02-21 18:43:55 +01:00
|
|
|
class QuickReplyManager;
|
2023-08-09 11:59:48 +02:00
|
|
|
class ReactionManager;
|
2024-02-04 10:41:53 +01:00
|
|
|
class SavedMessagesManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class SecretChatsManager;
|
2021-09-07 14:49:34 +02:00
|
|
|
class SponsoredMessageManager;
|
2024-06-27 20:21:20 +02:00
|
|
|
class StarManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class StateManager;
|
|
|
|
class StickersManager;
|
|
|
|
class StorageManager;
|
2023-05-19 15:20:19 +02:00
|
|
|
class StoryManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class Td;
|
2019-01-06 20:59:17 +01:00
|
|
|
class TdDb;
|
2018-12-31 20:04:05 +01:00
|
|
|
class TempAuthKeyWatchdog;
|
2021-08-27 14:51:50 +02:00
|
|
|
class ThemeManager;
|
2024-02-19 12:34:28 +01:00
|
|
|
class TimeZoneManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class TopDialogManager;
|
2023-11-21 17:27:25 +01:00
|
|
|
class TranscriptionManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class UpdatesManager;
|
2024-04-01 14:05:02 +02:00
|
|
|
class UserManager;
|
2018-12-31 20:04:05 +01:00
|
|
|
class WebPagesManager;
|
2018-06-26 01:43:11 +02:00
|
|
|
|
2021-07-04 04:58:54 +02:00
|
|
|
class Global final : public ActorContext {
|
2018-12-31 20:04:05 +01:00
|
|
|
public:
|
|
|
|
Global();
|
2021-07-03 22:51:36 +02:00
|
|
|
~Global() final;
|
2018-12-31 20:04:05 +01:00
|
|
|
Global(const Global &) = delete;
|
|
|
|
Global &operator=(const Global &) = delete;
|
2023-05-05 12:51:19 +02:00
|
|
|
Global(Global &&) = delete;
|
|
|
|
Global &operator=(Global &&) = delete;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-08-01 21:12:04 +02:00
|
|
|
static constexpr int32 ID = -572104940;
|
2021-07-03 22:51:36 +02:00
|
|
|
int32 get_id() const final {
|
2019-08-01 21:12:04 +02:00
|
|
|
return ID;
|
|
|
|
}
|
|
|
|
|
2019-04-08 00:09:54 +02:00
|
|
|
#define td_db() get_td_db_impl(__FILE__, __LINE__)
|
|
|
|
TdDb *get_td_db_impl(const char *file, int line) {
|
|
|
|
LOG_CHECK(td_db_) << close_flag() << " " << file << " " << line;
|
2018-12-31 20:04:05 +01:00
|
|
|
return td_db_.get();
|
|
|
|
}
|
2019-09-08 02:10:09 +02:00
|
|
|
|
2022-05-02 19:59:07 +02:00
|
|
|
void log_out(Slice reason);
|
|
|
|
|
2023-10-05 20:50:53 +02:00
|
|
|
void close_all(bool destroy_flag, Promise<> on_finished);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-03-13 20:29:56 +01:00
|
|
|
Status init(ActorId<Td> td, unique_ptr<TdDb> td_db_ptr) TD_WARN_UNUSED_RESULT;
|
|
|
|
|
|
|
|
Slice get_dir() const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-07-24 14:07:55 +02:00
|
|
|
Slice get_secure_files_dir() const {
|
|
|
|
if (store_all_files_in_files_directory_) {
|
|
|
|
return get_files_dir();
|
|
|
|
}
|
|
|
|
return get_dir();
|
|
|
|
}
|
2023-03-13 20:29:56 +01:00
|
|
|
|
|
|
|
Slice get_files_dir() const;
|
|
|
|
|
|
|
|
bool is_test_dc() const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
NetQueryCreator &net_query_creator() {
|
2020-07-30 16:28:56 +02:00
|
|
|
return *net_query_creator_.get();
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
|
|
|
|
2020-07-30 16:28:56 +02:00
|
|
|
void set_net_query_stats(std::shared_ptr<NetQueryStats> net_query_stats);
|
2021-10-06 17:47:32 +02:00
|
|
|
|
2018-09-27 03:19:03 +02:00
|
|
|
void set_net_query_dispatcher(unique_ptr<NetQueryDispatcher> net_query_dispatcher);
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
NetQueryDispatcher &net_query_dispatcher() {
|
2019-01-17 21:12:31 +01:00
|
|
|
CHECK(have_net_query_dispatcher());
|
2018-12-31 20:04:05 +01:00
|
|
|
return *net_query_dispatcher_;
|
|
|
|
}
|
|
|
|
|
2018-05-16 21:35:27 +02:00
|
|
|
bool have_net_query_dispatcher() const {
|
2020-06-13 03:43:07 +02:00
|
|
|
return net_query_dispatcher_.get() != nullptr;
|
2018-05-16 21:35:27 +02:00
|
|
|
}
|
|
|
|
|
2022-08-17 15:11:13 +02:00
|
|
|
void set_option_empty(Slice name);
|
|
|
|
|
|
|
|
void set_option_boolean(Slice name, bool value);
|
|
|
|
|
|
|
|
void set_option_integer(Slice name, int64 value);
|
|
|
|
|
|
|
|
void set_option_string(Slice name, Slice value);
|
|
|
|
|
|
|
|
bool have_option(Slice name) const;
|
|
|
|
|
|
|
|
bool get_option_boolean(Slice name, bool default_value = false) const;
|
|
|
|
|
|
|
|
int64 get_option_integer(Slice name, int64 default_value = 0) const;
|
|
|
|
|
|
|
|
string get_option_string(Slice name, string default_value = "") const;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-01-07 13:42:04 +01:00
|
|
|
bool is_server_time_reliable() const {
|
2023-07-26 11:29:36 +02:00
|
|
|
return server_time_difference_was_updated_.load(std::memory_order_relaxed);
|
2020-01-07 13:42:04 +01:00
|
|
|
}
|
2018-12-31 20:04:05 +01:00
|
|
|
double server_time() const {
|
2023-10-04 11:24:58 +02:00
|
|
|
return Time::now() + get_server_time_difference();
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
|
|
|
int32 unix_time() const {
|
2019-12-25 16:35:36 +01:00
|
|
|
return to_unix_time(server_time());
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
|
|
|
|
2023-05-14 20:58:54 +02:00
|
|
|
void update_server_time_difference(double diff, bool force);
|
2019-12-25 14:57:18 +01:00
|
|
|
|
|
|
|
void save_server_time();
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
double get_server_time_difference() const {
|
|
|
|
return server_time_difference_.load(std::memory_order_relaxed);
|
|
|
|
}
|
|
|
|
|
2019-07-04 18:21:07 +02:00
|
|
|
void update_dns_time_difference(double diff);
|
|
|
|
|
|
|
|
double get_dns_time_difference() const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<StateManager> state_manager() const {
|
|
|
|
return state_manager_;
|
|
|
|
}
|
|
|
|
void set_state_manager(ActorId<StateManager> state_manager) {
|
|
|
|
state_manager_ = state_manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
ActorId<Td> td() const {
|
|
|
|
return td_;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2023-09-08 15:19:30 +02:00
|
|
|
ActorId<AccountManager> account_manager() const {
|
|
|
|
return account_manager_;
|
|
|
|
}
|
|
|
|
void set_account_manager(ActorId<AccountManager> account_manager) {
|
|
|
|
account_manager_ = account_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<AnimationsManager> animations_manager() const {
|
|
|
|
return animations_manager_;
|
|
|
|
}
|
|
|
|
void set_animations_manager(ActorId<AnimationsManager> animations_manager) {
|
|
|
|
animations_manager_ = animations_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2022-08-10 20:12:05 +02:00
|
|
|
ActorId<AttachMenuManager> attach_menu_manager() const {
|
|
|
|
return attach_menu_manager_;
|
|
|
|
}
|
|
|
|
void set_attach_menu_manager(ActorId<AttachMenuManager> attach_menu_manager) {
|
|
|
|
attach_menu_manager_ = attach_menu_manager;
|
|
|
|
}
|
|
|
|
|
2022-08-17 19:01:03 +02:00
|
|
|
void set_auth_manager(ActorId<AuthManager> auth_manager) {
|
|
|
|
auth_manager_ = auth_manager;
|
|
|
|
}
|
|
|
|
|
2023-02-03 08:41:31 +01:00
|
|
|
ActorId<AutosaveManager> autosave_manager() const {
|
|
|
|
return autosave_manager_;
|
|
|
|
}
|
|
|
|
void set_autosave_manager(ActorId<AutosaveManager> autosave_manager) {
|
|
|
|
autosave_manager_ = autosave_manager;
|
|
|
|
}
|
|
|
|
|
2019-05-07 04:51:56 +02:00
|
|
|
ActorId<BackgroundManager> background_manager() const {
|
|
|
|
return background_manager_;
|
|
|
|
}
|
|
|
|
void set_background_manager(ActorId<BackgroundManager> background_manager) {
|
|
|
|
background_manager_ = background_manager;
|
|
|
|
}
|
|
|
|
|
2023-10-19 15:25:51 +02:00
|
|
|
ActorId<BoostManager> boost_manager() const {
|
|
|
|
return boost_manager_;
|
|
|
|
}
|
|
|
|
void set_boost_manager(ActorId<BoostManager> boost_manager) {
|
|
|
|
boost_manager_ = boost_manager;
|
|
|
|
}
|
|
|
|
|
2024-07-18 17:06:17 +02:00
|
|
|
ActorId<BotInfoManager> bot_info_manager() const {
|
|
|
|
return bot_info_manager_;
|
|
|
|
}
|
|
|
|
void set_bot_info_manager(ActorId<BotInfoManager> bot_info_manager) {
|
|
|
|
bot_info_manager_ = bot_info_manager;
|
|
|
|
}
|
|
|
|
|
2024-03-07 13:44:15 +01:00
|
|
|
ActorId<BusinessConnectionManager> business_connection_manager() const {
|
|
|
|
return business_connection_manager_;
|
|
|
|
}
|
|
|
|
void set_business_connection_manager(ActorId<BusinessConnectionManager> business_connection_manager) {
|
|
|
|
business_connection_manager_ = business_connection_manager;
|
|
|
|
}
|
|
|
|
|
2024-03-04 14:39:30 +01:00
|
|
|
ActorId<BusinessManager> business_manager() const {
|
|
|
|
return business_manager_;
|
|
|
|
}
|
|
|
|
void set_business_manager(ActorId<BusinessManager> business_manager) {
|
|
|
|
business_manager_ = business_manager;
|
|
|
|
}
|
|
|
|
|
2018-10-28 18:30:47 +01:00
|
|
|
ActorId<CallManager> call_manager() const {
|
|
|
|
return call_manager_;
|
|
|
|
}
|
|
|
|
void set_call_manager(ActorId<CallManager> call_manager) {
|
|
|
|
call_manager_ = call_manager;
|
|
|
|
}
|
|
|
|
|
2024-04-02 12:06:22 +02:00
|
|
|
ActorId<ChatManager> chat_manager() const {
|
|
|
|
return chat_manager_;
|
|
|
|
}
|
|
|
|
void set_chat_manager(ActorId<ChatManager> chat_manager) {
|
|
|
|
chat_manager_ = chat_manager;
|
|
|
|
}
|
|
|
|
|
2018-10-28 18:30:47 +01:00
|
|
|
ActorId<ConfigManager> config_manager() const {
|
|
|
|
return config_manager_;
|
|
|
|
}
|
|
|
|
void set_config_manager(ActorId<ConfigManager> config_manager) {
|
|
|
|
config_manager_ = config_manager;
|
|
|
|
}
|
|
|
|
|
2024-01-06 22:46:36 +01:00
|
|
|
ActorId<DialogActionManager> dialog_action_manager() const {
|
|
|
|
return dialog_action_manager_;
|
|
|
|
}
|
|
|
|
void set_dialog_action_manager(ActorId<DialogActionManager> dialog_action_manager) {
|
|
|
|
dialog_action_manager_ = std::move(dialog_action_manager);
|
|
|
|
}
|
|
|
|
|
2023-03-27 10:27:17 +02:00
|
|
|
ActorId<DialogFilterManager> dialog_filter_manager() const {
|
|
|
|
return dialog_filter_manager_;
|
|
|
|
}
|
|
|
|
void set_dialog_filter_manager(ActorId<DialogFilterManager> dialog_filter_manager) {
|
|
|
|
dialog_filter_manager_ = std::move(dialog_filter_manager);
|
|
|
|
}
|
|
|
|
|
2024-01-08 10:43:31 +01:00
|
|
|
ActorId<DialogInviteLinkManager> dialog_invite_link_manager() const {
|
|
|
|
return dialog_invite_link_manager_;
|
|
|
|
}
|
|
|
|
void set_dialog_invite_link_manager(ActorId<DialogInviteLinkManager> dialog_invite_link_manager) {
|
|
|
|
dialog_invite_link_manager_ = std::move(dialog_invite_link_manager);
|
|
|
|
}
|
|
|
|
|
2024-01-03 21:07:50 +01:00
|
|
|
ActorId<DialogManager> dialog_manager() const {
|
|
|
|
return dialog_manager_;
|
|
|
|
}
|
|
|
|
void set_dialog_manager(ActorId<DialogManager> dialog_manager) {
|
|
|
|
dialog_manager_ = std::move(dialog_manager);
|
|
|
|
}
|
|
|
|
|
2024-01-08 16:57:44 +01:00
|
|
|
ActorId<DialogParticipantManager> dialog_participant_manager() const {
|
|
|
|
return dialog_participant_manager_;
|
|
|
|
}
|
|
|
|
void set_dialog_participant_manager(ActorId<DialogParticipantManager> dialog_participant_manager) {
|
|
|
|
dialog_participant_manager_ = std::move(dialog_participant_manager);
|
|
|
|
}
|
|
|
|
|
2022-03-03 16:58:51 +01:00
|
|
|
ActorId<DownloadManager> download_manager() const {
|
|
|
|
return download_manager_;
|
|
|
|
}
|
|
|
|
void set_download_manager(ActorId<DownloadManager> download_manager) {
|
|
|
|
download_manager_ = std::move(download_manager);
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<FileManager> file_manager() const {
|
|
|
|
return file_manager_;
|
|
|
|
}
|
|
|
|
void set_file_manager(ActorId<FileManager> file_manager) {
|
|
|
|
file_manager_ = std::move(file_manager);
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2019-01-03 16:26:44 +01:00
|
|
|
ActorId<FileReferenceManager> file_reference_manager() const {
|
|
|
|
return file_reference_manager_;
|
|
|
|
}
|
|
|
|
void set_file_reference_manager(ActorId<FileReferenceManager> file_reference_manager) {
|
|
|
|
file_reference_manager_ = std::move(file_reference_manager);
|
|
|
|
}
|
|
|
|
|
2022-10-25 14:03:35 +02:00
|
|
|
ActorId<ForumTopicManager> forum_topic_manager() const {
|
|
|
|
return forum_topic_manager_;
|
|
|
|
}
|
|
|
|
void set_forum_topic_manager(ActorId<ForumTopicManager> forum_topic_manager) {
|
|
|
|
forum_topic_manager_ = forum_topic_manager;
|
|
|
|
}
|
|
|
|
|
2021-09-07 09:02:44 +02:00
|
|
|
ActorId<GameManager> game_manager() const {
|
|
|
|
return game_manager_;
|
|
|
|
}
|
|
|
|
void set_game_manager(ActorId<GameManager> game_manager) {
|
|
|
|
game_manager_ = game_manager;
|
|
|
|
}
|
|
|
|
|
2020-11-25 15:04:32 +01:00
|
|
|
ActorId<GroupCallManager> group_call_manager() const {
|
|
|
|
return group_call_manager_;
|
|
|
|
}
|
|
|
|
void set_group_call_manager(ActorId<GroupCallManager> group_call_manager) {
|
|
|
|
group_call_manager_ = group_call_manager;
|
|
|
|
}
|
|
|
|
|
2024-05-29 11:48:40 +02:00
|
|
|
ActorId<InlineMessageManager> inline_message_manager() const {
|
|
|
|
return inline_message_manager_;
|
|
|
|
}
|
|
|
|
void set_inline_message_manager(ActorId<InlineMessageManager> inline_message_manager) {
|
|
|
|
inline_message_manager_ = inline_message_manager;
|
|
|
|
}
|
|
|
|
|
2018-07-17 04:58:34 +02:00
|
|
|
ActorId<LanguagePackManager> language_pack_manager() const {
|
|
|
|
return language_pack_manager_;
|
|
|
|
}
|
|
|
|
void set_language_pack_manager(ActorId<LanguagePackManager> language_pack_manager) {
|
|
|
|
language_pack_manager_ = language_pack_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2021-05-25 01:39:29 +02:00
|
|
|
ActorId<LinkManager> link_manager() const {
|
|
|
|
return link_manager_;
|
|
|
|
}
|
|
|
|
void set_link_manager(ActorId<LinkManager> link_manager) {
|
|
|
|
link_manager_ = link_manager;
|
|
|
|
}
|
|
|
|
|
2024-01-06 20:06:52 +01:00
|
|
|
ActorId<MessageImportManager> message_import_manager() const {
|
|
|
|
return message_import_manager_;
|
|
|
|
}
|
|
|
|
void set_message_import_manager(ActorId<MessageImportManager> message_import_manager) {
|
|
|
|
message_import_manager_ = message_import_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<MessagesManager> messages_manager() const {
|
|
|
|
return messages_manager_;
|
|
|
|
}
|
|
|
|
void set_messages_manager(ActorId<MessagesManager> messages_manager) {
|
|
|
|
messages_manager_ = messages_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2018-11-11 13:58:52 +01:00
|
|
|
ActorId<NotificationManager> notification_manager() const {
|
|
|
|
return notification_manager_;
|
|
|
|
}
|
|
|
|
void set_notification_manager(ActorId<NotificationManager> notification_manager) {
|
|
|
|
notification_manager_ = notification_manager;
|
|
|
|
}
|
|
|
|
|
2022-04-14 13:31:18 +02:00
|
|
|
ActorId<NotificationSettingsManager> notification_settings_manager() const {
|
|
|
|
return notification_settings_manager_;
|
|
|
|
}
|
|
|
|
void set_notification_settings_manager(ActorId<NotificationSettingsManager> notification_settings_manager) {
|
|
|
|
notification_settings_manager_ = notification_settings_manager;
|
|
|
|
}
|
|
|
|
|
2024-08-01 15:07:38 +02:00
|
|
|
ActorId<OnlineManager> online_manager() const {
|
|
|
|
return online_manager_;
|
|
|
|
}
|
|
|
|
void set_online_manager(ActorId<OnlineManager> online_manager) {
|
|
|
|
online_manager_ = online_manager;
|
|
|
|
}
|
|
|
|
|
2022-08-18 17:52:59 +02:00
|
|
|
void set_option_manager(OptionManager *option_manager) {
|
2021-12-15 23:45:43 +01:00
|
|
|
option_manager_ = option_manager;
|
|
|
|
}
|
2023-12-08 10:57:13 +01:00
|
|
|
OptionManager *get_option_manager();
|
2021-12-15 23:45:43 +01:00
|
|
|
|
2018-03-27 15:11:15 +02:00
|
|
|
ActorId<PasswordManager> password_manager() const {
|
|
|
|
return password_manager_;
|
|
|
|
}
|
|
|
|
void set_password_manager(ActorId<PasswordManager> password_manager) {
|
|
|
|
password_manager_ = password_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2024-03-10 23:08:29 +01:00
|
|
|
ActorId<PeopleNearbyManager> people_nearby_manager() const {
|
|
|
|
return people_nearby_manager_;
|
|
|
|
}
|
|
|
|
void set_people_nearby_manager(ActorId<PeopleNearbyManager> people_nearby_manager) {
|
|
|
|
people_nearby_manager_ = people_nearby_manager;
|
|
|
|
}
|
|
|
|
|
2024-08-01 12:57:39 +02:00
|
|
|
ActorId<PromoDataManager> promo_data_manager() const {
|
|
|
|
return promo_data_manager_;
|
|
|
|
}
|
|
|
|
void set_promo_data_manager(ActorId<PromoDataManager> promo_data_manager) {
|
|
|
|
promo_data_manager_ = promo_data_manager;
|
|
|
|
}
|
|
|
|
|
2024-02-21 18:43:55 +01:00
|
|
|
ActorId<QuickReplyManager> quick_reply_manager() const {
|
|
|
|
return quick_reply_manager_;
|
|
|
|
}
|
|
|
|
void set_quick_reply_manager(ActorId<QuickReplyManager> quick_reply_manager) {
|
|
|
|
quick_reply_manager_ = quick_reply_manager;
|
|
|
|
}
|
|
|
|
|
2023-08-09 11:59:48 +02:00
|
|
|
ActorId<ReactionManager> reaction_manager() const {
|
|
|
|
return reaction_manager_;
|
|
|
|
}
|
|
|
|
void set_reaction_manager(ActorId<ReactionManager> reaction_manager) {
|
|
|
|
reaction_manager_ = reaction_manager;
|
|
|
|
}
|
|
|
|
|
2024-02-04 10:41:53 +01:00
|
|
|
ActorId<SavedMessagesManager> saved_messages_manager() const {
|
|
|
|
return saved_messages_manager_;
|
|
|
|
}
|
|
|
|
void set_saved_messages_manager(ActorId<SavedMessagesManager> saved_messages_manager) {
|
|
|
|
saved_messages_manager_ = saved_messages_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<SecretChatsManager> secret_chats_manager() const {
|
|
|
|
return secret_chats_manager_;
|
|
|
|
}
|
|
|
|
void set_secret_chats_manager(ActorId<SecretChatsManager> secret_chats_manager) {
|
|
|
|
secret_chats_manager_ = secret_chats_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2021-09-07 14:49:34 +02:00
|
|
|
ActorId<SponsoredMessageManager> sponsored_message_manager() const {
|
|
|
|
return sponsored_message_manager_;
|
|
|
|
}
|
|
|
|
void set_sponsored_message_manager(ActorId<SponsoredMessageManager> sponsored_message_manager) {
|
|
|
|
sponsored_message_manager_ = sponsored_message_manager;
|
|
|
|
}
|
|
|
|
|
2024-06-27 20:21:20 +02:00
|
|
|
ActorId<StarManager> star_manager() const {
|
|
|
|
return star_manager_;
|
|
|
|
}
|
|
|
|
void set_star_manager(ActorId<StarManager> star_manager) {
|
|
|
|
star_manager_ = star_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<StickersManager> stickers_manager() const {
|
|
|
|
return stickers_manager_;
|
|
|
|
}
|
|
|
|
void set_stickers_manager(ActorId<StickersManager> stickers_manager) {
|
|
|
|
stickers_manager_ = stickers_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<StorageManager> storage_manager() const {
|
|
|
|
return storage_manager_;
|
|
|
|
}
|
|
|
|
void set_storage_manager(ActorId<StorageManager> storage_manager) {
|
|
|
|
storage_manager_ = storage_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2023-05-19 15:20:19 +02:00
|
|
|
ActorId<StoryManager> story_manager() const {
|
|
|
|
return story_manager_;
|
|
|
|
}
|
|
|
|
void set_story_manager(ActorId<StoryManager> story_manager) {
|
|
|
|
story_manager_ = story_manager;
|
|
|
|
}
|
|
|
|
|
2021-08-27 14:51:50 +02:00
|
|
|
ActorId<ThemeManager> theme_manager() const {
|
|
|
|
return theme_manager_;
|
|
|
|
}
|
|
|
|
void set_theme_manager(ActorId<ThemeManager> theme_manager) {
|
|
|
|
theme_manager_ = theme_manager;
|
|
|
|
}
|
|
|
|
|
2024-02-19 12:34:28 +01:00
|
|
|
ActorId<TimeZoneManager> time_zone_manager() const {
|
|
|
|
return time_zone_manager_;
|
|
|
|
}
|
|
|
|
void set_time_zone_manager(ActorId<TimeZoneManager> time_zone_manager) {
|
|
|
|
time_zone_manager_ = time_zone_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<TopDialogManager> top_dialog_manager() const {
|
|
|
|
return top_dialog_manager_;
|
|
|
|
}
|
|
|
|
void set_top_dialog_manager(ActorId<TopDialogManager> top_dialog_manager) {
|
|
|
|
top_dialog_manager_ = top_dialog_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2023-11-21 17:27:25 +01:00
|
|
|
ActorId<TranscriptionManager> transcription_manager() const {
|
|
|
|
return transcription_manager_;
|
|
|
|
}
|
|
|
|
void set_transcription_manager(ActorId<TranscriptionManager> transcription_manager) {
|
|
|
|
transcription_manager_ = transcription_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<UpdatesManager> updates_manager() const {
|
|
|
|
return updates_manager_;
|
|
|
|
}
|
|
|
|
void set_updates_manager(ActorId<UpdatesManager> updates_manager) {
|
|
|
|
updates_manager_ = updates_manager;
|
|
|
|
}
|
2018-10-28 18:30:47 +01:00
|
|
|
|
2024-04-01 14:05:02 +02:00
|
|
|
ActorId<UserManager> user_manager() const {
|
|
|
|
return user_manager_;
|
|
|
|
}
|
|
|
|
void set_user_manager(ActorId<UserManager> user_manager) {
|
|
|
|
user_manager_ = user_manager;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<WebPagesManager> web_pages_manager() const {
|
|
|
|
return web_pages_manager_;
|
|
|
|
}
|
|
|
|
void set_web_pages_manager(ActorId<WebPagesManager> web_pages_manager) {
|
|
|
|
web_pages_manager_ = web_pages_manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
ActorId<ConnectionCreator> connection_creator() const;
|
|
|
|
void set_connection_creator(ActorOwn<ConnectionCreator> connection_creator);
|
|
|
|
|
|
|
|
ActorId<TempAuthKeyWatchdog> temp_auth_key_watchdog() const;
|
|
|
|
void set_temp_auth_key_watchdog(ActorOwn<TempAuthKeyWatchdog> actor);
|
|
|
|
|
2018-05-08 22:02:15 +02:00
|
|
|
MtprotoHeader &mtproto_header();
|
2018-09-27 03:19:03 +02:00
|
|
|
void set_mtproto_header(unique_ptr<MtprotoHeader> mtproto_header);
|
2018-05-16 21:35:27 +02:00
|
|
|
bool have_mtproto_header() const {
|
|
|
|
return mtproto_header_ != nullptr;
|
|
|
|
}
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2023-03-13 20:29:56 +01:00
|
|
|
bool use_file_database() const;
|
2023-03-13 17:47:38 +01:00
|
|
|
|
2023-03-13 23:41:04 +01:00
|
|
|
bool use_sqlite_pmc() const;
|
|
|
|
|
2023-03-13 20:29:56 +01:00
|
|
|
bool use_chat_info_database() const;
|
2023-03-13 17:47:38 +01:00
|
|
|
|
2023-03-13 20:29:56 +01:00
|
|
|
bool use_message_database() const;
|
2023-03-13 17:47:38 +01:00
|
|
|
|
2023-03-13 23:48:32 +01:00
|
|
|
bool keep_media_order() const {
|
|
|
|
return use_file_database();
|
|
|
|
}
|
|
|
|
|
2023-07-26 12:05:34 +02:00
|
|
|
int32 get_database_scheduler_id() {
|
|
|
|
return database_scheduler_id_;
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
int32 get_gc_scheduler_id() const {
|
|
|
|
return gc_scheduler_id_;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32 get_slow_net_scheduler_id() const {
|
|
|
|
return slow_net_scheduler_id_;
|
|
|
|
}
|
|
|
|
|
2018-06-25 23:10:53 +02:00
|
|
|
DcId get_webfile_dc_id() const;
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
std::shared_ptr<DhConfig> get_dh_config() {
|
|
|
|
#if !TD_HAVE_ATOMIC_SHARED_PTR
|
|
|
|
std::lock_guard<std::mutex> guard(dh_config_mutex_);
|
|
|
|
auto res = dh_config_;
|
|
|
|
return res;
|
|
|
|
#else
|
|
|
|
return atomic_load(&dh_config_);
|
|
|
|
#endif
|
|
|
|
}
|
2020-01-07 01:55:51 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_dh_config(std::shared_ptr<DhConfig> new_dh_config) {
|
|
|
|
#if !TD_HAVE_ATOMIC_SHARED_PTR
|
|
|
|
std::lock_guard<std::mutex> guard(dh_config_mutex_);
|
2021-10-19 17:11:16 +02:00
|
|
|
dh_config_ = std::move(new_dh_config);
|
2018-12-31 20:04:05 +01:00
|
|
|
#else
|
|
|
|
atomic_store(&dh_config_, std::move(new_dh_config));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-10-07 15:36:21 +02:00
|
|
|
static Status request_aborted_error() {
|
|
|
|
return Status::Error(500, "Request aborted");
|
|
|
|
}
|
|
|
|
|
2023-02-16 11:35:27 +01:00
|
|
|
template <class T>
|
|
|
|
void ignore_result_if_closing(Result<T> &result) const {
|
|
|
|
if (close_flag() && result.is_ok()) {
|
|
|
|
result = request_aborted_error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void set_close_flag() {
|
|
|
|
close_flag_ = true;
|
|
|
|
}
|
|
|
|
bool close_flag() const {
|
|
|
|
return close_flag_.load();
|
|
|
|
}
|
|
|
|
|
2021-10-07 15:36:21 +02:00
|
|
|
Status close_status() const {
|
|
|
|
return close_flag() ? request_aborted_error() : Status::OK();
|
|
|
|
}
|
|
|
|
|
2020-03-30 23:22:52 +02:00
|
|
|
bool is_expected_error(const Status &error) const {
|
|
|
|
CHECK(error.is_error());
|
|
|
|
if (error.code() == 401) {
|
|
|
|
// authorization is lost
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (error.code() == 420 || error.code() == 429) {
|
|
|
|
// flood wait
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return close_flag();
|
|
|
|
}
|
|
|
|
|
2022-04-12 15:12:22 +02:00
|
|
|
static int32 get_retry_after(int32 error_code, Slice error_message);
|
|
|
|
|
2023-11-23 12:49:05 +01:00
|
|
|
static int32 get_retry_after(const Status &error) {
|
|
|
|
return get_retry_after(error.code(), error.message());
|
|
|
|
}
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
const std::vector<std::shared_ptr<NetStatsCallback>> &get_net_stats_file_callbacks() {
|
|
|
|
return net_stats_file_callbacks_;
|
|
|
|
}
|
|
|
|
void set_net_stats_file_callbacks(std::vector<std::shared_ptr<NetStatsCallback>> callbacks) {
|
|
|
|
net_stats_file_callbacks_ = std::move(callbacks);
|
|
|
|
}
|
|
|
|
|
2018-08-14 01:11:49 +02:00
|
|
|
int64 get_location_access_hash(double latitude, double longitude);
|
|
|
|
|
|
|
|
void add_location_access_hash(double latitude, double longitude, int64 access_hash);
|
|
|
|
|
2019-07-24 14:07:55 +02:00
|
|
|
void set_store_all_files_in_files_directory(bool flag) {
|
|
|
|
store_all_files_in_files_directory_ = flag;
|
|
|
|
}
|
|
|
|
|
2024-04-08 19:18:48 +02:00
|
|
|
void notify_speed_limited(bool is_upload);
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
private:
|
|
|
|
std::shared_ptr<DhConfig> dh_config_;
|
|
|
|
|
2018-09-27 03:19:03 +02:00
|
|
|
unique_ptr<TdDb> td_db_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
ActorId<Td> td_;
|
2023-09-08 15:19:30 +02:00
|
|
|
ActorId<AccountManager> account_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<AnimationsManager> animations_manager_;
|
2022-08-10 20:12:05 +02:00
|
|
|
ActorId<AttachMenuManager> attach_menu_manager_;
|
2022-08-17 19:01:03 +02:00
|
|
|
ActorId<AuthManager> auth_manager_;
|
2023-02-03 08:41:31 +01:00
|
|
|
ActorId<AutosaveManager> autosave_manager_;
|
2019-05-07 04:51:56 +02:00
|
|
|
ActorId<BackgroundManager> background_manager_;
|
2023-10-19 15:25:51 +02:00
|
|
|
ActorId<BoostManager> boost_manager_;
|
2024-07-18 17:06:17 +02:00
|
|
|
ActorId<BotInfoManager> bot_info_manager_;
|
2024-03-07 13:44:15 +01:00
|
|
|
ActorId<BusinessConnectionManager> business_connection_manager_;
|
2024-03-04 14:39:30 +01:00
|
|
|
ActorId<BusinessManager> business_manager_;
|
2018-10-28 18:30:47 +01:00
|
|
|
ActorId<CallManager> call_manager_;
|
2024-04-02 12:06:22 +02:00
|
|
|
ActorId<ChatManager> chat_manager_;
|
2018-10-28 18:30:47 +01:00
|
|
|
ActorId<ConfigManager> config_manager_;
|
2024-01-06 22:46:36 +01:00
|
|
|
ActorId<DialogActionManager> dialog_action_manager_;
|
2023-03-27 10:27:17 +02:00
|
|
|
ActorId<DialogFilterManager> dialog_filter_manager_;
|
2024-01-08 10:43:31 +01:00
|
|
|
ActorId<DialogInviteLinkManager> dialog_invite_link_manager_;
|
2024-01-03 21:07:50 +01:00
|
|
|
ActorId<DialogManager> dialog_manager_;
|
2024-01-08 16:57:44 +01:00
|
|
|
ActorId<DialogParticipantManager> dialog_participant_manager_;
|
2022-03-03 16:58:51 +01:00
|
|
|
ActorId<DownloadManager> download_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<FileManager> file_manager_;
|
2019-01-03 16:26:44 +01:00
|
|
|
ActorId<FileReferenceManager> file_reference_manager_;
|
2022-10-25 14:03:35 +02:00
|
|
|
ActorId<ForumTopicManager> forum_topic_manager_;
|
2021-09-07 09:02:44 +02:00
|
|
|
ActorId<GameManager> game_manager_;
|
2020-11-25 15:04:32 +01:00
|
|
|
ActorId<GroupCallManager> group_call_manager_;
|
2024-05-29 11:48:40 +02:00
|
|
|
ActorId<InlineMessageManager> inline_message_manager_;
|
2018-07-17 04:58:34 +02:00
|
|
|
ActorId<LanguagePackManager> language_pack_manager_;
|
2021-05-25 01:39:29 +02:00
|
|
|
ActorId<LinkManager> link_manager_;
|
2024-01-06 20:06:52 +01:00
|
|
|
ActorId<MessageImportManager> message_import_manager_;
|
2018-10-28 18:30:47 +01:00
|
|
|
ActorId<MessagesManager> messages_manager_;
|
2018-11-11 13:58:52 +01:00
|
|
|
ActorId<NotificationManager> notification_manager_;
|
2022-04-14 13:31:18 +02:00
|
|
|
ActorId<NotificationSettingsManager> notification_settings_manager_;
|
2024-08-01 15:07:38 +02:00
|
|
|
ActorId<OnlineManager> online_manager_;
|
2018-03-27 15:11:15 +02:00
|
|
|
ActorId<PasswordManager> password_manager_;
|
2024-03-10 23:08:29 +01:00
|
|
|
ActorId<PeopleNearbyManager> people_nearby_manager_;
|
2024-08-01 12:57:39 +02:00
|
|
|
ActorId<PromoDataManager> promo_data_manager_;
|
2024-02-21 18:43:55 +01:00
|
|
|
ActorId<QuickReplyManager> quick_reply_manager_;
|
2023-08-09 11:59:48 +02:00
|
|
|
ActorId<ReactionManager> reaction_manager_;
|
2024-02-04 10:41:53 +01:00
|
|
|
ActorId<SavedMessagesManager> saved_messages_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<SecretChatsManager> secret_chats_manager_;
|
2021-09-07 14:49:34 +02:00
|
|
|
ActorId<SponsoredMessageManager> sponsored_message_manager_;
|
2024-06-27 20:21:20 +02:00
|
|
|
ActorId<StarManager> star_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<StickersManager> stickers_manager_;
|
|
|
|
ActorId<StorageManager> storage_manager_;
|
2023-05-19 15:20:19 +02:00
|
|
|
ActorId<StoryManager> story_manager_;
|
2021-08-27 14:51:50 +02:00
|
|
|
ActorId<ThemeManager> theme_manager_;
|
2024-02-19 12:34:28 +01:00
|
|
|
ActorId<TimeZoneManager> time_zone_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<TopDialogManager> top_dialog_manager_;
|
2023-11-21 17:27:25 +01:00
|
|
|
ActorId<TranscriptionManager> transcription_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<UpdatesManager> updates_manager_;
|
2024-04-01 14:05:02 +02:00
|
|
|
ActorId<UserManager> user_manager_;
|
2018-12-31 20:04:05 +01:00
|
|
|
ActorId<WebPagesManager> web_pages_manager_;
|
|
|
|
ActorOwn<ConnectionCreator> connection_creator_;
|
|
|
|
ActorOwn<TempAuthKeyWatchdog> temp_auth_key_watchdog_;
|
|
|
|
|
2018-09-27 03:19:03 +02:00
|
|
|
unique_ptr<MtprotoHeader> mtproto_header_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2022-08-18 17:52:59 +02:00
|
|
|
OptionManager *option_manager_ = nullptr;
|
|
|
|
|
2023-07-26 12:05:34 +02:00
|
|
|
int32 database_scheduler_id_ = 0;
|
2021-11-11 15:39:09 +01:00
|
|
|
int32 gc_scheduler_id_ = 0;
|
|
|
|
int32 slow_net_scheduler_id_ = 0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2019-07-24 14:07:55 +02:00
|
|
|
std::atomic<bool> store_all_files_in_files_directory_{false};
|
2020-01-07 01:55:51 +01:00
|
|
|
|
2019-01-24 04:18:14 +01:00
|
|
|
std::atomic<double> server_time_difference_{0.0};
|
|
|
|
std::atomic<bool> server_time_difference_was_updated_{false};
|
2019-07-04 18:21:07 +02:00
|
|
|
std::atomic<double> dns_time_difference_{0.0};
|
|
|
|
std::atomic<bool> dns_time_difference_was_updated_{false};
|
2018-12-31 20:04:05 +01:00
|
|
|
std::atomic<bool> close_flag_{false};
|
2019-12-25 16:03:08 +01:00
|
|
|
std::atomic<double> system_time_saved_at_{-1e10};
|
2020-02-22 17:31:08 +01:00
|
|
|
double saved_diff_ = 0.0;
|
|
|
|
double saved_system_time_ = 0.0;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2020-01-07 01:55:51 +01:00
|
|
|
#if !TD_HAVE_ATOMIC_SHARED_PTR
|
|
|
|
std::mutex dh_config_mutex_;
|
|
|
|
#endif
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
std::vector<std::shared_ptr<NetStatsCallback>> net_stats_file_callbacks_;
|
|
|
|
|
|
|
|
ActorId<StateManager> state_manager_;
|
|
|
|
|
2020-07-30 21:59:23 +02:00
|
|
|
LazySchedulerLocalStorage<unique_ptr<NetQueryCreator>> net_query_creator_;
|
2018-09-27 03:19:03 +02:00
|
|
|
unique_ptr<NetQueryDispatcher> net_query_dispatcher_;
|
2018-12-31 20:04:05 +01:00
|
|
|
|
2018-08-14 01:11:49 +02:00
|
|
|
static int64 get_location_key(double latitude, double longitude);
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<int64, int64> location_access_hashes_;
|
2018-08-14 01:11:49 +02:00
|
|
|
|
2020-02-22 17:31:08 +01:00
|
|
|
int32 to_unix_time(double server_time) const;
|
2019-12-25 16:35:36 +01:00
|
|
|
|
2022-08-18 13:54:57 +02:00
|
|
|
const OptionManager *get_option_manager() const;
|
|
|
|
|
2019-12-25 14:57:18 +01:00
|
|
|
void do_save_server_time_difference();
|
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
void do_close(Promise<> on_finish, bool destroy_flag);
|
|
|
|
};
|
|
|
|
|
2019-09-08 02:10:09 +02:00
|
|
|
#define G() G_impl(__FILE__, __LINE__)
|
|
|
|
|
|
|
|
inline Global *G_impl(const char *file, int line) {
|
2019-08-01 21:12:04 +02:00
|
|
|
ActorContext *context = Scheduler::context();
|
2021-11-09 08:19:04 +01:00
|
|
|
LOG_CHECK(context != nullptr && context->get_id() == Global::ID)
|
|
|
|
<< "Context = " << context << " in " << file << " at " << line;
|
2019-08-01 21:12:04 +02:00
|
|
|
return static_cast<Global *>(context);
|
2018-12-31 20:04:05 +01:00
|
|
|
}
|
2018-06-26 01:43:11 +02:00
|
|
|
|
2020-10-02 12:22:06 +02:00
|
|
|
double get_global_server_time();
|
2020-02-01 05:43:54 +01:00
|
|
|
|
2018-12-31 20:04:05 +01:00
|
|
|
} // namespace td
|