}
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;
/* 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 &&
str_append(str, args[2]);
str_append(str, ": ");
*in_group = TRUE;
+ *begin_group = TRUE;
return TRUE;
}
+ *begin_group = FALSE;
/* a) mailbox@domain
b) name <@route:mailbox@domain> */
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;
}