]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Show "foo/" style replies only for IMAP LIST command.
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Jul 2010 20:15:34 +0000 (21:15 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Jul 2010 20:15:34 +0000 (21:15 +0100)
Internally those replies just mess up things.

src/imap/cmd-list.c
src/lib-storage/list/mailbox-list-fs-iter.c
src/lib-storage/mailbox-list.h

index 06739ad2818d32f647f5bd19198057ad89c8b463..0dcce60cb3fc5451712248ab4a016d0992a8c1f0 100644 (file)
@@ -932,6 +932,7 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub)
                /* non-extended LIST - return children flags always */
                ctx->list_flags |= MAILBOX_LIST_ITER_RETURN_CHILDREN;
        }
+       ctx->list_flags |= MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT;
 
        if (!IMAP_ARG_IS_EOL(args)) {
                client_send_command_error(cmd, "Extra arguments.");
index e87867fefeb7a3c34e3ad50f85213d76aeed2866..0db9642b338c0d3fb305cb0ccf084d37c2481685 100644 (file)
@@ -517,6 +517,12 @@ list_file_subdir(struct fs_list_iterate_context *ctx,
                delayed_send = TRUE;
        }
 
+       if ((ctx->ctx.flags & MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT) == 0) {
+               /* LIST "" foo/% - we don't want to see foo/ returned */
+               delayed_send = FALSE;
+               match2 = IMAP_MATCH_CHILDREN;
+       }
+
        if (scan_subdir) {
                real_path = t_strconcat(ctx->dir->real_path, "/", fname, NULL);
                ret = list_opendir(ctx, real_path, vpath, &dirp);
index d7ebd7cdce3b1ae7bab9f4dd45f5e982dba44027..41320042a5cc5bb888679ec43a70f2f88f50410a 100644 (file)
@@ -61,6 +61,10 @@ enum mailbox_name_status {
 enum mailbox_list_iter_flags {
        /* Ignore index file and ACLs (used by ACL plugin internally) */
        MAILBOX_LIST_ITER_RAW_LIST              = 0x000001,
+       /* When listing "foo/%" and "foo" is an existing mailbox
+          (maybe \noselect), have LIST also return "foo/" in the replies.
+          This is needed by IMAP, but messes up internal code. */
+       MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT  = 0x000002,
        /* Don't list INBOX unless it actually exists */
        MAILBOX_LIST_ITER_NO_AUTO_INBOX         = 0x000004,