aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-06-10 17:28:19 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-06-10 17:28:19 +0400
commit2b5a8d60da266be61d35b285bc14a8c5d71798e7 (patch)
treec0319c35813e6060d358b3f929e6b4422053caa7 /src/lua/lua_task.c
parent8535693674a5e6d6b8a01c9fee43ef4d836c0909 (diff)
downloadrspamd-2b5a8d60da266be61d35b285bc14a8c5d71798e7.tar.gz
rspamd-2b5a8d60da266be61d35b285bc14a8c5d71798e7.zip
* Add LRU caching structure
* Add SPF records cache * Add ability to parse doubles to xmlrpc Several fixes to dns interface. Trie plugin now checks urls as well.
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c16
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
*/