[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.94.2.5, 1.94.2.6

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


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

Modified Files:
      Tag: branch_1_0
	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.94.2.5
retrieving revision 1.94.2.6
diff -u -d -r1.94.2.5 -r1.94.2.6
--- mbox-save.c	26 Jan 2007 13:58:33 -0000	1.94.2.5
+++ mbox-save.c	14 Feb 2007 18:23:15 -0000	1.94.2.6
@@ -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;
 
@@ -390,6 +391,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