aboutsummaryrefslogtreecommitdiffstats
path: root/src/settings.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-05-13 18:05:04 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-05-13 18:05:04 +0400
commit04d82cf8b4d82aa979138d97fa4293534d04812e (patch)
tree2a1bc187240506718b22eeda4683505d618db464 /src/settings.c
parent80d1d00d44654516875b937bc0ce7931dc3e407c (diff)
downloadrspamd-04d82cf8b4d82aa979138d97fa4293534d04812e.tar.gz
rspamd-04d82cf8b4d82aa979138d97fa4293534d04812e.zip
Add log message about action from settings
Diffstat (limited to 'src/settings.c')
-rw-r--r--src/settings.c22
1 files changed, 18 insertions, 4 deletions
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;
}