Option "chat_unload_delay" for bots (#1219)
* Option "chat_unload_delay" This option allows to override the default chat unload delay. The allowed range is from 60 to 86400 seconds (1 day)
This commit is contained in:
parent
771ace5c8d
commit
e0b335bc3e
@ -10219,7 +10219,15 @@ void MessagesManager::delete_all_channel_messages_from_user_on_server(ChannelId
|
|||||||
int32 MessagesManager::get_unload_dialog_delay() const {
|
int32 MessagesManager::get_unload_dialog_delay() const {
|
||||||
constexpr int32 DIALOG_UNLOAD_DELAY = 60; // seconds
|
constexpr int32 DIALOG_UNLOAD_DELAY = 60; // seconds
|
||||||
constexpr int32 DIALOG_UNLOAD_BOT_DELAY = 1800; // seconds
|
constexpr int32 DIALOG_UNLOAD_BOT_DELAY = 1800; // seconds
|
||||||
return td_->auth_manager_->is_bot() ? DIALOG_UNLOAD_BOT_DELAY : DIALOG_UNLOAD_DELAY;
|
|
||||||
|
auto is_bot = td_->auth_manager_->is_bot();
|
||||||
|
auto default_unload_delay = is_bot ? DIALOG_UNLOAD_BOT_DELAY : DIALOG_UNLOAD_DELAY;
|
||||||
|
|
||||||
|
if (G()->parameters().use_message_db || is_bot) {
|
||||||
|
return narrow_cast<int32>(G()->shared_config().get_option_integer("chat_unload_delay", default_unload_delay));
|
||||||
|
} else {
|
||||||
|
return default_unload_delay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::unload_dialog(DialogId dialog_id) {
|
void MessagesManager::unload_dialog(DialogId dialog_id) {
|
||||||
|
@ -7124,6 +7124,9 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
|
if ((parameters_.use_message_db || is_bot) && set_integer_option("chat_unload_delay", 60, 86400)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!is_bot && set_boolean_option("disable_contact_registered_notifications")) {
|
if (!is_bot && set_boolean_option("disable_contact_registered_notifications")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user