Add empty UserManager.

This commit is contained in:
levlam 2024-04-01 15:05:02 +03:00
parent d7203eb719
commit 6010475d26
7 changed files with 68 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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<UserManager> user_manager() const {
return user_manager_;
}
void set_user_manager(ActorId<UserManager> user_manager) {
user_manager_ = user_manager;
}
ActorId<WebPagesManager> web_pages_manager() const {
return web_pages_manager_;
}
@ -668,6 +676,7 @@ class Global final : public ActorContext {
ActorId<TopDialogManager> top_dialog_manager_;
ActorId<TranscriptionManager> transcription_manager_;
ActorId<UpdatesManager> updates_manager_;
ActorId<UserManager> user_manager_;
ActorId<WebPagesManager> web_pages_manager_;
ActorOwn<ConnectionCreator> connection_creator_;
ActorOwn<TempAuthKeyWatchdog> temp_auth_key_watchdog_;

View File

@ -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<Actor>(std::move(transcription_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(translation_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(updates_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(user_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(video_notes_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(voice_notes_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(web_pages_manager_actor_)));
@ -3988,6 +3991,9 @@ void Td::init_managers() {
updates_manager_ = make_unique<UpdatesManager>(this, create_reference());
updates_manager_actor_ = register_actor("UpdatesManager", updates_manager_.get());
G()->set_updates_manager(updates_manager_actor_.get());
user_manager_ = make_unique<UserManager>(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<VideoNotesManager>(this, create_reference());
video_notes_manager_actor_ = register_actor("VideoNotesManager", video_notes_manager_.get());
voice_notes_manager_ = make_unique<VoiceNotesManager>(this, create_reference());

View File

@ -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<TranslationManager> translation_manager_actor_;
unique_ptr<UpdatesManager> updates_manager_;
ActorOwn<UpdatesManager> updates_manager_actor_;
unique_ptr<UserManager> user_manager_;
ActorOwn<UserManager> user_manager_actor_;
unique_ptr<VideoNotesManager> video_notes_manager_;
ActorOwn<VideoNotesManager> video_notes_manager_actor_;
unique_ptr<VoiceNotesManager> voice_notes_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/UserManager.h"
namespace td {
UserManager::UserManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void UserManager::tear_down() {
parent_.reset();
}
} // namespace td

28
td/telegram/UserManager.h Normal file
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 UserManager final : public Actor {
public:
UserManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td