From 3c7be1018d11ef211d89929eb566a6059b869fd6 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 5 Dec 2000 23:10:32 +0000 Subject: Use camel to construct the list of recipients rather than just 2000-12-05 Jeffrey Stedfast * e-msg-composer.c (add_recipients): Use camel to construct the list of recipients rather than just strchr(recips, ',') which is very prone to errors. svn path=/trunk/; revision=6802 --- composer/ChangeLog | 6 ++++++ composer/e-msg-composer.c | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/composer/ChangeLog b/composer/ChangeLog index b3a2052b6c..93e9d630a7 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2000-12-05 Jeffrey Stedfast + + * e-msg-composer.c (add_recipients): Use camel to construct the + list of recipients rather than just strchr(recips, ',') which is + very prone to errors. + 2000-11-03 Iain Holmes * e-msg-composer-attachment-bar.c (update): Pass NULL diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 80e6eaf357..6db5954871 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1681,6 +1681,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) return new; } +#if 0 static GList * add_recipients (GList *list, const char *recips, gboolean decode) { @@ -1702,6 +1703,32 @@ add_recipients (GList *list, const char *recips, gboolean decode) return list; } +#endif + +static GList * +add_recipients (GList *list, const char *recips, gboolean decode) +{ + CamelInternetAddress *cia; + const char *name, *addr; + int num, i; + + cia = camel_internet_address_new (); + if (decode) + num = camel_address_decode (CAMEL_ADDRESS (cia), recips); + else + num = camel_address_unformat (CAMEL_ADDRESS (cia), recips); + + for (i = 0; i < num; i++) { + if (camel_internet_address_get (cia, i, &name, &addr)) { + char *str; + + str = camel_internet_address_format_address (name, addr); + list = g_list_append (list, str); + } + } + + return list; +} static void free_recipients (GList *list) -- cgit v1.2.3