From e662e210ef58e278cedab7ae3767dec2a60fbb2f Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 18 May 2020 02:39:59 +0300 Subject: [PATCH] Add secret chats support in getDialogList. GitOrigin-RevId: 3169ed59345ffd4bb82e106cd3b883de9f85df53 --- td/telegram/MessagesManager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 525d6ef8a..0d7f1e055 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -221,7 +221,9 @@ class GetDialogsQuery : public Td::ResultHandler { CHECK(input_dialog_ids.size() <= 100); auto input_dialog_peers = transform( input_dialog_ids, [](InputDialogId input_dialog_id) -> telegram_api::object_ptr { - return telegram_api::make_object(input_dialog_id.get_input_peer()); + auto input_peer = input_dialog_id.get_input_peer(); + CHECK(input_peer != nullptr); + return telegram_api::make_object(std::move(input_peer)); }); send_query(G()->net_query_creator().create(telegram_api::messages_getPeerDialogs(std::move(input_dialog_peers)))); } @@ -13593,9 +13595,16 @@ void MessagesManager::load_dialog_filter(DialogFilterId dialog_filter_id, bool f vector input_dialog_ids; for (auto &input_dialog_id : needed_dialog_ids) { + auto dialog_id = input_dialog_id.get_dialog_id(); // TODO load dialogs asynchronously - if (!have_dialog_force(input_dialog_id.get_dialog_id())) { - input_dialog_ids.push_back(input_dialog_id); + if (!have_dialog_force(dialog_id)) { + if (dialog_id.get_type() == DialogType::SecretChat) { + if (have_dialog_info_force(dialog_id)) { + force_create_dialog(dialog_id, "load_dialog_filter"); + } + } else { + input_dialog_ids.push_back(input_dialog_id); + } } }