Mercurial > dovecot > core-2.2
changeset 5438:97f9bdbe924d HEAD
LIST "" "" should return something even if we don't have a namespace with
empty prefix. Use INBOX namespace's separator then.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Mar 2007 00:32:25 +0300 |
parents | 2704fc574e70 |
children | c5401a8f4679 |
files | src/imap/cmd-list.c |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Tue Mar 27 23:13:32 2007 +0300 +++ b/src/imap/cmd-list.c Wed Mar 28 00:32:25 2007 +0300 @@ -478,15 +478,27 @@ } if (*mask == '\0' && !lsub) { + const char *ns_prefix; + /* special request to return the hierarchy delimiter and mailbox root name. Mailbox root name is somewhat strange concept which probably no other client uses than Pine. Just try our best to emulate UW-IMAP behavior and hopefully we're fine. */ ns = namespace_find_visible(client->namespaces, &ref); - if (ns == NULL) { + if (ns != NULL) + ns_prefix = ns->prefix; + else { const char *empty = ""; + + ns_prefix = ""; ns = namespace_find(client->namespaces, &empty); + if (ns == NULL) { + /* we must reply something. use INBOX + namespace's separator. */ + const char *inbox = "INBOX"; + ns = namespace_find(client->namespaces, &inbox); + } } if (ns != NULL) { @@ -494,10 +506,9 @@ str_printfa(str, "* LIST (\\Noselect) \"%s\" ", ns->sep_str); - if (*ns->prefix != '\0' && !ns->hidden) { + if (*ns_prefix != '\0' && !ns->hidden) { /* public namespace, use it as the root name */ - imap_quote_append_string(str, ns->prefix, - FALSE); + imap_quote_append_string(str, ns_prefix, FALSE); } else { /* private namespace, or empty namespace prefix. use the mailbox name's first part