changeset 13099:3a12ac2413e2

lib-storage: mailbox_exists() now returns NOSELECT for invalid mailbox names instead of error.
author Timo Sirainen <tss@iki.fi>
date Fri, 22 Jul 2011 13:11:26 +0300
parents c2aec00f40c5
children fbd680c37b6a
files src/lib-storage/mail-storage.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c	Fri Jul 22 13:10:41 2011 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Jul 22 13:11:26 2011 +0300
@@ -625,9 +625,10 @@
 int mailbox_exists(struct mailbox *box, enum mailbox_existence *existence_r)
 {
 	if (!mailbox_list_is_valid_existing_name(box->list, box->name)) {
-		mail_storage_set_error(box->storage, MAIL_ERROR_PARAMS,
-				       "Invalid mailbox name");
-		return -1;
+		/* report it as not selectable, since it exists but we won't
+		   let it be opened. */
+		*existence_r = MAILBOX_EXISTENCE_NOSELECT;
+		return 0;
 	}
 
 	if (have_listable_namespace_prefix(box->storage->user->namespaces,