Add DialogInviteLinkManager.

This commit is contained in:
levlam 2024-01-08 12:43:31 +03:00
parent 90b8acff67
commit ebf2f95681
7 changed files with 69 additions and 0 deletions

View File

@ -329,6 +329,7 @@ set(TDLIB_SOURCE
td/telegram/DialogFilterManager.cpp td/telegram/DialogFilterManager.cpp
td/telegram/DialogId.cpp td/telegram/DialogId.cpp
td/telegram/DialogInviteLink.cpp td/telegram/DialogInviteLink.cpp
td/telegram/DialogInviteLinkManager.cpp
td/telegram/DialogLocation.cpp td/telegram/DialogLocation.cpp
td/telegram/DialogManager.cpp td/telegram/DialogManager.cpp
td/telegram/DialogNotificationSettings.cpp td/telegram/DialogNotificationSettings.cpp
@ -607,6 +608,7 @@ set(TDLIB_SOURCE
td/telegram/DialogFilterId.h td/telegram/DialogFilterId.h
td/telegram/DialogFilterInviteLink.h td/telegram/DialogFilterInviteLink.h
td/telegram/DialogFilterManager.h td/telegram/DialogFilterManager.h
td/telegram/DialogInviteLinkManager.h
td/telegram/DialogId.h td/telegram/DialogId.h
td/telegram/DialogInviteLink.h td/telegram/DialogInviteLink.h
td/telegram/DialogListId.h td/telegram/DialogListId.h

View File

@ -290,6 +290,7 @@ function split_file($file, $chunks, $undo) {
'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager', 'country_info_manager[_(-][^.]|CountryInfoManager' => 'CountryInfoManager',
'dialog_action_manager[_(-][^.]|DialogActionManager' => "DialogActionManager", 'dialog_action_manager[_(-][^.]|DialogActionManager' => "DialogActionManager",
'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager", 'dialog_filter_manager[_(-][^.]|DialogFilterManager' => "DialogFilterManager",
'dialog_invite_link_manager[_(-][^.]|DialogInviteLinkManager' => "DialogInviteLinkManager",
'dialog_manager[_(-][^.]|DialogManager' => "DialogManager", 'dialog_manager[_(-][^.]|DialogManager' => "DialogManager",
'dialog_online_member_manager[_(-][^.]|DialogOnlineMemberManager' => "DialogOnlineMemberManager", 'dialog_online_member_manager[_(-][^.]|DialogOnlineMemberManager' => "DialogOnlineMemberManager",
'documents_manager[_(-][^.]|DocumentsManager' => "DocumentsManager", 'documents_manager[_(-][^.]|DocumentsManager' => "DocumentsManager",

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

View File

@ -43,6 +43,7 @@ class ConnectionCreator;
class ContactsManager; class ContactsManager;
class DialogActionManager; class DialogActionManager;
class DialogFilterManager; class DialogFilterManager;
class DialogInviteLinkManager;
class DialogManager; class DialogManager;
class DownloadManager; class DownloadManager;
class FileManager; class FileManager;
@ -261,6 +262,13 @@ class Global final : public ActorContext {
dialog_filter_manager_ = std::move(dialog_filter_manager); dialog_filter_manager_ = std::move(dialog_filter_manager);
} }
ActorId<DialogInviteLinkManager> dialog_invite_link_manager() const {
return dialog_invite_link_manager_;
}
void set_dialog_invite_link_manager(ActorId<DialogInviteLinkManager> dialog_invite_link_manager) {
dialog_invite_link_manager_ = std::move(dialog_invite_link_manager);
}
ActorId<DialogManager> dialog_manager() const { ActorId<DialogManager> dialog_manager() const {
return dialog_manager_; return dialog_manager_;
} }
@ -572,6 +580,7 @@ class Global final : public ActorContext {
ActorId<ContactsManager> contacts_manager_; ActorId<ContactsManager> contacts_manager_;
ActorId<DialogActionManager> dialog_action_manager_; ActorId<DialogActionManager> dialog_action_manager_;
ActorId<DialogFilterManager> dialog_filter_manager_; ActorId<DialogFilterManager> dialog_filter_manager_;
ActorId<DialogInviteLinkManager> dialog_invite_link_manager_;
ActorId<DialogManager> dialog_manager_; ActorId<DialogManager> dialog_manager_;
ActorId<DownloadManager> download_manager_; ActorId<DownloadManager> download_manager_;
ActorId<FileManager> file_manager_; ActorId<FileManager> file_manager_;

View File

@ -42,6 +42,7 @@
#include "td/telegram/DialogFilterId.h" #include "td/telegram/DialogFilterId.h"
#include "td/telegram/DialogFilterManager.h" #include "td/telegram/DialogFilterManager.h"
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/DialogInviteLinkManager.h"
#include "td/telegram/DialogListId.h" #include "td/telegram/DialogListId.h"
#include "td/telegram/DialogLocation.h" #include "td/telegram/DialogLocation.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
@ -3296,6 +3297,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "DialogActionManager was cleared" << timer; LOG(DEBUG) << "DialogActionManager was cleared" << timer;
dialog_filter_manager_.reset(); dialog_filter_manager_.reset();
LOG(DEBUG) << "DialogFilterManager was cleared" << timer; LOG(DEBUG) << "DialogFilterManager was cleared" << timer;
dialog_invite_link_manager_.reset();
LOG(DEBUG) << "DialogInviteLinkManager was cleared" << timer;
dialog_manager_.reset(); dialog_manager_.reset();
LOG(DEBUG) << "DialogManager was cleared" << timer; LOG(DEBUG) << "DialogManager was cleared" << timer;
dialog_online_member_manager_.reset(); dialog_online_member_manager_.reset();
@ -3517,6 +3520,8 @@ void Td::clear() {
LOG(DEBUG) << "DialogActionManager actor was cleared" << timer; LOG(DEBUG) << "DialogActionManager actor was cleared" << timer;
dialog_filter_manager_actor_.reset(); dialog_filter_manager_actor_.reset();
LOG(DEBUG) << "DialogFilterManager actor was cleared" << timer; LOG(DEBUG) << "DialogFilterManager actor was cleared" << timer;
dialog_invite_link_manager_actor_.reset();
LOG(DEBUG) << "DialogInviteLinkManager actor was cleared" << timer;
dialog_manager_actor_.reset(); dialog_manager_actor_.reset();
LOG(DEBUG) << "DialogManager actor was cleared" << timer; LOG(DEBUG) << "DialogManager actor was cleared" << timer;
dialog_online_member_manager_actor_.reset(); dialog_online_member_manager_actor_.reset();
@ -4020,6 +4025,9 @@ void Td::init_managers() {
dialog_filter_manager_ = make_unique<DialogFilterManager>(this, create_reference()); dialog_filter_manager_ = make_unique<DialogFilterManager>(this, create_reference());
dialog_filter_manager_actor_ = register_actor("DialogFilterManager", dialog_filter_manager_.get()); dialog_filter_manager_actor_ = register_actor("DialogFilterManager", dialog_filter_manager_.get());
G()->set_dialog_filter_manager(dialog_filter_manager_actor_.get()); G()->set_dialog_filter_manager(dialog_filter_manager_actor_.get());
dialog_invite_link_manager_ = make_unique<DialogInviteLinkManager>(this, create_reference());
dialog_invite_link_manager_actor_ = register_actor("DialogInviteLinkManager", dialog_invite_link_manager_.get());
G()->set_dialog_invite_link_manager(dialog_invite_link_manager_actor_.get());
dialog_manager_ = make_unique<DialogManager>(this, create_reference()); dialog_manager_ = make_unique<DialogManager>(this, create_reference());
dialog_manager_actor_ = register_actor("DialogManager", dialog_manager_.get()); dialog_manager_actor_ = register_actor("DialogManager", dialog_manager_.get());
G()->set_dialog_manager(dialog_manager_actor_.get()); G()->set_dialog_manager(dialog_manager_actor_.get());

View File

@ -55,6 +55,7 @@ class CountryInfoManager;
class DeviceTokenManager; class DeviceTokenManager;
class DialogActionManager; class DialogActionManager;
class DialogFilterManager; class DialogFilterManager;
class DialogInviteLinkManager;
class DialogManager; class DialogManager;
class DialogOnlineMemberManager; class DialogOnlineMemberManager;
class DocumentsManager; class DocumentsManager;
@ -183,6 +184,8 @@ class Td final : public Actor {
ActorOwn<DialogActionManager> dialog_action_manager_actor_; ActorOwn<DialogActionManager> dialog_action_manager_actor_;
unique_ptr<DialogFilterManager> dialog_filter_manager_; unique_ptr<DialogFilterManager> dialog_filter_manager_;
ActorOwn<DialogFilterManager> dialog_filter_manager_actor_; ActorOwn<DialogFilterManager> dialog_filter_manager_actor_;
unique_ptr<DialogInviteLinkManager> dialog_invite_link_manager_;
ActorOwn<DialogInviteLinkManager> dialog_invite_link_manager_actor_;
unique_ptr<DialogManager> dialog_manager_; unique_ptr<DialogManager> dialog_manager_;
ActorOwn<DialogManager> dialog_manager_actor_; ActorOwn<DialogManager> dialog_manager_actor_;
unique_ptr<DialogOnlineMemberManager> dialog_online_member_manager_; unique_ptr<DialogOnlineMemberManager> dialog_online_member_manager_;