diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-24 12:44:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-24 12:44:53 +0000 |
commit | e62051bb31def15690dbd83765865ae9810da4a7 (patch) | |
tree | d4020b5b93406cb74c13a64c903b74c344fc7a60 /src/lua | |
parent | 8bb02c7ed562f715b5760c71932dc4f9ac2620e2 (diff) | |
download | rspamd-e62051bb31def15690dbd83765865ae9810da4a7.tar.gz rspamd-e62051bb31def15690dbd83765865ae9810da4a7.zip |
Allow global lua functions in mime_regexp.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_common.h | 5 | ||||
-rw-r--r-- | src/lua/lua_task.c | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index ea0947c8a..d084f2096 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -123,6 +123,11 @@ void rspamd_free_lua_locked (struct lua_locked_state *st); void rspamd_lua_ip_push (lua_State *L, rspamd_inet_addr_t *addr); /** + * Push rspamd task structure to lua + */ +void rspamd_lua_task_push (lua_State *L, struct rspamd_task *task); + +/** * Return lua ip structure at the specified address */ struct rspamd_lua_ip * lua_check_ip (lua_State * L, gint pos); diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index b15d3e181..703043599 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -2502,3 +2502,12 @@ luaopen_url (lua_State * L) lua_pop (L, 1); /* remove metatable from stack */ } +void +rspamd_lua_task_push (lua_State *L, struct rspamd_task *task) +{ + struct rspamd_task **ptask; + + ptask = lua_newuserdata (L, sizeof (gpointer)); + rspamd_lua_setclass (L, "rspamd{task}", -1); + *ptask = task; +} |