]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
layout=maildir++: Don't list INBOX if it doesn't match the list patterns.
authorTimo Sirainen <tss@iki.fi>
Thu, 15 Mar 2012 11:25:36 +0000 (13:25 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 15 Mar 2012 11:25:36 +0000 (13:25 +0200)
src/lib-storage/list/mailbox-list-maildir-iter.c

index 51746f0d736798d4b338bbb1a63b5ffb8c4a7853..b0cac0cacd48e9f56ee08e5a8f8a348b0058a519 100644 (file)
@@ -135,16 +135,20 @@ maildir_fill_inbox(struct maildir_list_iterate_context *ctx,
                node = mailbox_tree_lookup(ctx->tree_ctx, inbox_name);
                if (node != NULL)
                        node->flags &= ~MAILBOX_NONEXISTENT;
-       } else {
+               return 0;
+       }
+
+       /* add the INBOX only if it matches the patterns */
+       match = imap_match(glob, inbox_name);
+       if (match == IMAP_MATCH_PARENT)
+               maildir_fill_parents(ctx, glob, FALSE, inbox_name);
+       else if (match == IMAP_MATCH_YES) {
                node = mailbox_tree_get(ctx->tree_ctx, inbox_name, &created);
                if (created)
                        node->flags = MAILBOX_NOCHILDREN;
                else
                        node->flags &= ~MAILBOX_NONEXISTENT;
-
-               match = imap_match(glob, inbox_name);
-               if ((match & (IMAP_MATCH_YES | IMAP_MATCH_PARENT)) != 0)
-                       node->flags |= MAILBOX_MATCHED;
+               node->flags |= MAILBOX_MATCHED;
        }
        return 0;
 }