Add MessageImportManager.

This commit is contained in:
levlam 2024-01-06 22:06:52 +03:00
parent cb6c15b9c9
commit f5a776b67c
7 changed files with 70 additions and 1 deletions

View File

@ -399,6 +399,7 @@ set(TDLIB_SOURCE
td/telegram/MessageEntity.cpp
td/telegram/MessageExtendedMedia.cpp
td/telegram/MessageId.cpp
td/telegram/MessageImportManager.cpp
td/telegram/MessageInputReplyTo.cpp
td/telegram/MessageOrigin.cpp
td/telegram/MessageReaction.cpp
@ -694,6 +695,7 @@ set(TDLIB_SOURCE
td/telegram/MessageExtendedMedia.h
td/telegram/MessageFullId.h
td/telegram/MessageId.h
td/telegram/MessageImportManager.h
td/telegram/MessageInputReplyTo.h
td/telegram/MessageLinkInfo.h
td/telegram/MessageOrigin.h

View File

@ -305,6 +305,7 @@ function split_file($file, $chunks, $undo) {
'link_manager[_(-][^.]|LinkManager' => 'LinkManager',
'LogeventIdWithGeneration|add_log_event|delete_log_event|get_erase_log_event_promise|parse_time|store_time' => 'logevent/LogEventHelper',
'MessageCopyOptions' => 'MessageCopyOptions',
'message_import_manager[_(-][^.]|MessageImportManager' => 'MessageImportManager',
'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager',
'notification_manager[_(-][^.]|NotificationManager|notifications[)]' => 'NotificationManager',
'notification_settings_manager[_(-][^.]|NotificationSettingsManager' => 'NotificationSettingsManager',

View File

@ -51,6 +51,7 @@ class GameManager;
class GroupCallManager;
class LanguagePackManager;
class LinkManager;
class MessageImportManager;
class MessagesManager;
class NetQueryDispatcher;
class NotificationManager;
@ -315,6 +316,13 @@ class Global final : public ActorContext {
link_manager_ = link_manager;
}
ActorId<MessageImportManager> message_import_manager() const {
return message_import_manager_;
}
void set_message_import_manager(ActorId<MessageImportManager> message_import_manager) {
message_import_manager_ = message_import_manager;
}
ActorId<MessagesManager> messages_manager() const {
return messages_manager_;
}
@ -564,6 +572,7 @@ class Global final : public ActorContext {
ActorId<GroupCallManager> group_call_manager_;
ActorId<LanguagePackManager> language_pack_manager_;
ActorId<LinkManager> link_manager_;
ActorId<MessageImportManager> message_import_manager_;
ActorId<MessagesManager> messages_manager_;
ActorId<NotificationManager> notification_manager_;
ActorId<NotificationSettingsManager> notification_settings_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/MessageImportManager.h"
namespace td {
MessageImportManager::MessageImportManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void MessageImportManager::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 MessageImportManager final : public Actor {
public:
MessageImportManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -79,6 +79,7 @@
#include "td/telegram/MessageEntity.h"
#include "td/telegram/MessageFullId.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/MessageImportManager.h"
#include "td/telegram/MessageLinkInfo.h"
#include "td/telegram/MessageReaction.h"
#include "td/telegram/MessageSearchFilter.h"
@ -3314,6 +3315,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "InlineQueriesManager was cleared" << timer;
link_manager_.reset();
LOG(DEBUG) << "LinkManager was cleared" << timer;
message_import_manager_.reset();
LOG(DEBUG) << "MessageImportManager was cleared" << timer;
messages_manager_.reset();
LOG(DEBUG) << "MessagesManager was cleared" << timer;
notification_manager_.reset();
@ -3529,7 +3532,9 @@ void Td::clear() {
LOG(DEBUG) << "InlineQueriesManager actor was cleared" << timer;
link_manager_actor_.reset();
LOG(DEBUG) << "LinkManager actor was cleared" << timer;
messages_manager_actor_.reset(); // TODO: Stop silent
message_import_manager_actor_.reset();
LOG(DEBUG) << "MessageImportManager actor was cleared" << timer;
messages_manager_actor_.reset();
LOG(DEBUG) << "MessagesManager actor was cleared" << timer;
notification_manager_actor_.reset();
LOG(DEBUG) << "NotificationManager actor was cleared" << timer;
@ -4030,6 +4035,9 @@ void Td::init_managers() {
link_manager_ = make_unique<LinkManager>(this, create_reference());
link_manager_actor_ = register_actor("LinkManager", link_manager_.get());
G()->set_link_manager(link_manager_actor_.get());
message_import_manager_ = make_unique<MessageImportManager>(this, create_reference());
message_import_manager_actor_ = register_actor("MessageImportManager", message_import_manager_.get());
G()->set_message_import_manager(message_import_manager_actor_.get());
messages_manager_ = make_unique<MessagesManager>(this, create_reference());
messages_manager_actor_ = register_actor("MessagesManager", messages_manager_.get());
G()->set_messages_manager(messages_manager_actor_.get());

View File

@ -67,6 +67,7 @@ class InlineQueriesManager;
class HashtagHints;
class LanguagePackManager;
class LinkManager;
class MessageImportManager;
class MessagesManager;
class NetStatsManager;
class NotificationManager;
@ -199,6 +200,8 @@ class Td final : public Actor {
ActorOwn<InlineQueriesManager> inline_queries_manager_actor_;
unique_ptr<LinkManager> link_manager_;
ActorOwn<LinkManager> link_manager_actor_;
unique_ptr<MessageImportManager> message_import_manager_;
ActorOwn<MessageImportManager> message_import_manager_actor_;
unique_ptr<MessagesManager> messages_manager_;
ActorOwn<MessagesManager> messages_manager_actor_;
unique_ptr<NotificationManager> notification_manager_;