Add TopDialogCategory.h.
GitOrigin-RevId: ce481612a17e38268b8b2c3a9d7b9ebad5cb572d
This commit is contained in:
parent
c36d45153c
commit
985e051bbe
@ -653,6 +653,7 @@ set(TDLIB_SOURCE
|
|||||||
td/telegram/TdDb.h
|
td/telegram/TdDb.h
|
||||||
td/telegram/TdParameters.h
|
td/telegram/TdParameters.h
|
||||||
td/telegram/TermsOfService.h
|
td/telegram/TermsOfService.h
|
||||||
|
td/telegram/TopDialogCategory.h
|
||||||
td/telegram/TopDialogManager.h
|
td/telegram/TopDialogManager.h
|
||||||
td/telegram/UniqueId.h
|
td/telegram/UniqueId.h
|
||||||
td/telegram/UpdatesManager.h
|
td/telegram/UpdatesManager.h
|
||||||
|
@ -281,6 +281,7 @@ function split_file($file, $chunks, $undo) {
|
|||||||
'secret_chats_manager[_(-][^.]|SecretChatsManager' => 'SecretChatsManager',
|
'secret_chats_manager[_(-][^.]|SecretChatsManager' => 'SecretChatsManager',
|
||||||
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
|
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
|
||||||
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',
|
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',
|
||||||
|
'TopDialogCategory|top_dialog_category_from_td_api' => 'TopDialogCategory',
|
||||||
'top_dialog_manager[_(-][^.]|TopDialogManager' => 'TopDialogManager',
|
'top_dialog_manager[_(-][^.]|TopDialogManager' => 'TopDialogManager',
|
||||||
'updates_manager[_(-][^.]|UpdatesManager|get_difference[)]' => 'UpdatesManager',
|
'updates_manager[_(-][^.]|UpdatesManager|get_difference[)]' => 'UpdatesManager',
|
||||||
'WebPageId(Hash)?' => 'WebPageId',
|
'WebPageId(Hash)?' => 'WebPageId',
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#include "td/telegram/StickersManager.h"
|
#include "td/telegram/StickersManager.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/TdDb.h"
|
#include "td/telegram/TdDb.h"
|
||||||
#include "td/telegram/TopDialogManager.h"
|
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
#include "td/telegram/Version.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) {
|
if (u->is_deleted) {
|
||||||
td_->inline_queries_manager_->remove_recent_inline_bot(user_id, Promise<>());
|
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
|
LOG(DEBUG) << "Update " << user_id << ": need_save_to_database = " << u->need_save_to_database
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "td/telegram/SequenceDispatcher.h"
|
#include "td/telegram/SequenceDispatcher.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/TdDb.h"
|
#include "td/telegram/TdDb.h"
|
||||||
|
#include "td/telegram/TopDialogCategory.h"
|
||||||
#include "td/telegram/TopDialogManager.h"
|
#include "td/telegram/TopDialogManager.h"
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
#include "td/telegram/Version.h"
|
#include "td/telegram/Version.h"
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
#include "td/telegram/StickersManager.h"
|
#include "td/telegram/StickersManager.h"
|
||||||
#include "td/telegram/StorageManager.h"
|
#include "td/telegram/StorageManager.h"
|
||||||
#include "td/telegram/TdDb.h"
|
#include "td/telegram/TdDb.h"
|
||||||
|
#include "td/telegram/TopDialogCategory.h"
|
||||||
#include "td/telegram/TopDialogManager.h"
|
#include "td/telegram/TopDialogManager.h"
|
||||||
#include "td/telegram/UpdatesManager.h"
|
#include "td/telegram/UpdatesManager.h"
|
||||||
#include "td/telegram/VideoNotesManager.h"
|
#include "td/telegram/VideoNotesManager.h"
|
||||||
|
48
td/telegram/TopDialogCategory.h
Normal file
48
td/telegram/TopDialogCategory.h
Normal file
@ -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
|
@ -9,11 +9,11 @@
|
|||||||
#include "td/actor/actor.h"
|
#include "td/actor/actor.h"
|
||||||
#include "td/actor/PromiseFuture.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/DialogId.h"
|
||||||
#include "td/telegram/net/NetQuery.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/common.h"
|
||||||
#include "td/utils/Time.h"
|
#include "td/utils/Time.h"
|
||||||
@ -23,39 +23,6 @@
|
|||||||
|
|
||||||
namespace td {
|
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 {
|
class TopDialogManager : public NetQueryCallback {
|
||||||
public:
|
public:
|
||||||
explicit TopDialogManager(ActorShared<> parent) : parent_(std::move(parent)) {
|
explicit TopDialogManager(ActorShared<> parent) : parent_(std::move(parent)) {
|
||||||
|
Reference in New Issue
Block a user