From 665166c376a54f52b070e891780ca6209bbaa2d1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 17 Jan 2015 21:53:49 +0000 Subject: Start refactoring of statistics in rspamd. --- src/lua/lua_classifier.c | 34 ---------------------------------- src/lua/lua_common.c | 22 ++-------------------- 2 files changed, 2 insertions(+), 54 deletions(-) (limited to 'src/lua') 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}, @@ -351,36 +347,6 @@ lua_statfile_get_label (lua_State *L) return 1; } -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) { 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; -- cgit v1.2.3