diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-13 19:03:15 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-05-13 19:03:15 +0100 |
commit | cba520a97286b3b4febdb654f028bc923c45726b (patch) | |
tree | 23cb3b57530a4fd570c6302c76b25a265178cea1 /src/libstat/stat_process.c | |
parent | e1ca9e917869509084743c28f2500e7fd5ff6f1e (diff) | |
download | rspamd-cba520a97286b3b4febdb654f028bc923c45726b.tar.gz rspamd-cba520a97286b3b4febdb654f028bc923c45726b.zip |
[Feature] Use headers hash in bayes metatokens
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r-- | src/libstat/stat_process.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 74bf89d5f..6411580f6 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -21,6 +21,7 @@ #include "libmime/images.h" #include "libserver/html.h" #include "lua/lua_common.h" +#include "libserver/mempool_vars_internal.h" #include "utlist.h" #include <math.h> @@ -79,6 +80,7 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, guint i; gchar tmpbuf[128]; lua_State *L = task->cfg->lua_state; + const gchar *headers_hash; ar = g_array_sized_new (FALSE, FALSE, sizeof (elt), 16); elt.flags = RSPAMD_STAT_TOKEN_FLAG_META; @@ -171,6 +173,17 @@ rspamd_stat_tokenize_parts_metadata (struct rspamd_stat_ctx *st_ctx, cur = g_list_next (cur); } + /* Use headers order */ + headers_hash = rspamd_mempool_get_variable (task->task_pool, + RSPAMD_MEMPOOL_HEADERS_HASH); + + if (headers_hash) { + elt.begin = (gchar *)headers_hash; + elt.len = 16; + g_array_append_val (ar, elt); + } + + /* Use metatokens plugin from Lua */ lua_getglobal (L, "rspamd_plugins"); |