aboutsummaryrefslogtreecommitdiffstats
path: root/src/controller.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-13 15:28:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-08-13 15:28:07 +0100
commit6f70b5767167f3414ee7c84346e84f32ebfeaf38 (patch)
tree1448f57c9730837667f5da5f037832b970e17993 /src/controller.c
parent7a1cfea11cf27eea852be68b2373b233e650f689 (diff)
downloadrspamd-6f70b5767167f3414ee7c84346e84f32ebfeaf38.tar.gz
rspamd-6f70b5767167f3414ee7c84346e84f32ebfeaf38.zip
More fixes for the new symbols structure.
Diffstat (limited to 'src/controller.c')
-rw-r--r--src/controller.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/controller.c b/src/controller.c
index c2dda4863..2c9cfae3e 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -503,9 +503,10 @@ rspamd_controller_handle_symbols (struct rspamd_http_connection_entry *conn_ent,
struct rspamd_http_message *msg)
{
struct rspamd_controller_session *session = conn_ent->ud;
- GHashTableIter it;
+ GHashTableIter it, sit;
struct rspamd_symbols_group *gr;
- struct rspamd_symbol_def *sym, *cur;
+ struct rspamd_symbol_def *sym;
+ struct metric *metric;
ucl_object_t *obj, *top, *sym_obj, *group_symbols;
gpointer k, v;
@@ -515,29 +516,33 @@ rspamd_controller_handle_symbols (struct rspamd_http_connection_entry *conn_ent,
top = ucl_object_typed_new (UCL_ARRAY);
- /* Go through all symbols groups */
- g_hash_table_iter_init (&it, session->ctx->cfg->symbols_groups);
+ /* Go through all symbols groups in the default metric */
+ metric = g_hash_table_lookup (session->ctx->cfg->metrics, DEFAULT_METRIC);
+ g_assert (metric != NULL);
+ g_hash_table_iter_init (&it, metric->groups);
+
while (g_hash_table_iter_next (&it, &k, &v)) {
gr = v;
obj = ucl_object_typed_new (UCL_OBJECT);
ucl_object_insert_key (obj, ucl_object_fromstring (
gr->name), "group", 0, false);
/* Iterate through all symbols */
- sym = gr->symbols;
+ g_hash_table_iter_init (&sit, gr->symbols);
group_symbols = ucl_object_typed_new (UCL_ARRAY);
- LL_FOREACH (sym, cur) {
+ while (g_hash_table_iter_next (&sit, &k, &v)) {
+ sym = v;
sym_obj = ucl_object_typed_new (UCL_OBJECT);
- ucl_object_insert_key (sym_obj, ucl_object_fromstring (cur->name),
+ ucl_object_insert_key (sym_obj, ucl_object_fromstring (sym->name),
"symbol", 0, false);
ucl_object_insert_key (sym_obj,
- ucl_object_fromdouble (*cur->weight_ptr),
+ ucl_object_fromdouble (*sym->weight_ptr),
"weight", 0, false);
- if (cur->description) {
+ if (sym->description) {
ucl_object_insert_key (sym_obj,
- ucl_object_fromstring (cur->description),
+ ucl_object_fromstring (sym->description),
"description", 0, false);
}