From e78fbd7f8dc6c7d4fb0f6eac1ad5a4f73015c4c9 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 13 Jun 2024 22:31:51 +0300 Subject: [PATCH] Add StarManager. --- CMakeLists.txt | 2 ++ SplitSource.php | 1 + td/telegram/StarManager.cpp | 18 ++++++++++++++++++ td/telegram/StarManager.h | 28 ++++++++++++++++++++++++++++ td/telegram/Td.cpp | 5 +++++ td/telegram/Td.h | 3 +++ 6 files changed, 57 insertions(+) create mode 100644 td/telegram/StarManager.cpp create mode 100644 td/telegram/StarManager.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0efec7496..47a0875c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -547,6 +547,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/SharedDialog.cpp td/telegram/SpecialStickerSetType.cpp td/telegram/SponsoredMessageManager.cpp + td/telegram/StarManager.cpp td/telegram/StateManager.cpp td/telegram/StatisticsManager.cpp td/telegram/StickerFormat.cpp @@ -881,6 +882,7 @@ set(TDLIB_SOURCE_PART2 td/telegram/SharedDialog.h td/telegram/SpecialStickerSetType.h td/telegram/SponsoredMessageManager.h + td/telegram/StarManager.h td/telegram/StateManager.h td/telegram/StatisticsManager.h td/telegram/StickerFormat.h diff --git a/SplitSource.php b/SplitSource.php index b6412c34d..1806926cf 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -408,6 +408,7 @@ function split_file($file, $chunks, $undo) { 'SentEmailCode' => 'SentEmailCode', 'SharedDialog' => 'SharedDialog', 'sponsored_message_manager[_(-](?![.]get[(][)])|SponsoredMessageManager' => 'SponsoredMessageManager', + 'star_manager[_(-](?![.]get[(][)])|StarManager' => 'StarManager', 'state_manager[_(-](?![.]get[(][)])|StateManager' => 'StateManager', 'statistics_manager[_(-](?![.]get[(][)])|StatisticsManager' => 'StatisticsManager', 'StickerSetId' => 'StickerSetId', diff --git a/td/telegram/StarManager.cpp b/td/telegram/StarManager.cpp new file mode 100644 index 000000000..c31c70f3b --- /dev/null +++ b/td/telegram/StarManager.cpp @@ -0,0 +1,18 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024 +// +// 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/StarManager.h" + +namespace td { + +StarManager::StarManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void StarManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/StarManager.h b/td/telegram/StarManager.h new file mode 100644 index 000000000..3e7a43c86 --- /dev/null +++ b/td/telegram/StarManager.h @@ -0,0 +1,28 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024 +// +// 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 StarManager final : public Actor { + public: + StarManager(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 aa7c1fb04..04aa27720 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -143,6 +143,7 @@ #include "td/telegram/SecureValue.h" #include "td/telegram/SentEmailCode.h" #include "td/telegram/SponsoredMessageManager.h" +#include "td/telegram/StarManager.h" #include "td/telegram/StateManager.h" #include "td/telegram/StatisticsManager.h" #include "td/telegram/StickerFormat.h" @@ -3099,6 +3100,7 @@ void Td::dec_actor_refcnt() { reset_manager(reaction_manager_, "ReactionManager"); reset_manager(saved_messages_manager_, "SavedMessagesManager"); reset_manager(sponsored_message_manager_, "SponsoredMessageManager"); + reset_manager(star_manager_, "StarManager"); reset_manager(statistics_manager_, "StatisticsManager"); reset_manager(stickers_manager_, "StickersManager"); reset_manager(story_manager_, "StoryManager"); @@ -3276,6 +3278,7 @@ void Td::clear() { 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(star_manager_actor_))); reset_actor(ActorOwn(std::move(statistics_manager_actor_))); reset_actor(ActorOwn(std::move(stickers_manager_actor_))); reset_actor(ActorOwn(std::move(story_manager_actor_))); @@ -3826,6 +3829,8 @@ void Td::init_managers() { 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()); + star_manager_ = make_unique(this, create_reference()); + star_manager_actor_ = register_actor("StarManager", star_manager_.get()); statistics_manager_ = make_unique(this, create_reference()); statistics_manager_actor_ = register_actor("StatisticsManager", statistics_manager_.get()); stickers_manager_ = make_unique(this, create_reference()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 2a96879aa..5c9ae0f7d 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -90,6 +90,7 @@ class SavedMessagesManager; class SecureManager; class SecretChatsManager; class SponsoredMessageManager; +class StarManager; class StateManager; class StatisticsManager; class StickersManager; @@ -247,6 +248,8 @@ class Td final : public Actor { ActorOwn saved_messages_manager_actor_; unique_ptr sponsored_message_manager_; ActorOwn sponsored_message_manager_actor_; + unique_ptr star_manager_; + ActorOwn star_manager_actor_; unique_ptr statistics_manager_; ActorOwn statistics_manager_actor_; unique_ptr stickers_manager_;