Add option "ignore_file_names".
This commit is contained in:
parent
cac5c4467a
commit
68336dbefc
@ -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")) {
|
if (set_boolean_option("ignore_default_disable_notification")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (set_boolean_option("ignore_file_names")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (set_boolean_option("ignore_inline_thumbnails")) {
|
if (set_boolean_option("ignore_inline_thumbnails")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3557,12 +3557,14 @@ void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
|
|||||||
auto api_hash = events.parameters.api_hash;
|
auto api_hash = events.parameters.api_hash;
|
||||||
|
|
||||||
bool use_storage_optimizer = events.parameters.enable_storage_optimizer;
|
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();
|
G()->init(std::move(events.parameters), actor_id(this), std::move(events.database)).ensure();
|
||||||
|
|
||||||
init_options_and_network();
|
init_options_and_network();
|
||||||
|
|
||||||
option_manager_->set_option_boolean("use_storage_optimizer", use_storage_optimizer);
|
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::getOption along with td_api::setOption for consistency
|
||||||
// we need to process td_api::setOption before managers and MTProto header are created,
|
// we need to process td_api::setOption before managers and MTProto header are created,
|
||||||
|
@ -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 stem = path_view.file_stem();
|
||||||
auto ext = path_view.extension();
|
auto ext = path_view.extension();
|
||||||
bool active = true;
|
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});
|
active = callback(PSLICE() << stem << Ext{ext});
|
||||||
for (int i = 0; active && i < 10; i++) {
|
for (int i = 0; active && i < 10; i++) {
|
||||||
active = callback(PSLICE() << stem << "_(" << i << ")" << Ext{ext});
|
active = callback(PSLICE() << stem << "_(" << i << ")" << Ext{ext});
|
||||||
|
Loading…
Reference in New Issue
Block a user