diff --git a/CMakeLists.txt b/CMakeLists.txt index 027ec22bc..5f216fbb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,6 +308,7 @@ set(TDLIB_SOURCE td/telegram/ChannelParticipantFilter.cpp td/telegram/ChatReactions.cpp td/telegram/ClientActor.cpp + td/telegram/CommonDialogManager.cpp td/telegram/ConfigManager.cpp td/telegram/ConnectionState.cpp td/telegram/Contact.cpp @@ -579,6 +580,7 @@ set(TDLIB_SOURCE td/telegram/ChatId.h td/telegram/ChatReactions.h td/telegram/ClientActor.h + td/telegram/CommonDialogManager.h td/telegram/ConfigManager.h td/telegram/ConnectionState.h td/telegram/Contact.h diff --git a/SplitSource.php b/SplitSource.php index a884bfdad..a44c8abdc 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -285,6 +285,7 @@ function split_file($file, $chunks, $undo) { 'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager", 'boost_manager[_(-][^.]|BoostManager' => "BoostManager", 'bot_info_manager[_(-][^.]|BotInfoManager' => "BotInfoManager", + 'common_dialog_manager[_(-][^.]|CommonDialogManager' => "CommonDialogManager", 'contacts_manager[_(-][^.]|ContactsManager([^ ;.]| [^*])' => 'ContactsManager', 'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager', 'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager", diff --git a/td/telegram/CommonDialogManager.cpp b/td/telegram/CommonDialogManager.cpp new file mode 100644 index 000000000..8c782de54 --- /dev/null +++ b/td/telegram/CommonDialogManager.cpp @@ -0,0 +1,18 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 +// +// 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) +// +#include "td/telegram/CommonDialogManager.h" + +namespace td { + +CommonDialogManager::CommonDialogManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void CommonDialogManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/CommonDialogManager.h b/td/telegram/CommonDialogManager.h new file mode 100644 index 000000000..5135d698e --- /dev/null +++ b/td/telegram/CommonDialogManager.h @@ -0,0 +1,28 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 +// +// 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/actor/actor.h" + +#include "td/utils/common.h" + +namespace td { + +class Td; + +class CommonDialogManager final : public Actor { + public: + CommonDialogManager(Td *td, ActorShared<> parent); + + private: + void tear_down() final; + + Td *td_; + ActorShared<> parent_; +}; + +} // namespace td diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 3b5dfab3c..367e90621 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -28,6 +28,7 @@ #include "td/telegram/ChannelId.h" #include "td/telegram/ChannelType.h" #include "td/telegram/ChatId.h" +#include "td/telegram/CommonDialogManager.h" #include "td/telegram/ConfigManager.h" #include "td/telegram/ContactsManager.h" #include "td/telegram/CountryInfoManager.h" @@ -3283,6 +3284,8 @@ void Td::dec_actor_refcnt() { LOG(DEBUG) << "BotInfoManager was cleared" << timer; callback_queries_manager_.reset(); LOG(DEBUG) << "CallbackQueriesManager was cleared" << timer; + common_dialog_manager_.reset(); + LOG(DEBUG) << "CommonDialogManager was cleared" << timer; contacts_manager_.reset(); LOG(DEBUG) << "ContactsManager was cleared" << timer; country_info_manager_.reset(); @@ -3498,6 +3501,8 @@ void Td::clear() { LOG(DEBUG) << "BoostManager actor was cleared" << timer; bot_info_manager_actor_.reset(); LOG(DEBUG) << "BotInfoManager actor was cleared" << timer; + common_dialog_manager_actor_.reset(); + LOG(DEBUG) << "CommonDialogManager actor was cleared" << timer; contacts_manager_actor_.reset(); LOG(DEBUG) << "ContactsManager actor was cleared" << timer; country_info_manager_actor_.reset(); @@ -3992,6 +3997,8 @@ void Td::init_managers() { G()->set_boost_manager(boost_manager_actor_.get()); bot_info_manager_ = make_unique(this, create_reference()); bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get()); + common_dialog_manager_ = make_unique(this, create_reference()); + common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get()); contacts_manager_ = make_unique(this, create_reference()); contacts_manager_actor_ = register_actor("ContactsManager", contacts_manager_.get()); G()->set_contacts_manager(contacts_manager_actor_.get()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 80ca7ed4f..97780cd85 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -48,6 +48,7 @@ class BoostManager; class BotInfoManager; class CallManager; class CallbackQueriesManager; +class CommonDialogManager; class ConfigManager; class ContactsManager; class CountryInfoManager; @@ -170,6 +171,8 @@ class Td final : public Actor { ActorOwn boost_manager_actor_; unique_ptr bot_info_manager_; ActorOwn bot_info_manager_actor_; + unique_ptr common_dialog_manager_; + ActorOwn common_dialog_manager_actor_; unique_ptr contacts_manager_; ActorOwn contacts_manager_actor_; unique_ptr country_info_manager_;