From: Timo Sirainen Date: Thu, 15 Mar 2012 11:25:36 +0000 (+0200) Subject: layout=maildir++: Don't list INBOX if it doesn't match the list patterns. X-Git-Tag: 2.1.2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b28ea1d18bcdac5bab1b1a97608f2fd73fd63221;p=thirdparty%2Fdovecot%2Fcore.git layout=maildir++: Don't list INBOX if it doesn't match the list patterns. --- diff --git a/src/lib-storage/list/mailbox-list-maildir-iter.c b/src/lib-storage/list/mailbox-list-maildir-iter.c index 51746f0d73..b0cac0cacd 100644 --- a/src/lib-storage/list/mailbox-list-maildir-iter.c +++ b/src/lib-storage/list/mailbox-list-maildir-iter.c @@ -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; }