Renamed option to chat_unload_delay, limited input value from 60 seconds to 1 day. Options limited to bots.

This commit is contained in:
Andrea Cavalli 2020-10-01 13:27:29 +02:00
parent 33a55a1a0a
commit b955a8fa77
2 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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")) {