From: Vsevolod Stakhov Date: Tue, 29 Dec 2015 09:04:41 +0000 (+0000) Subject: Init modules and workers in confighelp to get more doc strings X-Git-Tag: 1.1.0~188 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2f69ba4a877b29676819d7dc7be90f47384faef0;p=rspamd.git Init modules and workers in confighelp to get more doc strings --- diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c index 6a0492f1b..1988989e5 100644 --- a/src/rspamadm/confighelp.c +++ b/src/rspamadm/confighelp.c @@ -112,6 +112,9 @@ rspamadm_confighelp (gint argc, gchar **argv) const ucl_object_t *doc_obj; GOptionContext *context; GError *error = NULL; + module_t *mod, **pmod; + worker_t **pworker; + struct module_ctx *mod_ctx; gint i = 1, ret = 0; context = g_option_context_new ( @@ -131,9 +134,28 @@ rspamadm_confighelp (gint argc, gchar **argv) } cfg = rspamd_config_new (); + cfg->compiled_modules = modules; + cfg->compiled_workers = workers; top = rspamd_rcl_config_init (cfg); + /* Init modules to get documentation strings */ + for (pmod = cfg->compiled_modules; pmod != NULL && *pmod != NULL; pmod++) { + mod = *pmod; + mod_ctx = g_slice_alloc0 (sizeof (struct module_ctx)); + + if (mod->module_init_func (cfg, &mod_ctx) == 0) { + g_hash_table_insert (cfg->c_modules, + (gpointer) mod->name, + mod_ctx); + mod_ctx->mod = mod; + } + } + /* Also init all workers */ + for (pworker = cfg->compiled_workers; *pworker != NULL; pworker ++) { + (*pworker)->worker_init_func (cfg); + } + if (argc > 1) { while (argc > 1) { if (argv[i][0] != '-') { @@ -159,5 +181,7 @@ rspamadm_confighelp (gint argc, gchar **argv) rspamadm_confighelp_show (NULL, cfg->doc_strings); } + rspamd_config_free (cfg); + exit (ret); }