struct metric_action *action)
{
const ucl_object_t *act, *sact;
+ const gchar *act_name;
double score;
if (metric) {
act = ucl_object_find_key (metric, "actions");
if (act) {
- sact = ucl_object_find_key (act, rspamd_action_to_str (action->action));
+ act_name = rspamd_action_to_str (action->action);
+ sact = ucl_object_find_key (act, act_name);
if (sact != NULL && ucl_object_todouble_safe (sact, &score)) {
+ msg_debug ("found override score %.2f for action %s in settings",
+ score, act_name);
return score;
}
}
for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i++) {
c->actions[i].score = -1.0;
+ c->actions[i].action = i;
}
c->subject = SPAM_SUBJECT;
gchar action_char;
m = mres->metric;
+ mres->action = rspamd_check_action_metric (task, mres->score,
+ &required_score, m);
- /* XXX: handle settings */
- if (mres->action == METRIC_ACTION_MAX) {
- mres->action = rspamd_check_action_metric (task, mres->score,
- &required_score, m);
- }
- else {
- required_score = mres->metric->actions[mres->action].score;
- }
action = mres->action;
is_spam = (action == METRIC_ACTION_REJECT);