diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-17 21:53:49 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-18 23:05:15 +0000 |
commit | 665166c376a54f52b070e891780ca6209bbaa2d1 (patch) | |
tree | 034b58919947b10b1c5adb85796bc8d1a8ea0ed7 /src/lua | |
parent | 5d9fc64987e526b3a3cccd3dcb5f980ccc8b83cb (diff) | |
download | rspamd-665166c376a54f52b070e891780ca6209bbaa2d1.tar.gz rspamd-665166c376a54f52b070e891780ca6209bbaa2d1.zip |
Start refactoring of statistics in rspamd.
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_classifier.c | 34 | ||||
-rw-r--r-- | src/lua/lua_common.c | 22 |
2 files changed, 2 insertions, 54 deletions
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c index 346f5d64b..7adc473ba 100644 --- a/src/lua/lua_classifier.c +++ b/src/lua/lua_classifier.c @@ -45,16 +45,12 @@ static const struct luaL_reg classifierlib_m[] = { LUA_FUNCTION_DEF (statfile, get_symbol); LUA_FUNCTION_DEF (statfile, get_label); -LUA_FUNCTION_DEF (statfile, get_path); -LUA_FUNCTION_DEF (statfile, get_size); LUA_FUNCTION_DEF (statfile, is_spam); LUA_FUNCTION_DEF (statfile, get_param); static const struct luaL_reg statfilelib_m[] = { LUA_INTERFACE_DEF (statfile, get_symbol), LUA_INTERFACE_DEF (statfile, get_label), - LUA_INTERFACE_DEF (statfile, get_path), - LUA_INTERFACE_DEF (statfile, get_size), LUA_INTERFACE_DEF (statfile, is_spam), LUA_INTERFACE_DEF (statfile, get_param), {"__tostring", rspamd_lua_class_tostring}, @@ -352,36 +348,6 @@ lua_statfile_get_label (lua_State *L) } static gint -lua_statfile_get_path (lua_State *L) -{ - struct rspamd_statfile_config *st = lua_check_statfile (L); - - if (st != NULL) { - lua_pushstring (L, st->path); - } - else { - lua_pushnil (L); - } - - return 1; -} - -static gint -lua_statfile_get_size (lua_State *L) -{ - struct rspamd_statfile_config *st = lua_check_statfile (L); - - if (st != NULL) { - lua_pushinteger (L, st->size); - } - else { - lua_pushnil (L); - } - - return 1; -} - -static gint lua_statfile_is_spam (lua_State *L) { struct rspamd_statfile_config *st = lua_check_statfile (L); diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index 8df878585..73471719b 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -355,9 +355,8 @@ gboolean rspamd_init_lua_filters (struct rspamd_config *cfg) { struct rspamd_config **pcfg; - GList *cur, *tmp; + GList *cur; struct script_module *module; - struct rspamd_statfile_config *st; lua_State *L = cfg->lua_state; cur = g_list_first (cfg->script_modules); @@ -395,24 +394,7 @@ rspamd_init_lua_filters (struct rspamd_config *cfg) } cur = g_list_next (cur); } - /* Init statfiles normalizers */ - cur = g_list_first (cfg->statfiles); - while (cur) { - st = cur->data; - if (st->normalizer == rspamd_lua_normalize) { - tmp = st->normalizer_data; - if (tmp && (tmp = g_list_next (tmp))) { - if (tmp->data) { - /* Code must be loaded from data */ - if (luaL_loadstring (L, tmp->data) != 0) { - msg_info ("cannot load normalizer code %s", tmp->data); - return FALSE; - } - } - } - } - cur = g_list_next (cur); - } + /* Assign state */ cfg->lua_state = L; |