dovecot-2.0: mail-log: Code cleanup.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 4 17:51:51 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/57723949babb
changeset: 11471:57723949babb
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 04 15:50:41 2010 +0100
description:
mail-log: Code cleanup.

diffstat:

 src/plugins/mail-log/mail-log-plugin.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r 1c2d74e3e312 -r 57723949babb src/plugins/mail-log/mail-log-plugin.c
--- a/src/plugins/mail-log/mail-log-plugin.c	Fri Jun 04 15:39:58 2010 +0100
+++ b/src/plugins/mail-log/mail-log-plugin.c	Fri Jun 04 15:50:41 2010 +0100
@@ -2,6 +2,7 @@
 
 #include "lib.h"
 #include "array.h"
+#include "llist.h"
 #include "str.h"
 #include "str-sanitize.h"
 #include "imap-util.h"
@@ -81,6 +82,7 @@
 
 struct mail_log_message {
 	struct mail_log_message *prev, *next;
+
 	const char *pretext, *text;
 };
 
@@ -209,10 +211,13 @@
 		str_append(text, ", ");
 	}
 	if ((mail_log_set.fields & MAIL_LOG_FIELD_UID) != 0) {
-		if (event == MAIL_LOG_EVENT_SAVE)
+		if (event != MAIL_LOG_EVENT_SAVE)
+			mail_log_append_uid(ctx, msg, text, mail->uid);
+		else {
+			/* with mbox mail->uid contains the uid, but handle
+			   this consistently with all mailbox formats */
 			mail_log_append_uid(ctx, msg, text, 0);
-		else
-			mail_log_append_uid(ctx, msg, text, mail->uid);
+		}
 		str_append(text, ", ");
 	}
 	if ((mail_log_set.fields & MAIL_LOG_FIELD_MSGID) != 0) {
@@ -250,12 +255,7 @@
 	str_truncate(text, str_len(text)-2);
 
 	msg->text = p_strdup(ctx->pool, str_c(text));
-	msg->prev = ctx->messages_tail;
-	ctx->messages_tail = msg;
-	if (msg->prev != NULL)
-		msg->prev->next = msg;
-	if (ctx->messages == NULL)
-		ctx->messages = msg;
+	DLLIST2_APPEND(&ctx->messages, &ctx->messages_tail, msg);
 }
 
 static void


More information about the dovecot-cvs mailing list