From 32071d63a4f23bd1063331d43859463e6d53e93f Mon Sep 17 00:00:00 2001 From: Mubeen Jukaku Date: Fri, 11 Nov 2005 09:59:43 +0000 Subject: Re-implemented this funciton. (add_attendee_cb): Removed this callback 2005-10-11 Mubeen Jukaku * mail-to-task.c (set_attendees): Re-implemented this funciton. (add_attendee_cb): Removed this callback because of above change. Fixes bug #301081 svn path=/trunk/; revision=30600 --- plugins/mail-to-task/mail-to-task.c | 40 ++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'plugins/mail-to-task/mail-to-task.c') diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 462ae04231..ba277fc7a8 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -32,33 +32,41 @@ typedef struct { }AsyncData; static void -add_attendee_cb (gpointer key, gpointer value, gpointer user_data) +set_attendees (ECalComponent *comp, CamelMimeMessage *message) { + GSList *attendees = NULL, *l; ECalComponentAttendee *ca; - const char *str, *name; - GSList **attendees = user_data; + const CamelInternetAddress *to, *cc, *bcc, *arr[3]; + int len, i, j; - if (!camel_internet_address_get (value, 0, &name, &str)) - return; + to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); + cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); + bcc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC); - ca = g_new0 (ECalComponentAttendee, 1); - ca->value = str; - ca->cn = name; - /* FIXME: missing many fields */ + arr[0] = to, arr[1] = cc, arr[2] = bcc; - *attendees = g_slist_append (*attendees, ca); -} + for(j = 0; j < 3; j++) + { + len = CAMEL_ADDRESS (arr[j])->addresses->len; + for (i = 0; i < len; i++) { + const char *name, *addr; -static void -set_attendees (ECalComponent *comp, CamelMimeMessage *message) -{ - GSList *attendees = NULL, *l; + if (camel_internet_address_get (arr[j], i, &name, &addr)) { + ca = g_new0 (ECalComponentAttendee, 1); + ca->value = addr; + ca->cn = name; + /* FIXME: missing many fields */ + + attendees = g_slist_append (attendees, ca); + } + } + } - g_hash_table_foreach (message->recipients, (GHFunc) add_attendee_cb, &attendees); e_cal_component_set_attendee_list (comp, attendees); for (l = attendees; l != NULL; l = l->next) g_free (l->data); + g_slist_free (attendees); } -- cgit v1.2.3