changeset 6630:427eeded8078 HEAD

Don't fail if trying to delete a nonselectable mailbox.
author Timo Sirainen <tss@iki.fi>
date Sat, 27 Oct 2007 20:37:35 +0300
parents 0511e301acbc
children 0dd9b91fd52c
files src/plugins/quota/quota-storage.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota-storage.c	Sat Oct 27 20:30:04 2007 +0300
+++ b/src/plugins/quota/quota-storage.c	Sat Oct 27 20:37:35 2007 +0300
@@ -391,6 +391,7 @@
 	struct quota_transaction_context *qt;
 	struct mail *mail;
 	struct mail_search_arg search_arg;
+	enum mail_error error;
 	int ret;
 
 	/* This is a bit annoying to handle. We'll have to open the mailbox
@@ -399,8 +400,14 @@
 	   calculations by adding/removing mails while we're doing this. */
 	box = mailbox_open(qlist->storage, name, NULL, MAILBOX_OPEN_FAST |
 			   MAILBOX_OPEN_KEEP_RECENT | MAILBOX_OPEN_KEEP_LOCKED);
-	if (box == NULL)
-		return -1;
+	if (box == NULL) {
+		(void)mail_storage_get_last_error(qlist->storage, &error);
+		if (error != MAIL_ERROR_NOTPOSSIBLE)
+			return -1;
+
+		/* mailbox isn't selectable */
+		return qlist->module_ctx.super.delete_mailbox(list, name);
+	}
 
 	if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ, 0, NULL) < 0) {
 		mailbox_close(&box);