]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: MAIL_INDEX_SYNC_FLAG_DELETING_INDEX now allows committing changes to delet...
authorTimo Sirainen <tss@iki.fi>
Tue, 9 Aug 2011 13:32:27 +0000 (16:32 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 9 Aug 2011 13:32:27 +0000 (16:32 +0300)
This fixes deleting mailboxes.

src/lib-index/mail-index-sync.c
src/lib-index/mail-index-transaction-private.h
src/lib-index/mail-index-transaction.c

index 7e1049194f487dd0778ae17e0fefae3684cb55af..03d17f4afbadf47fdbef9f3aec75994bbcd496c8 100644 (file)
@@ -390,7 +390,8 @@ mail_index_sync_begin_init(struct mail_index *index,
                return 0;
        }
 
-       if (index->index_deleted) {
+       if (index->index_deleted &&
+           (flags & MAIL_INDEX_SYNC_FLAG_DELETING_INDEX) == 0) {
                /* index is already deleted. we can't sync. */
                if (locked)
                        mail_transaction_log_sync_unlock(index->log);
@@ -490,6 +491,8 @@ int mail_index_sync_begin_to(struct mail_index *index,
                trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_FSYNC;
        ctx->ext_trans = mail_index_transaction_begin(ctx->view, trans_flags);
        ctx->ext_trans->sync_transaction = TRUE;
+       ctx->ext_trans->commit_deleted_index =
+               (flags & MAIL_INDEX_SYNC_FLAG_DELETING_INDEX) != 0;
 
        *ctx_r = ctx;
        *view_r = ctx->view;
index 1004dfcbcd35339814ddd80b1d9add409c317664..2d3889c6d989dbefc63d4a372a58cc5bb02017c6 100644 (file)
@@ -86,6 +86,7 @@ struct mail_index_transaction {
        unsigned int reset:1;
        unsigned int index_deleted:1;
        unsigned int index_undeleted:1;
+       unsigned int commit_deleted_index:1;
        /* non-extension updates. flag updates don't change this because
           they may be added and removed, so be sure to check that the updates
           array is non-empty also. */
index 205b4097d6688fb30d83f6d38bb79387b95727a1..195428b2ab26f43ad666f511966177106c73d8a2 100644 (file)
@@ -219,7 +219,7 @@ int mail_index_transaction_commit_full(struct mail_index_transaction **_t,
                mail_index_transaction_rollback(_t);
                return -1;
        }
-       if (!index_undeleted) {
+       if (!index_undeleted && !t->commit_deleted_index) {
                if (t->view->index->index_deleted ||
                    (t->view->index->index_delete_requested &&
                     !t->view->index->syncing)) {