aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-24 17:03:11 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-24 17:03:11 +0000
commit2a9a50655c680e4346bac25ef862295c73d48674 (patch)
treed7604110edaae443b169cf21b78654ffd2357382 /src
parent744d3ff5e587786db29e537d4683294780d6ab13 (diff)
downloadrspamd-2a9a50655c680e4346bac25ef862295c73d48674.tar.gz
rspamd-2a9a50655c680e4346bac25ef862295c73d48674.zip
Output emails properly.
Diffstat (limited to 'src')
-rw-r--r--src/protocol.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 97d7d494a..2b7f03b5b 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -476,6 +476,34 @@ rspamd_urls_tree_ucl (GTree *input, struct worker_task *task)
return obj;
}
+static gboolean
+emails_protocol_cb (gpointer key, gpointer value, gpointer ud)
+{
+ struct tree_cb_data *cb = ud;
+ struct uri *url = value;
+ ucl_object_t *obj;
+
+ obj = ucl_object_fromlstring (url->user, url->userlen + url->hostlen + 1);
+ DL_APPEND (cb->top->value.av, obj);
+
+ return FALSE;
+}
+
+static ucl_object_t *
+rspamd_emails_tree_ucl (GTree *input, struct worker_task *task)
+{
+ struct tree_cb_data cb;
+ ucl_object_t *obj;
+
+ obj = ucl_object_typed_new (UCL_ARRAY);
+ cb.top = obj;
+ cb.task = task;
+
+ g_tree_foreach (input, emails_protocol_cb, &cb);
+
+ return obj;
+}
+
/* Write new subject */
static const gchar *
@@ -724,7 +752,7 @@ write_check_reply (struct rspamd_http_message *msg, struct worker_task *task)
top = ucl_object_insert_key (top, rspamd_urls_tree_ucl (task->urls, task), "urls", 0, false);
}
if (g_tree_nnodes (task->emails) > 0) {
- top = ucl_object_insert_key (top, rspamd_urls_tree_ucl (task->emails, task), "emails", 0, false);
+ top = ucl_object_insert_key (top, rspamd_emails_tree_ucl (task->emails, task), "emails", 0, false);
}
top = ucl_object_insert_key (top, ucl_object_fromstring (task->message_id), "message-id", 0, false);