From 1b908acde049d391f1f94971e04d149852b4d2e5 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Wed, 21 Jan 2009 10:33:27 +0000 Subject: [PATCH 1/1] * Fixes NB#95165, remove duplicate addresses in Cc when "reply to all" pmo-trunk-r7209 --- src/modest-text-utils.c | 2 +- src/modest-text-utils.h | 1 - src/modest-tny-msg.c | 23 ++++++++++++----------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 7f06a99..aead8af 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -626,7 +626,7 @@ modest_text_utils_split_addresses_list (const gchar *addresses) /* nope, we are at the start of some address * now, let's find the end of the address */ end = my_addrs + 1; - while (end[0] && end[0] != ';') { + while (end[0] && (end[0] != ';') && (end[0] != ',')) { if (end[0] == '\"') { while (end[0] && end[0] != '\"') ++end; diff --git a/src/modest-text-utils.h b/src/modest-text-utils.h index 503c4a7..9826348 100644 --- a/src/modest-text-utils.h +++ b/src/modest-text-utils.h @@ -153,7 +153,6 @@ gchar* modest_text_utils_remove_address (const gchar *address_list, * in case of error or the original @address_list was NULL */ gchar* modest_text_utils_remove_duplicate_addresses (const gchar *address_list); - /** diff --git a/src/modest-tny-msg.c b/src/modest-tny-msg.c index e481d9f..a249f7c 100644 --- a/src/modest-tny-msg.c +++ b/src/modest-tny-msg.c @@ -593,17 +593,17 @@ create_reply_forward_mail (TnyMsg *msg, TnyHeader *header, const gchar *from, part of the message to create the reply/forwarded mail */ if (msg != NULL) body = modest_tny_msg_find_body_part (msg, FALSE); - + if (modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT, NULL)) formatter = modest_formatter_new ("text/html", signature); else formatter = modest_formatter_new ("text/plain", signature); - + /* if we don't have a text-part */ no_text_part = (!body) || (strcmp (tny_mime_part_get_content_type (body), "text/html")==0); - + /* when we're reply, include the text part if we have it, or nothing otherwise. */ if (is_reply) new_msg = modest_formatter_quote (formatter, no_text_part ? NULL: body, header, @@ -618,11 +618,11 @@ create_reply_forward_mail (TnyMsg *msg, TnyHeader *header, const gchar *from, attachments); } } - + g_object_unref (G_OBJECT(formatter)); if (body) g_object_unref (G_OBJECT(body)); - + /* Fill the header */ new_header = tny_msg_get_header (new_msg); tny_header_set_from (new_header, from); @@ -825,15 +825,16 @@ get_new_to (TnyMsg *msg, TnyHeader *header, const gchar* from, static gchar* get_new_cc (TnyHeader *header, const gchar* from) { - gchar *old_cc; - gchar *result; + gchar *old_cc, *result, *dup; old_cc = tny_header_dup_cc (header); if (!old_cc) return NULL; /* remove me (the new From:) from the Cc: list */ - result = modest_text_utils_remove_address (old_cc, from); + dup = modest_text_utils_remove_address (old_cc, from); + result = modest_text_utils_remove_duplicate_addresses (dup); + g_free (dup); g_free (old_cc); return result; } @@ -882,8 +883,8 @@ modest_tny_msg_create_reply_msg (TnyMsg *msg, else { tny_header_set_to (new_header, new_to); g_free (new_to); - } - + } + if (reply_mode == MODEST_TNY_MSG_REPLY_MODE_ALL) { gchar *new_cc = get_new_cc (header, from); if (new_cc) { @@ -891,7 +892,7 @@ modest_tny_msg_create_reply_msg (TnyMsg *msg, g_free (new_cc); } } - + /* Clean */ g_object_unref (G_OBJECT (new_header)); g_object_unref (G_OBJECT (header)); -- 1.7.9.5