Add can_archive_and_mute_new_chats_from_unknown_users option.

This commit is contained in:
levlam 2020-11-28 16:39:56 +03:00
parent 56866524aa
commit e3a31f062e
2 changed files with 20 additions and 1 deletions

View File

@ -287,8 +287,11 @@ Changes in 1.7.0:
* Added the field `progressive_sizes` to the class `photo` to allow partial progressive JPEG photo download.
* Added the field `redirect_stderr` to the class `logStreamFile` to allow explicit control over stderr redirection to
the log file.
* Added the read-only option "can_archive_and_mute_new_chats_from_unknown_users", which can be used to check, whether
the option "archive_and_mute_new_chats_from_unknown_users" can be changed.
* Added the writable option "archive_and_mute_new_chats_from_unknown_users", which can be used to automatically archive
and mute new chats from non-contacts. The option can be set only if the change was suggested by the server.
and mute new chats from non-contacts. The option can be set only if the option
"can_archive_and_mute_new_chats_from_unknown_users" is true.
* Added the writable option "message_unload_delay", which can be used to change the minimum delay before messages are
unloaded from the memory.
* Added the writable option "disable_persistent_network_statistics", which can be used to disable persistent

View File

@ -1483,6 +1483,7 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
string animation_search_provider;
string animation_search_emojis;
vector<SuggestedAction> suggested_actions;
bool can_archive_and_mute_new_chats_from_unknown_users = false;
if (config->get_id() == telegram_api::jsonObject::ID) {
for (auto &key_value : static_cast<telegram_api::jsonObject *>(config.get())->value_) {
Slice key = key_value->key_;
@ -1630,6 +1631,15 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
}
continue;
}
if (key == "autoarchive_setting_available") {
if (value->get_id() == telegram_api::jsonBool::ID) {
can_archive_and_mute_new_chats_from_unknown_users =
std::move(static_cast<telegram_api::jsonBool *>(value)->value_);
} else {
LOG(ERROR) << "Receive unexpected autoarchive_setting_available " << to_string(*value);
}
continue;
}
new_values.push_back(std::move(key_value));
}
@ -1677,6 +1687,12 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
} else {
shared_config.set_option_string("animation_search_emojis", animation_search_emojis);
}
if (!can_archive_and_mute_new_chats_from_unknown_users) {
shared_config.set_option_empty("can_archive_and_mute_new_chats_from_unknown_users");
} else {
shared_config.set_option_boolean("can_archive_and_mute_new_chats_from_unknown_users",
can_archive_and_mute_new_chats_from_unknown_users);
}
shared_config.set_option_empty("default_ton_blockchain_config");
shared_config.set_option_empty("default_ton_blockchain_name");