浏览代码

Rework R_PARTS_DIFFER rule.

tags/1.0.0
Vsevolod Stakhov 9 年前
父节点
当前提交
c9ed268e92
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17
    1
      conf/lua/rspamd.lua

+ 17
- 1
conf/lua/rspamd.lua 查看文件

dofile('regexp/drugs.lua') dofile('regexp/drugs.lua')


local reconf = config['regexp'] local reconf = config['regexp']
local util = require "rspamd_util"


-- Uncategorized rules -- Uncategorized rules


reconf['R_FLASH_REDIR_IMGSHACK'] = '/^(?:http:\\/\\/)?img\\d{1,5}\\.imageshack\\.us\\/\\S+\\.swf/U' reconf['R_FLASH_REDIR_IMGSHACK'] = '/^(?:http:\\/\\/)?img\\d{1,5}\\.imageshack\\.us\\/\\S+\\.swf/U'


-- Different text parts -- Different text parts
reconf['R_PARTS_DIFFER'] = 'compare_parts_distance(50)';
reconf['R_PARTS_DIFFER'] = function(task)
local distance = task:get_mempool():get_variable('parts_distance', 'int')
if distance then
print(distance)
local nd = tonumber(distance)
if nd < 50 then
local score = 1 - util.tanh(nd / 100.0)
task:insert_result('R_PARTS_DIFFER', score, tostring(nd) .. '%')
end
end
return false
end


rspamd_config.R_EMPTY_IMAGE = function (task) rspamd_config.R_EMPTY_IMAGE = function (task)
parts = task:get_text_parts() parts = task:get_text_parts()

正在加载...
取消
保存