sizeof ("soft reject") - 1) == 0) {
*result = METRIC_ACTION_NOACTION;
}
+ else if (g_ascii_strncasecmp (data, "accept",
+ sizeof ("accept") - 1) == 0) {
+ *result = METRIC_ACTION_NOACTION;
+ }
else {
return FALSE;
}
gpointer checkpoint; /**< Opaque checkpoint data */
struct {
- enum rspamd_metric_action action; /**< Action of pre filters */
+ guint32 action; /**< Action of pre filters */
gchar *str; /**< String describing action */
} pre_result; /**< Result of pre-filters */
* - `add header`: add spam header
* - `rewrite subject`: rewrite subject to spam subject
* - `greylist`: greylist message
+ * - `accept` or `no action`: whitelist message
* @param {rspamd_action or string} action a numeric or string action value
* @param {string} description optional descripton
@example
else if (lua_type (L, 2) == LUA_TSTRING) {
rspamd_action_from_str (lua_tostring (L, 2), &action);
}
- if (action < (gint)task->pre_result.action &&
- action < METRIC_ACTION_MAX &&
- action >= METRIC_ACTION_REJECT) {
+ if (action < METRIC_ACTION_MAX && action >= METRIC_ACTION_REJECT) {
/* We also need to set the default metric to that result */
mres = rspamd_create_metric_result (task, DEFAULT_METRIC);
if (mres != NULL) {
mres->score = mres->metric->actions[action].score;
mres->action = action;
}
+
task->pre_result.action = action;
+
if (lua_gettop (L) >= 3) {
action_str = rspamd_mempool_strdup (task->task_pool,
luaL_checkstring (L, 3));
msg_info_task ("<%s>: set pre-result to %s: '%s'",
task->message_id, rspamd_action_to_str (action),
task->pre_result.str);
+
+ /* Don't classify or filter message if pre-filter sets results */
+ task->processed_stages |= (RSPAMD_TASK_STAGE_FILTERS |
+ RSPAMD_TASK_STAGE_CLASSIFIERS |
+ RSPAMD_TASK_STAGE_CLASSIFIERS_PRE |
+ RSPAMD_TASK_STAGE_CLASSIFIERS_POST);
}
}
return 0;