Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9287:d7251058200c HEAD
maildir+deliver: Add all existing messages to uidlist if it doesn't exist yet.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 07 Aug 2009 13:24:13 -0400 |
parents | 528f904067d4 |
children | c00df1152f1f |
files | src/lib-storage/index/maildir/maildir-save.c |
diffstat | 1 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-save.c Fri Aug 07 12:59:15 2009 -0400 +++ b/src/lib-storage/index/maildir/maildir-save.c Fri Aug 07 13:24:13 2009 -0400 @@ -626,16 +626,22 @@ 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 maildir, just add all the new mails listed in