]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Use headers hash in bayes metatokens
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 May 2017 18:03:15 +0000 (19:03 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 May 2017 18:03:15 +0000 (19:03 +0100)
src/libstat/stat_process.c

index 74bf89d5f67e1a705509d39032f41c3d80d69158..6411580f6c08de34c23949506384e7dc41c078c1 100644 (file)
@@ -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");