From 393a7c39ecc9224faa7c11afc32c8e74f54ea3c5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 5 Jan 2013 20:29:26 +0400 Subject: Add webui handler for rspamd (skeleton). Fix url detector. Add group option for modules options. Some fixes in controller and rrd code. --- src/cfg_xml.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src/cfg_xml.c') diff --git a/src/cfg_xml.c b/src/cfg_xml.c index 277172f2b..88650c990 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -324,6 +324,12 @@ static struct xml_parser_rule grammar[] = { G_STRUCT_OFFSET (struct config_file, mlock_statfile_pool), NULL }, + { + "rrd", + xml_handle_string, + G_STRUCT_OFFSET (struct config_file, rrd_file), + NULL + }, NULL_ATTR }, NULL_DEF_ATTR @@ -1109,11 +1115,18 @@ handle_module_opt (struct config_file *cfg, struct rspamd_xml_userdata *ctx, con name = memory_pool_strdup (cfg->cfg_pool, tag); } - /* Check for lua */ - if (attrs != NULL && (val = g_hash_table_lookup (attrs, "lua")) != NULL) { - if (g_ascii_strcasecmp (val, "yes") == 0) { + cur = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct module_opt)); + /* Check for options */ + if (attrs != NULL) { + if ((val = g_hash_table_lookup (attrs, "lua")) != NULL && g_ascii_strcasecmp (val, "yes") == 0) { is_lua = TRUE; } + if ((val = g_hash_table_lookup (attrs, "description")) != NULL) { + cur->description = memory_pool_strdup (cfg->cfg_pool, val); + } + if ((val = g_hash_table_lookup (attrs, "group")) != NULL) { + cur->group = memory_pool_strdup (cfg->cfg_pool, val); + } } /* * XXX: in fact we cannot check for lua modules and need to do it in post-config procedure @@ -1121,7 +1134,6 @@ handle_module_opt (struct config_file *cfg, struct rspamd_xml_userdata *ctx, con */ /* Insert option */ - cur = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct module_opt)); cur->param = (char *)name; cur->value = data; cur->is_lua = is_lua; -- cgit v1.2.3