Add QuickReplyManager.

This commit is contained in:
levlam 2024-02-21 20:43:55 +03:00
parent 94ae90dcaf
commit 094066eceb
7 changed files with 67 additions and 0 deletions

View File

@ -462,6 +462,7 @@ set(TDLIB_SOURCE
td/telegram/PrivacyManager.cpp
td/telegram/QueryCombiner.cpp
td/telegram/QueryMerger.cpp
td/telegram/QuickReplyManager.cpp
td/telegram/ReactionListType.cpp
td/telegram/ReactionManager.cpp
td/telegram/ReactionType.cpp
@ -789,6 +790,7 @@ set(TDLIB_SOURCE
td/telegram/PublicDialogType.h
td/telegram/QueryCombiner.h
td/telegram/QueryMerger.h
td/telegram/QuickReplyManager.h
td/telegram/ReactionListType.h
td/telegram/ReactionManager.h
td/telegram/ReactionType.h

View File

@ -372,6 +372,7 @@ function split_file($file, $chunks, $undo) {
'poll_manager[_(-](?![.]get[(][)])|PollManager' => 'PollManager',
'privacy_manager[_(-](?![.]get[(][)])|PrivacyManager' => 'PrivacyManager',
'PublicDialogType|get_public_dialog_type' => 'PublicDialogType',
'quick_reply_manager[_(-](?![.]get[(][)])|QuickReplyManager' => 'QuickReplyManager',
'ReactionListType|[a-z_]*_reaction_list_type' => 'ReactionListType',
'reaction_manager[_(-](?![.]get[(][)])|ReactionManager' => 'ReactionManager',
'ReactionType|[a-z_]*_reaction_type' => 'ReactionType',

View File

@ -61,6 +61,7 @@ class NotificationManager;
class NotificationSettingsManager;
class OptionManager;
class PasswordManager;
class QuickReplyManager;
class ReactionManager;
class SavedMessagesManager;
class SecretChatsManager;
@ -382,6 +383,13 @@ class Global final : public ActorContext {
password_manager_ = password_manager;
}
ActorId<QuickReplyManager> quick_reply_manager() const {
return quick_reply_manager_;
}
void set_quick_reply_manager(ActorId<QuickReplyManager> quick_reply_manager) {
quick_reply_manager_ = quick_reply_manager;
}
ActorId<ReactionManager> reaction_manager() const {
return reaction_manager_;
}
@ -620,6 +628,7 @@ class Global final : public ActorContext {
ActorId<NotificationManager> notification_manager_;
ActorId<NotificationSettingsManager> notification_settings_manager_;
ActorId<PasswordManager> password_manager_;
ActorId<QuickReplyManager> quick_reply_manager_;
ActorId<ReactionManager> reaction_manager_;
ActorId<SavedMessagesManager> saved_messages_manager_;
ActorId<SecretChatsManager> secret_chats_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/QuickReplyManager.h"
namespace td {
QuickReplyManager::QuickReplyManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void QuickReplyManager::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 QuickReplyManager final : public Actor {
public:
QuickReplyManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -117,6 +117,7 @@
#include "td/telegram/Premium.h"
#include "td/telegram/PrivacyManager.h"
#include "td/telegram/PublicDialogType.h"
#include "td/telegram/QuickReplyManager.h"
#include "td/telegram/ReactionManager.h"
#include "td/telegram/ReactionType.h"
#include "td/telegram/ReportReason.h"
@ -3224,6 +3225,7 @@ void Td::dec_actor_refcnt() {
reset_manager(notification_settings_manager_, "NotificationSettingsManager");
reset_manager(poll_manager_, "PollManager");
reset_manager(privacy_manager_, "PrivacyManager");
reset_manager(quick_reply_manager_, "QuickReplyManager");
reset_manager(reaction_manager_, "ReactionManager");
reset_manager(saved_messages_manager_, "SavedMessagesManager");
reset_manager(sponsored_message_manager_, "SponsoredMessageManager");
@ -3394,6 +3396,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(notification_settings_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(poll_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(privacy_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(quick_reply_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(reaction_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(saved_messages_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(sponsored_message_manager_actor_)));
@ -3917,6 +3920,9 @@ void Td::init_managers() {
poll_manager_actor_ = register_actor("PollManager", poll_manager_.get());
privacy_manager_ = make_unique<PrivacyManager>(this, create_reference());
privacy_manager_actor_ = register_actor("PrivacyManager", privacy_manager_.get());
quick_reply_manager_ = make_unique<QuickReplyManager>(this, create_reference());
quick_reply_manager_actor_ = register_actor("QuickReplyManager", quick_reply_manager_.get());
G()->set_quick_reply_manager(quick_reply_manager_actor_.get());
reaction_manager_ = make_unique<ReactionManager>(this, create_reference());
reaction_manager_actor_ = register_actor("ReactionManager", reaction_manager_.get());
G()->set_reaction_manager(reaction_manager_actor_.get());

View File

@ -79,6 +79,7 @@ class PasswordManager;
class PhoneNumberManager;
class PollManager;
class PrivacyManager;
class QuickReplyManager;
class ReactionManager;
class SavedMessagesManager;
class SecureManager;
@ -220,6 +221,8 @@ class Td final : public Actor {
ActorOwn<PollManager> poll_manager_actor_;
unique_ptr<PrivacyManager> privacy_manager_;
ActorOwn<PrivacyManager> privacy_manager_actor_;
unique_ptr<QuickReplyManager> quick_reply_manager_;
ActorOwn<QuickReplyManager> quick_reply_manager_actor_;
unique_ptr<ReactionManager> reaction_manager_;
ActorOwn<ReactionManager> reaction_manager_actor_;
unique_ptr<SavedMessagesManager> saved_messages_manager_;