Add empty LinkManager.

This commit is contained in:
levlam 2021-05-25 02:24:30 +03:00
parent 200da2c684
commit d946ab9267
7 changed files with 70 additions and 1 deletions

View File

@ -331,6 +331,7 @@ set(TDLIB_SOURCE
td/telegram/InputMessageText.cpp
td/telegram/JsonValue.cpp
td/telegram/LanguagePackManager.cpp
td/telegram/LinkManager.cpp
td/telegram/Location.cpp
td/telegram/logevent/LogEventHelper.cpp
td/telegram/Logging.cpp
@ -512,6 +513,7 @@ set(TDLIB_SOURCE
td/telegram/InputMessageText.h
td/telegram/JsonValue.h
td/telegram/LanguagePackManager.h
td/telegram/LinkManager.h
td/telegram/Location.h
td/telegram/logevent/LogEvent.h
td/telegram/logevent/LogEventHelper.h

View File

@ -290,6 +290,7 @@ function split_file($file, $chunks, $undo) {
'HashtagHints' => 'HashtagHints',
'inline_queries_manager[_(-][^.]|InlineQueriesManager' => 'InlineQueriesManager',
'language_pack_manager[_(-][^.]|LanguagePackManager' => 'LanguagePackManager',
'link_manager[_(-][^.]|LinkManager' => 'LinkManager',
'LogeventIdWithGeneration|add_log_event|delete_log_event|get_erase_log_event_promise|parse_time|store_time' => 'logevent/LogEventHelper',
'MessageCopyOptions' => 'MessageCopyOptions',
'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager',

View File

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

34
td/telegram/LinkManager.h Normal file
View File

@ -0,0 +1,34 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
//
// 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 LinkManager : public Actor {
public:
LinkManager(Td *td, ActorShared<> parent);
LinkManager(const LinkManager &) = delete;
LinkManager &operator=(const LinkManager &) = delete;
LinkManager(LinkManager &&) = delete;
LinkManager &operator=(LinkManager &&) = delete;
~LinkManager() override;
private:
void tear_down() override;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -49,6 +49,7 @@
#include "td/telegram/InlineQueriesManager.h"
#include "td/telegram/JsonValue.h"
#include "td/telegram/LanguagePackManager.h"
#include "td/telegram/LinkManager.h"
#include "td/telegram/Location.h"
#include "td/telegram/Logging.h"
#include "td/telegram/MessageCopyOptions.h"
@ -3816,6 +3817,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "GroupCallManager was cleared" << timer;
inline_queries_manager_.reset();
LOG(DEBUG) << "InlineQueriesManager was cleared" << timer;
link_manager_.reset();
LOG(DEBUG) << "LinkManager was cleared" << timer;
messages_manager_.reset();
LOG(DEBUG) << "MessagesManager was cleared" << timer;
notification_manager_.reset();
@ -4002,6 +4005,8 @@ void Td::clear() {
LOG(DEBUG) << "GroupCallManager actor was cleared" << timer;
inline_queries_manager_actor_.reset();
LOG(DEBUG) << "InlineQueriesManager actor was cleared" << timer;
link_manager_actor_.reset();
LOG(DEBUG) << "LinkManager actor was cleared" << timer;
messages_manager_actor_.reset(); // TODO: Stop silent
LOG(DEBUG) << "MessagesManager actor was cleared" << timer;
notification_manager_actor_.reset();
@ -4438,6 +4443,8 @@ void Td::init_managers() {
G()->set_group_call_manager(group_call_manager_actor_.get());
inline_queries_manager_ = make_unique<InlineQueriesManager>(this, create_reference());
inline_queries_manager_actor_ = register_actor("InlineQueriesManager", inline_queries_manager_.get());
link_manager_ = make_unique<LinkManager>(this, create_reference());
link_manager_actor_ = register_actor("LinkManager", link_manager_.get());
messages_manager_ = make_unique<MessagesManager>(this, create_reference());
messages_manager_actor_ = register_actor("MessagesManager", messages_manager_.get());
G()->set_messages_manager(messages_manager_actor_.get());

View File

@ -55,6 +55,7 @@ class GroupCallManager;
class InlineQueriesManager;
class HashtagHints;
class LanguagePackManager;
class LinkManager;
class MessagesManager;
class NetStatsManager;
class NotificationManager;
@ -164,6 +165,8 @@ class Td final : public NetQueryCallback {
ActorOwn<GroupCallManager> group_call_manager_actor_;
unique_ptr<InlineQueriesManager> inline_queries_manager_;
ActorOwn<InlineQueriesManager> inline_queries_manager_actor_;
unique_ptr<LinkManager> link_manager_;
ActorOwn<LinkManager> link_manager_actor_;
unique_ptr<MessagesManager> messages_manager_;
ActorOwn<MessagesManager> messages_manager_actor_;
unique_ptr<NotificationManager> notification_manager_;

View File

@ -36,7 +36,7 @@ int32 get_vector_hash(const vector<uint32> &numbers) TD_WARN_UNUSED_RESULT;
// returns emoji corresponding to the specified number
string get_emoji_fingerprint(uint64 num);
// checks whether url is a valid tg, ton or HTTP(S) URL and returns its in a canonical form
// checks whether url is a valid tg, ton or HTTP(S) URL and returns it in a canonical form
Result<string> check_url(Slice url);
// removes all emoji modifiers