dovecot-2.0: maildir+deliver: Add all existing messages to uidli...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 7 20:56:23 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/f108a865dbca
changeset: 9739:f108a865dbca
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 07 13:24:13 2009 -0400
description:
maildir+deliver: Add all existing messages to uidlist if it doesn't exist yet.

diffstat:

1 file changed, 11 insertions(+), 5 deletions(-)
src/lib-storage/index/maildir/maildir-save.c |   16 +++++++++++-----

diffs (30 lines):

diff -r 95ea01bb65f5 -r f108a865dbca src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Fri Aug 07 12:59:59 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-save.c	Fri Aug 07 13:24:13 2009 -0400
@@ -739,15 +739,21 @@ maildir_save_sync_index(struct maildir_s
 	ret = maildir_uidlist_lock(mbox->uidlist);
 	i_assert(ret > 0);
 
+	if (maildir_sync_header_refresh(mbox) < 0)
+		return -1;
+	if ((ret = maildir_uidlist_refresh_fast_init(mbox->uidlist)) < 0)
+		return -1;
+
+	if (ret == 0) {
+		/* uidlist doesn't exist. make sure all existing message
+		   are added to uidlist first. */
+		(void)maildir_storage_sync_force(mbox, 0);
+	}
+
 	if (maildir_sync_index_begin(mbox, NULL, &ctx->sync_ctx) < 0)
 		return -1;
 	ctx->keywords_sync_ctx =
 		maildir_sync_get_keywords_sync_ctx(ctx->sync_ctx);
-
-	if (maildir_sync_header_refresh(mbox) < 0)
-		return -1;
-	if (maildir_uidlist_refresh_fast_init(mbox->uidlist) < 0)
-		return -1;
 
 	/* now that uidlist is locked, make sure all the existing mails
 	   have been added to index. we don't really look into the


More information about the dovecot-cvs mailing list