aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-29 19:28:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-29 19:28:38 +0100
commit99c56f1eeacc33404f14f8d47da60606d1efa7d5 (patch)
tree430350a6b0d71918760fabe83ba6c75cd6ffdcf9 /lualib
parent0e2d605055462751b63b26b5f3809fcc3a020b10 (diff)
downloadrspamd-99c56f1eeacc33404f14f8d47da60606d1efa7d5.tar.gz
rspamd-99c56f1eeacc33404f14f8d47da60606d1efa7d5.zip
[Minor] Fix various issues
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_util.lua20
1 files changed, 11 insertions, 9 deletions
diff --git a/lualib/lua_util.lua b/lualib/lua_util.lua
index 457c2f7b2..8da8d2341 100644
--- a/lualib/lua_util.lua
+++ b/lualib/lua_util.lua
@@ -2,7 +2,7 @@ local exports = {}
local lpeg = require 'lpeg'
local split_grammar = {}
-exports.rspamd_str_split = function(s, sep)
+local function rspamd_str_split(s, sep)
local gr = split_grammar[sep]
if not gr then
@@ -16,6 +16,8 @@ exports.rspamd_str_split = function(s, sep)
return gr:match(s)
end
+exports.rspamd_str_split = rspamd_str_split
+
local space = lpeg.S' \t\n\v\f\r'
local nospace = 1 - space
local ptrim = space^0 * lpeg.C((space^0 * nospace^1)^0)
@@ -40,7 +42,7 @@ exports.template = function(tmpl, keys)
return lpeg.match(template_grammar, tmpl)
end
-exports.remove_email_aliases = function(addr)
+exports.remove_email_aliases = function(email_addr)
local function check_gmail_user(addr)
-- Remove all points
local no_dots_user = string.gsub(addr.user, '.', '')
@@ -96,7 +98,7 @@ exports.remove_email_aliases = function(addr)
return nil
end
- local function check_gmail(addr)
+ local function check_googlemail(addr)
local nd = 'gmail.com'
local nu, tags = check_gmail_user(addr)
@@ -112,18 +114,18 @@ exports.remove_email_aliases = function(addr)
['googlemail.com'] = check_googlemail,
}
- if addr then
- if addr.domain and specific_domains[addr.domain] then
- local nu, tags, nd = specific_domains[addr.domain](addr)
+ if email_addr then
+ if email_addr.domain and specific_domains[email_addr.domain] then
+ local nu, tags, nd = specific_domains[email_addr.domain](email_addr)
if nu or nd then
- set_addr(addr, nu, nd)
+ set_addr(email_addr, nu, nd)
return nu, tags
end
else
- local nu, tags, nd = check_address(addr)
+ local nu, tags, nd = check_address(email_addr)
if nu or nd then
- set_addr(addr, nu, nd)
+ set_addr(email_addr, nu, nd)
return nu, tags
end