dovecot-1.2: Some fixes to shared namespace listing code.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 9 13:05:57 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/d30f0525d457
changeset: 8257:d30f0525d457
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 09 13:05:52 2008 +0300
description:
Some fixes to shared namespace listing code.

diffstat:

1 file changed, 14 insertions(+), 8 deletions(-)
src/lib-storage/index/shared/shared-list.c |   22 ++++++++++++++--------

diffs (40 lines):

diff -r 6e1d0ae97963 -r d30f0525d457 src/lib-storage/index/shared/shared-list.c
--- a/src/lib-storage/index/shared/shared-list.c	Thu Oct 09 00:08:34 2008 +0300
+++ b/src/lib-storage/index/shared/shared-list.c	Thu Oct 09 13:05:52 2008 +0300
@@ -118,14 +118,20 @@ shared_list_join_refpattern(struct mailb
 			    const char *ref, const char *pattern)
 {
 	struct mail_namespace *ns;
-
-	if (*ref != '\0' &&
-	    shared_storage_get_namespace(list->ns->storage, &ref, &ns) == 0)
+	const char *ns_ref, *prefix = list->ns->prefix;
+	unsigned int prefix_len = strlen(prefix);
+
+	if (*ref != '\0' && strncmp(ref, prefix, prefix_len) == 0)
+		ns_ref = ref + prefix_len;
+	else if (*ref == '\0' && strncmp(pattern, prefix, prefix_len) == 0)
+		ns_ref = pattern + prefix_len;
+	else
+		ns_ref = NULL;
+
+	if (ns_ref != NULL &&
+	    shared_storage_get_namespace(list->ns->storage,
+					 &ns_ref, &ns) == 0)
 		return mailbox_list_join_refpattern(ns->list, ref, pattern);
-
-	if (*ref == '\0' &&
-	    shared_storage_get_namespace(list->ns->storage, &pattern, &ns) == 0)
-		return mailbox_list_join_refpattern(ns->list, "", pattern);
 
 	/* fallback to default behavior */
 	if (*ref != '\0')
@@ -162,7 +168,7 @@ static int shared_list_iter_deinit(struc
 		(struct shared_mailbox_list_iterate_context *)_ctx;
 
 	i_free(ctx);
-	return -1;
+	return 0;
 }
 
 static int shared_list_set_subscribed(struct mailbox_list *list,


More information about the dovecot-cvs mailing list