Add ForumTopicManager.

This commit is contained in:
levlam 2022-10-25 15:03:35 +03:00
parent 4ee2a1c066
commit 83a2a786ef
8 changed files with 80 additions and 1 deletions

View File

@ -356,6 +356,7 @@ set(TDLIB_SOURCE
td/telegram/ForumTopicEditedData.cpp
td/telegram/ForumTopicIcon.cpp
td/telegram/ForumTopicInfo.cpp
td/telegram/ForumTopicManager.cpp
td/telegram/Game.cpp
td/telegram/GameManager.cpp
td/telegram/Global.cpp
@ -588,6 +589,7 @@ set(TDLIB_SOURCE
td/telegram/ForumTopicEditedData.h
td/telegram/ForumTopicIcon.h
td/telegram/ForumTopicInfo.h
td/telegram/ForumTopicManager.h
td/telegram/FullMessageId.h
td/telegram/Game.h
td/telegram/GameManager.h

View File

@ -286,6 +286,7 @@ function split_file($file, $chunks, $undo) {
'documents_manager[_(-][^.]|DocumentsManager' => "DocumentsManager",
'file_reference_manager[_(-][^.]|FileReferenceManager|file_references[)]' => 'FileReferenceManager',
'file_manager[_(-][^.]|FileManager([^ ;.]| [^*])|update_file[)]' => 'files/FileManager',
'forum_topic_manager[_(-][^.]|ForumTopicManager' => 'ForumTopicManager',
'G[(][)]|Global[^A-Za-z]' => 'Global',
'game_manager[_(-][^.]|GameManager' => 'GameManager',
'group_call_manager[_(-][^.]|GroupCallManager' => 'GroupCallManager',

View File

@ -5180,7 +5180,7 @@ sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to_mess
//@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message
//@chat_id Identifier of the chat to which to forward messages
//@message_thread_id If not 0, a message thread identifier in which the message will be sent
//@message_thread_id If not 0, a message thread identifier in which the message will be sent; for forum threads only
//@from_chat_id Identifier of the chat from which to forward messages
//@message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously
//@options Options to be used to send the messages; pass null to use default options

View File

@ -0,0 +1,22 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// 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/ForumTopicManager.h"
#include "td/telegram/Td.h"
namespace td {
ForumTopicManager::ForumTopicManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
ForumTopicManager::~ForumTopicManager() = default;
void ForumTopicManager::tear_down() {
parent_.reset();
}
} // namespace td

View File

@ -0,0 +1,34 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// 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"
#include "td/utils/Promise.h"
namespace td {
class Td;
class ForumTopicManager final : public Actor {
public:
ForumTopicManager(Td *td, ActorShared<> parent);
ForumTopicManager(const ForumTopicManager &) = delete;
ForumTopicManager &operator=(const ForumTopicManager &) = delete;
ForumTopicManager(ForumTopicManager &&) = delete;
ForumTopicManager &operator=(ForumTopicManager &&) = delete;
~ForumTopicManager() final;
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -42,6 +42,7 @@ class ContactsManager;
class DownloadManager;
class FileManager;
class FileReferenceManager;
class ForumTopicManager;
class GameManager;
class GroupCallManager;
class LanguagePackManager;
@ -252,6 +253,13 @@ class Global final : public ActorContext {
file_reference_manager_ = std::move(file_reference_manager);
}
ActorId<ForumTopicManager> forum_topic_manager() const {
return forum_topic_manager_;
}
void set_forum_topic_manager(ActorId<ForumTopicManager> forum_topic_manager) {
forum_topic_manager_ = forum_topic_manager;
}
ActorId<GameManager> game_manager() const {
return game_manager_;
}
@ -474,6 +482,7 @@ class Global final : public ActorContext {
ActorId<DownloadManager> download_manager_;
ActorId<FileManager> file_manager_;
ActorId<FileReferenceManager> file_reference_manager_;
ActorId<ForumTopicManager> forum_topic_manager_;
ActorId<GameManager> game_manager_;
ActorId<GroupCallManager> group_call_manager_;
ActorId<LanguagePackManager> language_pack_manager_;

View File

@ -52,6 +52,7 @@
#include "td/telegram/files/FileStats.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/ForumTopicManager.h"
#include "td/telegram/FullMessageId.h"
#include "td/telegram/GameManager.h"
#include "td/telegram/Global.h"
@ -3235,6 +3236,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "FileManager was cleared" << timer;
file_reference_manager_.reset();
LOG(DEBUG) << "FileReferenceManager was cleared" << timer;
forum_topic_manager_.reset();
LOG(DEBUG) << "ForumTopicManager was cleared" << timer;
game_manager_.reset();
LOG(DEBUG) << "GameManager was cleared" << timer;
group_call_manager_.reset();
@ -3425,6 +3428,8 @@ void Td::clear() {
LOG(DEBUG) << "FileManager actor was cleared" << timer;
file_reference_manager_actor_.reset();
LOG(DEBUG) << "FileReferenceManager actor was cleared" << timer;
forum_topic_manager_actor_.reset();
LOG(DEBUG) << "ForumTopicManager actor was cleared" << timer;
game_manager_actor_.reset();
LOG(DEBUG) << "GameManager actor was cleared" << timer;
group_call_manager_actor_.reset();
@ -3876,6 +3881,9 @@ void Td::init_managers() {
download_manager_ = DownloadManager::create(td::make_unique<DownloadManagerCallback>(this, create_reference()));
download_manager_actor_ = register_actor("DownloadManager", download_manager_.get());
G()->set_download_manager(download_manager_actor_.get());
forum_topic_manager_ = make_unique<ForumTopicManager>(this, create_reference());
forum_topic_manager_actor_ = register_actor("ForumTopicManager", forum_topic_manager_.get());
G()->set_forum_topic_manager(forum_topic_manager_actor_.get());
game_manager_ = make_unique<GameManager>(this, create_reference());
game_manager_actor_ = register_actor("GameManager", game_manager_.get());
G()->set_game_manager(game_manager_actor_.get());

View File

@ -53,6 +53,7 @@ class DocumentsManager;
class DownloadManager;
class FileManager;
class FileReferenceManager;
class ForumTopicManager;
class GameManager;
class GroupCallManager;
class InlineQueriesManager;
@ -154,6 +155,8 @@ class Td final : public Actor {
ActorOwn<FileManager> file_manager_actor_;
unique_ptr<FileReferenceManager> file_reference_manager_;
ActorOwn<FileReferenceManager> file_reference_manager_actor_;
unique_ptr<ForumTopicManager> forum_topic_manager_;
ActorOwn<ForumTopicManager> forum_topic_manager_actor_;
unique_ptr<GameManager> game_manager_;
ActorOwn<GameManager> game_manager_actor_;
unique_ptr<GroupCallManager> group_call_manager_;