Add CommonDialogManager.

This commit is contained in:
levlam 2024-01-04 19:20:14 +03:00
parent 2c6917d044
commit 8d7058109c
6 changed files with 59 additions and 0 deletions

View File

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

View File

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

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/CommonDialogManager.h"
namespace td {
CommonDialogManager::CommonDialogManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void CommonDialogManager::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 CommonDialogManager final : public Actor {
public:
CommonDialogManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -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<BotInfoManager>(this, create_reference());
bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get());
common_dialog_manager_ = make_unique<CommonDialogManager>(this, create_reference());
common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get());
contacts_manager_ = make_unique<ContactsManager>(this, create_reference());
contacts_manager_actor_ = register_actor("ContactsManager", contacts_manager_.get());
G()->set_contacts_manager(contacts_manager_actor_.get());

View File

@ -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<BoostManager> boost_manager_actor_;
unique_ptr<BotInfoManager> bot_info_manager_;
ActorOwn<BotInfoManager> bot_info_manager_actor_;
unique_ptr<CommonDialogManager> common_dialog_manager_;
ActorOwn<CommonDialogManager> common_dialog_manager_actor_;
unique_ptr<ContactsManager> contacts_manager_;
ActorOwn<ContactsManager> contacts_manager_actor_;
unique_ptr<CountryInfoManager> country_info_manager_;