dovecot-2.2: lib-imap: imap_envelope_parse() added extra "," aft...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 3 21:32:42 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/342f6962390e
changeset: 17039:342f6962390e
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 03 21:31:59 2013 +0200
description:
lib-imap: imap_envelope_parse() added extra "," after address group.
This function wasn't actually used by Dovecot anywhere anymore.
Patch by Potapov Sergey.

diffstat:

 src/lib-imap/imap-envelope.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (55 lines):

diff -r 9946079253c4 -r 342f6962390e src/lib-imap/imap-envelope.c
--- a/src/lib-imap/imap-envelope.c	Tue Dec 03 17:29:38 2013 +0200
+++ b/src/lib-imap/imap-envelope.c	Tue Dec 03 21:31:59 2013 +0200
@@ -226,7 +226,7 @@
 }
 
 static bool imap_address_arg_append(const struct imap_arg *arg, string_t *str,
-				    bool *in_group)
+				    bool *in_group, bool *begin_group)
 {
 	const struct imap_arg *list_args;
 	unsigned int list_count;
@@ -250,10 +250,11 @@
 		/* end of group */
 		str_append_c(str, ';');
 		*in_group = FALSE;
+		*begin_group = FALSE;
 		return TRUE;
 	}
 
-	if (str_len(str) > 0)
+	if (str_len(str) > 0 && !*begin_group)
 		str_append(str, ", ");
 
 	if (!*in_group && args[0] == NULL && args[1] == NULL &&
@@ -262,8 +263,10 @@
 		str_append(str, args[2]);
 		str_append(str, ": ");
 		*in_group = TRUE;
+		*begin_group = TRUE;
 		return TRUE;
 	}
+	*begin_group = FALSE;
 
 	/* a) mailbox at domain
 	   b) name <@route:mailbox at domain> */
@@ -302,15 +305,17 @@
 	const struct imap_arg *list_args;
 	string_t *str;
 	bool in_group;
+	bool begin_group;
 
 	if (!imap_arg_get_list(arg, &list_args))
 		return NULL;
 
 	in_group = FALSE;
+	begin_group = FALSE;
 	str = t_str_new(128);
 
 	for (; !IMAP_ARG_IS_EOL(list_args); list_args++) {
-		if (!imap_address_arg_append(list_args, str, &in_group))
+		if (!imap_address_arg_append(list_args, str, &in_group, &begin_group))
 			return NULL;
 	}
 


More information about the dovecot-cvs mailing list