dovecot-2.1: lib-lda: mail_deliver()'s dest_mail now prefetches ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 4 05:35:12 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/c93601fa444e
changeset: 14380:c93601fa444e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 04 05:34:51 2012 +0300
description:
lib-lda: mail_deliver()'s dest_mail now prefetches message's GUID.
This fixes copying an already expunged mail with maildir.

diffstat:

 src/lib-lda/mail-deliver.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (25 lines):

diff -r 96ce9c0c6f05 -r c93601fa444e src/lib-lda/mail-deliver.c
--- a/src/lib-lda/mail-deliver.c	Wed Apr 04 05:34:11 2012 +0300
+++ b/src/lib-lda/mail-deliver.c	Wed Apr 04 05:34:51 2012 +0300
@@ -268,7 +268,7 @@
 	struct mailbox_header_lookup_ctx *headers_ctx;
 	struct mail_keywords *kw;
 	enum mail_error error;
-	const char *mailbox_name, *errstr;
+	const char *mailbox_name, *errstr, *guid;
 	struct mail_transaction_commit_changes changes;
 	const struct seq_range *range;
 	bool default_save;
@@ -338,7 +338,11 @@
 			t = mailbox_transaction_begin(box, 0);
 			ctx->dest_mail = mail_alloc(t, MAIL_FETCH_STREAM_BODY,
 						    NULL);
-			if (!mail_set_uid(ctx->dest_mail, range[0].seq1)) {
+			/* copying needs the message body. with maildir we also
+			   need to get the GUID in case the message gets
+			   expunged */
+			if (!mail_set_uid(ctx->dest_mail, range[0].seq1) ||
+			    mail_get_special(ctx->dest_mail, MAIL_FETCH_GUID, &guid) < 0) {
 				mail_free(&ctx->dest_mail);
 				mailbox_transaction_rollback(&t);
 			}


More information about the dovecot-cvs mailing list