Add empty SavedMessagesManager.

This commit is contained in:
levlam 2024-02-04 12:41:53 +03:00
parent d85dcb8298
commit 1eb8c22f75
7 changed files with 67 additions and 0 deletions

View File

@ -470,6 +470,7 @@ set(TDLIB_SOURCE
td/telegram/ReportReason.cpp
td/telegram/RequestedDialogType.cpp
td/telegram/RestrictionReason.cpp
td/telegram/SavedMessagesManager.cpp
td/telegram/SavedMessagesTopicId.cpp
td/telegram/ScopeNotificationSettings.cpp
td/telegram/SecretChatActor.cpp
@ -796,6 +797,7 @@ set(TDLIB_SOURCE
td/telegram/RequestActor.h
td/telegram/RequestedDialogType.h
td/telegram/RestrictionReason.h
td/telegram/SavedMessagesManager.h
td/telegram/SavedMessagesTopicId.h
td/telegram/ScheduledServerMessageId.h
td/telegram/ScopeNotificationSettings.h

View File

@ -376,6 +376,7 @@ function split_file($file, $chunks, $undo) {
'reaction_manager[_(-](?![.]get[(][)])|ReactionManager' => 'ReactionManager',
'ReactionType|[a-z_]*_reaction_type' => 'ReactionType',
'RequestActor|RequestOnceActor' => 'RequestActor',
'saved_messages_manager[_(-](?![.]get[(][)])|SavedMessagesManager' => 'SavedMessagesManager',
'ScopeNotificationSettings|[a-z_]*_scope_notification_settings' => 'ScopeNotificationSettings',
'SecretChatActor' => 'SecretChatActor',
'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager',

View File

@ -62,6 +62,7 @@ class NotificationSettingsManager;
class OptionManager;
class PasswordManager;
class ReactionManager;
class SavedMessagesManager;
class SecretChatsManager;
class SponsoredMessageManager;
class StateManager;
@ -387,6 +388,13 @@ class Global final : public ActorContext {
reaction_manager_ = reaction_manager;
}
ActorId<SavedMessagesManager> saved_messages_manager() const {
return saved_messages_manager_;
}
void set_saved_messages_manager(ActorId<SavedMessagesManager> saved_messages_manager) {
saved_messages_manager_ = saved_messages_manager;
}
ActorId<SecretChatsManager> secret_chats_manager() const {
return secret_chats_manager_;
}
@ -605,6 +613,7 @@ class Global final : public ActorContext {
ActorId<NotificationSettingsManager> notification_settings_manager_;
ActorId<PasswordManager> password_manager_;
ActorId<ReactionManager> reaction_manager_;
ActorId<SavedMessagesManager> saved_messages_manager_;
ActorId<SecretChatsManager> secret_chats_manager_;
ActorId<SponsoredMessageManager> sponsored_message_manager_;
ActorId<StickersManager> stickers_manager_;

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

View File

@ -120,6 +120,7 @@
#include "td/telegram/ReactionType.h"
#include "td/telegram/ReportReason.h"
#include "td/telegram/RequestActor.h"
#include "td/telegram/SavedMessagesManager.h"
#include "td/telegram/SavedMessagesTopicId.h"
#include "td/telegram/ScopeNotificationSettings.h"
#include "td/telegram/SecretChatId.h"
@ -3221,6 +3222,7 @@ void Td::dec_actor_refcnt() {
reset_manager(poll_manager_, "PollManager");
reset_manager(privacy_manager_, "PrivacyManager");
reset_manager(reaction_manager_, "ReactionManager");
reset_manager(saved_messages_manager_, "SavedMessagesManager");
reset_manager(sponsored_message_manager_, "SponsoredMessageManager");
reset_manager(statistics_manager_, "StatisticsManager");
reset_manager(stickers_manager_, "StickersManager");
@ -3390,6 +3392,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(poll_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(privacy_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(reaction_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(saved_messages_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(sponsored_message_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(statistics_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(stickers_manager_actor_)));
@ -3913,6 +3916,9 @@ void Td::init_managers() {
reaction_manager_ = make_unique<ReactionManager>(this, create_reference());
reaction_manager_actor_ = register_actor("ReactionManager", reaction_manager_.get());
G()->set_reaction_manager(reaction_manager_actor_.get());
saved_messages_manager_ = make_unique<SavedMessagesManager>(this, create_reference());
saved_messages_manager_actor_ = register_actor("SavedMessagesManager", saved_messages_manager_.get());
G()->set_saved_messages_manager(saved_messages_manager_actor_.get());
sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference());
sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get());
G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get());

View File

@ -80,6 +80,7 @@ class PhoneNumberManager;
class PollManager;
class PrivacyManager;
class ReactionManager;
class SavedMessagesManager;
class SecureManager;
class SecretChatsManager;
class SponsoredMessageManager;
@ -220,6 +221,8 @@ class Td final : public Actor {
ActorOwn<PrivacyManager> privacy_manager_actor_;
unique_ptr<ReactionManager> reaction_manager_;
ActorOwn<ReactionManager> reaction_manager_actor_;
unique_ptr<SavedMessagesManager> saved_messages_manager_;
ActorOwn<SavedMessagesManager> saved_messages_manager_actor_;
unique_ptr<SponsoredMessageManager> sponsored_message_manager_;
ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_;
unique_ptr<StatisticsManager> statistics_manager_;