aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-16 23:57:39 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-16 23:57:39 +0000
commit601bcf0e76ffd31291f21d99e7f8d4ca969b0791 (patch)
tree34fa63c34d76c73df307d2daf24bc4d7ddab0f50
parentbe7c52baebbc5134d57ec775ff789cb5fb8ab5b5 (diff)
downloadrspamd-601bcf0e76ffd31291f21d99e7f8d4ca969b0791.tar.gz
rspamd-601bcf0e76ffd31291f21d99e7f8d4ca969b0791.zip
Add other rules types.
-rw-r--r--src/plugins/lua/spamassassin.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua
index 2cc59ff6e..03387255b 100644
--- a/src/plugins/lua/spamassassin.lua
+++ b/src/plugins/lua/spamassassin.lua
@@ -153,6 +153,7 @@ _.each(function(k, r)
-- Subject for optimization
if (r['re']:match(rh['decoded'])) then
task:insert_result(k, 1.0)
+ return
end
end
end
@@ -165,4 +166,46 @@ _.each(function(k, r)
_.filter(function(k, r)
return r['type'] == 'header' and r['header']
end,
+ rules))
+
+-- Parts rules
+_.each(function(k, r)
+ local f = function(task)
+ local parts = task:get_parts()
+ if parts then
+ for n, part in ipairs(parts) do
+ -- Subject for optimization
+ if (r['re']:match(part:get_content())) then
+ task:insert_result(k, 1.0)
+ return
+ end
+ end
+ end
+ end
+ rspamd_config:register_symbol(k, 1.0, f)
+ if r['score'] then
+ rspamd_config:set_metric_symbol(k, r['score'], r['description'])
+ end
+ end,
+ _.filter(function(k, r)
+ return r['type'] == 'part'
+ end,
+ rules))
+
+-- Raw body rules
+_.each(function(k, r)
+ local f = function(task)
+ if (r['re']:match(task:get_content())) then
+ task:insert_result(k, 1.0)
+ return
+ end
+ end
+ rspamd_config:register_symbol(k, 1.0, f)
+ if r['score'] then
+ rspamd_config:set_metric_symbol(k, r['score'], r['description'])
+ end
+ end,
+ _.filter(function(k, r)
+ return r['type'] == 'message'
+ end,
rules)) \ No newline at end of file