diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-21 17:47:40 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-21 17:47:40 +0000 |
commit | be34b724e5ee019864f00c3e18890da6a44bccc7 (patch) | |
tree | 91ceebe63e5c5ffd34d3740f6ada7fed9c8e2063 /src/protocol.c | |
parent | 93724ea85907b20546f7c2cd5fc0c2d39944ee5b (diff) | |
download | rspamd-be34b724e5ee019864f00c3e18890da6a44bccc7.tar.gz rspamd-be34b724e5ee019864f00c3e18890da6a44bccc7.zip |
Output urls and emails more clearly.
Diffstat (limited to 'src/protocol.c')
-rw-r--r-- | src/protocol.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/protocol.c b/src/protocol.c index 23ed859ad..97d7d494a 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -435,7 +435,7 @@ write_hashes_to_log (struct worker_task *task, GString *logbuf) /* Structure for writing tree data */ struct tree_cb_data { - GString *urls; + ucl_object_t *top; struct worker_task *task; }; @@ -447,8 +447,10 @@ urls_protocol_cb (gpointer key, gpointer value, gpointer ud) { struct tree_cb_data *cb = ud; struct uri *url = value; + ucl_object_t *obj; - rspamd_printf_gstring (cb->urls, " %*s,", url->hostlen, url->host); + obj = ucl_object_fromlstring (url->host, url->hostlen); + DL_APPEND (cb->top->value.av, obj); if (cb->task->cfg->log_urls) { msg_info ("<%s> URL: %s - %s: %s", cb->task->message_id, cb->task->user ? @@ -465,17 +467,12 @@ rspamd_urls_tree_ucl (GTree *input, struct worker_task *task) struct tree_cb_data cb; ucl_object_t *obj; - cb.urls = g_string_sized_new (BUFSIZ); + obj = ucl_object_typed_new (UCL_ARRAY); + cb.top = obj; cb.task = task; g_tree_foreach (input, urls_protocol_cb, &cb); - /* Strip last ',' */ - if (cb.urls->str[cb.urls->len - 1] == ',') { - cb.urls->len --; - } - obj = ucl_object_fromlstring (cb.urls->str, cb.urls->len); - g_string_free (cb.urls, TRUE); return obj; } |