# HG changeset patch # User Timo Sirainen # Date 1193506204 -10800 # Node ID 0511e301acbc4487ec88042d751328b200d534fa # Parent 7373240c3d1d1764cbae335d32dede5753dd5e0d Allow subscribing to namespace prefixes if they're listable. diff -r 7373240c3d1d -r 0511e301acbc src/imap/cmd-subscribe.c --- 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)