--- src/plugins/mail-log/mail-log-plugin.c.orig 2014-08-05 13:12:21.000000000 +0400 +++ src/plugins/mail-log/mail-log-plugin.c 2014-08-05 13:15:30.000000000 +0400 @@ -13,6 +13,8 @@ #include +#include "network.h" + #define MAILBOX_NAME_LOG_LEN 64 #define HEADER_LOG_LEN 80 @@ -27,7 +29,9 @@ MAIL_LOG_FIELD_VSIZE = 0x10, MAIL_LOG_FIELD_FLAGS = 0x20, MAIL_LOG_FIELD_FROM = 0x40, - MAIL_LOG_FIELD_SUBJECT = 0x80 + MAIL_LOG_FIELD_SUBJECT = 0x80, + MAIL_LOG_FIELD_REMOTE_IP = 0x100, + MAIL_LOG_FIELD_LOCAL_IP = 0x200 }; #define MAIL_LOG_DEFAULT_FIELDS \ (MAIL_LOG_FIELD_UID | MAIL_LOG_FIELD_BOX | \ @@ -58,6 +62,8 @@ "flags", "from", "subject", + "rip", + "lip", NULL }; @@ -265,6 +271,14 @@ mail_get_keywords(mail)); str_append(text, "), "); } + if ((muser->fields & MAIL_LOG_FIELD_REMOTE_IP) != 0) { + str_printfa(text, "rip=%s", net_ip2addr(mail->box->storage->user->remote_ip)); + str_append(text, ", "); + } + if ((muser->fields & MAIL_LOG_FIELD_LOCAL_IP) != 0) { + str_printfa(text, "lip=%s", net_ip2addr(mail->box->storage->user->local_ip)); + str_append(text, ", "); + } str_truncate(text, str_len(text)-2); msg->event = event;