Add ChannelRecommendationManager.

This commit is contained in:
levlam 2024-03-13 14:06:14 +03:00
parent b41f3219dc
commit 407bb811b3
6 changed files with 59 additions and 0 deletions

View File

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

View File

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

View File

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

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

View File

@ -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<Actor>(std::move(boost_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(channel_recommendation_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(country_info_manager_actor_)));
@ -3877,6 +3880,9 @@ void Td::init_managers() {
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());
channel_recommendation_manager_ = make_unique<ChannelRecommendationManager>(this, create_reference());
channel_recommendation_manager_actor_ =
register_actor("ChannelRecommendationManager", channel_recommendation_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());

View File

@ -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<BotInfoManager> bot_info_manager_actor_;
unique_ptr<BusinessManager> business_manager_;
ActorOwn<BusinessManager> business_manager_actor_;
unique_ptr<ChannelRecommendationManager> channel_recommendation_manager_;
ActorOwn<ChannelRecommendationManager> channel_recommendation_manager_actor_;
unique_ptr<CommonDialogManager> common_dialog_manager_;
ActorOwn<CommonDialogManager> common_dialog_manager_actor_;
unique_ptr<ContactsManager> contacts_manager_;