From bb683c298839902c46be3b4a0171c7891dd869ed Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 7 Mar 2024 15:44:15 +0300 Subject: [PATCH] Add empty BusinessConnectionManager. --- CMakeLists.txt | 2 ++ SplitSource.php | 1 + td/telegram/BusinessConnectionManager.cpp | 18 +++++++++++++++ td/telegram/BusinessConnectionManager.h | 28 +++++++++++++++++++++++ td/telegram/Global.h | 9 ++++++++ td/telegram/Td.cpp | 6 +++++ td/telegram/Td.h | 3 +++ 7 files changed, 67 insertions(+) create mode 100644 td/telegram/BusinessConnectionManager.cpp create mode 100644 td/telegram/BusinessConnectionManager.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a4de57f87..792c694f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,6 +304,7 @@ set(TDLIB_SOURCE td/telegram/BusinessAwayMessage.cpp td/telegram/BusinessAwayMessageSchedule.cpp td/telegram/BusinessConnectedBot.cpp + td/telegram/BusinessConnectionManager.cpp td/telegram/BusinessGreetingMessage.cpp td/telegram/BusinessInfo.cpp td/telegram/BusinessManager.cpp @@ -592,6 +593,7 @@ set(TDLIB_SOURCE td/telegram/BusinessAwayMessage.h td/telegram/BusinessAwayMessageSchedule.h td/telegram/BusinessConnectedBot.h + td/telegram/BusinessConnectionManager.h td/telegram/BusinessGreetingMessage.h td/telegram/BusinessInfo.h td/telegram/BusinessManager.h diff --git a/SplitSource.php b/SplitSource.php index 21461b27e..0cd972c63 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -311,6 +311,7 @@ function split_file($file, $chunks, $undo) { 'bot_info_manager[_(-](?![.]get[(][)])|BotInfoManager' => 'BotInfoManager', 'BusinessAwayMessage' => 'BusinessAwayMessage', 'BusinessConnectedBot' => 'BusinessConnectedBot', + 'business_connection_manager[_(-](?![.]get[(][)])|BusinessConnectionManager' => 'BusinessConnectionManager', 'BusinessGreetingMessage' => 'BusinessGreetingMessage', 'BusinessInfo|business_info' => 'BusinessInfo', 'business_manager[_(-](?![.]get[(][)])|BusinessManager' => 'BusinessManager', diff --git a/td/telegram/BusinessConnectionManager.cpp b/td/telegram/BusinessConnectionManager.cpp new file mode 100644 index 000000000..0178e348a --- /dev/null +++ b/td/telegram/BusinessConnectionManager.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/BusinessConnectionManager.h" + +namespace td { + +BusinessConnectionManager::BusinessConnectionManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void BusinessConnectionManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/BusinessConnectionManager.h b/td/telegram/BusinessConnectionManager.h new file mode 100644 index 000000000..43cb025fb --- /dev/null +++ b/td/telegram/BusinessConnectionManager.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 BusinessConnectionManager final : public Actor { + public: + BusinessConnectionManager(Td *td, ActorShared<> parent); + + private: + void tear_down() final; + + Td *td_; + ActorShared<> parent_; +}; + +} // namespace td diff --git a/td/telegram/Global.h b/td/telegram/Global.h index 187c1fd13..f2d09bb41 100644 --- a/td/telegram/Global.h +++ b/td/telegram/Global.h @@ -37,6 +37,7 @@ class AuthManager; class AutosaveManager; class BackgroundManager; class BoostManager; +class BusinessConnectionManager; class BusinessManager; class CallManager; class ConfigManager; @@ -233,6 +234,13 @@ class Global final : public ActorContext { boost_manager_ = boost_manager; } + ActorId business_connection_manager() const { + return business_connection_manager_; + } + void set_business_connection_manager(ActorId business_connection_manager) { + business_connection_manager_ = business_connection_manager; + } + ActorId business_manager() const { return business_manager_; } @@ -623,6 +631,7 @@ class Global final : public ActorContext { ActorId autosave_manager_; ActorId background_manager_; ActorId boost_manager_; + ActorId business_connection_manager_; ActorId business_manager_; ActorId call_manager_; ActorId config_manager_; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 4f9d6778c..a6e05537b 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -23,6 +23,7 @@ #include "td/telegram/BotInfoManager.h" #include "td/telegram/BotMenuButton.h" #include "td/telegram/BusinessAwayMessage.h" +#include "td/telegram/BusinessConnectionManager.h" #include "td/telegram/BusinessGreetingMessage.h" #include "td/telegram/BusinessManager.h" #include "td/telegram/BusinessWorkHours.h" @@ -3208,6 +3209,7 @@ void Td::dec_actor_refcnt() { reset_manager(background_manager_, "BackgroundManager"); reset_manager(boost_manager_, "BoostManager"); reset_manager(bot_info_manager_, "BotInfoManager"); + reset_manager(business_connection_manager_, "BusinessConnectionManager"); reset_manager(business_manager_, "BusinessManager"); reset_manager(callback_queries_manager_, "CallbackQueriesManager"); reset_manager(channel_recommendation_manager_, "ChannelRecommendationManager"); @@ -3384,6 +3386,7 @@ void Td::clear() { reset_actor(ActorOwn(std::move(background_manager_actor_))); reset_actor(ActorOwn(std::move(boost_manager_actor_))); reset_actor(ActorOwn(std::move(bot_info_manager_actor_))); + reset_actor(ActorOwn(std::move(business_connection_manager_actor_))); reset_actor(ActorOwn(std::move(business_manager_actor_))); reset_actor(ActorOwn(std::move(channel_recommendation_manager_actor_))); reset_actor(ActorOwn(std::move(common_dialog_manager_actor_))); @@ -3877,6 +3880,9 @@ 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()); + business_connection_manager_ = make_unique(this, create_reference()); + business_connection_manager_actor_ = register_actor("BusinessConnectionManager", business_connection_manager_.get()); + G()->set_business_connection_manager(business_connection_manager_actor_.get()); business_manager_ = make_unique(this, create_reference()); business_manager_actor_ = register_actor("BusinessManager", business_manager_.get()); G()->set_business_manager(business_manager_actor_.get()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index b5ada0942..20b29c5f4 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -46,6 +46,7 @@ class AutosaveManager; class BackgroundManager; class BoostManager; class BotInfoManager; +class BusinessConnectionManager; class BusinessManager; class CallManager; class CallbackQueriesManager; @@ -180,6 +181,8 @@ class Td final : public Actor { ActorOwn boost_manager_actor_; unique_ptr bot_info_manager_; ActorOwn bot_info_manager_actor_; + unique_ptr business_connection_manager_; + ActorOwn business_connection_manager_actor_; unique_ptr business_manager_; ActorOwn business_manager_actor_; unique_ptr channel_recommendation_manager_;