From: Timo Sirainen Date: Sat, 9 May 2009 19:04:22 +0000 (-0400) Subject: Allow prefix="" namespace to have list=no and make it work in a somewhat useful way. X-Git-Tag: 2.0.alpha1~799 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b8f95b9ad0c0af4bceeadfaad7aba245397697c;p=thirdparty%2Fdovecot%2Fcore.git Allow prefix="" namespace to have list=no and make it work in a somewhat useful way. Based on patch by Mark Washenberger. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index 5acef37b7b..64876adcd1 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -570,8 +570,17 @@ list_namespace_match_pattern(struct cmd_list_context *ctx, bool inboxcase, skip_namespace_prefix_pattern(ctx, &cur_ns_prefix, cur_ref, &cur_pattern); - if (*cur_ns_prefix == '\0') - return TRUE; + if (*cur_ns_prefix == '\0') { + /* no namespace prefix: if list=no we don't want to show + anything, except when the client does e.g. LIST "" mailbox. + prefix="", list=no namespace is mainly useful for working + around client bugs. */ + if ((ns->flags & NAMESPACE_FLAG_LIST_PREFIX) == 0 && + list_pattern_has_wildcards(cur_pattern)) + return FALSE; + else + return TRUE; + } /* namespace prefix still wasn't completely skipped over. for example cur_ns_prefix=INBOX/, pattern=%/% or pattern=IN%. diff --git a/src/lib-storage/mail-namespace.c b/src/lib-storage/mail-namespace.c index cf846598db..78a4027140 100644 --- a/src/lib-storage/mail-namespace.c +++ b/src/lib-storage/mail-namespace.c @@ -176,12 +176,6 @@ namespaces_check(struct mail_namespace *namespaces, const char **error_r) return FALSE; } } - if (*ns->prefix == '\0' && - (ns->flags & NAMESPACE_FLAG_LIST_PREFIX) == 0) { - *error_r = "namespace configuration error: " - "Empty prefix requires list=yes"; - return FALSE; - } if ((ns->flags & NAMESPACE_FLAG_SUBSCRIPTIONS) != 0) subscriptions_count++; }