changeset 5959:5513182aed67 HEAD

One more UIDVALIDITY=0 fix
author Timo Sirainen <tss@iki.fi>
date Thu, 12 Jul 2007 04:55:20 +0300
parents 5825961b9862
children 33908f232e9a
files src/lib-storage/index/maildir/maildir-uidlist.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Thu Jul 12 04:24:22 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Thu Jul 12 04:55:20 2007 +0300
@@ -967,6 +967,15 @@
 	struct maildir_uidlist *uidlist = ctx->uidlist;
 	uoff_t file_size;
 
+	if (uidlist->uid_validity == 0) {
+		/* saving a message to a newly created maildir. */
+		const struct mail_index_header *hdr;
+
+		hdr = mail_index_get_header(uidlist->mbox->ibox.view);
+		uidlist->uid_validity = hdr->uid_validity != 0 ?
+			hdr->uid_validity : ioloop_time;
+	}
+
 	if (ctx->uidlist->recreate || uidlist->fd == -1 ||
 	    uidlist->version != 3 ||
 	    (uidlist->read_records_count + ctx->new_files_count) *
@@ -1289,8 +1298,6 @@
 	struct maildir_uidlist_sync_ctx *ctx = *_ctx;
 	int ret = ctx->failed ? -1 : 0;
 
-	i_assert(ctx->uidlist->uid_validity != 0);
-
 	*_ctx = NULL;
 
 	if (!ctx->finished)