diff options
-rw-r--r-- | server/include/modules_handler.h | 1 | ||||
-rw-r--r-- | server/modules/metadata/flat_files/main.cpp | 3 | ||||
-rw-r--r-- | server/src/modules_handler.cpp | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/server/include/modules_handler.h b/server/include/modules_handler.h index c111faf..d174aca 100644 --- a/server/include/modules_handler.h +++ b/server/include/modules_handler.h @@ -38,6 +38,7 @@ class modules_handler void load_metadata_modules(const std::string &path); void load_downloader_modules(const std::string &path); void sync_module_settings(module_base *m); + void load_module_settings(); std::string list_modules_single_type_internal(const std::list<module_base*> &modules); std::string get_self_path(); std::string self_path; diff --git a/server/modules/metadata/flat_files/main.cpp b/server/modules/metadata/flat_files/main.cpp index 7fd197c..fb52812 100644 --- a/server/modules/metadata/flat_files/main.cpp +++ b/server/modules/metadata/flat_files/main.cpp @@ -27,7 +27,7 @@ void storage_impl::on_modules_loaded() { - settings = api->get_module_settings(this); + //settings = api->get_module_settings(this); //you can get module settings here, by default settings loaded automatically after this function call } @@ -40,6 +40,7 @@ void storage_impl::load(core_api *a) info.version = "0.0.0.1draft"; info.default_settings["data_path"] = "~/.local/share/udm/metadata"; info.on_modules_loaded = boost::bind(&storage_impl::on_modules_loaded, this); + info.set_module_settings = boost::bind(&storage_impl::set_module_settings, this); std::cout<<"flat_files metadata module succesfully loaded\n"; } diff --git a/server/src/modules_handler.cpp b/server/src/modules_handler.cpp index 7a17ec7..2c708b9 100644 --- a/server/src/modules_handler.cpp +++ b/server/src/modules_handler.cpp @@ -175,6 +175,7 @@ void modules_handler::load_modules() load_downloader_modules(replace_home_var("~/.share/udm/modules/downloader")); load_downloader_modules("/usr/lib/udm/modules/downloader"); on_modules_loaded(); + load_module_settings(); } void modules_handler::on_modules_loaded() @@ -191,6 +192,14 @@ void modules_handler::on_modules_loaded() } } +void modules_handler::load_module_settings() +{ + for(auto i = metadata_modules.begin(), end = metadata_modules.end(); i != end; ++i) + (*i)->set_module_settings(module_api->get_module_settings(*i)); + for(auto i = downloader_modules.begin(), end = downloader_modules.end(); i != end; ++i) + (*i)->set_module_settings(module_api->get_module_settings(*i)); +} + modules_handler::~modules_handler() { //dtor |