/* 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;
}
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) {
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);
}
act = cur->data;
if (score >= act->score) {
res = act->action;
+ sel = act;
}
cur = g_list_next (cur);
}
}
}
- 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;
}