aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/lua_selectors/transforms.lua
diff options
context:
space:
mode:
authorrm-minus-rf <rm.minus.rf@protonmail.com>2020-04-17 07:43:56 +0200
committerrm-minus-rf <rm.minus.rf@protonmail.com>2020-04-17 07:43:56 +0200
commit834279171c3ec8c8a355a9e438f07a06f5b16325 (patch)
tree789362c07329ded6f584d9f214c368551d1e10d8 /lualib/lua_selectors/transforms.lua
parent0d13c724df534012de7e41c5d5b743a7d9314431 (diff)
downloadrspamd-834279171c3ec8c8a355a9e438f07a06f5b16325.tar.gz
rspamd-834279171c3ec8c8a355a9e438f07a06f5b16325.zip
[Feature] add queueid, uid, messageid and specific symbols to selectors
[Minor] use only selectors to fill vars in force_actions message
Diffstat (limited to 'lualib/lua_selectors/transforms.lua')
-rw-r--r--lualib/lua_selectors/transforms.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/lualib/lua_selectors/transforms.lua b/lualib/lua_selectors/transforms.lua
index b0c912deb..be896126d 100644
--- a/lualib/lua_selectors/transforms.lua
+++ b/lualib/lua_selectors/transforms.lua
@@ -413,8 +413,20 @@ Empty string comes the first argument or 'true', non-empty string comes nil]],
['args_schema'] = {(ts.number + ts.string / tonumber),
(ts.number + ts.string / tonumber):is_optional()}
},
+ -- Returns the string with all non ascii chars replaced
+ ['to_ascii'] = {
+ ['types'] = {
+ ['string'] = true,
+ },
+ ['map_type'] = 'string',
+ ['process'] = function(inp, _)
+ return string.gsub(inp, '[\128-\255]', '?'), 'string'
+ end,
+ ['description'] = 'Returns the string with all non-ascii bytes replaced with `?`',
+ },
+
}
transform_function.match = transform_function.regexp
-return transform_function \ No newline at end of file
+return transform_function