Browse Source

Add improved version of R_EMPTY_IMAGE.

tags/1.0.0
Vsevolod Stakhov 8 years ago
parent
commit
ff8400a269
2 changed files with 23 additions and 16 deletions
  1. 23
    0
      conf/lua/html.lua
  2. 0
    16
      conf/lua/rspamd.lua

+ 23
- 0
conf/lua/html.lua View File

@@ -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

+ 0
- 16
conf/lua/rspamd.lua View File

@@ -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

Loading…
Cancel
Save