From: Vsevolod Stakhov Date: Tue, 15 Sep 2015 17:29:25 +0000 (+0100) Subject: Print 'from: ' in logs if a task has no `user` specified X-Git-Tag: 1.0.0~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=010142fade619ba8ace48bc2746c1926ff815cb7;p=rspamd.git Print 'from: ' in logs if a task has no `user` specified --- diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index a1dabfab0..c023f768a 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -1041,6 +1041,17 @@ rspamd_protocol_write_ucl (struct rspamd_task *task, GString *logbuf) if (task->user) { rspamd_printf_gstring (logbuf, "user: %s, ", task->user); } + else if (task->from_envelope) { + InternetAddress *ia; + + ia = internet_address_list_get_address (task->from_envelope, 0); + + if (ia && INTERNET_ADDRESS_IS_MAILBOX (ia)) { + InternetAddressMailbox *iamb = INTERNET_ADDRESS_MAILBOX (ia); + + rspamd_printf_gstring (logbuf, "from: %s, ", iamb->addr); + } + } } g_hash_table_iter_init (&hiter, task->results);