aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-29 09:59:11 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-29 09:59:11 +0100
commit365d60218dac672472b0405a088e06394a1a371c (patch)
treec589ce79391faf60511c286b691da0380fa48cec /src/libmime
parent54781dd54db908d90b7d1e4acee46c89cbd6aeb0 (diff)
downloadrspamd-365d60218dac672472b0405a088e06394a1a371c.tar.gz
rspamd-365d60218dac672472b0405a088e06394a1a371c.zip
[Feature] Store actions limits in metric result
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/filter.c7
-rw-r--r--src/libmime/filter.h5
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libmime/filter.c b/src/libmime/filter.c
index cc34fcb0c..f5c819821 100644
--- a/src/libmime/filter.c
+++ b/src/libmime/filter.c
@@ -29,6 +29,7 @@ rspamd_create_metric_result (struct rspamd_task *task, const gchar *name)
{
struct metric_result *metric_res;
struct metric *metric;
+ guint i;
metric_res = g_hash_table_lookup (task->results, name);
@@ -53,12 +54,16 @@ rspamd_create_metric_result (struct rspamd_task *task, const gchar *name)
rspamd_mempool_add_destructor (task->task_pool,
(rspamd_mempool_destruct_t) g_hash_table_unref,
metric_res->sym_groups);
- metric_res->checked = FALSE;
metric_res->metric = metric;
metric_res->grow_factor = 0;
metric_res->score = 0;
g_hash_table_insert (task->results, (gpointer) metric->name,
metric_res);
+
+ for (i = 0; i < METRIC_ACTION_MAX; i++) {
+ metric_res->actions_limits[i] = metric->actions[i].score;
+ }
+
metric_res->action = METRIC_ACTION_MAX;
return metric_res;
diff --git a/src/libmime/filter.h b/src/libmime/filter.h
index bacbede06..6bb0ef4e9 100644
--- a/src/libmime/filter.h
+++ b/src/libmime/filter.h
@@ -30,12 +30,11 @@ struct symbol {
struct metric_result {
struct metric *metric; /**< pointer to metric structure */
double score; /**< total score */
- double required_score; /**< real required score */
double grow_factor; /**< current grow factor */
GHashTable *symbols; /**< symbols of metric */
GHashTable *sym_groups; /**< groups of symbols */
- gboolean checked; /**< whether metric result is consolidated */
- enum rspamd_metric_action action; /**< the current action */
+ gdouble actions_limits[METRIC_ACTION_MAX]; /**< set of actions for this metric */
+ enum rspamd_metric_action action; /**< the current action */
};
/**