Add DialogOnlineMemberManager.

This commit is contained in:
levlam 2024-01-04 18:02:36 +03:00
parent 52b8e295ca
commit 211071970e
6 changed files with 61 additions and 0 deletions

View File

@ -330,6 +330,7 @@ set(TDLIB_SOURCE
td/telegram/DialogLocation.cpp
td/telegram/DialogManager.cpp
td/telegram/DialogNotificationSettings.cpp
td/telegram/DialogOnlineMemberManager.cpp
td/telegram/DialogParticipant.cpp
td/telegram/DialogParticipantFilter.cpp
td/telegram/DialogSource.cpp
@ -607,6 +608,7 @@ set(TDLIB_SOURCE
td/telegram/DialogLocation.h
td/telegram/DialogManager.h
td/telegram/DialogNotificationSettings.h
td/telegram/DialogOnlineMemberManager.h
td/telegram/DialogParticipant.h
td/telegram/DialogParticipantFilter.h
td/telegram/DialogSource.h

View File

@ -289,6 +289,7 @@ function split_file($file, $chunks, $undo) {
'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager',
'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager",
'dialog_manager[_(-][^.]|DialogManager' => "DialogManager",
'dialog_online_member_manager[_(-][^.]|DialogOnlineMemberManager' => "DialogOnlineMemberManager",
'documents_manager[_(-][^.]|DocumentsManager' => "DocumentsManager",
'download_manager[_(-][^.]|DownloadManager' => "DownloadManager",
'file_reference_manager[_(-][^.]|FileReferenceManager|file_references[)]' => 'FileReferenceManager',

View File

@ -0,0 +1,19 @@
//
// 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/DialogOnlineMemberManager.h"
namespace td {
DialogOnlineMemberManager::DialogOnlineMemberManager(Td *td, ActorShared<> parent)
: td_(td), parent_(std::move(parent)) {
}
void DialogOnlineMemberManager::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 DialogOnlineMemberManager final : public Actor {
public:
DialogOnlineMemberManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -43,6 +43,7 @@
#include "td/telegram/DialogListId.h"
#include "td/telegram/DialogLocation.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/DialogOnlineMemberManager.h"
#include "td/telegram/DialogParticipant.h"
#include "td/telegram/DialogParticipantFilter.h"
#include "td/telegram/DialogSource.h"
@ -3290,6 +3291,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "DialogFilterManager was cleared" << timer;
dialog_manager_.reset();
LOG(DEBUG) << "DialogManager was cleared" << timer;
dialog_online_member_manager_.reset();
LOG(DEBUG) << "DialogOnlineMemberManager was cleared" << timer;
documents_manager_.reset();
LOG(DEBUG) << "DocumentsManager was cleared" << timer;
download_manager_.reset();
@ -3503,6 +3506,8 @@ void Td::clear() {
LOG(DEBUG) << "DialogFilterManager actor was cleared" << timer;
dialog_manager_actor_.reset();
LOG(DEBUG) << "DialogManager actor was cleared" << timer;
dialog_online_member_manager_actor_.reset();
LOG(DEBUG) << "DialogOnlineMemberManager actor was cleared" << timer;
download_manager_actor_.reset();
LOG(DEBUG) << "DownloadManager actor was cleared" << timer;
file_manager_actor_.reset();
@ -3998,6 +4003,9 @@ void Td::init_managers() {
dialog_manager_ = make_unique<DialogManager>(this, create_reference());
dialog_manager_actor_ = register_actor("DialogManager", dialog_manager_.get());
G()->set_dialog_manager(dialog_manager_actor_.get());
dialog_online_member_manager_ = make_unique<DialogOnlineMemberManager>(this, create_reference());
dialog_online_member_manager_actor_ =
register_actor("DialogOnlineMemberManager", dialog_online_member_manager_.get());
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());

View File

@ -54,6 +54,7 @@ class CountryInfoManager;
class DeviceTokenManager;
class DialogFilterManager;
class DialogManager;
class DialogOnlineMemberManager;
class DocumentsManager;
class DownloadManager;
class FileManager;
@ -177,6 +178,8 @@ class Td final : public Actor {
ActorOwn<DialogFilterManager> dialog_filter_manager_actor_;
unique_ptr<DialogManager> dialog_manager_;
ActorOwn<DialogManager> dialog_manager_actor_;
unique_ptr<DialogOnlineMemberManager> dialog_online_member_manager_;
ActorOwn<DialogOnlineMemberManager> dialog_online_member_manager_actor_;
unique_ptr<DownloadManager> download_manager_;
ActorOwn<DownloadManager> download_manager_actor_;
unique_ptr<FileManager> file_manager_;