aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-15 18:42:05 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-09-15 18:42:05 +0400
commit6b57031f55ef73619b763c98eadb1dbf82494eac (patch)
tree8a749d0b5c0ac6c331363a7a3ba871666c2f148c /src/lua/lua_task.c
parente03d0749928abdff045de0bd2eeb21c5989a94c4 (diff)
downloadrspamd-6b57031f55ef73619b763c98eadb1dbf82494eac.tar.gz
rspamd-6b57031f55ef73619b763c98eadb1dbf82494eac.zip
* Add lua plugin for checking received headers
* Some tunes to lua API * Fix bug with http maps * Optimize installation and make custom prefix for configs
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 07edcb044..844229f9d 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -105,14 +105,26 @@ static int
lua_task_insert_result (lua_State *L)
{
struct worker_task *task = lua_check_task (L);
- const char *metric_name, *symbol_name;
+ const char *metric_name, *symbol_name, *param;
double flag;
+ GList *params = NULL;
+ int i, top;
if (task != NULL) {
metric_name = luaL_checkstring (L, 2);
symbol_name = luaL_checkstring (L, 3);
flag = luaL_checknumber (L, 4);
- insert_result (task, metric_name, symbol_name, flag, NULL);
+ top = lua_gettop (L);
+ /* Get additional options */
+ for (i = 5; i <= top; i ++) {
+ param = luaL_checkstring (L, i);
+ params = g_list_prepend (params, memory_pool_strdup (task->task_pool, param));
+ }
+
+ insert_result (task, metric_name, symbol_name, flag, params);
+ if (params != NULL) {
+ memory_pool_add_destructor (task->task_pool, (pool_destruct_func)g_list_free, params);
+ }
}
return 1;
}