diff options
author | Andrew Lewis <nerf@judo.za.org> | 2016-07-19 12:32:38 +0100 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2016-07-19 12:32:38 +0100 |
commit | cd276d1a7dba5a8dc0d1f38896c244de62f60479 (patch) | |
tree | 1d08925fe6c2c39f300ab4e6a320c835a07fe451 /src/plugins/lua/spamassassin.lua | |
parent | e1e2c7f0b69adfdaa5e36aebb3f1b607e4f6f62a (diff) | |
download | rspamd-cd276d1a7dba5a8dc0d1f38896c244de62f60479.tar.gz rspamd-cd276d1a7dba5a8dc0d1f38896c244de62f60479.zip |
[Minor] SpamAssassin: Import fun.lua into main namespace
Diffstat (limited to 'src/plugins/lua/spamassassin.lua')
-rw-r--r-- | src/plugins/lua/spamassassin.lua | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/plugins/lua/spamassassin.lua b/src/plugins/lua/spamassassin.lua index 07868b789..3cf345b2b 100644 --- a/src/plugins/lua/spamassassin.lua +++ b/src/plugins/lua/spamassassin.lua @@ -23,7 +23,7 @@ local rspamd_expression = require "rspamd_expression" local rspamd_mempool = require "rspamd_mempool" local rspamd_trie = require "rspamd_trie" local util = require "rspamd_util" -local _ = require "fun" +require "fun" () --local dumper = require 'pl.pretty'.dump @@ -189,7 +189,7 @@ local function handle_header_def(hline, cur_rule) ordinary = false end - _.each(function(func) + each(function(func) if func == 'addr' then cur_param['function'] = function(str) local addr_parsed = util.parse_addr(str) @@ -226,7 +226,7 @@ local function handle_header_def(hline, cur_rule) rspamd_logger.warnx(rspamd_config, 'Function %1 is not supported in %2', func, cur_rule['symbol']) end - end, _.tail(args)) + end, tail(args)) local function split_hdr_param(param, headers) for i,h in ipairs(headers) do @@ -553,11 +553,11 @@ local function maybe_parse_sa_function(line) end local function words_to_re(words, start) - return table.concat(_.totable(_.drop_n(start, words)), " "); + return table.concat(totable(drop_n(start, words)), " "); end local function process_tflags(rule, flags) - _.each(function(flag) + each(function(flag) if flag == 'publish' then rule['publish'] = true elseif flag == 'multiple' then @@ -567,7 +567,7 @@ local function process_tflags(rule, flags) elseif flag == 'nice' then rule['nice'] = true end - end, _.drop_n(1, flags)) + end, drop_n(1, flags)) if rule['re'] then if rule['maxhits'] then @@ -654,7 +654,7 @@ local function process_sa_conf(f) if string.match(l, '^ifplugin') then local ls = split(l) - if not _.any(function(pl) + if not any(function(pl) if pl == ls[2] then return true end return false end, known_plugins) then @@ -663,7 +663,7 @@ local function process_sa_conf(f) end elseif string.match(l, '^if !plugin%(') then local pname = string.match(l, '^if !plugin%(([A-Za-z:]+)%)') - if _.any(function(pl) + if any(function(pl) if pl == pname then return true end return false end, known_plugins) then @@ -680,11 +680,11 @@ local function process_sa_conf(f) local slash = string.find(l, '/') -- Skip comments - words = _.totable(_.take_while( + words = totable(take_while( function(w) return string.sub(w, 1, 1) ~= '#' end, - _.filter(function(w) + filter(function(w) return w ~= "" end, - _.iter(split(l))))) + iter(split(l))))) if words[1] == "header" or words[1] == 'mimeheader' then -- header SYMBOL Header ~= /regexp/ @@ -93 |