[dovecot-cvs] dovecot/src/imap cmd-list.c,1.51.2.9,1.51.2.10

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-serv672

Modified Files:
      Tag: branch_1_0
	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.51.2.9
retrieving revision 1.51.2.10
diff -u -d -r1.51.2.9 -r1.51.2.10
--- cmd-list.c	14 Mar 2007 16:17:44 -0000	1.51.2.9
+++ cmd-list.c	27 Mar 2007 21:32:23 -0000	1.51.2.10
@@ -465,15 +465,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) {
@@ -481,10 +493,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