Add BotInfoManager.

This commit is contained in:
levlam 2023-04-16 23:12:28 +03:00
parent cbe62e306d
commit 4f916a4d8e
6 changed files with 60 additions and 1 deletions

View File

@ -298,8 +298,8 @@ set(TDLIB_SOURCE
td/telegram/BackgroundType.cpp
td/telegram/BotCommand.cpp
td/telegram/BotCommandScope.cpp
td/telegram/BotInfoManager.cpp
td/telegram/BotMenuButton.cpp
td/telegram/BotMenuButton.h
td/telegram/CallActor.cpp
td/telegram/CallDiscardReason.cpp
td/telegram/CallManager.cpp
@ -532,6 +532,8 @@ set(TDLIB_SOURCE
td/telegram/BackgroundType.h
td/telegram/BotCommand.h
td/telegram/BotCommandScope.h
td/telegram/BotInfoManager.h
td/telegram/BotMenuButton.h
td/telegram/CallActor.h
td/telegram/CallDiscardReason.h
td/telegram/CallId.h

View File

@ -282,6 +282,7 @@ function split_file($file, $chunks, $undo) {
'auth_manager[_(-][^.]|AuthManager' => 'AuthManager',
'autosave_manager[_(-][^.]|AutosaveManager' => 'AutosaveManager',
'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager",
'bot_info_manager[_(-][^.]|BotInfoManager' => "BotInfoManager",
'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/BotInfoManager.h"
namespace td {
BotInfoManager::BotInfoManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void BotInfoManager::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 BotInfoManager final : public Actor {
public:
BotInfoManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -18,6 +18,7 @@
#include "td/telegram/BackgroundManager.h"
#include "td/telegram/BackgroundType.h"
#include "td/telegram/BotCommand.h"
#include "td/telegram/BotInfoManager.h"
#include "td/telegram/BotMenuButton.h"
#include "td/telegram/CallbackQueriesManager.h"
#include "td/telegram/CallId.h"
@ -3165,6 +3166,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "AutosaveManager was cleared" << timer;
background_manager_.reset();
LOG(DEBUG) << "BackgroundManager was cleared" << timer;
bot_info_manager_.reset();
LOG(DEBUG) << "BotInfoManager was cleared" << timer;
callback_queries_manager_.reset();
LOG(DEBUG) << "CallbackQueriesManager was cleared" << timer;
contacts_manager_.reset();
@ -3367,6 +3370,8 @@ void Td::clear() {
LOG(DEBUG) << "AutosaveManager actor was cleared" << timer;
background_manager_actor_.reset();
LOG(DEBUG) << "BackgroundManager actor was cleared" << timer;
bot_info_manager_actor_.reset();
LOG(DEBUG) << "BotInfoManager actor was cleared" << timer;
contacts_manager_actor_.reset();
LOG(DEBUG) << "ContactsManager actor was cleared" << timer;
country_info_manager_actor_.reset();
@ -3841,6 +3846,8 @@ void Td::init_managers() {
background_manager_ = make_unique<BackgroundManager>(this, create_reference());
background_manager_actor_ = register_actor("BackgroundManager", background_manager_.get());
G()->set_background_manager(background_manager_actor_.get());
bot_info_manager_ = make_unique<BotInfoManager>(this, create_reference());
bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_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

@ -43,6 +43,7 @@ class AudiosManager;
class AuthManager;
class AutosaveManager;
class BackgroundManager;
class BotInfoManager;
class CallManager;
class CallbackQueriesManager;
class ConfigManager;
@ -155,6 +156,8 @@ class Td final : public Actor {
ActorOwn<AutosaveManager> autosave_manager_actor_;
unique_ptr<BackgroundManager> background_manager_;
ActorOwn<BackgroundManager> background_manager_actor_;
unique_ptr<BotInfoManager> bot_info_manager_;
ActorOwn<BotInfoManager> bot_info_manager_actor_;
unique_ptr<ContactsManager> contacts_manager_;
ActorOwn<ContactsManager> contacts_manager_actor_;
unique_ptr<CountryInfoManager> country_info_manager_;