]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Set MAILBOX_CHILDREN flag for \NoSelect mailboxes if we know it.
authorTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 23:03:17 +0000 (02:03 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 11 Jun 2008 23:03:17 +0000 (02:03 +0300)
--HG--
branch : HEAD

src/lib-storage/index/dbox/dbox-storage.c

index 8cc9040d8e05730f16f7f6d6c1b6076fe557fa1b..a37c4aaf27b172e76a23733ab84d66d5e9933424 100644 (file)
@@ -588,7 +588,7 @@ static int dbox_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx
                                     enum mailbox_info_flags *flags)
 {
        const char *path, *maildir_path;
-       struct stat st;
+       struct stat st, st2;
        int ret = 1;
 
        /* try to avoid stat() with these checks */
@@ -634,8 +634,12 @@ static int dbox_list_iter_is_mailbox(struct mailbox_list_iterate_context *ctx
        if ((*flags & (MAILBOX_NOSELECT | MAILBOX_NONEXISTENT)) == 0) {
                /* make sure it's a selectable mailbox */
                maildir_path = t_strconcat(path, "/"DBOX_MAILDIR_NAME, NULL);
-               if (stat(maildir_path, &st) < 0 || !S_ISDIR(st.st_mode))
+               if (stat(maildir_path, &st2) < 0 || !S_ISDIR(st2.st_mode)) {
                        *flags |= MAILBOX_NOSELECT;
+                       if (st.st_nlink == 3 &&
+                           *ctx->list->set.maildir_name != '\0')
+                               *flags |= MAILBOX_CHILDREN;
+               }
        }
        return ret;
 }