# HG changeset patch # User Timo Sirainen # Date 1241895862 14400 # Node ID e144fa1dd2cee31514ebb82be352c1feda742634 # Parent 937dca181d77567f0489d770736f92461606e40f Allow prefix="" namespace to have list=no and make it work in a somewhat useful way. Based on patch by Mark Washenberger. diff -r 937dca181d77 -r e144fa1dd2ce src/imap/cmd-list.c --- a/src/imap/cmd-list.c Sat May 09 14:53:06 2009 -0400 +++ b/src/imap/cmd-list.c Sat May 09 15:04:22 2009 -0400 @@ -570,8 +570,17 @@ 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 -r 937dca181d77 -r e144fa1dd2ce src/lib-storage/mail-namespace.c --- a/src/lib-storage/mail-namespace.c Sat May 09 14:53:06 2009 -0400 +++ b/src/lib-storage/mail-namespace.c Sat May 09 15:04:22 2009 -0400 @@ -176,12 +176,6 @@ 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++; }