From 661f634db96c2c049439b5bd7afae5af232c6ae7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 26 Apr 2017 17:13:10 +0100 Subject: [Rework] Remove multiple metrics support from Rspamd --- src/libmime/filter.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/libmime/filter.c') diff --git a/src/libmime/filter.c b/src/libmime/filter.c index 4a1b8bcbc..b16018507 100644 --- a/src/libmime/filter.c +++ b/src/libmime/filter.c @@ -26,19 +26,20 @@ #define COMMON_PART_FACTOR 95 struct rspamd_metric_result * -rspamd_create_metric_result (struct rspamd_task *task, const gchar *name) +rspamd_create_metric_result (struct rspamd_task *task) { struct rspamd_metric_result *metric_res; struct rspamd_metric *metric; guint i; - metric_res = g_hash_table_lookup (task->results, name); + metric_res = task->result; if (metric_res != NULL) { return metric_res; } - metric = g_hash_table_lookup (task->cfg->metrics, name); + metric = task->cfg->default_metric; + if (metric == NULL) { return NULL; } @@ -64,8 +65,6 @@ rspamd_create_metric_result (struct rspamd_task *task, const gchar *name) } metric_res->action = METRIC_ACTION_MAX; - g_hash_table_insert (task->results, (gpointer) metric->name, - metric_res); return metric_res; } @@ -108,7 +107,7 @@ insert_metric_result (struct rspamd_task *task, const ucl_object_t *mobj, *sobj; gint max_shots; - metric_res = rspamd_create_metric_result (task, metric->name); + metric_res = rspamd_create_metric_result (task); sdef = g_hash_table_lookup (metric->symbols, symbol); if (sdef == NULL) { -- cgit v1.2.3