Add StarManager.

This commit is contained in:
levlam 2024-06-13 22:31:51 +03:00
parent 0c72e2031b
commit e78fbd7f8d
6 changed files with 57 additions and 0 deletions

View File

@ -547,6 +547,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/SharedDialog.cpp td/telegram/SharedDialog.cpp
td/telegram/SpecialStickerSetType.cpp td/telegram/SpecialStickerSetType.cpp
td/telegram/SponsoredMessageManager.cpp td/telegram/SponsoredMessageManager.cpp
td/telegram/StarManager.cpp
td/telegram/StateManager.cpp td/telegram/StateManager.cpp
td/telegram/StatisticsManager.cpp td/telegram/StatisticsManager.cpp
td/telegram/StickerFormat.cpp td/telegram/StickerFormat.cpp
@ -881,6 +882,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/SharedDialog.h td/telegram/SharedDialog.h
td/telegram/SpecialStickerSetType.h td/telegram/SpecialStickerSetType.h
td/telegram/SponsoredMessageManager.h td/telegram/SponsoredMessageManager.h
td/telegram/StarManager.h
td/telegram/StateManager.h td/telegram/StateManager.h
td/telegram/StatisticsManager.h td/telegram/StatisticsManager.h
td/telegram/StickerFormat.h td/telegram/StickerFormat.h

View File

@ -408,6 +408,7 @@ function split_file($file, $chunks, $undo) {
'SentEmailCode' => 'SentEmailCode', 'SentEmailCode' => 'SentEmailCode',
'SharedDialog' => 'SharedDialog', 'SharedDialog' => 'SharedDialog',
'sponsored_message_manager[_(-](?![.]get[(][)])|SponsoredMessageManager' => 'SponsoredMessageManager', 'sponsored_message_manager[_(-](?![.]get[(][)])|SponsoredMessageManager' => 'SponsoredMessageManager',
'star_manager[_(-](?![.]get[(][)])|StarManager' => 'StarManager',
'state_manager[_(-](?![.]get[(][)])|StateManager' => 'StateManager', 'state_manager[_(-](?![.]get[(][)])|StateManager' => 'StateManager',
'statistics_manager[_(-](?![.]get[(][)])|StatisticsManager' => 'StatisticsManager', 'statistics_manager[_(-](?![.]get[(][)])|StatisticsManager' => 'StatisticsManager',
'StickerSetId' => 'StickerSetId', 'StickerSetId' => 'StickerSetId',

View File

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

28
td/telegram/StarManager.h Normal file
View File

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

View File

@ -143,6 +143,7 @@
#include "td/telegram/SecureValue.h" #include "td/telegram/SecureValue.h"
#include "td/telegram/SentEmailCode.h" #include "td/telegram/SentEmailCode.h"
#include "td/telegram/SponsoredMessageManager.h" #include "td/telegram/SponsoredMessageManager.h"
#include "td/telegram/StarManager.h"
#include "td/telegram/StateManager.h" #include "td/telegram/StateManager.h"
#include "td/telegram/StatisticsManager.h" #include "td/telegram/StatisticsManager.h"
#include "td/telegram/StickerFormat.h" #include "td/telegram/StickerFormat.h"
@ -3099,6 +3100,7 @@ void Td::dec_actor_refcnt() {
reset_manager(reaction_manager_, "ReactionManager"); reset_manager(reaction_manager_, "ReactionManager");
reset_manager(saved_messages_manager_, "SavedMessagesManager"); reset_manager(saved_messages_manager_, "SavedMessagesManager");
reset_manager(sponsored_message_manager_, "SponsoredMessageManager"); reset_manager(sponsored_message_manager_, "SponsoredMessageManager");
reset_manager(star_manager_, "StarManager");
reset_manager(statistics_manager_, "StatisticsManager"); reset_manager(statistics_manager_, "StatisticsManager");
reset_manager(stickers_manager_, "StickersManager"); reset_manager(stickers_manager_, "StickersManager");
reset_manager(story_manager_, "StoryManager"); reset_manager(story_manager_, "StoryManager");
@ -3276,6 +3278,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(reaction_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(saved_messages_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(sponsored_message_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(sponsored_message_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(star_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(statistics_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(statistics_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(stickers_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(stickers_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(story_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(story_manager_actor_)));
@ -3826,6 +3829,8 @@ void Td::init_managers() {
sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference()); sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference());
sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get()); sponsored_message_manager_actor_ = register_actor("SponsoredMessageManager", sponsored_message_manager_.get());
G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get()); G()->set_sponsored_message_manager(sponsored_message_manager_actor_.get());
star_manager_ = make_unique<StarManager>(this, create_reference());
star_manager_actor_ = register_actor("StarManager", star_manager_.get());
statistics_manager_ = make_unique<StatisticsManager>(this, create_reference()); statistics_manager_ = make_unique<StatisticsManager>(this, create_reference());
statistics_manager_actor_ = register_actor("StatisticsManager", statistics_manager_.get()); statistics_manager_actor_ = register_actor("StatisticsManager", statistics_manager_.get());
stickers_manager_ = make_unique<StickersManager>(this, create_reference()); stickers_manager_ = make_unique<StickersManager>(this, create_reference());

View File

@ -90,6 +90,7 @@ class SavedMessagesManager;
class SecureManager; class SecureManager;
class SecretChatsManager; class SecretChatsManager;
class SponsoredMessageManager; class SponsoredMessageManager;
class StarManager;
class StateManager; class StateManager;
class StatisticsManager; class StatisticsManager;
class StickersManager; class StickersManager;
@ -247,6 +248,8 @@ class Td final : public Actor {
ActorOwn<SavedMessagesManager> saved_messages_manager_actor_; ActorOwn<SavedMessagesManager> saved_messages_manager_actor_;
unique_ptr<SponsoredMessageManager> sponsored_message_manager_; unique_ptr<SponsoredMessageManager> sponsored_message_manager_;
ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_; ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_;
unique_ptr<StarManager> star_manager_;
ActorOwn<StarManager> star_manager_actor_;
unique_ptr<StatisticsManager> statistics_manager_; unique_ptr<StatisticsManager> statistics_manager_;
ActorOwn<StatisticsManager> statistics_manager_actor_; ActorOwn<StatisticsManager> statistics_manager_actor_;
unique_ptr<StickersManager> stickers_manager_; unique_ptr<StickersManager> stickers_manager_;