diff --git a/CMakeLists.txt b/CMakeLists.txt index b3d7647e0..ef0fc361b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/SplitSource.php b/SplitSource.php index c89dd3216..2618b4faa 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -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', diff --git a/td/telegram/Global.h b/td/telegram/Global.h index 474959556..e77d64ea0 100644 --- a/td/telegram/Global.h +++ b/td/telegram/Global.h @@ -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 saved_messages_manager() const { + return saved_messages_manager_; + } + void set_saved_messages_manager(ActorId saved_messages_manager) { + saved_messages_manager_ = saved_messages_manager; + } + ActorId secret_chats_manager() const { return secret_chats_manager_; } @@ -605,6 +613,7 @@ class Global final : public ActorContext { ActorId notification_settings_manager_; ActorId password_manager_; ActorId reaction_manager_; + ActorId saved_messages_manager_; ActorId secret_chats_manager_; ActorId sponsored_message_manager_; ActorId stickers_manager_; diff --git a/td/telegram/SavedMessagesManager.cpp b/td/telegram/SavedMessagesManager.cpp new file mode 100644 index 000000000..0b866fbf1 --- /dev/null +++ b/td/telegram/SavedMessagesManager.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/SavedMessagesManager.h" + +namespace td { + +SavedMessagesManager::SavedMessagesManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void SavedMessagesManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/SavedMessagesManager.h b/td/telegram/SavedMessagesManager.h new file mode 100644 index 000000000..931c25235 --- /dev/null +++ b/td/telegram/SavedMessagesManager.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 SavedMessagesManager final : public Actor { + public: + SavedMessagesManager(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 36b3b5428..224a1b786 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -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(std::move(poll_manager_actor_))); reset_actor(ActorOwn(std::move(privacy_manager_actor_))); reset_actor(ActorOwn(std::move(reaction_manager_actor_))); + reset_actor(ActorOwn(std::move(saved_messages_manager_actor_))); reset_actor(ActorOwn(std::move(sponsored_message_manager_actor_))); reset_actor(ActorOwn(std::move(statistics_manager_actor_))); reset_actor(ActorOwn(std::move(stickers_manager_actor_))); @@ -3913,6 +3916,9 @@ void Td::init_managers() { reaction_manager_ = make_unique(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(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(this, create_reference()); sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get()); G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index f3700db74..584f0ff4a 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -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 privacy_manager_actor_; unique_ptr reaction_manager_; ActorOwn reaction_manager_actor_; + unique_ptr saved_messages_manager_; + ActorOwn saved_messages_manager_actor_; unique_ptr sponsored_message_manager_; ActorOwn sponsored_message_manager_actor_; unique_ptr statistics_manager_;