changeset 11336:2587eb79a83d HEAD

lib-storage: mailbox_list_iter_init_namespaces() didn't match INBOX pattern correctly.
author Timo Sirainen <tss@iki.fi>
date Wed, 19 May 2010 17:35:27 +0200
parents 1c1db8a6cfc7
children 4ec22f3bfd9f
files src/lib-storage/mailbox-list.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mailbox-list.c	Wed May 19 17:21:42 2010 +0200
+++ b/src/lib-storage/mailbox-list.c	Wed May 19 17:35:27 2010 +0200
@@ -607,6 +607,19 @@
 }
 
 static bool
+ns_match_inbox(struct mail_namespace *ns, const char *pattern)
+{
+	struct imap_match_glob *glob;
+
+	if ((ns->flags & NAMESPACE_FLAG_INBOX) == 0)
+		return FALSE;
+
+	glob = imap_match_init(pool_datastack_create(), pattern,
+			       TRUE, ns->sep);
+	return imap_match(glob, "INBOX") == IMAP_MATCH_YES;
+}
+
+static bool
 ns_match_next(struct ns_list_iterate_context *ctx, struct mail_namespace *ns,
 	      const char *pattern)
 {
@@ -693,6 +706,8 @@
 		   necessary, but this shouldn't matter much */
 		T_BEGIN {
 			for (i = 0; ctx->patterns_ns_match[i] != NULL; i++) {
+				if (ns_match_inbox(ns, ctx->patterns_ns_match[i]))
+					break;
 				if (ns_match_next(ctx, ns,
 						  ctx->patterns_ns_match[i]))
 					break;