Add InlineMessageManager.

This commit is contained in:
levlam 2024-05-29 12:48:40 +03:00
parent bd2baf3429
commit f99a093e0a
7 changed files with 67 additions and 0 deletions

View File

@ -431,6 +431,7 @@ set(TDLIB_SOURCE_PART1
td/telegram/GroupCallParticipantOrder.cpp td/telegram/GroupCallParticipantOrder.cpp
td/telegram/GroupCallVideoPayload.cpp td/telegram/GroupCallVideoPayload.cpp
td/telegram/HashtagHints.cpp td/telegram/HashtagHints.cpp
td/telegram/InlineMessageManager.cpp
td/telegram/InlineQueriesManager.cpp td/telegram/InlineQueriesManager.cpp
td/telegram/InputBusinessChatLink.cpp td/telegram/InputBusinessChatLink.cpp
td/telegram/InputDialogId.cpp td/telegram/InputDialogId.cpp
@ -730,6 +731,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/GroupCallParticipantOrder.h td/telegram/GroupCallParticipantOrder.h
td/telegram/GroupCallVideoPayload.h td/telegram/GroupCallVideoPayload.h
td/telegram/HashtagHints.h td/telegram/HashtagHints.h
td/telegram/InlineMessageManager.h
td/telegram/InlineQueriesManager.h td/telegram/InlineQueriesManager.h
td/telegram/InputBusinessChatLink.h td/telegram/InputBusinessChatLink.h
td/telegram/InputDialogId.h td/telegram/InputDialogId.h

View File

@ -362,6 +362,7 @@ function split_file($file, $chunks, $undo) {
'GroupCallId' => 'GroupCallId', 'GroupCallId' => 'GroupCallId',
'group_call_manager[_(-](?![.]get[(][)])|GroupCallManager' => 'GroupCallManager', 'group_call_manager[_(-](?![.]get[(][)])|GroupCallManager' => 'GroupCallManager',
'hashtag_hints[_(-](?![.]get[(][)])|HashtagHints' => 'HashtagHints', 'hashtag_hints[_(-](?![.]get[(][)])|HashtagHints' => 'HashtagHints',
'inline_message_manager[_(-](?![.]get[(][)])|InlineMessageManager' => 'InlineQueriesManager',
'inline_queries_manager[_(-](?![.]get[(][)])|InlineQueriesManager' => 'InlineQueriesManager', 'inline_queries_manager[_(-](?![.]get[(][)])|InlineQueriesManager' => 'InlineQueriesManager',
'InputBusinessChatLink' => 'InputBusinessChatLink', 'InputBusinessChatLink' => 'InputBusinessChatLink',
'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager', 'language_pack_manager[_(-]|LanguagePackManager' => 'LanguagePackManager',

View File

@ -54,6 +54,7 @@ class FileReferenceManager;
class ForumTopicManager; class ForumTopicManager;
class GameManager; class GameManager;
class GroupCallManager; class GroupCallManager;
class InlineMessageManager;
class LanguagePackManager; class LanguagePackManager;
class LinkManager; class LinkManager;
class MessageImportManager; class MessageImportManager;
@ -347,6 +348,13 @@ class Global final : public ActorContext {
group_call_manager_ = group_call_manager; group_call_manager_ = group_call_manager;
} }
ActorId<InlineMessageManager> inline_message_manager() const {
return inline_message_manager_;
}
void set_inline_message_manager(ActorId<InlineMessageManager> inline_message_manager) {
inline_message_manager_ = inline_message_manager;
}
ActorId<LanguagePackManager> language_pack_manager() const { ActorId<LanguagePackManager> language_pack_manager() const {
return language_pack_manager_; return language_pack_manager_;
} }
@ -657,6 +665,7 @@ class Global final : public ActorContext {
ActorId<ForumTopicManager> forum_topic_manager_; ActorId<ForumTopicManager> forum_topic_manager_;
ActorId<GameManager> game_manager_; ActorId<GameManager> game_manager_;
ActorId<GroupCallManager> group_call_manager_; ActorId<GroupCallManager> group_call_manager_;
ActorId<InlineMessageManager> inline_message_manager_;
ActorId<LanguagePackManager> language_pack_manager_; ActorId<LanguagePackManager> language_pack_manager_;
ActorId<LinkManager> link_manager_; ActorId<LinkManager> link_manager_;
ActorId<MessageImportManager> message_import_manager_; ActorId<MessageImportManager> message_import_manager_;

View File

@ -0,0 +1,18 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// 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/InlineMessageManager.h"
namespace td {
InlineMessageManager::InlineMessageManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void InlineMessageManager::tear_down() {
parent_.reset();
}
} // namespace td

View File

@ -0,0 +1,28 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// 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 InlineMessageManager final : public Actor {
public:
InlineMessageManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -79,6 +79,7 @@
#include "td/telegram/GroupCallId.h" #include "td/telegram/GroupCallId.h"
#include "td/telegram/GroupCallManager.h" #include "td/telegram/GroupCallManager.h"
#include "td/telegram/HashtagHints.h" #include "td/telegram/HashtagHints.h"
#include "td/telegram/InlineMessageManager.h"
#include "td/telegram/InlineQueriesManager.h" #include "td/telegram/InlineQueriesManager.h"
#include "td/telegram/JsonValue.h" #include "td/telegram/JsonValue.h"
#include "td/telegram/LanguagePackManager.h" #include "td/telegram/LanguagePackManager.h"
@ -3143,6 +3144,7 @@ void Td::dec_actor_refcnt() {
reset_manager(forum_topic_manager_, "ForumTopicManager"); reset_manager(forum_topic_manager_, "ForumTopicManager");
reset_manager(game_manager_, "GameManager"); reset_manager(game_manager_, "GameManager");
reset_manager(group_call_manager_, "GroupCallManager"); reset_manager(group_call_manager_, "GroupCallManager");
reset_manager(inline_message_manager_, "InlineMessageManager");
reset_manager(inline_queries_manager_, "InlineQueriesManager"); reset_manager(inline_queries_manager_, "InlineQueriesManager");
reset_manager(link_manager_, "LinkManager"); reset_manager(link_manager_, "LinkManager");
reset_manager(message_import_manager_, "MessageImportManager"); reset_manager(message_import_manager_, "MessageImportManager");
@ -3318,6 +3320,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(forum_topic_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(forum_topic_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(game_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(game_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(group_call_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(group_call_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(inline_message_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(inline_queries_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(inline_queries_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(link_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(link_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(message_import_manager_actor_))); reset_actor(ActorOwn<Actor>(std::move(message_import_manager_actor_)));
@ -3840,6 +3843,9 @@ void Td::init_managers() {
group_call_manager_ = make_unique<GroupCallManager>(this, create_reference()); group_call_manager_ = make_unique<GroupCallManager>(this, create_reference());
group_call_manager_actor_ = register_actor("GroupCallManager", group_call_manager_.get()); group_call_manager_actor_ = register_actor("GroupCallManager", group_call_manager_.get());
G()->set_group_call_manager(group_call_manager_actor_.get()); G()->set_group_call_manager(group_call_manager_actor_.get());
inline_message_manager_ = make_unique<InlineMessageManager>(this, create_reference());
inline_message_manager_actor_ = register_actor("InlineMessageManager", inline_message_manager_.get());
G()->set_inline_message_manager(inline_message_manager_actor_.get());
inline_queries_manager_ = make_unique<InlineQueriesManager>(this, create_reference()); inline_queries_manager_ = make_unique<InlineQueriesManager>(this, create_reference());
inline_queries_manager_actor_ = register_actor("InlineQueriesManager", inline_queries_manager_.get()); inline_queries_manager_actor_ = register_actor("InlineQueriesManager", inline_queries_manager_.get());
link_manager_ = make_unique<LinkManager>(this, create_reference()); link_manager_ = make_unique<LinkManager>(this, create_reference());

View File

@ -68,6 +68,7 @@ class FileReferenceManager;
class ForumTopicManager; class ForumTopicManager;
class GameManager; class GameManager;
class GroupCallManager; class GroupCallManager;
class InlineMessageManager;
class InlineQueriesManager; class InlineQueriesManager;
class HashtagHints; class HashtagHints;
class LanguagePackManager; class LanguagePackManager;
@ -216,6 +217,8 @@ class Td final : public Actor {
ActorOwn<GameManager> game_manager_actor_; ActorOwn<GameManager> game_manager_actor_;
unique_ptr<GroupCallManager> group_call_manager_; unique_ptr<GroupCallManager> group_call_manager_;
ActorOwn<GroupCallManager> group_call_manager_actor_; ActorOwn<GroupCallManager> group_call_manager_actor_;
unique_ptr<InlineMessageManager> inline_message_manager_;
ActorOwn<InlineMessageManager> inline_message_manager_actor_;
unique_ptr<InlineQueriesManager> inline_queries_manager_; unique_ptr<InlineQueriesManager> inline_queries_manager_;
ActorOwn<InlineQueriesManager> inline_queries_manager_actor_; ActorOwn<InlineQueriesManager> inline_queries_manager_actor_;
unique_ptr<LinkManager> link_manager_; unique_ptr<LinkManager> link_manager_;