[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.102, 1.103

tss at dovecot.org tss at dovecot.org
Wed Feb 14 18:23:20 UTC 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv30235

Modified Files:
	mbox-save.c 
Log Message:
When saving a message to an empty mbox file, write X-IMAPbase header so the
UID doesn't change.



Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- mbox-save.c	17 Dec 2006 16:35:34 -0000	1.102
+++ mbox-save.c	14 Feb 2007 18:23:18 -0000	1.103
@@ -36,7 +36,7 @@
 
 	string_t *headers;
 	size_t space_end_idx;
-	uint32_t seq, next_uid;
+	uint32_t seq, next_uid, uid_validity;
 
 	struct istream *input;
 	struct ostream *output, *body_output;
@@ -199,6 +199,7 @@
 	hdr = mail_index_get_header(view);
 
 	ctx->next_uid = hdr->next_uid;
+	ctx->uid_validity = hdr->uid_validity;
 	ctx->synced = TRUE;
         t->mbox_modified = TRUE;
 
@@ -387,6 +388,11 @@
 	save_flags = (flags & ~MAIL_RECENT) | MAIL_RECENT;
 	str_truncate(ctx->headers, 0);
 	if (ctx->synced) {
+		if (ctx->output->offset == 0) {
+			/* writing the first mail. Insert X-IMAPbase as well. */
+			str_printfa(ctx->headers, "X-IMAPbase: %u %010u\n",
+				    ctx->uid_validity, ctx->next_uid);
+		}
 		str_printfa(ctx->headers, "X-UID: %u\n", ctx->next_uid);
 		if (!mbox->ibox.keep_recent)
 			save_flags &= ~MAIL_RECENT;



More information about the dovecot-cvs mailing list