diff --git a/CMakeLists.txt b/CMakeLists.txt index 94ae3f287..fb96a4da1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,6 +320,7 @@ set(TDLIB_SOURCE td/telegram/DhCache.cpp td/telegram/DialogAction.cpp td/telegram/DialogActionBar.cpp + td/telegram/DialogActionManager.cpp td/telegram/DialogAdministrator.cpp td/telegram/DialogDb.cpp td/telegram/DialogEventLog.cpp @@ -595,6 +596,7 @@ set(TDLIB_SOURCE td/telegram/DhConfig.h td/telegram/DialogAction.h td/telegram/DialogActionBar.h + td/telegram/DialogActionManager.h td/telegram/DialogAdministrator.h td/telegram/DialogBoostLinkInfo.h td/telegram/DialogDate.h diff --git a/SplitSource.php b/SplitSource.php index 5aee690aa..0935e6d5d 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -288,6 +288,7 @@ function split_file($file, $chunks, $undo) { 'common_dialog_manager[_(-][^.]|CommonDialogManager' => "CommonDialogManager", 'contacts_manager[_(-][^.]|ContactsManager([^ ;.]| [^*])' => 'ContactsManager', 'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager', + 'dialog_action_manager[_(-][^.]|DialogActionManager' => "DialogActionManager", 'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager", 'dialog_manager[_(-][^.]|DialogManager' => "DialogManager", 'dialog_online_member_manager[_(-][^.]|DialogOnlineMemberManager' => "DialogOnlineMemberManager", diff --git a/td/telegram/DialogActionManager.cpp b/td/telegram/DialogActionManager.cpp new file mode 100644 index 000000000..69d226c68 --- /dev/null +++ b/td/telegram/DialogActionManager.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/DialogActionManager.h" + +namespace td { + +DialogActionManager::DialogActionManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void DialogActionManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/DialogActionManager.h b/td/telegram/DialogActionManager.h new file mode 100644 index 000000000..ba81f8090 --- /dev/null +++ b/td/telegram/DialogActionManager.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 DialogActionManager final : public Actor { + public: + DialogActionManager(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 35971766d..87e50942d 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -35,6 +35,7 @@ #include "td/telegram/CustomEmojiId.h" #include "td/telegram/DeviceTokenManager.h" #include "td/telegram/DialogAction.h" +#include "td/telegram/DialogActionManager.h" #include "td/telegram/DialogBoostLinkInfo.h" #include "td/telegram/DialogEventLog.h" #include "td/telegram/DialogFilter.h" @@ -3291,6 +3292,8 @@ void Td::dec_actor_refcnt() { LOG(DEBUG) << "ContactsManager was cleared" << timer; country_info_manager_.reset(); LOG(DEBUG) << "CountryInfoManager was cleared" << timer; + dialog_action_manager_.reset(); + LOG(DEBUG) << "DialogActionManager was cleared" << timer; dialog_filter_manager_.reset(); LOG(DEBUG) << "DialogFilterManager was cleared" << timer; dialog_manager_.reset(); @@ -3510,6 +3513,8 @@ void Td::clear() { LOG(DEBUG) << "ContactsManager actor was cleared" << timer; country_info_manager_actor_.reset(); LOG(DEBUG) << "CountryInfoManager actor was cleared" << timer; + dialog_action_manager_actor_.reset(); + LOG(DEBUG) << "DialogActionManager actor was cleared" << timer; dialog_filter_manager_actor_.reset(); LOG(DEBUG) << "DialogFilterManager actor was cleared" << timer; dialog_manager_actor_.reset(); @@ -4009,6 +4014,8 @@ void Td::init_managers() { G()->set_contacts_manager(contacts_manager_actor_.get()); country_info_manager_ = make_unique(this, create_reference()); country_info_manager_actor_ = register_actor("CountryInfoManager", country_info_manager_.get()); + dialog_action_manager_ = make_unique(this, create_reference()); + dialog_action_manager_actor_ = register_actor("DialogActionManager", dialog_action_manager_.get()); dialog_filter_manager_ = make_unique(this, create_reference()); dialog_filter_manager_actor_ = register_actor("DialogFilterManager", dialog_filter_manager_.get()); G()->set_dialog_filter_manager(dialog_filter_manager_actor_.get()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 1ea37c4a6..3968ccf9f 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -53,6 +53,7 @@ class ConfigManager; class ContactsManager; class CountryInfoManager; class DeviceTokenManager; +class DialogActionManager; class DialogFilterManager; class DialogManager; class DialogOnlineMemberManager; @@ -178,6 +179,8 @@ class Td final : public Actor { ActorOwn contacts_manager_actor_; unique_ptr country_info_manager_; ActorOwn country_info_manager_actor_; + unique_ptr dialog_action_manager_; + ActorOwn dialog_action_manager_actor_; unique_ptr dialog_filter_manager_; ActorOwn dialog_filter_manager_actor_; unique_ptr dialog_manager_;