summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-18 17:55:27 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-18 17:55:27 +0400
commitbada3312a8c1c6cdca474e99c74babb759e65823 (patch)
tree682cad72bd10ad6f881622c8919986aa310c6616 /src/lua
parent80422de224dae1d68b3ff9e9c3c6abf780367e36 (diff)
downloadrspamd-bada3312a8c1c6cdca474e99c74babb759e65823.tar.gz
rspamd-bada3312a8c1c6cdca474e99c74babb759e65823.zip
Fix statfiles class determination euristic.
Fix call of classifier pre-callback.
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_classifier.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lua/lua_classifier.c b/src/lua/lua_classifier.c
index 901d6cff5..4e868b7f7 100644
--- a/src/lua/lua_classifier.c
+++ b/src/lua/lua_classifier.c
@@ -81,8 +81,7 @@ call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task
{
struct classifier_config **pccf;
struct worker_task **ptask;
- struct statfile *st;
- gint i, len;
+ struct statfile **pst;
GList *res = NULL;
pccf = lua_newuserdata (L, sizeof (struct classifier_config *));
@@ -100,15 +99,16 @@ call_classifier_pre_callback (struct classifier_config *ccf, struct worker_task
msg_warn ("error running pre classifier callback %s", lua_tostring (L, -1));
}
else {
- if (lua_istable (L, 1)) {
- len = lua_objlen (L, 1);
- for (i = 1; i <= len; i ++) {
- lua_rawgeti (L, 1, i);
- st = lua_check_statfile (L);
- if (st) {
- res = g_list_prepend (res, st);
+ if (lua_istable (L, -1)) {
+ lua_pushnil (L);
+ while(lua_next (L, -2)) {
+ pst = luaL_checkudata (L, -1, "rspamd{statfile}");
+ if (pst) {
+ res = g_list_prepend (res, *pst);
}
+ lua_pop (L, 1);
}
+ lua_pop (L, 1);
}
}