aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2022-10-22 21:50:04 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2022-10-22 21:50:04 +0100
commite28a3436d668c1f7d9f75b28741cc4db9651c497 (patch)
treee46c84bb8d85e037a2872e8db68b52e087ae1ff6 /src
parentfffeb9ff378e41e1b7c7bfb9fb4215261fd3c636 (diff)
downloadrspamd-e28a3436d668c1f7d9f75b28741cc4db9651c497.tar.gz
rspamd-e28a3436d668c1f7d9f75b28741cc4db9651c497.zip
[Feature] Milter_headers: Add `x-rspamd-action` routine
Include it into `extended_spam_headers` as well
Diffstat (limited to 'src')
-rw-r--r--src/plugins/lua/milter_headers.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/plugins/lua/milter_headers.lua b/src/plugins/lua/milter_headers.lua
index a8be5ef37..1c35f89b4 100644
--- a/src/plugins/lua/milter_headers.lua
+++ b/src/plugins/lua/milter_headers.lua
@@ -71,6 +71,10 @@ local settings = {
header = 'X-Rspamd-Pre-Result',
remove = 0,
},
+ ['x-rspamd-action'] = {
+ header = 'X-Rspamd-Action',
+ remove = 0,
+ },
['remove-spam-flag'] = {
header = 'X-Spam',
},
@@ -352,6 +356,19 @@ local function milter_headers(task)
add[local_mod.header] = string.rep(local_mod.char, math.floor(score))
end
+ routines['x-rspamd-action'] = function()
+ local local_mod = settings.routines['x-rspamd-action']
+ if skip_wanted('x-rspamd-action') then return end
+ if not common['metric_action'] then
+ common['metric_action'] = task:get_metric_score()
+ end
+ local action = common['metric_action']
+ if local_mod.remove then
+ remove[local_mod.header] = local_mod.remove
+ end
+ add[local_mod.header] = action
+ end
+
local function spam_header (class, name, value, remove_v)
if skip_wanted(class) then return end
if not common['metric_action'] then
@@ -631,6 +648,7 @@ if opts.extended_spam_headers then
activate_routine('x-spamd-result')
activate_routine('x-rspamd-server')
activate_routine('x-rspamd-queue-id')
+ activate_routine('x-rspamd-action')
end
if opts.local_headers then