From: Timo Sirainen Date: Fri, 5 Sep 2008 16:33:41 +0000 (+0300) Subject: CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client. X-Git-Tag: 1.2.alpha1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7cd4e205ddcf3cbe159c63b18b9518ac971c1ab;p=thirdparty%2Fdovecot%2Fcore.git CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client. Also the previous code wasn't really even closing the mailbox. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-close.c b/src/imap/cmd-close.c index bcb2fa92aa..6815799c1b 100644 --- a/src/imap/cmd-close.c +++ b/src/imap/cmd-close.c @@ -4,16 +4,6 @@ #include "commands.h" #include "imap-expunge.h" -static void cmd_close_finish(struct client *client) -{ - client_search_updates_free(client); - if (mailbox_close(&client->mailbox) < 0) { - client_send_untagged_storage_error(client, - mailbox_get_storage(client->mailbox)); - } - client_update_mailbox_flags(client, NULL); -} - bool cmd_close(struct client_command_context *cmd) { struct client *client = cmd->client; @@ -25,26 +15,18 @@ bool cmd_close(struct client_command_context *cmd) return TRUE; i_assert(client->mailbox_change_lock == NULL); - client->mailbox_change_lock = cmd; + client->mailbox = NULL; storage = mailbox_get_storage(mailbox); if ((ret = imap_expunge(mailbox, NULL)) < 0) client_send_untagged_storage_error(client, storage); + if (mailbox_sync(mailbox, 0, 0, NULL) < 0) + client_send_untagged_storage_error(client, storage); - if ((client->enabled_features & MAILBOX_FEATURE_QRESYNC) != 0 && - ret > 0) { - /* we expunged something. since we're sending updated - HIGHESTMODSEQ make sure the client sees all changes up to - it by syncing the mailbox one last time. We wouldn't need - to include our own expunge in there, but it's too much - trouble to hide it. */ - return cmd_sync(cmd, MAILBOX_SYNC_FLAG_EXPUNGE, - IMAP_SYNC_FLAG_SAFE, "OK Close completed."); - } else { - if (mailbox_sync(mailbox, 0, 0, NULL) < 0) - client_send_untagged_storage_error(client, storage); - cmd_close_finish(client); - client_send_tagline(cmd, "OK Close completed."); - return TRUE; - } + if (mailbox_close(&mailbox) < 0) + client_send_untagged_storage_error(client, storage); + client_update_mailbox_flags(client, NULL); + + client_send_tagline(cmd, "OK Close completed."); + return TRUE; }