]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: MAILBOX_LIST_ITER_NO_AUTO_INBOX flag didn't work correctly.
authorTimo Sirainen <tss@iki.fi>
Sun, 4 Apr 2010 23:56:31 +0000 (02:56 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 4 Apr 2010 23:56:31 +0000 (02:56 +0300)
--HG--
branch : HEAD

src/lib-storage/list/mailbox-list-fs-iter.c
src/lib-storage/list/mailbox-list-maildir-iter.c

index c26034916d23fbbc42312c448ada3c7ab1624315..7101fc56d4bf0463ebfaa75d10611c6e73640de2 100644 (file)
@@ -413,6 +413,10 @@ static struct mailbox_info *fs_list_inbox(struct fs_list_iterate_context *ctx)
        if (mailbox_list_mailbox(ctx->ctx.list, "INBOX", &ctx->info.flags) < 0)
                ctx->ctx.failed = TRUE;
 
+       if ((ctx->ctx.flags & MAILBOX_LIST_ITER_NO_AUTO_INBOX) != 0 &&
+           (ctx->info.flags & MAILBOX_NONEXISTENT) != 0)
+               return NULL;
+
        ctx->info.flags |= fs_list_get_subscription_flags(ctx, "INBOX");
        inbox_flags_set(ctx);
        /* we got here because we didn't see INBOX among other mailboxes,
@@ -762,7 +766,6 @@ fs_list_next(struct fs_list_iterate_context *ctx)
        }
 
        if (!ctx->inbox_found &&
-           (ctx->ctx.flags & MAILBOX_LIST_ITER_NO_AUTO_INBOX) == 0 &&
            (ctx->ctx.list->ns->flags & NAMESPACE_FLAG_INBOX) != 0 &&
            ((ctx->glob != NULL &&
              imap_match(ctx->glob, "INBOX") == IMAP_MATCH_YES) ||
index f6fd393137d4ba655564596e6f394c351b952cab..0463a6af24b94321a2b12b354d0126130a80c575 100644 (file)
@@ -124,7 +124,6 @@ maildir_fill_inbox(struct maildir_list_iterate_context *ctx,
                   struct imap_match_glob *glob,
                   bool update_only)
 {
-       const struct mailbox_list_settings *set = &ctx->ctx.list->set;
        struct mailbox_node *node;
        enum mailbox_info_flags flags;
        enum imap_match_result match;
@@ -133,17 +132,13 @@ maildir_fill_inbox(struct maildir_list_iterate_context *ctx,
 
        if ((ctx->ctx.flags & MAILBOX_LIST_ITER_NO_AUTO_INBOX) == 0) {
                /* always show INBOX */
-       } else if (set->inbox_path != NULL &&
-                  strcmp(set->inbox_path, set->root_dir) != 0) {
-               /* INBOX doesn't exist, since it wasn't listed */
-               update_only = TRUE;
        } else {
-               /* INBOX is in Maildir root. show it only if it has already
-                  been created */
+               /* INBOX may be Maildir root or completely elsewhere.
+                  show it only if it has already been created */
                ret = mailbox_list_mailbox(ctx->ctx.list, "INBOX", &flags);
                if (ret < 0)
                        return -1;
-               if (ret == 0)
+               if ((flags & MAILBOX_NONEXISTENT) != 0)
                        update_only = TRUE;
        }