[dovecot-cvs] dovecot/src/imap cmd-list.c,1.66,1.67

tss at dovecot.org tss at dovecot.org
Wed Mar 28 00:32:27 EEST 2007


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv668

Modified Files:
	cmd-list.c 
Log Message:
LIST "" "" should return something even if we don't have a namespace with
empty prefix. Use INBOX namespace's separator then.



Index: cmd-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- cmd-list.c	15 Mar 2007 21:19:58 -0000	1.66
+++ cmd-list.c	27 Mar 2007 21:32:25 -0000	1.67
@@ -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



More information about the dovecot-cvs mailing list