aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-callbacks.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-06-19 04:12:19 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-06-19 04:12:19 +0800
commitcbb3f733b364eb84faa802a627dbcae7524c24a0 (patch)
treed836566af61e4ef643c205e201fe5d6a1ac66da5 /mail/mail-callbacks.c
parentdd5c4dbfdfdfd135dafd3855f90e424e6819fe4d (diff)
downloadgsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar.gz
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar.bz2
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar.lz
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar.xz
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.tar.zst
gsoc2013-evolution-cbb3f733b364eb84faa802a627dbcae7524c24a0.zip
Now takes a hash table of already-used-recipients so that we don't get
2001-06-18 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (list_add_addresses): Now takes a hash table of already-used-recipients so that we don't get duplicates. (mail_generate_reply): Pass in a rcpt_hash argument to list_add_addresses(). These changes fix bug #1639. svn path=/trunk/; revision=10278
Diffstat (limited to 'mail/mail-callbacks.c')
-rw-r--r--mail/mail-callbacks.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index f10b0f7d22..0e3faa0711 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -467,7 +467,8 @@ send_to_url (const char *url)
static GList *
list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *accounts,
- const MailConfigAccount **me, const char *ignore_addr)
+ GHashTable *rcpt_hash, const MailConfigAccount **me,
+ const char *ignore_addr)
{
const char *name, *addr;
const GSList *l;
@@ -502,9 +503,10 @@ list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *
l = l->next;
}
- if (notme)
+ if (notme && !g_hash_table_lookup (rcpt_hash, addr)) {
+ g_hash_table_insert (rcpt_hash, g_strdup (addr), GINT_TO_POINTER (1));
list = g_list_append (list, full);
- else
+ } else
g_free (full);
}
}
@@ -645,6 +647,10 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
to = address && i != max ? g_list_append (to, g_strdup (address)) : to;
}
} else {
+ GHashTable *rcpt_hash;
+
+ rcpt_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
reply_to = camel_mime_message_get_reply_to (message);
if (!reply_to)
reply_to = camel_mime_message_get_from (message);
@@ -652,6 +658,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
/* Get the Reply-To address so we can ignore references to it in the Cc: list */
camel_internet_address_get (reply_to, 0, NULL, &reply_addr);
+ g_hash_table_insert (rcpt_hash, reply_addr, GINT_TO_POINTER (1));
to = g_list_append (to, camel_address_format (CAMEL_ADDRESS (reply_to)));
}
@@ -659,11 +666,13 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
if (mode == REPLY_ALL) {
- cc = list_add_addresses (cc, to_addrs, accounts, &me, NULL);
- cc = list_add_addresses (cc, cc_addrs, accounts, me ? NULL : &me, reply_addr);
+ cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, &me, NULL);
+ cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me, reply_addr);
} else if (me == NULL) {
me = guess_me (to_addrs, cc_addrs, accounts);
}
+
+ g_hash_table_destroy (rcpt_hash);
}
/* Set the subject of the new message. */