changeset 6629:0511e301acbc HEAD

Allow subscribing to namespace prefixes if they're listable.
author Timo Sirainen <tss@iki.fi>
date Sat, 27 Oct 2007 20:30:04 +0300
parents 7373240c3d1d
children 427eeded8078
files src/imap/cmd-subscribe.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-subscribe.c	Sat Oct 27 20:18:37 2007 +0300
+++ b/src/imap/cmd-subscribe.c	Sat Oct 27 20:30:04 2007 +0300
@@ -6,7 +6,7 @@
 
 bool cmd_subscribe_full(struct client_command_context *cmd, bool subscribe)
 {
-	struct mail_namespace *ns;
+	struct mail_namespace *ns, *ns2;
         struct mail_storage *storage;
 	struct mailbox_list *list;
 	const char *mailbox, *verify_name;
@@ -31,8 +31,15 @@
 		verify_name = t_strndup(verify_name, strlen(verify_name)-1);
 	}
 
-	if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))
-		return TRUE;
+	ns2 = mail_namespace_find_prefix_nosep(cmd->client->namespaces,
+					       mailbox);
+	if (ns2 != NULL && (ns2->flags & NAMESPACE_FLAG_LIST) != 0) {
+		/* subscribing to a listable namespace prefix, allow it. */
+	} else {
+		if (!client_verify_mailbox_name(cmd, verify_name,
+						subscribe, FALSE))
+			return TRUE;
+	}
 
 	list = mail_storage_get_list(storage);
 	if (mailbox_list_set_subscribed(list, mailbox, subscribe) < 0)