From: Timo Sirainen Date: Wed, 11 Jun 2008 12:43:12 +0000 (+0300) Subject: Changed the way mailbox changing ambiguity is checked. X-Git-Tag: 1.2.alpha1~345 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17e367eb70fbd5d200a4deaee062a044e1db3805;p=thirdparty%2Fdovecot%2Fcore.git Changed the way mailbox changing ambiguity is checked. --HG-- branch : HEAD --- diff --git a/src/imap/client.c b/src/imap/client.c index d80b01b5d4..c9b471d56d 100644 --- a/src/imap/client.c +++ b/src/imap/client.c @@ -401,7 +401,8 @@ static bool client_command_check_ambiguity(struct client_command_context *cmd) /* 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; @@ -464,6 +465,8 @@ void client_command_free(struct client_command_context **_cmd) 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); diff --git a/src/imap/client.h b/src/imap/client.h index 8dcb4b026c..644448f47f 100644 --- a/src/imap/client.h +++ b/src/imap/client.h @@ -103,6 +103,8 @@ struct client { /* 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. */ @@ -112,7 +114,6 @@ struct client { 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; diff --git a/src/imap/cmd-close.c b/src/imap/cmd-close.c index 56d2dd3ffb..a850819659 100644 --- a/src/imap/cmd-close.c +++ b/src/imap/cmd-close.c @@ -12,7 +12,6 @@ static void cmd_close_finish(struct client *client) 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) @@ -38,8 +37,8 @@ bool cmd_close(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) diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index 67ff06c18e..597cfdf3d3 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -195,7 +195,6 @@ static void cmd_select_finish(struct imap_select_context *ctx, int ret) "OK [READ-ONLY] Select completed." : "OK [READ-WRITE] Select completed."); } - ctx->cmd->client->changing_mailbox = FALSE; select_context_free(ctx); } @@ -355,8 +354,8 @@ bool cmd_select_full(struct client_command_context *cmd, bool readonly) } } - 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); diff --git a/src/imap/cmd-unselect.c b/src/imap/cmd-unselect.c index 5ab2101ee1..3b4b18ad0d 100644 --- a/src/imap/cmd-unselect.c +++ b/src/imap/cmd-unselect.c @@ -14,7 +14,7 @@ bool cmd_unselect(struct client_command_context *cmd) 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);