From bc509dfcc0628f0a72a84b867a0d0ad66379b49a Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 20 Dec 2007 16:54:06 +0000 Subject: [PATCH] * only remove ourselves from the To: if we do ReplyAll; and when even then, only if there are multiple recipients. Fixes: NB#78773 pmo-trunk-r3950 --- src/modest-tny-msg.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/modest-tny-msg.c b/src/modest-tny-msg.c index c7880c5..69745e5 100644 --- a/src/modest-tny-msg.c +++ b/src/modest-tny-msg.c @@ -660,6 +660,23 @@ modest_tny_msg_get_header (TnyMsg *msg, const gchar *header) } +static gint +count_addresses (const gchar* addresses) +{ + gint count = 1; + + if (!addresses) + return 0; + + while (*addresses) { + if (*addresses == ',' || *addresses == ';') + ++count; + ++addresses; + } + + return count; +} + /* get the new To:, based on the old header, * result is newly allocated or NULL in case of error @@ -715,17 +732,20 @@ get_new_to (TnyMsg *msg, TnyHeader *header, const gchar* from, g_free (new_to); new_to = tmp; } + + /* now, strip me (the new From:) from the new_to, but only if + * there are >1 addresses there */ + if (count_addresses (new_to) > 1) { + gchar *tmp = modest_text_utils_remove_address (new_to, from); + g_free (new_to); + new_to = tmp; + } + + /* remove duplicate entries */ + gchar *tmp = modest_text_utils_remove_duplicate_addresses (new_to); + g_free (new_to); + new_to = tmp; } - - /* now, strip me (the new From:) from the new_to */ - gchar *tmp = modest_text_utils_remove_address (new_to, from); - g_free (new_to); - new_to = tmp; - - /* remove duplicate entries */ - tmp = modest_text_utils_remove_duplicate_addresses (new_to); - g_free (new_to); - new_to = tmp; return new_to; } -- 1.7.9.5