From d15db6745775aefb311a891d73e7f7f483c3c893 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 26 Jul 2006 01:57:24 +0000 Subject: fixed reply-to-all. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1099 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 6 ++++++ src/compose.c | 38 +++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d6eee86..3a999db1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-07-26 + + * src/compose.c: compose_reply_set_entry(): use original address + strings instead of stripped ones. Fixed a bug that To: address + was duplicated in Cc: on reply-to-all. + 2006-07-25 * libsylph/prefs_common.[ch] diff --git a/src/compose.c b/src/compose.c index 7c0ab52c..9109f504 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1629,40 +1629,44 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo, if (!compose->replyto && to_ml && compose->ml_post) return; if (!to_all) return; + if (compose->replyto && msginfo->from) + cc_list = address_list_append_orig(cc_list, msginfo->from); + cc_list = address_list_append_orig(cc_list, msginfo->to); + cc_list = address_list_append_orig(cc_list, compose->cc); + + to_table = g_hash_table_new(g_str_hash, g_str_equal); if (compose->replyto) { - Xstrdup_a(replyto, compose->replyto, return); + replyto = g_strdup(compose->replyto); extract_address(replyto); - } - if (msginfo->from) { - Xstrdup_a(from, msginfo->from, return); + g_hash_table_insert(to_table, replyto, GINT_TO_POINTER(1)); + } else if (msginfo->from) { + from = g_strdup(msginfo->from); extract_address(from); + g_hash_table_insert(to_table, from, GINT_TO_POINTER(1)); } - - if (replyto && from) - cc_list = address_list_append(cc_list, from); - cc_list = address_list_append(cc_list, msginfo->to); - cc_list = address_list_append(cc_list, compose->cc); - - to_table = g_hash_table_new(g_str_hash, g_str_equal); - if (replyto) - g_hash_table_insert(to_table, replyto, GINT_TO_POINTER(1)); if (compose->account) - g_hash_table_insert(to_table, compose->account->address, + g_hash_table_insert(to_table, + g_strdup(compose->account->address), GINT_TO_POINTER(1)); - /* remove address on To: and that of current account */ + /* remove duplicate addresses */ for (cur = cc_list; cur != NULL; ) { gchar *addr = (gchar *)cur->data; GSList *next = cur->next; + gchar *addr_; - if (g_hash_table_lookup(to_table, addr) != NULL) { + addr_ = g_strdup(addr); + extract_address(addr_); + if (g_hash_table_lookup(to_table, addr_) != NULL) { cc_list = g_slist_remove(cc_list, addr); + g_free(addr_); g_free(addr); } else - g_hash_table_insert(to_table, addr, cur); + g_hash_table_insert(to_table, addr_, cur); cur = next; } + hash_free_strings(to_table); g_hash_table_destroy(to_table); if (cc_list) { -- cgit v1.2.3