diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-26 17:13:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-04-26 19:48:30 +0100 |
commit | 661f634db96c2c049439b5bd7afae5af232c6ae7 (patch) | |
tree | 5cf6992b9afb0eb14324daf20c0df022aa982fd5 /src/libmime | |
parent | 1ca24ef40609f571241fc18151d8c8cc7ef02e78 (diff) | |
download | rspamd-661f634db96c2c049439b5bd7afae5af232c6ae7.tar.gz rspamd-661f634db96c2c049439b5bd7afae5af232c6ae7.zip |
[Rework] Remove multiple metrics support from Rspamd
Diffstat (limited to 'src/libmime')
-rw-r--r-- | src/libmime/filter.c | 11 | ||||
-rw-r--r-- | src/libmime/filter.h | 4 | ||||
-rw-r--r-- | src/libmime/message.c | 2 |
3 files changed, 7 insertions, 10 deletions
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) { diff --git a/src/libmime/filter.h b/src/libmime/filter.h index 3d8fa38a8..49904962f 100644 --- a/src/libmime/filter.h +++ b/src/libmime/filter.h @@ -47,11 +47,9 @@ struct rspamd_metric_result { /** * Create or return existing result for the specified metric name * @param task task object - * @param name name of metric * @return metric result or NULL if metric `name` has not been found */ -struct rspamd_metric_result * rspamd_create_metric_result (struct rspamd_task *task, - const gchar *name); +struct rspamd_metric_result * rspamd_create_metric_result (struct rspamd_task *task); /** * Insert a result to task diff --git a/src/libmime/message.c b/src/libmime/message.c index 0094afc6b..15483f089 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -544,7 +544,7 @@ rspamd_message_process_text_part (struct rspamd_task *task, if (rspamd_check_gtube (task, text_part)) { struct rspamd_metric_result *mres; - mres = rspamd_create_metric_result (task, DEFAULT_METRIC); + mres = rspamd_create_metric_result (task); if (mres != NULL) { mres->score = rspamd_task_get_required_score (task, mres); |