diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-23 17:20:37 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-23 17:20:37 +0100 |
commit | ff8400a269f8aed9d2c9396a48f7daedde238452 (patch) | |
tree | d42263942a2c1fd9a8e4977c53bc3930c495afa1 /conf | |
parent | da58251a803c482fcf23ea4b24c4c9c834ac7695 (diff) | |
download | rspamd-ff8400a269f8aed9d2c9396a48f7daedde238452.tar.gz rspamd-ff8400a269f8aed9d2c9396a48f7daedde238452.zip |
Add improved version of R_EMPTY_IMAGE.
Diffstat (limited to 'conf')
-rw-r--r-- | conf/lua/html.lua | 23 | ||||
-rw-r--r-- | conf/lua/rspamd.lua | 16 |
2 files changed, 23 insertions, 16 deletions
diff --git a/conf/lua/html.lua b/conf/lua/html.lua index bd7abd987..161bbe3b5 100644 --- a/conf/lua/html.lua +++ b/conf/lua/html.lua @@ -15,6 +15,7 @@ local reconf = config['regexp'] local rspamd_regexp = require "rspamd_regexp" +local rspamd_logger = require "rspamd_logger" -- Messages that have only HTML part reconf['MIME_HTML_ONLY'] = 'has_only_html_part()' @@ -50,4 +51,26 @@ rspamd_config.HTML_SHORT_LINK_IMG_2 = function(task) end rspamd_config.HTML_SHORT_LINK_IMG_3 = function(task) return check_html_image(task, 1536, 2048) +end +rspamd_config.R_EMPTY_IMAGE = function(task) + local tp = task:get_text_parts() + + for _,p in ipairs(tp) do + if p:is_html() then + local hc = p:get_html() + local lines = p:get_lines_count() + + if lines < 5 then + local images = hc:get_images() + + if images then + for _,i in ipairs(images) do + if i['height'] + i['width'] >= 400 then + return true + end + end + end + end + end + end end
\ No newline at end of file diff --git a/conf/lua/rspamd.lua b/conf/lua/rspamd.lua index bb1709c69..ce2edd2b3 100644 --- a/conf/lua/rspamd.lua +++ b/conf/lua/rspamd.lua @@ -62,22 +62,6 @@ rspamd_config.R_PARTS_DIFFER = function(task) return false end -rspamd_config.R_EMPTY_IMAGE = function (task) - parts = task:get_text_parts() - if parts then - for _,part in ipairs(parts) do - if part:is_empty() then - images = task:get_images() - if images then - return true - end - return false - end - end - end - return false -end - -- Date issues rspamd_config.MISSING_DATE = function(task) if rspamd_config:get_api_version() >= 5 then |