Add DialogActionManager.

This commit is contained in:
levlam 2024-01-06 22:56:28 +03:00
parent bd7f900df8
commit 4bc9f8d72e
6 changed files with 59 additions and 0 deletions

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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<CountryInfoManager>(this, create_reference());
country_info_manager_actor_ = register_actor("CountryInfoManager", country_info_manager_.get());
dialog_action_manager_ = make_unique<DialogActionManager>(this, create_reference());
dialog_action_manager_actor_ = register_actor("DialogActionManager", dialog_action_manager_.get());
dialog_filter_manager_ = make_unique<DialogFilterManager>(this, create_reference());
dialog_filter_manager_actor_ = register_actor("DialogFilterManager", dialog_filter_manager_.get());
G()->set_dialog_filter_manager(dialog_filter_manager_actor_.get());

View File

@ -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<ContactsManager> contacts_manager_actor_;
unique_ptr<CountryInfoManager> country_info_manager_;
ActorOwn<CountryInfoManager> country_info_manager_actor_;
unique_ptr<DialogActionManager> dialog_action_manager_;
ActorOwn<DialogActionManager> dialog_action_manager_actor_;
unique_ptr<DialogFilterManager> dialog_filter_manager_;
ActorOwn<DialogFilterManager> dialog_filter_manager_actor_;
unique_ptr<DialogManager> dialog_manager_;