From 64e533b717c1a426c69a20f2a938271013e5a39e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 7 Dec 2015 11:31:28 +0000 Subject: [PATCH] Add support of 'special' SA headers to 'exists' function --- src/plugins/lua/spamassassin.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index ea2f954771..39dd5cd8c3 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -376,8 +376,23 @@ local function maybe_parse_sa_function(line) local substitutions = { {'^exists:', function(task) -- filter - if task:get_header(arg) then - return 1 + local hdrs_check = {} + if arg == 'MESSAGEID' then + hdrs_check = { + 'Message-ID', + 'X-Message-ID', + 'Resent-Message-ID' + } + elseif arg == 'ToCc' then + hdrs_check = { 'To', 'Cc', 'Bcc' } + else + hdrs_check = {arg} + end + + for i,h in ipairs(hdrs_check) do + if task:get_header(h) then + return 1 + end end return 0 end, -- 2.47.3