Add empty BusinessManager.

This commit is contained in:
levlam 2024-03-04 16:39:30 +03:00
parent a629700b3c
commit e78c0aa360
7 changed files with 67 additions and 0 deletions

View File

@ -306,6 +306,7 @@ set(TDLIB_SOURCE
td/telegram/BusinessConnectedBot.cpp td/telegram/BusinessConnectedBot.cpp
td/telegram/BusinessGreetingMessage.cpp td/telegram/BusinessGreetingMessage.cpp
td/telegram/BusinessInfo.cpp td/telegram/BusinessInfo.cpp
td/telegram/BusinessManager.cpp
td/telegram/BusinessRecipients.cpp td/telegram/BusinessRecipients.cpp
td/telegram/BusinessWorkHours.cpp td/telegram/BusinessWorkHours.cpp
td/telegram/CallActor.cpp td/telegram/CallActor.cpp
@ -591,6 +592,7 @@ set(TDLIB_SOURCE
td/telegram/BusinessConnectedBot.h td/telegram/BusinessConnectedBot.h
td/telegram/BusinessGreetingMessage.h td/telegram/BusinessGreetingMessage.h
td/telegram/BusinessInfo.h td/telegram/BusinessInfo.h
td/telegram/BusinessManager.h
td/telegram/BusinessRecipients.h td/telegram/BusinessRecipients.h
td/telegram/BusinessWorkHours.h td/telegram/BusinessWorkHours.h
td/telegram/CallActor.h td/telegram/CallActor.h

View File

@ -313,6 +313,7 @@ function split_file($file, $chunks, $undo) {
'BusinessConnectedBot' => 'BusinessConnectedBot', 'BusinessConnectedBot' => 'BusinessConnectedBot',
'BusinessGreetingMessage' => 'BusinessGreetingMessage', 'BusinessGreetingMessage' => 'BusinessGreetingMessage',
'BusinessInfo|business_info' => 'BusinessInfo', 'BusinessInfo|business_info' => 'BusinessInfo',
'business_manager[_(-](?![.]get[(][)])|BusinessManager' => 'BusinessManager',
'BusinessRecipients' => 'BusinessRecipients', 'BusinessRecipients' => 'BusinessRecipients',
'BusinessWorkHours' => 'BusinessWorkHours', 'BusinessWorkHours' => 'BusinessWorkHours',
'callback_queries_manager[_(-](?![.]get[(][)])|CallbackQueriesManager' => 'CallbackQueriesManager', 'callback_queries_manager[_(-](?![.]get[(][)])|CallbackQueriesManager' => 'CallbackQueriesManager',

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

View File

@ -37,6 +37,7 @@ class AuthManager;
class AutosaveManager; class AutosaveManager;
class BackgroundManager; class BackgroundManager;
class BoostManager; class BoostManager;
class BusinessManager;
class CallManager; class CallManager;
class ConfigManager; class ConfigManager;
class ConnectionCreator; class ConnectionCreator;
@ -231,6 +232,13 @@ class Global final : public ActorContext {
boost_manager_ = boost_manager; boost_manager_ = boost_manager;
} }
ActorId<BusinessManager> business_manager() const {
return business_manager_;
}
void set_business_manager(ActorId<BusinessManager> business_manager) {
business_manager_ = business_manager;
}
ActorId<CallManager> call_manager() const { ActorId<CallManager> call_manager() const {
return call_manager_; return call_manager_;
} }
@ -607,6 +615,7 @@ class Global final : public ActorContext {
ActorId<AutosaveManager> autosave_manager_; ActorId<AutosaveManager> autosave_manager_;
ActorId<BackgroundManager> background_manager_; ActorId<BackgroundManager> background_manager_;
ActorId<BoostManager> boost_manager_; ActorId<BoostManager> boost_manager_;
ActorId<BusinessManager> business_manager_;
ActorId<CallManager> call_manager_; ActorId<CallManager> call_manager_;
ActorId<ConfigManager> config_manager_; ActorId<ConfigManager> config_manager_;
ActorId<ContactsManager> contacts_manager_; ActorId<ContactsManager> contacts_manager_;

View File

@ -24,6 +24,7 @@
#include "td/telegram/BotMenuButton.h" #include "td/telegram/BotMenuButton.h"
#include "td/telegram/BusinessAwayMessage.h" #include "td/telegram/BusinessAwayMessage.h"
#include "td/telegram/BusinessGreetingMessage.h" #include "td/telegram/BusinessGreetingMessage.h"
#include "td/telegram/BusinessManager.h"
#include "td/telegram/BusinessWorkHours.h" #include "td/telegram/BusinessWorkHours.h"
#include "td/telegram/CallbackQueriesManager.h" #include "td/telegram/CallbackQueriesManager.h"
#include "td/telegram/CallId.h" #include "td/telegram/CallId.h"
@ -3205,6 +3206,7 @@ void Td::dec_actor_refcnt() {
reset_manager(background_manager_, "BackgroundManager"); reset_manager(background_manager_, "BackgroundManager");
reset_manager(boost_manager_, "BoostManager"); reset_manager(boost_manager_, "BoostManager");
reset_manager(bot_info_manager_, "BotInfoManager"); reset_manager(bot_info_manager_, "BotInfoManager");
reset_manager(business_manager_, "BusinessManager");
reset_manager(callback_queries_manager_, "CallbackQueriesManager"); reset_manager(callback_queries_manager_, "CallbackQueriesManager");
reset_manager(common_dialog_manager_, "CommonDialogManager"); reset_manager(common_dialog_manager_, "CommonDialogManager");
reset_manager(contacts_manager_, "ContactsManager"); reset_manager(contacts_manager_, "ContactsManager");
@ -3378,6 +3380,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(background_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(background_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(boost_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(boost_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(bot_info_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(bot_info_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(business_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(common_dialog_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(common_dialog_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(contacts_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(contacts_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(country_info_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(country_info_manager_actor_)));
@ -3868,6 +3871,9 @@ void Td::init_managers() {
G()->set_boost_manager(boost_manager_actor_.get()); G()->set_boost_manager(boost_manager_actor_.get());
bot_info_manager_ = make_unique<BotInfoManager>(this, create_reference()); bot_info_manager_ = make_unique<BotInfoManager>(this, create_reference());
bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get()); bot_info_manager_actor_ = register_actor("BotInfoManager", bot_info_manager_.get());
business_manager_ = make_unique<BusinessManager>(this, create_reference());
business_manager_actor_ = register_actor("BusinessManager", business_manager_.get());
G()->set_business_manager(business_manager_actor_.get());
common_dialog_manager_ = make_unique<CommonDialogManager>(this, create_reference()); common_dialog_manager_ = make_unique<CommonDialogManager>(this, create_reference());
common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get()); common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get());
contacts_manager_ = make_unique<ContactsManager>(this, create_reference()); contacts_manager_ = make_unique<ContactsManager>(this, create_reference());

View File

@ -46,6 +46,7 @@ class AutosaveManager;
class BackgroundManager; class BackgroundManager;
class BoostManager; class BoostManager;
class BotInfoManager; class BotInfoManager;
class BusinessManager;
class CallManager; class CallManager;
class CallbackQueriesManager; class CallbackQueriesManager;
class CommonDialogManager; class CommonDialogManager;
@ -177,6 +178,8 @@ class Td final : public Actor {
ActorOwn<BoostManager> boost_manager_actor_; ActorOwn<BoostManager> boost_manager_actor_;
unique_ptr<BotInfoManager> bot_info_manager_; unique_ptr<BotInfoManager> bot_info_manager_;
ActorOwn<BotInfoManager> bot_info_manager_actor_; ActorOwn<BotInfoManager> bot_info_manager_actor_;
unique_ptr<BusinessManager> business_manager_;
ActorOwn<BusinessManager> business_manager_actor_;
unique_ptr<CommonDialogManager> common_dialog_manager_; unique_ptr<CommonDialogManager> common_dialog_manager_;
ActorOwn<CommonDialogManager> common_dialog_manager_actor_; ActorOwn<CommonDialogManager> common_dialog_manager_actor_;
unique_ptr<ContactsManager> contacts_manager_; unique_ptr<ContactsManager> contacts_manager_;