diff options
Diffstat (limited to 'src/lua/lua_common.c')
-rw-r--r-- | src/lua/lua_common.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 15e26beda..f61fa6d0b 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -37,6 +37,7 @@ LUA_FUNCTION_DEF (worker, get_name); LUA_FUNCTION_DEF (worker, get_stat); LUA_FUNCTION_DEF (worker, get_index); LUA_FUNCTION_DEF (worker, get_pid); +LUA_FUNCTION_DEF (worker, is_scanner); LUA_FUNCTION_DEF (worker, spawn_process); const luaL_reg worker_reg[] = { @@ -45,6 +46,7 @@ const luaL_reg worker_reg[] = { LUA_INTERFACE_DEF (worker, get_index), LUA_INTERFACE_DEF (worker, get_pid), LUA_INTERFACE_DEF (worker, spawn_process), + LUA_INTERFACE_DEF (worker, is_scanner), {"__tostring", rspamd_lua_class_tostring}, {NULL, NULL} }; @@ -1431,6 +1433,22 @@ lua_worker_get_pid (lua_State *L) return 1; } + +static gint +lua_worker_is_scanner (lua_State *L) +{ + struct rspamd_worker *w = lua_check_worker (L, 1); + + if (w) { + lua_pushboolean (L, rspamd_worker_is_scanner (w)); + } + else { + return luaL_error (L, "invalid arguments"); + } + + return 1; +} + struct rspamd_lua_process_cbdata { gint sp[2]; gint func_cbref; |