aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-23 16:38:18 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-09-23 16:38:18 +0100
commit1018b509c8a9d2c0b48fc34510b6a32095733959 (patch)
treeadc1423c169e95e97915c147d73dacfe1bce56d2 /src
parent117c578d05b9a7183513d93fb8a82e6493589f77 (diff)
downloadrspamd-1018b509c8a9d2c0b48fc34510b6a32095733959.tar.gz
rspamd-1018b509c8a9d2c0b48fc34510b6a32095733959.zip
Add pre-result as `reason` key for the output.
Diffstat (limited to 'src')
-rw-r--r--src/client/rspamc.c4
-rw-r--r--src/libserver/protocol.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index f347eabd1..74f5ae111 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -501,6 +501,10 @@ rspamc_symbols_output (ucl_object_t *obj)
rspamd_fprintf (stdout, "Scan error: %s\n", ucl_object_tostring (
cur));
}
+ else if (g_ascii_strcasecmp (ucl_object_key (cur), "reason") == 0) {
+ rspamd_fprintf (stdout, "Reason: %s\n", ucl_object_tostring (
+ cur));
+ }
else if (cur->type == UCL_OBJECT) {
/* Parse metric */
rspamc_metric_output (cur);
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index 56f29071c..9ecb3c642 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -790,6 +790,7 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
rspamd_http_message_add_header (msg, hn->str, hv->str);
}
+
g_hash_table_iter_init (&hiter, task->results);
top = ucl_object_typed_new (UCL_OBJECT);
@@ -800,6 +801,11 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg,
ucl_object_insert_key (top, obj, h, 0, false);
}
+ if (task->pre_result.str != NULL) {
+ ucl_object_insert_key (top, ucl_object_fromstring (task->pre_result.str),
+ "reason", 0, false);
+ }
+
if (task->messages != NULL) {
ucl_object_insert_key (top, rspamd_str_list_ucl (
task->messages), "messages", 0, false);