From bdf14a499e73d5dd762aaaeec701870d39bdf1fc Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 16 Aug 2014 18:29:27 +0100 Subject: [PATCH] Add method to set task's settings. --- src/lua/lua_task.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index fd8942ce6..2a2c173e1 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -92,6 +92,7 @@ LUA_FUNCTION_DEF (task, get_timeval); LUA_FUNCTION_DEF (task, get_metric_score); LUA_FUNCTION_DEF (task, get_metric_action); LUA_FUNCTION_DEF (task, learn); +LUA_FUNCTION_DEF (task, set_settings); static const struct luaL_reg tasklib_f[] = { LUA_INTERFACE_DEF (task, create_empty), @@ -143,6 +144,7 @@ static const struct luaL_reg tasklib_m[] = { LUA_INTERFACE_DEF (task, get_metric_score), LUA_INTERFACE_DEF (task, get_metric_action), LUA_INTERFACE_DEF (task, learn), + LUA_INTERFACE_DEF (task, set_settings), {"__tostring", lua_class_tostring}, {NULL, NULL} }; @@ -1336,6 +1338,20 @@ lua_task_learn (lua_State *L) return ret; } +static gint +lua_task_set_settings (lua_State *L) +{ + struct rspamd_task *task = lua_check_task (L); + ucl_object_t *settings; + + settings = ucl_object_lua_import (L, 2); + if (settings != NULL) { + task->settings = settings; + } + + return 0; +} + static gint lua_task_get_metric_score (lua_State *L) { -- 2.39.5