From 7b6227cfaa3b5b4273e6841c8d5811514fff28e2 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 7 Jan 2019 16:08:37 +0000 Subject: [Minor] Core: Allow to pass flags to squeezed rules --- src/lua/lua_config.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/lua/lua_config.c') diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index cc0ba7aed..31d4af79b 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -1278,8 +1278,27 @@ rspamd_register_symbol_fromlua (lua_State *L, /* Push function reference */ lua_rawgeti (L, LUA_REGISTRYINDEX, ref); + /* Flags */ + lua_createtable (L, 0, 0); + + if (type & SYMBOL_TYPE_MIME_ONLY) { + lua_pushstring (L, "mime"); + lua_pushboolean (L, true); + lua_settable (L, -3); + } + if (type & SYMBOL_TYPE_FINE) { + lua_pushstring (L, "fine"); + lua_pushboolean (L, true); + lua_settable (L, -3); + } + if (type & SYMBOL_TYPE_NOSTAT) { + lua_pushstring (L, "nostat"); + lua_pushboolean (L, true); + lua_settable (L, -3); + } + /* Now call for squeeze function */ - if (lua_pcall (L, 2, 1, err_idx) != 0) { + if (lua_pcall (L, 3, 1, err_idx) != 0) { GString *tb = lua_touserdata (L, -1); msg_err_config ("call to squeeze_rule failed: %v", tb); -- cgit v1.2.3