Skip to content

Commit 985e051

Browse files
committed
Add TopDialogCategory.h.
GitOrigin-RevId: ce481612a17e38268b8b2c3a9d7b9ebad5cb572d
1 parent c36d451 commit 985e051

7 files changed

+55
-44
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ set(TDLIB_SOURCE
653653
td/telegram/TdDb.h
654654
td/telegram/TdParameters.h
655655
td/telegram/TermsOfService.h
656+
td/telegram/TopDialogCategory.h
656657
td/telegram/TopDialogManager.h
657658
td/telegram/UniqueId.h
658659
td/telegram/UpdatesManager.h

SplitSource.php

+1
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function ($matches) use ($needed_std_headers) {
281281
'secret_chats_manager[_(-][^.]|SecretChatsManager' => 'SecretChatsManager',
282282
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
283283
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',
284+
'TopDialogCategory|top_dialog_category_from_td_api' => 'TopDialogCategory',
284285
'top_dialog_manager[_(-][^.]|TopDialogManager' => 'TopDialogManager',
285286
'updates_manager[_(-][^.]|UpdatesManager|get_difference[)]' => 'UpdatesManager',
286287
'WebPageId(Hash)?' => 'WebPageId',

td/telegram/ContactsManager.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "td/telegram/StickersManager.h"
3636
#include "td/telegram/Td.h"
3737
#include "td/telegram/TdDb.h"
38-
#include "td/telegram/TopDialogManager.h"
3938
#include "td/telegram/UpdatesManager.h"
4039
#include "td/telegram/Version.h"
4140

@@ -7894,13 +7893,6 @@ void ContactsManager::update_user(User *u, UserId user_id, bool from_binlog, boo
78947893

78957894
if (u->is_deleted) {
78967895
td_->inline_queries_manager_->remove_recent_inline_bot(user_id, Promise<>());
7897-
/*
7898-
DialogId dialog_id(user_id);
7899-
for (auto category : {TopDialogCategory::Correspondent, TopDialogCategory::BotPM, TopDialogCategory::BotInline}) {
7900-
send_closure(G()->top_dialog_manager(), &TopDialogManager::delete_dialog, category, dialog_id,
7901-
get_input_peer_user(user_id, AccessRights::Read));
7902-
}
7903-
*/
79047896
}
79057897

79067898
LOG(DEBUG) << "Update " << user_id << ": need_save_to_database = " << u->need_save_to_database

td/telegram/MessagesManager.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "td/telegram/SequenceDispatcher.h"
4646
#include "td/telegram/Td.h"
4747
#include "td/telegram/TdDb.h"
48+
#include "td/telegram/TopDialogCategory.h"
4849
#include "td/telegram/TopDialogManager.h"
4950
#include "td/telegram/UpdatesManager.h"
5051
#include "td/telegram/Version.h"

td/telegram/Td.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#include "td/telegram/StickersManager.h"
8181
#include "td/telegram/StorageManager.h"
8282
#include "td/telegram/TdDb.h"
83+
#include "td/telegram/TopDialogCategory.h"
8384
#include "td/telegram/TopDialogManager.h"
8485
#include "td/telegram/UpdatesManager.h"
8586
#include "td/telegram/VideoNotesManager.h"

td/telegram/TopDialogCategory.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//
2+
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 2014-2020
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
#pragma once
8+
9+
#include "td/telegram/td_api.h"
10+
11+
#include "td/utils/common.h"
12+
13+
namespace td {
14+
15+
enum class TopDialogCategory : int32 {
16+
Correspondent,
17+
BotPM,
18+
BotInline,
19+
Group,
20+
Channel,
21+
Call,
22+
ForwardUsers,
23+
ForwardChats,
24+
Size
25+
};
26+
27+
inline TopDialogCategory top_dialog_category_from_td_api(const td_api::TopChatCategory &category) {
28+
switch (category.get_id()) {
29+
case td_api::topChatCategoryUsers::ID:
30+
return TopDialogCategory::Correspondent;
31+
case td_api::topChatCategoryBots::ID:
32+
return TopDialogCategory::BotPM;
33+
case td_api::topChatCategoryInlineBots::ID:
34+
return TopDialogCategory::BotInline;
35+
case td_api::topChatCategoryGroups::ID:
36+
return TopDialogCategory::Group;
37+
case td_api::topChatCategoryChannels::ID:
38+
return TopDialogCategory::Channel;
39+
case td_api::topChatCategoryCalls::ID:
40+
return TopDialogCategory::Call;
41+
case td_api::topChatCategoryForwardChats::ID:
42+
return TopDialogCategory::ForwardUsers;
43+
default:
44+
UNREACHABLE();
45+
}
46+
}
47+
48+
} // namespace td

td/telegram/TopDialogManager.h

+3-36
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include "td/actor/actor.h"
1010
#include "td/actor/PromiseFuture.h"
1111

12-
#include "td/telegram/td_api.h"
13-
#include "td/telegram/telegram_api.h"
14-
1512
#include "td/telegram/DialogId.h"
1613
#include "td/telegram/net/NetQuery.h"
14+
#include "td/telegram/td_api.h"
15+
#include "td/telegram/telegram_api.h"
16+
#include "td/telegram/TopDialogCategory.h"
1717

1818
#include "td/utils/common.h"
1919
#include "td/utils/Time.h"
@@ -23,39 +23,6 @@
2323

2424
namespace td {
2525

26-
enum class TopDialogCategory : int32 {
27-
Correspondent,
28-
BotPM,
29-
BotInline,
30-
Group,
31-
Channel,
32-
Call,
33-
ForwardUsers,
34-
ForwardChats,
35-
Size
36-
};
37-
38-
inline TopDialogCategory top_dialog_category_from_td_api(const td_api::TopChatCategory &category) {
39-
switch (category.get_id()) {
40-
case td_api::topChatCategoryUsers::ID:
41-
return TopDialogCategory::Correspondent;
42-
case td_api::topChatCategoryBots::ID:
43-
return TopDialogCategory::BotPM;
44-
case td_api::topChatCategoryInlineBots::ID:
45-
return TopDialogCategory::BotInline;
46-
case td_api::topChatCategoryGroups::ID:
47-
return TopDialogCategory::Group;
48-
case td_api::topChatCategoryChannels::ID:
49-
return TopDialogCategory::Channel;
50-
case td_api::topChatCategoryCalls::ID:
51-
return TopDialogCategory::Call;
52-
case td_api::topChatCategoryForwardChats::ID:
53-
return TopDialogCategory::ForwardUsers;
54-
default:
55-
UNREACHABLE();
56-
}
57-
}
58-
5926
class TopDialogManager : public NetQueryCallback {
6027
public:
6128
explicit TopDialogManager(ActorShared<> parent) : parent_(std::move(parent)) {

0 commit comments

Comments
 (0)