diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-17 11:22:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-09-17 11:22:29 +0100 |
commit | 954727f41c7ed5449206f035d4015d30b6c92f13 (patch) | |
tree | 574986510bdee81c9551ab1e46a11bd8d1199615 /src/lua | |
parent | aab027ac0e5f42ea76587e06476296c9f10a2d9f (diff) | |
download | rspamd-954727f41c7ed5449206f035d4015d30b6c92f13.tar.gz rspamd-954727f41c7ed5449206f035d4015d30b6c92f13.zip |
[Minor] Allow to set custom delimiter for regexp selectors
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_config.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index e989bb77f..ccf614300 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -3594,10 +3594,15 @@ lua_config_register_re_selector (lua_State *L) struct rspamd_config *cfg = lua_check_config (L, 1); const gchar *name = luaL_checkstring (L, 2); const gchar *selector_str = luaL_checkstring (L, 3); + const gchar *delimiter = ""; gint top = lua_gettop (L); bool res = false; if (cfg && name && selector_str) { + if (lua_gettop (L) >= 4) { + delimiter = luaL_checkstring (L, 4); + } + if (luaL_dostring (L, "return require \"lua_selectors\"") != 0) { msg_warn_config ("cannot require lua_selectors: %s", lua_tostring (L, -1)); @@ -3632,8 +3637,9 @@ lua_config_register_re_selector (lua_State *L) rspamd_lua_setclass (L, "rspamd{config}", -1); *pcfg = cfg; lua_pushstring (L, selector_str); + lua_pushstring (L, delimiter); - if ((ret = lua_pcall (L, 2, 1, err_idx)) != 0) { + if ((ret = lua_pcall (L, 3, 1, err_idx)) != 0) { tb = lua_touserdata (L, -1); msg_err_config ("call to create_selector_closure lua " "script failed (%d): %v", ret, tb); |