From: Vsevolod Stakhov Date: Fri, 13 May 2011 14:05:04 +0000 (+0400) Subject: Add log message about action from settings X-Git-Tag: 0.3.13~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=04d82cf8b4d82aa979138d97fa4293534d04812e;p=rspamd.git Add log message about action from settings --- diff --git a/src/settings.c b/src/settings.c index 8899bc305..2f3dd85be 100644 --- a/src/settings.c +++ b/src/settings.c @@ -443,10 +443,10 @@ check_metric_settings (struct worker_task * task, struct metric * metric, double /* First look in user white list */ if (check_bwhitelist(task, us, &black)) { if (black) { - *score = DEFAULT_REJECT_SCORE; + *score = -DEFAULT_REJECT_SCORE; } else { - *score = 0; + *score = DEFAULT_REJECT_SCORE; } return TRUE; } @@ -493,10 +493,11 @@ gboolean check_metric_action_settings (struct worker_task *task, struct metric *metric, double score, enum rspamd_metric_action *result) { struct rspamd_settings *us = NULL, *ds = NULL; - struct metric_action *act; + struct metric_action *act, *sel = NULL; GList *cur; enum rspamd_metric_action res = METRIC_ACTION_NOACTION; gboolean black; + double rej = 0.; if (check_setting (task, &us, &ds)) { if (us != NULL) { @@ -516,6 +517,10 @@ check_metric_action_settings (struct worker_task *task, struct metric *metric, d act = cur->data; if (score >= act->score) { res = act->action; + sel = act; + } + if (res == METRIC_ACTION_REJECT) { + rej = act->score; } cur = g_list_next (cur); } @@ -537,6 +542,7 @@ check_metric_action_settings (struct worker_task *task, struct metric *metric, d act = cur->data; if (score >= act->score) { res = act->action; + sel = act; } cur = g_list_next (cur); } @@ -544,8 +550,16 @@ check_metric_action_settings (struct worker_task *task, struct metric *metric, d } } - if (res != METRIC_ACTION_NOACTION && result != NULL) { + if (sel != NULL && result != NULL) { *result = res; + if (res != rej && rej != 0.) { + msg_info ("<%s> applying action %s with score %.2f, reject: %.2f", task->message_id, + str_action_metric (sel->action), sel->score, rej); + } + else { + msg_info ("<%s> applying action %s with score %.2f", task->message_id, + str_action_metric (sel->action), sel->score); + } return TRUE; }