aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/spamassassin.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-23 14:04:02 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-11-23 14:04:02 +0000
commit078737808ddbde4ef3d7dde9f64c289718bdd662 (patch)
tree34e328aff6eed2f0e985d5e283abc9f6e7a10866 /src/plugins/lua/spamassassin.lua
parent3e3b6e8185b8e19794e7dbd2515f60e2bbc81983 (diff)
downloadrspamd-078737808ddbde4ef3d7dde9f64c289718bdd662.tar.gz
rspamd-078737808ddbde4ef3d7dde9f64c289718bdd662.zip
Add check_for_mime('mime_attachement') function
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r--src/plugins/lua/spamassassin.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 7f5376019..fd1d62854 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -291,6 +291,29 @@ local function gen_eval_rule(arg)
return 0
end
},
+ {
+ 'check_for_mime',
+ function(task, remain)
+ local arg = string.match(remain, "^%(%s*['\"]([^%s]+)['\"]%s*%)$")
+
+ if arg then
+ if arg == 'mime_attachment' then
+ local parts = task:get_parts()
+ if parts then
+ for i,p in ipairs(parts) do
+ if p:get_filename() then
+ return 1
+ end
+ end
+ end
+ else
+ rspamd_logger.infox(task, 'unimplemented mime check %1', arg)
+ end
+ end
+
+ return 0
+ end
+ }
}
for k,f in ipairs(eval_funcs) do