Browse Source

Init modules and workers in confighelp to get more doc strings

tags/1.1.0
Vsevolod Stakhov 8 years ago
parent
commit
2f69ba4a87
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      src/rspamadm/confighelp.c

+ 24
- 0
src/rspamadm/confighelp.c View File

@@ -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);
}

Loading…
Cancel
Save