aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-29 09:04:41 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-29 09:04:41 +0000
commit2f69ba4a877b29676819d7dc7be90f47384faef0 (patch)
treefa5ac5d83260c0e9d506d7462e7fc4dd5b416eb2
parent5c0f25db11642a2aaa1d511d16e01cbe035090c6 (diff)
downloadrspamd-2f69ba4a877b29676819d7dc7be90f47384faef0.tar.gz
rspamd-2f69ba4a877b29676819d7dc7be90f47384faef0.zip
Init modules and workers in confighelp to get more doc strings
-rw-r--r--src/rspamadm/confighelp.c24
1 files changed, 24 insertions, 0 deletions
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);
}