]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox rebuild: Dont try to give unknown maildir files UIDs that are after uidlist...
authorTimo Sirainen <tss@iki.fi>
Thu, 22 Jan 2009 00:42:35 +0000 (02:42 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 22 Jan 2009 00:42:35 +0000 (02:42 +0200)
Although it might allow keeping the same UIDs after repeated rebuilds, if
any of the files were deleted at some point the UIDs would change and that
would be just worse.

--HG--
branch : HEAD

src/lib-storage/index/dbox/dbox-sync-rebuild.c

index d0193aff42ac7b6f739aa4c9c9fc5665da630305..b196603a64b8ad4d3c96459ed3c188aeca62cd14 100644 (file)
@@ -339,30 +339,15 @@ static int dbox_sync_index_rebuild_dir(struct dbox_sync_rebuild_context *ctx,
 static int dbox_sync_new_maildir(struct dbox_sync_rebuild_context *ctx)
 {
        struct mail_index_view *trans_view;
-       const struct mail_index_header *hdr;
        char *const *fnames;
        unsigned int i, count;
-       uint32_t next_uid, seq;
        int ret = 0;
 
        fnames = array_get(&ctx->maildir_new_files, &count);
        if (count == 0)
                return 0;
 
-       /* try to give them UIDs beginning from uidlist's next_uid */
-       next_uid = maildir_uidlist_get_next_uid(ctx->maildir_uidlist);
-       trans_view = mail_index_transaction_open_updated_view(ctx->trans);
-       for (i = 0; i < count; i++) {
-               if (mail_index_lookup_seq(trans_view, next_uid, &seq))
-                       break;
-       }
-
-       if (i == count)
-               ctx->maildir_new_uid = next_uid;
-       else {
-               hdr = mail_index_get_header(trans_view);
-               ctx->maildir_new_uid = hdr->next_uid;
-       }
+       ctx->maildir_new_uid = mail_index_get_header(trans_view)->next_uid;
        mail_index_view_close(&trans_view);
 
        for (i = 0; i < count && ret == 0; i++) {