aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/rspamc.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-04 15:36:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-04 15:36:29 +0100
commit763be28d8a4d85717c0b3300df63894e225fac8a (patch)
tree147a29dc5cc42250e4b5d0efcf0281a39ba98fd7 /src/client/rspamc.c
parent7025b147cced04037ed0e7f7fea754aef495cea5 (diff)
downloadrspamd-763be28d8a4d85717c0b3300df63894e225fac8a.tar.gz
rspamd-763be28d8a4d85717c0b3300df63894e225fac8a.zip
Add X-Spam-Score header.
Diffstat (limited to 'src/client/rspamc.c')
-rw-r--r--src/client/rspamc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 2da12d346..7d523e737 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -861,6 +861,8 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input, GError *err
const ucl_object_t *metric, *res;
const gchar *action = "no action";
gint act;
+ gdouble score = 0.0, required_score = 0.0;
+ gchar scorebuf[32];
gboolean is_spam = FALSE;
const gchar *hdr_scanned, *hdr_spam;
gchar *json_header, *json_header_encoded;
@@ -889,6 +891,16 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input, GError *err
if (res) {
action = ucl_object_tostring (res);
}
+
+ res = ucl_object_find_key (metric, "score");
+ if (res) {
+ score = ucl_object_todouble (res);
+ }
+
+ res = ucl_object_find_key (metric, "required_score");
+ if (res) {
+ required_score = ucl_object_todouble (res);
+ }
}
rspamd_action_from_str (action, &act);
@@ -908,6 +920,11 @@ rspamc_mime_output (FILE *out, ucl_object_t *result, GString *input, GError *err
g_mime_object_append_header (GMIME_OBJECT (message), "X-Spam-Action",
action);
+ rspamd_snprintf (scorebuf, sizeof (scorebuf), "%.2f / %.2f", score,
+ required_score);
+ g_mime_object_append_header (GMIME_OBJECT (message), "X-Spam-Score",
+ scorebuf);
+
if (json || raw) {
/* We also append json data as a specific header */
if (json) {