From: Vsevolod Stakhov Date: Tue, 11 Dec 2018 20:05:25 +0000 (+0000) Subject: [Minor] Selectors: Add equal processor X-Git-Tag: 1.9.0~448 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3a6e16277b4580a03af56476b66df379818bec6;p=thirdparty%2Frspamd.git [Minor] Selectors: Add equal processor --- diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index cc137bddd8..8d68341b47 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -497,6 +497,22 @@ the second argument is optional hash type (`blake2`, `sha256`, `sha1`, `sha512`, ['description'] = 'Drops input value and return values from function\'s arguments or an empty string', ['args_schema'] = (ts.string + ts.array_of(ts.string)):is_optional() }, + ['equal'] = { + ['types'] = { + ['string'] = true, + }, + ['map_type'] = 'string', + ['process'] = function(inp, _, args) + if inp == args[1] then + return inp,'string' + end + + return nil + end, + ['description'] = [[Boolean function equal. +Returns either nil or its argument if input is equal to argument]], + ['args_schema'] = {ts.string} + }, -- Boolean function in, returns either nil or its input if input is in args list ['in'] = { ['types'] = {