diff options
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r-- | src/lua/lua_task.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 2ab56b29c..0931eb13c 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -57,6 +57,7 @@ LUA_FUNCTION_DEF (task, resolve_dns_txt); LUA_FUNCTION_DEF (task, call_rspamd_function); LUA_FUNCTION_DEF (task, get_recipients); LUA_FUNCTION_DEF (task, get_from); +LUA_FUNCTION_DEF (task, get_user); LUA_FUNCTION_DEF (task, get_recipients_headers); LUA_FUNCTION_DEF (task, get_from_headers); LUA_FUNCTION_DEF (task, get_from_ip); @@ -86,6 +87,7 @@ static const struct luaL_reg tasklib_m[] = { LUA_INTERFACE_DEF (task, call_rspamd_function), LUA_INTERFACE_DEF (task, get_recipients), LUA_INTERFACE_DEF (task, get_from), + LUA_INTERFACE_DEF (task, get_user), LUA_INTERFACE_DEF (task, get_recipients_headers), LUA_INTERFACE_DEF (task, get_from_headers), LUA_INTERFACE_DEF (task, get_from_ip), @@ -833,6 +835,20 @@ lua_task_get_from (lua_State *L) return 1; } +static gint +lua_task_get_user (lua_State *L) +{ + struct worker_task *task = lua_check_task (L); + + if (task && task->user != NULL) { + lua_pushstring (L, task->user); + return 1; + } + + lua_pushnil (L); + return 1; +} + /* * Headers versions */ |