diff --git a/CMakeLists.txt b/CMakeLists.txt index cd4909926..0088248b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -653,6 +653,7 @@ set(TDLIB_SOURCE td/telegram/TdDb.h td/telegram/TdParameters.h td/telegram/TermsOfService.h + td/telegram/TopDialogCategory.h td/telegram/TopDialogManager.h td/telegram/UniqueId.h td/telegram/UpdatesManager.h diff --git a/SplitSource.php b/SplitSource.php index 6ff66c4e2..16a89fa77 100644 --- a/SplitSource.php +++ b/SplitSource.php @@ -281,6 +281,7 @@ function split_file($file, $chunks, $undo) { 'secret_chats_manager[_(-][^.]|SecretChatsManager' => 'SecretChatsManager', 'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager', '[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb', + 'TopDialogCategory|top_dialog_category_from_td_api' => 'TopDialogCategory', 'top_dialog_manager[_(-][^.]|TopDialogManager' => 'TopDialogManager', 'updates_manager[_(-][^.]|UpdatesManager|get_difference[)]' => 'UpdatesManager', 'WebPageId(Hash)?' => 'WebPageId', diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index d847f5bac..e585c04bc 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -35,7 +35,6 @@ #include "td/telegram/StickersManager.h" #include "td/telegram/Td.h" #include "td/telegram/TdDb.h" -#include "td/telegram/TopDialogManager.h" #include "td/telegram/UpdatesManager.h" #include "td/telegram/Version.h" @@ -7894,13 +7893,6 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo if (u->is_deleted) { td_->inline_queries_manager_->remove_recent_inline_bot(user_id, Promise<>()); - /* - DialogId dialog_id(user_id); - for (auto category : {TopDialogCategory::Correspondent, TopDialogCategory::BotPM, TopDialogCategory::BotInline}) { - send_closure(G()->top_dialog_manager(), &TopDialogManager::delete_dialog, category, dialog_id, - get_input_peer_user(user_id, AccessRights::Read)); - } - */ } LOG(DEBUG) << "Update " << user_id << ": need_save_to_database = " << u->need_save_to_database diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index a6e4efde8..5c40d678e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -45,6 +45,7 @@ #include "td/telegram/SequenceDispatcher.h" #include "td/telegram/Td.h" #include "td/telegram/TdDb.h" +#include "td/telegram/TopDialogCategory.h" #include "td/telegram/TopDialogManager.h" #include "td/telegram/UpdatesManager.h" #include "td/telegram/Version.h" diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 076316bd1..eafec3245 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -80,6 +80,7 @@ #include "td/telegram/StickersManager.h" #include "td/telegram/StorageManager.h" #include "td/telegram/TdDb.h" +#include "td/telegram/TopDialogCategory.h" #include "td/telegram/TopDialogManager.h" #include "td/telegram/UpdatesManager.h" #include "td/telegram/VideoNotesManager.h" diff --git a/td/telegram/TopDialogCategory.h b/td/telegram/TopDialogCategory.h new file mode 100644 index 000000000..f7f08524d --- /dev/null +++ b/td/telegram/TopDialogCategory.h @@ -0,0 +1,48 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020 +// +// 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/telegram/td_api.h" + +#include "td/utils/common.h" + +namespace td { + +enum class TopDialogCategory : int32 { + Correspondent, + BotPM, + BotInline, + Group, + Channel, + Call, + ForwardUsers, + ForwardChats, + Size +}; + +inline TopDialogCategory top_dialog_category_from_td_api(const td_api::TopChatCategory &category) { + switch (category.get_id()) { + case td_api::topChatCategoryUsers::ID: + return TopDialogCategory::Correspondent; + case td_api::topChatCategoryBots::ID: + return TopDialogCategory::BotPM; + case td_api::topChatCategoryInlineBots::ID: + return TopDialogCategory::BotInline; + case td_api::topChatCategoryGroups::ID: + return TopDialogCategory::Group; + case td_api::topChatCategoryChannels::ID: + return TopDialogCategory::Channel; + case td_api::topChatCategoryCalls::ID: + return TopDialogCategory::Call; + case td_api::topChatCategoryForwardChats::ID: + return TopDialogCategory::ForwardUsers; + default: + UNREACHABLE(); + } +} + +} // namespace td diff --git a/td/telegram/TopDialogManager.h b/td/telegram/TopDialogManager.h index e861896e9..122ff7b33 100644 --- a/td/telegram/TopDialogManager.h +++ b/td/telegram/TopDialogManager.h @@ -9,11 +9,11 @@ #include "td/actor/actor.h" #include "td/actor/PromiseFuture.h" -#include "td/telegram/td_api.h" -#include "td/telegram/telegram_api.h" - #include "td/telegram/DialogId.h" #include "td/telegram/net/NetQuery.h" +#include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" +#include "td/telegram/TopDialogCategory.h" #include "td/utils/common.h" #include "td/utils/Time.h" @@ -23,39 +23,6 @@ namespace td { -enum class TopDialogCategory : int32 { - Correspondent, - BotPM, - BotInline, - Group, - Channel, - Call, - ForwardUsers, - ForwardChats, - Size -}; - -inline TopDialogCategory top_dialog_category_from_td_api(const td_api::TopChatCategory &category) { - switch (category.get_id()) { - case td_api::topChatCategoryUsers::ID: - return TopDialogCategory::Correspondent; - case td_api::topChatCategoryBots::ID: - return TopDialogCategory::BotPM; - case td_api::topChatCategoryInlineBots::ID: - return TopDialogCategory::BotInline; - case td_api::topChatCategoryGroups::ID: - return TopDialogCategory::Group; - case td_api::topChatCategoryChannels::ID: - return TopDialogCategory::Channel; - case td_api::topChatCategoryCalls::ID: - return TopDialogCategory::Call; - case td_api::topChatCategoryForwardChats::ID: - return TopDialogCategory::ForwardUsers; - default: - UNREACHABLE(); - } -} - class TopDialogManager : public NetQueryCallback { public: explicit TopDialogManager(ActorShared<> parent) : parent_(std::move(parent)) {