From b955a8fa7786b4a579525b8b0ccf059922ac392c Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Thu, 1 Oct 2020 13:27:29 +0200 Subject: [PATCH] Renamed option to chat_unload_delay, limited input value from 60 seconds to 1 day. Options limited to bots. --- td/telegram/MessagesManager.cpp | 8 ++++---- td/telegram/Td.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 4ccb8a312..f6187c48e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -10303,11 +10303,11 @@ void MessagesManager::delete_all_channel_messages_from_user_on_server(ChannelId int32 MessagesManager::get_unload_dialog_delay() const { constexpr int32 DIALOG_UNLOAD_DELAY = 60; // seconds constexpr int32 DIALOG_UNLOAD_BOT_DELAY = 1800; // seconds - auto custom_unload_delay = clamp(G()->shared_config().get_option_integer("dialog_unload_delay", -1), -1, 86400); - if (custom_unload_delay != -1) { - return custom_unload_delay; + if (td_->auth_manager_->is_bot()) { + return G()->shared_config().get_option_integer("chat_unload_delay", DIALOG_UNLOAD_BOT_DELAY); + } else { + return DIALOG_UNLOAD_DELAY; } - return td_->auth_manager_->is_bot() ? DIALOG_UNLOAD_BOT_DELAY : DIALOG_UNLOAD_DELAY; } void MessagesManager::unload_dialog(DialogId dialog_id) { diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 2cf086736..d0bb13a87 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -7123,7 +7123,7 @@ void Td::on_request(uint64 id, td_api::setOption &request) { } break; case 'd': - if (set_integer_option("dialog_unload_delay")) { + if (is_bot && set_integer_option("chat_unload_delay", 60, 86400)) { return; } if (!is_bot && set_boolean_option("disable_contact_registered_notifications")) {