Skip to content

Commit

Permalink
virtual plugin: If we detect backend box to be deleted, mark it perma…
Browse files Browse the repository at this point in the history
…nently deleted.
  • Loading branch information
sirainen committed Mar 15, 2016
1 parent baa93d5 commit 76fd7aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/virtual/virtual-storage.h
Expand Up @@ -110,6 +110,7 @@ struct virtual_backend_box {
unsigned int negative_match:1;
unsigned int uids_nonsorted:1;
unsigned int search_args_initialized:1;
unsigned int deleted:1;
};
ARRAY_DEFINE_TYPE(virtual_backend_box, struct virtual_backend_box *);

Expand Down
5 changes: 5 additions & 0 deletions src/plugins/virtual/virtual-sync.c
Expand Up @@ -1092,6 +1092,8 @@ static void virtual_sync_backend_box_deleted(struct virtual_sync_context *ctx,
array_foreach(&bbox->uids, uidmap)
seq_range_array_add(&removed_uids, uidmap->real_uid);
virtual_sync_mailbox_box_remove(ctx, bbox, &removed_uids);

bbox->deleted = TRUE;
}

static int virtual_sync_backend_box(struct virtual_sync_context *ctx,
Expand All @@ -1102,6 +1104,9 @@ static int virtual_sync_backend_box(struct virtual_sync_context *ctx,
bool bbox_index_opened = bbox->box->opened;
int ret;

if (bbox->deleted)
return 0;

/* if we already did some changes to index, commit them before
syncing starts. */
virtual_backend_box_sync_mail_unset(bbox);
Expand Down

0 comments on commit 76fd7aa

Please sign in to comment.