[dovecot-cvs] dovecot/src/imap cmd-list.c,1.21,1.22
cras at procontrol.fi
cras at procontrol.fi
Thu Mar 20 19:38:41 EET 2003
Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv18128/imap
Modified Files:
cmd-list.c
Log Message:
More kludgy LIST fixes for maildir subfolders
Index: cmd-list.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmd-list.c 20 Mar 2003 17:19:03 -0000 1.21
+++ cmd-list.c 20 Mar 2003 17:38:39 -0000 1.22
@@ -24,16 +24,17 @@
const char *response_name;
const char *sep;
struct imap_match_glob *glob;
- int listext;
+ int listext, no_placeholder;
};
-static const char *mailbox_flags2str(enum mailbox_flags flags, int listext)
+static const char *mailbox_flags2str(enum mailbox_flags flags,
+ int listext, int no_placeholder)
{
const char *str;
if (flags & MAILBOX_PLACEHOLDER) {
- if (flags == MAILBOX_PLACEHOLDER) {
- if (!listext)
+ if ((flags & ~MAILBOX_CHILDREN) == MAILBOX_PLACEHOLDER) {
+ if (!listext || no_placeholder)
flags = MAILBOX_NOSELECT;
} else {
/* it was at one point, but then we got better specs */
@@ -59,7 +60,6 @@
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;
@@ -88,7 +88,8 @@
/* not found, create it */
*node = p_new(pool, struct list_node, 1);
(*node)->name = p_strdup(pool, name);
- (*node)->flags = *path == '\0' ? flags : dir_flags;
+ (*node)->flags = *path == '\0' ? flags :
+ MAILBOX_PLACEHOLDER;
} else {
if (*path == '\0') {
if (((*node)->flags & MAILBOX_NOSELECT) != 0 &&
@@ -155,7 +156,8 @@
if (match == IMAP_MATCH_YES) {
/* node->name should already be escaped */
- flagstr = mailbox_flags2str(node->flags, ctx->listext);
+ flagstr = mailbox_flags2str(node->flags, ctx->listext,
+ ctx->no_placeholder);
str = t_strdup_printf("* %s (%s) \"%s\" \"%s\"",
ctx->response_name, flagstr,
ctx->sep, send_name);
@@ -178,19 +180,15 @@
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,
- dir_flags, list->flags);
+ list->flags);
}
send_ctx.client = client;
@@ -199,6 +197,7 @@
send_ctx.glob = imap_match_init(data_stack_pool, mask, TRUE,
client->storage->hierarchy_sep);
send_ctx.listext = listext;
+ send_ctx.no_placeholder = (list_flags & MAILBOX_LIST_SUBSCRIBED) == 0;
list_send(&send_ctx, nodes, NULL);
imap_match_deinit(send_ctx.glob);
@@ -219,7 +218,8 @@
else
name = str_escape(list->name);
str = t_strdup_printf("* %s (%s) \"%s\" \"%s\"", reply,
- mailbox_flags2str(list->flags, listext),
+ mailbox_flags2str(list->flags, listext,
+ FALSE),
sep, name);
client_send_line(client, str);
t_pop();
More information about the dovecot-cvs
mailing list