dovecot-2.0: imap delete: Use mailbox_backends_equal() for findi...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 24 22:58:17 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/5024551304d9
changeset: 9651:5024551304d9
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 24 15:58:08 2009 -0400
description:
imap delete: Use mailbox_backends_equal() for finding if we're deleting selected mailbox.

diffstat:

1 file changed, 5 insertions(+), 8 deletions(-)
src/imap/cmd-delete.c |   13 +++++--------

diffs (33 lines):

diff -r 6b6d6e094674 -r 5024551304d9 src/imap/cmd-delete.c
--- a/src/imap/cmd-delete.c	Fri Jul 24 15:56:21 2009 -0400
+++ b/src/imap/cmd-delete.c	Fri Jul 24 15:58:08 2009 -0400
@@ -7,7 +7,6 @@ bool cmd_delete(struct client_command_co
 {
 	struct client *client = cmd->client;
 	struct mail_namespace *ns;
-	struct mail_storage *storage;
 	struct mailbox *mailbox;
 	const char *name;
 
@@ -25,16 +24,14 @@ bool cmd_delete(struct client_command_co
 	if (ns == NULL)
 		return TRUE;
 
-	mailbox = client->mailbox;
-	if (mailbox != NULL && mailbox_get_namespace(mailbox) == ns &&
-	    strcmp(mailbox_get_name(mailbox), name) == 0) {
+	mailbox = mailbox_alloc(ns->list, name, NULL, 0);
+	if (client->mailbox != NULL &&
+	    mailbox_backends_equal(mailbox, client->mailbox)) {
 		/* deleting selected mailbox. close it first */
 		client_search_updates_free(client);
-		storage = mailbox_get_storage(mailbox);
-		client->mailbox = NULL;
-
-		mailbox_close(&mailbox);
+		mailbox_close(&client->mailbox);
 	}
+	mailbox_close(&mailbox);
 
 	if ((client->workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
 	    *name != '\0' &&


More information about the dovecot-cvs mailing list