summaryrefslogtreecommitdiffstats
path: root/src/libserver/protocol.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-05 16:24:44 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-05 16:24:44 +0100
commit5cb2fe96545d019d9a457f9be307eea165790b09 (patch)
tree09c7c97a00328adc25be5d87b6530eaff3f7def4 /src/libserver/protocol.c
parentd00b49ff64146d8d06d62592aaa4f6c409584e9b (diff)
downloadrspamd-5cb2fe96545d019d9a457f9be307eea165790b09.tar.gz
rspamd-5cb2fe96545d019d9a457f9be307eea165790b09.zip
[Feature] Extend log structure
Diffstat (limited to 'src/libserver/protocol.c')
-rw-r--r--src/libserver/protocol.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index e0df280d5..35c912f59 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -1061,6 +1061,7 @@ rspamd_protocol_write_log_pipe (struct rspamd_worker_ctx *ctx,
struct metric_result *mres;
GHashTableIter it;
gpointer k, v;
+ struct symbol *sym;
gint id, i;
gsize sz;
@@ -1071,9 +1072,12 @@ rspamd_protocol_write_log_pipe (struct rspamd_worker_ctx *ctx,
mres = g_hash_table_lookup (task->results, DEFAULT_METRIC);
if (mres) {
- sz = sizeof (*ls) + sizeof (guint32) *
+ sz = sizeof (*ls) +
+ sizeof (struct rspamd_protocol_log_symbol_result) *
g_hash_table_size (mres->symbols);
ls = g_slice_alloc (sz);
+ ls->score = mres->score;
+ ls->required_score = mres->actions_limits[METRIC_ACTION_REJECT];
ls->nresults = g_hash_table_size (mres->symbols);
g_hash_table_iter_init (&it, mres->symbols);
@@ -1082,12 +1086,15 @@ rspamd_protocol_write_log_pipe (struct rspamd_worker_ctx *ctx,
while (g_hash_table_iter_next (&it, &k, &v)) {
id = rspamd_symbols_cache_find_symbol (task->cfg->cache,
k);
+ sym = v;
if (id >= 0) {
- ls->results[i] = id;
+ ls->results[i].id = id;
+ ls->results[i].score = sym->score;
}
else {
- ls->results[i] = -1;
+ ls->results[i].id = -1;
+ ls->results[i].score = 0.0;
}
i ++;
@@ -1095,7 +1102,7 @@ rspamd_protocol_write_log_pipe (struct rspamd_worker_ctx *ctx,
}
else {
sz = sizeof (*ls);
- ls = g_slice_alloc (sz);
+ ls = g_slice_alloc0 (sz);
ls->nresults = 0;
}