]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Allow prefix="" namespace to have list=no and make it work in a somewhat useful way.
authorTimo Sirainen <tss@iki.fi>
Sat, 9 May 2009 19:04:22 +0000 (15:04 -0400)
committerTimo Sirainen <tss@iki.fi>
Sat, 9 May 2009 19:04:22 +0000 (15:04 -0400)
Based on patch by Mark Washenberger.

--HG--
branch : HEAD

src/imap/cmd-list.c
src/lib-storage/mail-namespace.c

index 5acef37b7bdfcabb186e6a720368fb8059a0186a..64876adcd10f3c879c635bcac81dfef6b5434741 100644 (file)
@@ -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%.
index cf846598dbeb40c0464d74a4b7e6a59cb2d7615c..78a402714016ce91621d9bb705083fbe585d7e36 100644 (file)
@@ -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++;
        }