aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-17 20:30:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-17 20:30:22 +0100
commit6fdf4b3304a6101ceca3b53ae56307cb9d7147ae (patch)
tree002cce5d029a52a118b5f3a117e336e9ee195479
parentee09913d6f7a970ceaaeb243b1abd37be71d6fb5 (diff)
downloadrspamd-6fdf4b3304a6101ceca3b53ae56307cb9d7147ae.tar.gz
rspamd-6fdf4b3304a6101ceca3b53ae56307cb9d7147ae.zip
[Minor] Rework lists
-rw-r--r--lualib/lua_selectors.lua40
1 files changed, 8 insertions, 32 deletions
diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua
index d2723b630..960d15a24 100644
--- a/lualib/lua_selectors.lua
+++ b/lualib/lua_selectors.lua
@@ -164,14 +164,14 @@ local selectors = {
-- Get header with the name that is expected as an argument. Returns list of
-- headers with this name
['header'] = {
- ['type'] = 'header_list',
+ ['type'] = 'kv_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',
+ ['type'] = 'kv_list',
['get_value'] = function(task)
return task:get_received_headers()
end,
@@ -245,7 +245,7 @@ local transform_function = {
['first'] = {
['types'] = {
['url_list'] = true,
- ['header_list'] = true,
+ ['kv_list'] = true,
['received_list'] = true,
['string_list'] = true
},
@@ -258,8 +258,7 @@ local transform_function = {
['last'] = {
['types'] = {
['url_list'] = true,
- ['header_list'] = true,
- ['received_list'] = true,
+ ['kv_list'] = true,
['string_list'] = true
},
['process'] = function(inp, t)
@@ -271,8 +270,7 @@ local transform_function = {
['nth'] = {
['types'] = {
['url_list'] = true,
- ['header_list'] = true,
- ['received_list'] = true,
+ ['kv_list'] = true,
['string_list'] = true
},
['process'] = function(inp, t, args)
@@ -331,38 +329,16 @@ local transform_function = {
return inp:sub(start_pos, end_pos), 'string'
end
},
- -- Get header value
- ['hdr_value'] = {
- ['types'] = {
- ['header'] = true,
- },
- ['map_type'] = 'string',
- ['process'] = function(inp, _)
- return inp.value
- end
- },
- -- Get header raw value
- ['hdr_raw'] = {
- ['types'] = {
- ['header'] = true,
- },
- ['map_type'] = 'string',
- ['process'] = function(inp, _)
- return inp.raw
- end
- },
- -- Extracts table value from table
+ -- Extracts table value from key-value list
['elt'] = {
['types'] = {
- ['header'] = true,
- ['received'] = true,
+ ['kv_list'] = true,
},
- ['map_type'] = 'string',
['process'] = function(inp, t, args)
return inp[args[1]],'string'
end
},
- -- Get address
+ -- Call specific userdata method
['method'] = {
['types'] = {
['email'] = true,