Mercurial > irccd
diff irccd-test/main.cpp @ 757:97b356010785
Irccd: create (command|jsapi)::registry
Make two list of constructor functions to initialize all command and all
Javascript modules to avoid duplicating efforts in case of change.
While here, update test fixtures to load all of them for simplicity.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 06 Aug 2018 21:27:00 +0200 |
parents | c216d148558d |
children | f25c878d823b |
line wrap: on
line diff
--- a/irccd-test/main.cpp Mon Aug 06 12:40:00 2018 +0200 +++ b/irccd-test/main.cpp Mon Aug 06 21:27:00 2018 +0200 @@ -631,9 +631,15 @@ void load(int argc, char** argv) { daemon = std::make_unique<irccd>(io); + daemon->plugins().add_loader(std::make_unique<dynlib_plugin_loader>()); -#if defined(IRCCD_HAVE_JS) - daemon->plugins().add_loader(js_plugin_loader::defaults(*daemon)); +#if defined(HAVE_JS) + auto loader = std::make_unique<js_plugin_loader>(); + + for (const auto& f : jsapi::registry) + daemon->get_modules().push_back(f()); + + daemon->plugins().add_loader(std::move(loader)); #endif load_options(argc, argv);