aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-16 18:29:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-08-16 18:29:27 +0100
commitbdf14a499e73d5dd762aaaeec701870d39bdf1fc (patch)
tree7fe9ff3452f84faa10f06935e1a710d0f81f5689 /src
parent5a8c4600f749f5bc39132b283d88e2319d79eaeb (diff)
downloadrspamd-bdf14a499e73d5dd762aaaeec701870d39bdf1fc.tar.gz
rspamd-bdf14a499e73d5dd762aaaeec701870d39bdf1fc.zip
Add method to set task's settings.
Diffstat (limited to 'src')
-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 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}
};
@@ -1337,6 +1339,20 @@ lua_task_learn (lua_State *L)
}
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)
{
struct rspamd_task *task = lua_check_task (L);