From e01c11d2ae6c22283bce8c25eeadeefdec11fd3e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 3 Feb 2020 11:45:57 +0000 Subject: [PATCH] [Fix] Fix ignored symbols exporting --- src/lua/lua_task.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 0b5fab09e..3855c3cc4 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -4586,8 +4586,10 @@ lua_task_get_symbols_all (lua_State *L) lua_createtable (L, kh_size (mres->symbols), 0); kh_foreach_value_ptr (mres->symbols, s, { - lua_push_symbol_result (L, task, s->name, s, FALSE, TRUE); - lua_rawseti (L, -2, i++); + if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) { + lua_push_symbol_result (L, task, s->name, s, FALSE, TRUE); + lua_rawseti (L, -2, i++); + } }); } } @@ -4708,11 +4710,16 @@ tokens_foreach_cb (struct rspamd_symcache_item *item, gpointer ud) } if ((s = rspamd_task_find_symbol_result (cbd->task, sym)) != NULL) { - if (cbd->normalize) { - lua_pushnumber (cbd->L, tanh (s->score)); + if (s->flags & RSPAMD_SYMBOL_RESULT_IGNORED) { + lua_pushnumber (cbd->L, 0.0); } else { - lua_pushnumber (cbd->L, s->score); + if (cbd->normalize) { + lua_pushnumber (cbd->L, tanh (s->score)); + } + else { + lua_pushnumber (cbd->L, s->score); + } } } else { -- 2.39.5