From 407bb811b367c5b13812d325d15063b18cd0c525 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 13 Mar 2024 14:06:14 +0300 Subject: [PATCH] Add ChannelRecommendationManager. --- CMakeLists.txt | 2 ++ SplitSource.php | 1 + td/telegram/ChannelRecommendationManager.cpp | 19 +++++++++++++ td/telegram/ChannelRecommendationManager.h | 28 ++++++++++++++++++++ td/telegram/Td.cpp | 6 +++++ td/telegram/Td.h | 3 +++ 6 files changed, 59 insertions(+) create mode 100644 td/telegram/ChannelRecommendationManager.cpp create mode 100644 td/telegram/ChannelRecommendationManager.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f1e9681a..a4de57f87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,6 +314,7 @@ set(TDLIB_SOURCE td/telegram/CallDiscardReason.cpp td/telegram/CallManager.cpp td/telegram/ChannelParticipantFilter.cpp + td/telegram/ChannelRecommendationManager.cpp td/telegram/ChatReactions.cpp td/telegram/ClientActor.cpp td/telegram/CommonDialogManager.cpp @@ -604,6 +605,7 @@ set(TDLIB_SOURCE td/telegram/ChainId.h td/telegram/ChannelId.h td/telegram/ChannelParticipantFilter.h + td/telegram/ChannelRecommendationManager.h td/telegram/ChannelType.h td/telegram/ChatId.h td/telegram/ChatReactions.h diff --git a/SplitSource.php b/SplitSource.php index a52e6809e..21461b27e 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -320,6 +320,7 @@ function split_file($file, $chunks, $undo) { 'CallId' => 'CallId', 'call_manager[_(-](?![.]get[(][)])|CallManager' => 'CallManager', 'ChannelId' => 'ChannelId', + 'channel_recommendation_manager[_(-](?![.]get[(][)])|ChannelRecommendationManager' => 'ChannelRecommendationManager', 'ChatId' => 'ChatId', 'common_dialog_manager[_(-](?![.]get[(][)])|CommonDialogManager' => 'CommonDialogManager', 'contacts_manager[_(-](?![.]get[(][)])|ContactsManager([^ ;.]| [^*])' => 'ContactsManager', diff --git a/td/telegram/ChannelRecommendationManager.cpp b/td/telegram/ChannelRecommendationManager.cpp new file mode 100644 index 000000000..dc507d61b --- /dev/null +++ b/td/telegram/ChannelRecommendationManager.cpp @@ -0,0 +1,19 @@ +// +// 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/ChannelRecommendationManager.h" + +namespace td { + +ChannelRecommendationManager::ChannelRecommendationManager(Td *td, ActorShared<> parent) + : td_(td), parent_(std::move(parent)) { +} + +void ChannelRecommendationManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/ChannelRecommendationManager.h b/td/telegram/ChannelRecommendationManager.h new file mode 100644 index 000000000..d0ef82271 --- /dev/null +++ b/td/telegram/ChannelRecommendationManager.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 ChannelRecommendationManager final : public Actor { + public: + ChannelRecommendationManager(Td *td, ActorShared<> parent); + + private: + void tear_down() final; + + Td *td_; + ActorShared<> parent_; +}; + +} // namespace td diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index a2d86265e..8ce9d190d 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -30,6 +30,7 @@ #include "td/telegram/CallId.h" #include "td/telegram/CallManager.h" #include "td/telegram/ChannelId.h" +#include "td/telegram/ChannelRecommendationManager.h" #include "td/telegram/ChannelType.h" #include "td/telegram/ChatId.h" #include "td/telegram/CommonDialogManager.h" @@ -3209,6 +3210,7 @@ void Td::dec_actor_refcnt() { reset_manager(bot_info_manager_, "BotInfoManager"); reset_manager(business_manager_, "BusinessManager"); reset_manager(callback_queries_manager_, "CallbackQueriesManager"); + reset_manager(channel_recommendation_manager_, "ChannelRecommendationManager"); reset_manager(common_dialog_manager_, "CommonDialogManager"); reset_manager(contacts_manager_, "ContactsManager"); reset_manager(country_info_manager_, "CountryInfoManager"); @@ -3383,6 +3385,7 @@ void Td::clear() { reset_actor(ActorOwn(std::move(boost_manager_actor_))); reset_actor(ActorOwn(std::move(bot_info_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_))); reset_actor(ActorOwn(std::move(contacts_manager_actor_))); reset_actor(ActorOwn(std::move(country_info_manager_actor_))); @@ -3877,6 +3880,9 @@ void Td::init_managers() { business_manager_ = make_unique(this, create_reference()); business_manager_actor_ = register_actor("BusinessManager", business_manager_.get()); G()->set_business_manager(business_manager_actor_.get()); + channel_recommendation_manager_ = make_unique(this, create_reference()); + channel_recommendation_manager_actor_ = + register_actor("ChannelRecommendationManager", channel_recommendation_manager_.get()); common_dialog_manager_ = make_unique(this, create_reference()); common_dialog_manager_actor_ = register_actor("CommonDialogManager", common_dialog_manager_.get()); contacts_manager_ = make_unique(this, create_reference()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 8014cf8b8..b5ada0942 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -49,6 +49,7 @@ class BotInfoManager; class BusinessManager; class CallManager; class CallbackQueriesManager; +class ChannelRecommendationManager; class CommonDialogManager; class ConfigManager; class ContactsManager; @@ -181,6 +182,8 @@ class Td final : public Actor { ActorOwn bot_info_manager_actor_; unique_ptr business_manager_; ActorOwn business_manager_actor_; + unique_ptr channel_recommendation_manager_; + ActorOwn channel_recommendation_manager_actor_; unique_ptr common_dialog_manager_; ActorOwn common_dialog_manager_actor_; unique_ptr contacts_manager_;