struct rspamd_action *action, *selected_action = NULL;
double max_score = -(G_MAXDOUBLE), sc;
int i;
+ gboolean set_action = FALSE;
+ if (task->processed_stages | (RSPAMD_TASK_STAGE_DONE|RSPAMD_TASK_STAGE_IDEMPOTENT)) {
+ if (mres->action != METRIC_ACTION_MAX) {
+ return mres->action;
+ }
+
+ set_action = TRUE;
+ }
+
+ /* We are not certain about the results during processing */
if (task->pre_result.action == METRIC_ACTION_MAX) {
for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i++) {
action = &task->cfg->actions[i];
}
if (selected_action) {
+ if (set_action) {
+ mres->action = selected_action->action;
+ }
+
return selected_action->action;
}
if (metric_res != NULL) {
- if (metric_res->action != METRIC_ACTION_MAX) {
- action = metric_res->action;
- }
- else {
- action = rspamd_check_action_metric (task, metric_res);
- }
+ action = rspamd_check_action_metric (task, metric_res);
if (action == METRIC_ACTION_SOFT_REJECT &&
(task->flags & RSPAMD_TASK_FLAG_GREYLISTED)) {
}
else {
row->score = metric_res->score;
- row->action = metric_res->action;
+ row->action = rspamd_check_action_metric (task, metric_res);
row->required_score = rspamd_task_get_required_score (task, metric_res);
cbdata.pos = row->symbols;
cbdata.remain = sizeof (row->symbols);
guint i, j;
mres = task->result;
+ rspamd_check_action_metric (task, mres);
if (mres != NULL) {
switch (lf->type) {
mres = task->result;
if (mres) {
-
- mres->action = rspamd_check_action_metric (task, mres);
-
if (mres->score > rspamd_task_get_required_score (task, mres)) {
task->flags |= RSPAMD_TASK_FLAG_LEARN_SPAM;