[dovecot-cvs] dovecot/src/plugins/mail-log mail-log-plugin.c, 1.5, 1.6

tss at dovecot.org tss at dovecot.org
Sat Mar 10 14:54:23 EET 2007


Update of /var/lib/cvs/dovecot/src/plugins/mail-log
In directory talvi:/tmp/cvs-serv32221

Modified Files:
	mail-log-plugin.c 
Log Message:
Log the mailbox name, unless it's INBOX.



Index: mail-log-plugin.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/mail-log/mail-log-plugin.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mail-log-plugin.c	28 Feb 2007 21:00:39 -0000	1.5
+++ mail-log-plugin.c	10 Mar 2007 12:54:20 -0000	1.6
@@ -38,11 +38,22 @@
 
 static void mail_log_action(struct mail *mail, const char *action)
 {
-	const char *msgid;
+	const char *msgid, *mailbox_str;
+
+	mailbox_str = mailbox_get_name(mail->box);
+	if (strcmp(mailbox_str, "INBOX") == 0) {
+		/* most operations are for INBOX, and POP3 has only INBOX,
+		   so don't add it. */
+		mailbox_str = "";
+	} else {
+		mailbox_str = str_sanitize(mailbox_str, 80);
+		mailbox_str = t_strconcat(", box=", mailbox_str, NULL);
+	}
 
 	msgid = mail_get_first_header(mail, "Message-ID");
-	i_info("%s: uid=%u, msgid=%s", action, mail->uid,
-	       msgid == NULL ? "(null)" : str_sanitize(msgid, MSGID_LOG_LEN));
+	i_info("%s: uid=%u, msgid=%s%s", action, mail->uid,
+	       msgid == NULL ? "(null)" : str_sanitize(msgid, MSGID_LOG_LEN),
+	       mailbox_str);
 }
 
 static int mail_log_mail_expunge(struct mail *_mail)



More information about the dovecot-cvs mailing list