aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-17 20:25:15 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-17 20:25:15 +0100
commitee09913d6f7a970ceaaeb243b1abd37be71d6fb5 (patch)
tree3da5a800c0c3709e86bb9bb27d47a0025e07f11e /lualib
parent6c52111a871f4245c0ec1972591ad525da65af2f (diff)
downloadrspamd-ee09913d6f7a970ceaaeb243b1abd37be71d6fb5.tar.gz
rspamd-ee09913d6f7a970ceaaeb243b1abd37be71d6fb5.zip
[Minor] Add mempool selector
Diffstat (limited to 'lualib')
-rw-r--r--lualib/lua_selectors.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua
index 4a5845974..d2723b630 100644
--- a/lualib/lua_selectors.lua
+++ b/lualib/lua_selectors.lua
@@ -32,6 +32,7 @@ local M = "lua_selectors"
local E = {}
local selectors = {
+ -- Get source IP address
['ip'] = {
['type'] = 'ip',
['get_value'] = function(task)
@@ -40,6 +41,7 @@ local selectors = {
return nil
end,
},
+ -- Get SMTP from
['smtp_from'] = {
['type'] = 'email',
['get_value'] = function(task)
@@ -50,6 +52,7 @@ local selectors = {
return nil
end,
},
+ -- Get MIME from
['mime_from'] = {
['type'] = 'email',
['get_value'] = function(task)
@@ -60,6 +63,7 @@ local selectors = {
return nil
end,
},
+ -- Get country (ASN module must be executed first)
['country'] = {
['type'] = 'string',
['get_value'] = function(task)
@@ -71,6 +75,7 @@ local selectors = {
end
end,
},
+ -- Get ASN number
['asn'] = {
['type'] = 'string',
['get_value'] = function(task)
@@ -82,6 +87,7 @@ local selectors = {
end
end,
},
+ -- Get authenticated username
['user'] = {
['type'] = 'string',
['get_value'] = function(task)
@@ -93,18 +99,21 @@ local selectors = {
end
end,
},
+ -- Get principal recipient
['to'] = {
['type'] = 'email',
['get_value'] = function(task)
return task:get_principal_recipient()
end,
},
+ -- Get content digest
['digest'] = {
['type'] = 'string',
['get_value'] = function(task)
return task:get_digest()
end,
},
+ -- Get list of all attachments digests
['attachments'] = {
['type'] = 'string_list',
['get_value'] = function(task)
@@ -124,6 +133,7 @@ local selectors = {
return nil
end,
},
+ -- Get all attachments files
['files'] = {
['type'] = 'string_list',
['get_value'] = function(task)
@@ -144,35 +154,49 @@ local selectors = {
return nil
end,
},
+ -- Get helo value
['helo'] = {
['type'] = 'string',
['get_value'] = function(task)
return task:get_helo()
end,
},
+ -- Get header with the name that is expected as an argument. Returns list of
+ -- headers with this name
['header'] = {
['type'] = 'header_list',
['get_value'] = function(task, args)
return task:get_header_full(args[1])
end,
},
+ -- Get list of received headers (returns list of tables)
['received'] = {
['type'] = 'received_list',
['get_value'] = function(task)
return task:get_received_headers()
end,
},
+ -- Get all urls
['urls'] = {
['type'] = 'url_list',
['get_value'] = function(task)
return task:get_urls()
end,
},
+ -- Get all emails
['emails'] = {
['type'] = 'url_list',
['get_value'] = function(task)
return task:get_emails()
end,
+ },
+ -- Get specific pool var. The first argument must be variable name,
+ -- the second argument is optional and defines the type (string by default)
+ ['pool_var'] = {
+ ['type'] = 'string',
+ ['get_value'] = function(task, _, args)
+ return task:get_mempool():get_variable(args[1], args[2])
+ end,
}
}