dovecot-2.0: listescape: Fixed problems with handling mailbox li...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 3 07:19:33 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/ddc3593a2091
changeset: 9715:ddc3593a2091
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 03 00:19:26 2009 -0400
description:
listescape: Fixed problems with handling mailbox listing.

diffstat:

1 file changed, 15 insertions(+), 9 deletions(-)
src/plugins/listescape/listescape-plugin.c |   24 +++++++++++++++---------

diffs (52 lines):

diff -r 3876c3818628 -r ddc3593a2091 src/plugins/listescape/listescape-plugin.c
--- a/src/plugins/listescape/listescape-plugin.c	Mon Aug 03 00:18:06 2009 -0400
+++ b/src/plugins/listescape/listescape-plugin.c	Mon Aug 03 00:19:26 2009 -0400
@@ -56,10 +56,13 @@ static const char *list_escape(struct ma
 		str++;
 	}
 	for (; *str != '\0'; str++) {
-		if (*str == ns->sep && change_sep)
-			str_append_c(esc, ns->list->hierarchy_sep);
-		else if (*str == ns->list->hierarchy_sep ||
-			 *str == mlist->escape_char || *str == '/')
+		if (*str == ns->sep) {
+			if (change_sep)
+				str_append_c(esc, ns->list->hierarchy_sep);
+			else
+				str_append_c(esc, *str);
+		} else if (*str == ns->list->hierarchy_sep ||
+			   *str == mlist->escape_char || *str == '/')
 			str_printfa(esc, "%c%02x", mlist->escape_char, *str);
 		else
 			str_append_c(esc, *str);
@@ -105,14 +108,18 @@ listescape_mailbox_list_iter_init(struct
 	struct mailbox_list_iterate_context *ctx;
 	const char **escaped_patterns;
 	unsigned int i;
-
-	t_push();
-	if ((flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) != 0) {
+	bool change_sep;
+
+	/* this is kind of kludgy. In ACL code we want to convert patterns,
+	   in maildir renaming code we don't. so for now just use the _RAW_LIST
+	   flag.. */
+	if ((flags & MAILBOX_LIST_ITER_RAW_LIST) == 0) {
+		change_sep = (flags & MAILBOX_LIST_ITER_VIRTUAL_NAMES) == 0;
 		escaped_patterns = t_new(const char *,
 					 str_array_length(patterns) + 1);
 		for (i = 0; patterns[i] != NULL; i++) {
 			escaped_patterns[i] =
-				list_escape(list->ns, patterns[i], FALSE);
+				list_escape(list->ns, patterns[i], change_sep);
 		}
 		patterns = escaped_patterns;
 	}
@@ -124,7 +131,6 @@ listescape_mailbox_list_iter_init(struct
 	list->ns->real_sep = list->hierarchy_sep;
 	ctx = mlist->module_ctx.super.iter_init(list, patterns, flags);
 	list->ns->real_sep = list->ns->sep;
-	t_pop();
 	return ctx;
 }
 


More information about the dovecot-cvs mailing list