Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6577:5b2ff32877d4 HEAD
Send namespace prefix LIST reply for list=no namespaces also if doing LIST
"" prefix.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 21 Oct 2007 01:43:48 +0300 |
parents | 66e6311e22b3 |
children | d7ed8c41d8b3 |
files | src/imap/cmd-list.c |
diffstat | 1 files changed, 22 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Sun Oct 21 00:03:20 2007 +0300 +++ b/src/imap/cmd-list.c Sun Oct 21 01:43:48 2007 +0300 @@ -508,6 +508,26 @@ } static bool +list_want_send_prefix(struct cmd_list_context *ctx, const char *pattern) +{ + /* don't send the prefix if we're listing subscribed mailboxes */ + if ((ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0) + return FALSE; + + /* send the prefix if namespace is listable.. */ + if ((ctx->ns->flags & NAMESPACE_FLAG_LIST) != 0) + return TRUE; + + /* ..or if pattern is exactly the same as namespace prefix. + some clients (mutt) want to do LIST "" prefix. */ + for (; *pattern != '\0'; pattern++) { + if (*pattern == '*' || *pattern == '%') + break; + } + return *pattern == '\0'; +} + +static bool list_namespace_match_pattern(struct cmd_list_context *ctx, bool inboxcase, const char *cur_ref, const char *cur_ns_prefix, const char *cur_pattern) @@ -549,12 +569,9 @@ inboxcase, ns->sep); match = imap_match(pat_glob, cur_ns_prefix); if (match == IMAP_MATCH_YES) { - if ((ns->flags & NAMESPACE_FLAG_LIST) != 0 && - (ctx->list_flags & - MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) == 0) { - /* the namespace prefix itself matches too. send it. */ + if (list_want_send_prefix(ctx, orig_cur_pattern)) ctx->cur_ns_send_prefix = TRUE; - } + /* if the pattern contains '*' characters, we'll need to check our children too */ for (p = orig_cur_pattern; *p != '\0'; p++) {