]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Shared Maildirs: Fixes to listing INBOX.
authorTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 22:14:51 +0000 (18:14 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 2 Apr 2009 22:14:51 +0000 (18:14 -0400)
Based on patch by Bernhard Herzog.

--HG--
branch : HEAD

src/lib-storage/list/mailbox-list-maildir-iter.c
src/lib-storage/mail-namespace.c

index 97b04d4bbce3c192cf08e860f40461b782512a8b..355a74cf1a1b082bab3e2d72eb2ca2ef7a60b2c6 100644 (file)
@@ -235,32 +235,28 @@ maildir_fill_readdir(struct maildir_list_iterate_context *ctx,
        }
 
        if ((ns->flags & NAMESPACE_FLAG_INBOX) != 0) {
-               /* make sure INBOX is there */
+               /* make sure INBOX is listed */
+               if (!virtual_names)
+                       mailbox_name = "INBOX";
+               else {
+                       mailbox_name = mail_namespace_get_vname(ns, mailbox,
+                                                               "INBOX");
+               }
+
                created = FALSE;
                node = update_only ?
-                       mailbox_tree_lookup(ctx->tree_ctx, "INBOX") :
-                       mailbox_tree_get(ctx->tree_ctx, "INBOX", &created);
+                       mailbox_tree_lookup(ctx->tree_ctx, mailbox_name) :
+                       mailbox_tree_get(ctx->tree_ctx, mailbox_name, &created);
                if (created)
                        node->flags = MAILBOX_NOCHILDREN;
                else if (node != NULL)
                        node->flags &= ~MAILBOX_NONEXISTENT;
 
-               match = imap_match(glob, "INBOX");
+               match = imap_match(glob, mailbox_name);
                if ((match & (IMAP_MATCH_YES | IMAP_MATCH_PARENT)) != 0) {
                        if (!update_only)
                                node->flags |= MAILBOX_MATCHED;
                }
-       } else if (mailbox_tree_lookup(ctx->tree_ctx, "INBOX") == NULL &&
-                  imap_match(glob, "INBOX") == IMAP_MATCH_YES) {
-               /* see if INBOX exists. */
-               ret = ctx->ctx.list->v.
-                       iter_is_mailbox(&ctx->ctx, ctx->dir, "", "INBOX",
-                                       MAILBOX_LIST_FILE_TYPE_UNKNOWN, &flags);
-               if (ret > 0) {
-                       node = mailbox_tree_get(ctx->tree_ctx,
-                               t_strconcat(ns->prefix, "INBOX", NULL), NULL);
-                       node->flags = MAILBOX_NOCHILDREN | MAILBOX_MATCHED;
-               }
        }
        return 0;
 }
index a80ac1e4f0764fb5ff2fc644477333c0a4fddcbd..598ebf79b0f13628fd85149d4e74ef4525098cc1 100644 (file)
@@ -348,7 +348,8 @@ const char *mail_namespace_get_vname(struct mail_namespace *ns, string_t *dest,
 {
        str_truncate(dest, 0);
        if ((ns->flags & NAMESPACE_FLAG_INBOX) == 0 ||
-           strcasecmp(name, "INBOX") != 0)
+           strcasecmp(name, "INBOX") != 0 ||
+           ns->user != ns->owner)
                str_append(dest, ns->prefix);
 
        for (; *name != '\0'; name++) {