]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use \PlaceHolder only when listing subscriptions.
authorTimo Sirainen <tss@iki.fi>
Mon, 24 Feb 2003 18:30:23 +0000 (20:30 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 24 Feb 2003 18:30:23 +0000 (20:30 +0200)
--HG--
branch : HEAD

src/imap/cmd-list.c
src/lib-storage/index/maildir/maildir-list.c

index 5e34e6a78b938e3fa557154ae0cd4623dbb29b49..66471bd7e852c6504fec1d9f362417631df5e022 100644 (file)
@@ -59,6 +59,7 @@ static const char *mailbox_flags2str(enum mailbox_flags flags, int listext)
 
 static void list_node_update(pool_t pool, struct list_node **node,
                             const char *path, char separator,
+                            enum mailbox_flags dir_flags,
                             enum mailbox_flags flags)
 {
        const char *name, *parent;
@@ -87,11 +88,17 @@ static void list_node_update(pool_t pool, struct list_node **node,
                        /* not found, create it */
                        *node = p_new(pool, struct list_node, 1);
                        (*node)->name = p_strdup(pool, name);
-                       (*node)->flags = *path == '\0' ?
-                               flags : MAILBOX_PLACEHOLDER;
+                       (*node)->flags = *path == '\0' ? flags : dir_flags;
                } else {
-                       if (*path == '\0')
+                       if (*path == '\0') {
+                               if (((*node)->flags & MAILBOX_NOSELECT) != 0 &&
+                                   (flags & MAILBOX_NOSELECT) == 0) {
+                                       /* overrides previous flag */
+                                       (*node)->flags &= ~MAILBOX_NOSELECT;
+                               }
+
                                (*node)->flags |= flags;
+                       }
                }
 
                t_pop();
@@ -157,20 +164,25 @@ static void list_send(struct list_send_context *ctx, struct list_node *node,
 static void list_and_sort(struct client *client,
                          struct mailbox_list_context *ctx,
                          const char *response_name,
-                         const char *sep, const char *mask, int listext)
+                         const char *sep, const char *mask,
+                         enum mailbox_list_flags list_flags, int listext)
 {
        struct mailbox_list *list;
        struct list_node *nodes;
        struct list_send_context send_ctx;
+       enum mailbox_flags dir_flags;
        pool_t pool;
 
+       dir_flags = (list_flags & MAILBOX_LIST_SUBSCRIBED) ?
+               MAILBOX_PLACEHOLDER : MAILBOX_NOSELECT;
+
        pool = pool_alloconly_create("list_mailboxes", 10240);
        nodes = NULL;
 
        while ((list = client->storage->list_mailbox_next(ctx)) != NULL) {
                list_node_update(pool, &nodes, list->name,
                                 client->storage->hierarchy_sep,
-                                list->flags);
+                                dir_flags, list->flags);
        }
 
        send_ctx.client = client;
@@ -314,7 +326,7 @@ int _cmd_list_full(struct client *client, int lsub)
                                              listext);
                        } else {
                                list_and_sort(client, ctx, response_name, sep,
-                                             mask, listext);
+                                             mask, list_flags, listext);
                        }
 
                        failed = !client->storage->list_mailbox_deinit(ctx);
index 0f8df4e28e7559957b9d24ee104f5f2565364e55..255c1570a9cab46074c990086c4e5f02ef489276 100644 (file)
@@ -241,7 +241,7 @@ static struct mailbox_list *maildir_list_next(struct mailbox_list_context *ctx)
                        continue; /* ignore inboxes */
 
                if (match == IMAP_MATCH_PARENT) {
-                       ctx->list.flags = MAILBOX_PLACEHOLDER;
+                       ctx->list.flags = MAILBOX_NOSELECT;
                        while ((p = strrchr(fname, '.')) != NULL) {
                                fname = t_strdup_until(fname, p);
                                if (imap_match(ctx->glob, fname) > 0) {