]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail-log: Code cleanup.
authorTimo Sirainen <tss@iki.fi>
Fri, 4 Jun 2010 14:50:41 +0000 (15:50 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 4 Jun 2010 14:50:41 +0000 (15:50 +0100)
--HG--
branch : HEAD

src/plugins/mail-log/mail-log-plugin.c

index e0be1d351806ccf14e48c26878ab83e00a78e083..87af8f7b6c1d00de0087bc83fa7aae28efbf5006 100644 (file)
@@ -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_settings {
 
 struct mail_log_message {
        struct mail_log_message *prev, *next;
+
        const char *pretext, *text;
 };
 
@@ -209,10 +211,13 @@ mail_log_append_mail_message_real(struct mail_log_mail_txn_context *ctx,
                str_append(text, ", ");
        }
        if ((mail_log_set.fields & MAIL_LOG_FIELD_UID) != 0) {
-               if (event == MAIL_LOG_EVENT_SAVE)
-                       mail_log_append_uid(ctx, msg, text, 0);
-               else
+               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);
+               }
                str_append(text, ", ");
        }
        if ((mail_log_set.fields & MAIL_LOG_FIELD_MSGID) != 0) {
@@ -250,12 +255,7 @@ mail_log_append_mail_message_real(struct mail_log_mail_txn_context *ctx,
        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