Add option "ignore_file_names".

This commit is contained in:
levlam 2023-03-13 19:19:13 +03:00
parent cac5c4467a
commit 68336dbefc
3 changed files with 6 additions and 1 deletions

View File

@ -675,6 +675,9 @@ void OptionManager::set_option(const string &name, td_api::object_ptr<td_api::Op
if (set_boolean_option("ignore_default_disable_notification")) {
return;
}
if (set_boolean_option("ignore_file_names")) {
return;
}
if (set_boolean_option("ignore_inline_thumbnails")) {
return;
}

View File

@ -3557,12 +3557,14 @@ void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
auto api_hash = events.parameters.api_hash;
bool use_storage_optimizer = events.parameters.enable_storage_optimizer;
bool ignore_file_names = events.parameters.ignore_file_names;
G()->init(std::move(events.parameters), actor_id(this), std::move(events.database)).ensure();
init_options_and_network();
option_manager_->set_option_boolean("use_storage_optimizer", use_storage_optimizer);
option_manager_->set_option_boolean("ignore_file_names", ignore_file_names);
// we need to process td_api::getOption along with td_api::setOption for consistency
// we need to process td_api::setOption before managers and MTProto header are created,

View File

@ -105,7 +105,7 @@ bool for_suggested_file_name(CSlice name, bool use_pmc, bool use_random, F &&cal
auto stem = path_view.file_stem();
auto ext = path_view.extension();
bool active = true;
if (!stem.empty() && !G()->parameters().ignore_file_names) {
if (!stem.empty() && !G()->get_option_boolean("ignore_file_names")) {
active = callback(PSLICE() << stem << Ext{ext});
for (int i = 0; active && i < 10; i++) {
active = callback(PSLICE() << stem << "_(" << i << ")" << Ext{ext});