changeset 1246:d850b16d583f HEAD

Use \PlaceHolder only when listing subscriptions.
author Timo Sirainen <tss@iki.fi>
date Mon, 24 Feb 2003 20:30:23 +0200
parents 06b1b95ae756
children 467e79a48848
files src/imap/cmd-list.c src/lib-storage/index/maildir/maildir-list.c
diffstat 2 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-list.c	Mon Feb 24 20:15:18 2003 +0200
+++ b/src/imap/cmd-list.c	Mon Feb 24 20:30:23 2003 +0200
@@ -59,6 +59,7 @@
 
 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 @@
 			/* 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_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 @@
 					      listext);
 			} else {
 				list_and_sort(client, ctx, response_name, sep,
-					      mask, listext);
+					      mask, list_flags, listext);
 			}
 
 			failed = !client->storage->list_mailbox_deinit(ctx);
--- a/src/lib-storage/index/maildir/maildir-list.c	Mon Feb 24 20:15:18 2003 +0200
+++ b/src/lib-storage/index/maildir/maildir-list.c	Mon Feb 24 20:30:23 2003 +0200
@@ -241,7 +241,7 @@
 			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) {