summaryrefslogtreecommitdiffstats
path: root/src/protocol.c
diff options
context:
space:
mode:
authorcebka@lenovo-laptop <cebka@lenovo-laptop>2010-02-17 18:57:05 +0300
committercebka@lenovo-laptop <cebka@lenovo-laptop>2010-02-17 18:57:05 +0300
commit94edb9f04b2144be4a78556653451456738ba767 (patch)
tree59418513a28438035b0cdde8ef408622ebb2f52b /src/protocol.c
parent3ec2330431b62e442f4fdea41cacab152cbcee55 (diff)
downloadrspamd-94edb9f04b2144be4a78556653451456738ba767.tar.gz
rspamd-94edb9f04b2144be4a78556653451456738ba767.zip
* Add ability to add custom messages to rspamd output
* Add messages from spf checks
Diffstat (limited to 'src/protocol.c')
-rw-r--r--src/protocol.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 134820cab..e07640807 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -547,6 +547,7 @@ show_metric_symbols (struct metric_result *metric_res, struct metric_callback_da
}
}
+
static void
show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data)
{
@@ -652,6 +653,22 @@ show_metric_result (gpointer metric_name, gpointer metric_value, void *user_data
(long int)task->msg->len, calculate_check_time (&task->ts, task->cfg->clock_res));
}
+static void
+show_messages (struct worker_task *task)
+{
+ int r = 0;
+ char outbuf[OUTBUFSIZ];
+ GList *cur;
+
+ cur = task->messages;
+ while (cur) {
+ r += snprintf (outbuf + r, sizeof (outbuf) - r, "Message: %s" CRLF, (char *)cur->data);
+ cur = g_list_next (cur);
+ }
+
+ rspamd_dispatcher_write (task->dispatcher, outbuf, r, FALSE, FALSE);
+}
+
static int
write_check_reply (struct worker_task *task)
{
@@ -694,6 +711,8 @@ write_check_reply (struct worker_task *task)
/* Write result for each metric separately */
g_hash_table_foreach (task->results, show_metric_result, &cd);
+ /* Messages */
+ show_messages (task);
/* URL stat */
show_url_header (task);
}
@@ -748,7 +767,8 @@ write_process_reply (struct worker_task *task)
/* Write result for each metric separately */
g_hash_table_foreach (task->results, show_metric_result, &cd);
- /* URL stat */
+ /* Messages */
+ show_messages (task);
}
write_hashes_to_log (task, logbuf, cd.log_offset, cd.log_size);
msg_info ("%s", logbuf);