changeset 7940:87214cbd824c HEAD

maildir: Convert dovecot-uidlist files to new format immediately when opening them. Without this it's possible that entries are appended to old format uidlist in the new format.
author Timo Sirainen <tss@iki.fi>
date Sat, 21 Jun 2008 15:53:43 +0300
parents 8df17bb25a6e
children f33e8e801023
files src/lib-storage/index/maildir/maildir-uidlist.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Fri Jun 20 11:54:35 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Sat Jun 21 15:53:43 2008 +0300
@@ -323,6 +323,16 @@
 	}
 
 	mhdr = &uidlist->mbox->maildir_hdr;
+	if (mhdr->uidlist_mtime == 0) {
+		if (!uidlist->initial_read)
+			(void)maildir_uidlist_refresh(uidlist);
+		if (uidlist->version != UIDLIST_VERSION) {
+			/* upgrading from older verson. don't update the
+			   uidlist times until it uses the new format */
+			uidlist->recreate = TRUE;
+			return;
+		}
+	}
 	mhdr->uidlist_mtime = st->st_mtime;
 	mhdr->uidlist_mtime_nsecs = ST_MTIME_NSEC(*st);
 	mhdr->uidlist_size = st->st_size;