From: Timo Sirainen Date: Sat, 15 Nov 2008 16:48:52 +0000 (+0200) Subject: Maildir: Fixed to work with LAYOUT=fs and non-empty DIRNAME. X-Git-Tag: 1.2.alpha4~89 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=269c7a4f364abde5b797f431ca51b8332d881790;p=thirdparty%2Fdovecot%2Fcore.git Maildir: Fixed to work with LAYOUT=fs and non-empty DIRNAME. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index 84b859cd05..d9d59629d3 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -930,19 +930,33 @@ maildir_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx if (stat(cur_path, &st2) < 0 || !S_ISDIR(st2.st_mode)) *flags |= MAILBOX_NOSELECT; - /* now we can figure out based on the link count if we have - child mailboxes or not. for a selectable mailbox we have - 3 more links (cur/, new/ and tmp/) than non-selectable. */ - if ((*flags & MAILBOX_NOSELECT) == 0) { - if (st.st_nlink > 5) - *flags |= MAILBOX_CHILDREN; - else - *flags |= MAILBOX_NOCHILDREN; + if (*ctx->list->set.maildir_name == '\0') { + /* now we can figure out based on the link count if we + have child mailboxes or not. for a selectable + mailbox we have 3 more links (cur/, new/ and tmp/) + than non-selectable. */ + if ((*flags & MAILBOX_NOSELECT) == 0) { + if (st.st_nlink > 5) + *flags |= MAILBOX_CHILDREN; + else + *flags |= MAILBOX_NOCHILDREN; + } else { + if (st.st_nlink > 2) + *flags |= MAILBOX_CHILDREN; + else + *flags |= MAILBOX_NOCHILDREN; + } } else { - if (st.st_nlink > 2) + /* link count 3 may mean either a selectable mailbox + or a non-selectable mailbox with 1 child. */ + if (st.st_nlink > 3) *flags |= MAILBOX_CHILDREN; - else - *flags |= MAILBOX_NOCHILDREN; + else if (st.st_nlink == 3) { + if ((*flags & MAILBOX_NOSELECT) != 0) + *flags |= MAILBOX_CHILDREN; + else + *flags |= MAILBOX_NOCHILDREN; + } } } return 1;