/* don't do anything until syncing is finished */
return TRUE;
}
- if (cmd->client->changing_mailbox) {
+ if (cmd->client->mailbox_change_lock != NULL &&
+ cmd->client->mailbox_change_lock != cmd) {
/* don't do anything until mailbox is fully
opened/closed */
return TRUE;
client->input_lock = NULL;
if (client->output_lock == cmd)
client->output_lock = NULL;
+ if (client->mailbox_change_lock == cmd)
+ client->mailbox_change_lock = NULL;
if (client->free_parser != NULL)
imap_parser_destroy(&cmd->parser);
/* client input/output is locked by this command */
struct client_command_context *input_lock;
struct client_command_context *output_lock;
+ /* command changing the mailbox */
+ struct client_command_context *mailbox_change_lock;
/* syncing marks this TRUE when it sees \Deleted flags. this is by
EXPUNGE for Outlook-workaround. */
unsigned int destroyed:1;
unsigned int handling_input:1;
unsigned int syncing:1;
- unsigned int changing_mailbox:1;
unsigned int input_skip_line:1; /* skip all the data until we've
found a new line */
unsigned int modseqs_sent_since_sync:1;
mailbox_get_storage(client->mailbox));
}
client_update_mailbox_flags(client, NULL);
- client->changing_mailbox = FALSE;
}
static bool cmd_close_callback(struct client_command_context *cmd)
if (!client_verify_open_mailbox(cmd))
return TRUE;
- i_assert(!client->changing_mailbox);
- client->changing_mailbox = TRUE;
+ i_assert(client->mailbox_change_lock == NULL);
+ client->mailbox_change_lock = cmd;
storage = mailbox_get_storage(mailbox);
if ((ret = imap_expunge(mailbox, NULL)) < 0)
"OK [READ-ONLY] Select completed." :
"OK [READ-WRITE] Select completed.");
}
- ctx->cmd->client->changing_mailbox = FALSE;
select_context_free(ctx);
}
}
}
- i_assert(!client->changing_mailbox);
- client->changing_mailbox = TRUE;
+ i_assert(client->mailbox_change_lock == NULL);
+ client->mailbox_change_lock = cmd;
if (client->mailbox != NULL) {
client_search_updates_free(client);
client_search_updates_free(client);
- i_assert(!client->changing_mailbox);
+ i_assert(client->mailbox_change_lock == NULL);
client->mailbox = NULL;
storage = mailbox_get_storage(mailbox);