From 19502cbe15c23bff33f741cfb9bb79dcf3249748 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 12 Apr 2023 01:52:36 +0300 Subject: [PATCH] Remove separate td_api::hideChatFolderNewChats. --- td/generate/scheme/td_api.tl | 7 ++----- td/telegram/Td.cpp | 16 +++++++--------- td/telegram/Td.h | 4 +--- td/telegram/cli.cpp | 8 ++------ 4 files changed, 12 insertions(+), 23 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index b79150ad0..9cc4409d1 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -6875,11 +6875,8 @@ addChatFolderByInviteLink invite_link:string chat_ids:vector = Ok; //@description Returns new chats added to a shareable chat folder by its owner. The method must be called at most once in getOption("chat_folder_new_chats_update_period") for the given chat folder @chat_folder_id Chat folder identifier getChatFolderNewChats chat_folder_id:int32 = Chats; -//@description Adds new chats added to a shareable chat folder by its owner to the user's chat folder @chat_folder_id Chat folder identifier @chat_ids Identifiers of the new chats added to the chat folder. The chats are automatically joined if they aren't joined yet -addChatFolderNewChats chat_folder_id:int32 chat_ids:vector = Ok; - -//@description Hides new chats added to a shareable chat folder by its owner, so they aren't received next time @chat_folder_id Chat folder identifier -hideChatFolderNewChats chat_folder_id:int32 = Ok; +//@description Process new chats added to a shareable chat folder by its owner @chat_folder_id Chat folder identifier @added_chat_ids Identifiers of the new chats, which are added to the chat folder. The chats are automatically joined if they aren't joined yet +processChatFolderNewChats chat_folder_id:int32 added_chat_ids:vector = Ok; //@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 307bc3af6..f9656dcf4 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6204,17 +6204,15 @@ void Td::on_request(uint64 id, const td_api::getChatFolderNewChats &request) { dialog_filter_manager_->get_dialog_filter_new_chats(DialogFilterId(request.chat_folder_id_), std::move(promise)); } -void Td::on_request(uint64 id, const td_api::addChatFolderNewChats &request) { +void Td::on_request(uint64 id, const td_api::processChatFolderNewChats &request) { CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); - dialog_filter_manager_->add_dialog_filter_new_chats(DialogFilterId(request.chat_folder_id_), - DialogId::get_dialog_ids(request.chat_ids_), std::move(promise)); -} - -void Td::on_request(uint64 id, const td_api::hideChatFolderNewChats &request) { - CHECK_IS_USER(); - CREATE_OK_REQUEST_PROMISE(); - dialog_filter_manager_->hide_dialog_filter_new_chats(DialogFilterId(request.chat_folder_id_), std::move(promise)); + if (request.added_chat_ids_.empty()) { + dialog_filter_manager_->hide_dialog_filter_new_chats(DialogFilterId(request.chat_folder_id_), std::move(promise)); + } else { + dialog_filter_manager_->add_dialog_filter_new_chats( + DialogFilterId(request.chat_folder_id_), DialogId::get_dialog_ids(request.added_chat_ids_), std::move(promise)); + } } void Td::on_request(uint64 id, td_api::setChatTitle &request) { diff --git a/td/telegram/Td.h b/td/telegram/Td.h index 98bad0f08..7f722cfac 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -943,9 +943,7 @@ class Td final : public Actor { void on_request(uint64 id, const td_api::getChatFolderNewChats &request); - void on_request(uint64 id, const td_api::addChatFolderNewChats &request); - - void on_request(uint64 id, const td_api::hideChatFolderNewChats &request); + void on_request(uint64 id, const td_api::processChatFolderNewChats &request); void on_request(uint64 id, td_api::setChatTitle &request); diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index c114e3f33..8ecde152d 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4685,15 +4685,11 @@ class CliClient final : public Actor { ChatFolderId chat_folder_id; get_args(args, chat_folder_id); send_request(td_api::make_object(chat_folder_id)); - } else if (op == "acfnc") { + } else if (op == "pcfnc") { ChatFolderId chat_folder_id; string chat_ids; get_args(args, chat_folder_id, chat_ids); - send_request(td_api::make_object(chat_folder_id, as_chat_ids(chat_ids))); - } else if (op == "hcfnc") { - ChatFolderId chat_folder_id; - get_args(args, chat_folder_id); - send_request(td_api::make_object(chat_folder_id)); + send_request(td_api::make_object(chat_folder_id, as_chat_ids(chat_ids))); } else if (op == "grcf") { send_request(td_api::make_object()); } else if (op == "gcfdin") {