diff --git a/CMakeLists.txt b/CMakeLists.txt index a240e711b..6b6f8dec2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -531,6 +531,7 @@ set(TDLIB_SOURCE td/telegram/TranscriptionManager.cpp td/telegram/TranslationManager.cpp td/telegram/UpdatesManager.cpp + td/telegram/UserManager.cpp td/telegram/Usernames.cpp td/telegram/UserPrivacySetting.cpp td/telegram/UserPrivacySettingRule.cpp @@ -889,6 +890,7 @@ set(TDLIB_SOURCE td/telegram/UniqueId.h td/telegram/UpdatesManager.h td/telegram/UserId.h + td/telegram/UserManager.h td/telegram/Usernames.h td/telegram/UserPrivacySetting.h td/telegram/UserPrivacySettingRule.h diff --git a/SplitSource.php b/SplitSource.php index 68345c8ed..219dcbba5 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -418,6 +418,7 @@ function split_file($file, $chunks, $undo) { 'transcription_manager[_(-](?![.]get[(][)])|TranscriptionManager' => 'TranscriptionManager', 'updates_manager[_(-](?![.]get[(][)])|UpdatesManager|get_difference[)]|updateSentMessage|dummyUpdate' => 'UpdatesManager', 'UserId' => 'UserId', + 'user_manager[_(-](?![.]get[(][)])|UserManager([^ ;.]| [^*])' => 'UserManager', 'video_notes_manager[_(-](?![.]get[(][)])|VideoNotesManager' => 'VideoNotesManager', 'videos_manager[_(-](?![.]get[(][)])|VideosManager' => 'VideosManager', 'voice_notes_manager[_(-](?![.]get[(][)])|VoiceNotesManager' => 'VoiceNotesManager', @@ -468,6 +469,7 @@ $files = array('td/telegram/ContactsManager' => 20, 'td/telegram/NotificationManager' => 10, 'td/telegram/StickersManager' => 10, 'td/telegram/Td' => 50, + 'td/telegram/UserManager' => 20, 'td/generate/auto/td/telegram/td_api' => 10, 'td/generate/auto/td/telegram/td_api_json' => 10, 'td/generate/auto/td/telegram/telegram_api' => 10); diff --git a/td/telegram/Global.h b/td/telegram/Global.h index f2d09bb41..f4b6c37b1 100644 --- a/td/telegram/Global.h +++ b/td/telegram/Global.h @@ -81,6 +81,7 @@ class TimeZoneManager; class TopDialogManager; class TranscriptionManager; class UpdatesManager; +class UserManager; class WebPagesManager; class Global final : public ActorContext { @@ -498,6 +499,13 @@ class Global final : public ActorContext { updates_manager_ = updates_manager; } + ActorId user_manager() const { + return user_manager_; + } + void set_user_manager(ActorId user_manager) { + user_manager_ = user_manager; + } + ActorId web_pages_manager() const { return web_pages_manager_; } @@ -668,6 +676,7 @@ class Global final : public ActorContext { ActorId top_dialog_manager_; ActorId transcription_manager_; ActorId updates_manager_; + ActorId user_manager_; ActorId web_pages_manager_; ActorOwn connection_creator_; ActorOwn temp_auth_key_watchdog_; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 4fc635cab..b3111222b 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -164,6 +164,7 @@ #include "td/telegram/TranslationManager.h" #include "td/telegram/UpdatesManager.h" #include "td/telegram/UserId.h" +#include "td/telegram/UserManager.h" #include "td/telegram/Version.h" #include "td/telegram/VideoNotesManager.h" #include "td/telegram/VideosManager.h" @@ -3253,6 +3254,7 @@ void Td::dec_actor_refcnt() { reset_manager(transcription_manager_, "TranscriptionManager"); reset_manager(translation_manager_, "TranslationManager"); reset_manager(updates_manager_, "UpdatesManager"); + reset_manager(user_manager_, "UserManager"); reset_manager(video_notes_manager_, "VideoNotesManager"); reset_manager(videos_manager_, "VideosManager"); reset_manager(voice_notes_manager_, "VoiceNotesManager"); @@ -3428,6 +3430,7 @@ void Td::clear() { reset_actor(ActorOwn(std::move(transcription_manager_actor_))); reset_actor(ActorOwn(std::move(translation_manager_actor_))); reset_actor(ActorOwn(std::move(updates_manager_actor_))); + reset_actor(ActorOwn(std::move(user_manager_actor_))); reset_actor(ActorOwn(std::move(video_notes_manager_actor_))); reset_actor(ActorOwn(std::move(voice_notes_manager_actor_))); reset_actor(ActorOwn(std::move(web_pages_manager_actor_))); @@ -3988,6 +3991,9 @@ void Td::init_managers() { updates_manager_ = make_unique(this, create_reference()); updates_manager_actor_ = register_actor("UpdatesManager", updates_manager_.get()); G()->set_updates_manager(updates_manager_actor_.get()); + user_manager_ = make_unique(this, create_reference()); + user_manager_actor_ = register_actor("UserManager", user_manager_.get()); + G()->set_user_manager(user_manager_actor_.get()); video_notes_manager_ = make_unique(this, create_reference()); video_notes_manager_actor_ = register_actor("VideoNotesManager", video_notes_manager_.get()); voice_notes_manager_ = make_unique(this, create_reference()); diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 0bae464c7..4960559cf 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -100,6 +100,7 @@ class TopDialogManager; class TranscriptionManager; class TranslationManager; class UpdatesManager; +class UserManager; class VideoNotesManager; class VideosManager; class VoiceNotesManager; @@ -259,6 +260,8 @@ class Td final : public Actor { ActorOwn translation_manager_actor_; unique_ptr updates_manager_; ActorOwn updates_manager_actor_; + unique_ptr user_manager_; + ActorOwn user_manager_actor_; unique_ptr video_notes_manager_; ActorOwn video_notes_manager_actor_; unique_ptr voice_notes_manager_; diff --git a/td/telegram/UserManager.cpp b/td/telegram/UserManager.cpp new file mode 100644 index 000000000..4ba99d229 --- /dev/null +++ b/td/telegram/UserManager.cpp @@ -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/UserManager.h" + +namespace td { + +UserManager::UserManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { +} + +void UserManager::tear_down() { + parent_.reset(); +} + +} // namespace td diff --git a/td/telegram/UserManager.h b/td/telegram/UserManager.h new file mode 100644 index 000000000..f80789af7 --- /dev/null +++ b/td/telegram/UserManager.h @@ -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 UserManager final : public Actor { + public: + UserManager(Td *td, ActorShared<> parent); + + private: + void tear_down() final; + + Td *td_; + ActorShared<> parent_; +}; + +} // namespace td