[evolution-patches] Fix for bug #301081 (plugins/mail-to-task)



Hi,

Attached is patch to fix
http://bugzilla.gnome.org/show_bug.cgi?id=301081

Please see ChangeLog for details.

Thanks,
Mubeen
Index: mail-to-task.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/mail-to-task/mail-to-task.c,v
retrieving revision 1.5
diff -u -p -r1.5 mail-to-task.c
--- mail-to-task.c	3 Oct 2005 10:16:37 -0000	1.5
+++ mail-to-task.c	14 Oct 2005 09:54:37 -0000
@@ -32,33 +32,41 @@ typedef struct {
 }AsyncData;
 
 static void
-add_attendee_cb (gpointer key, gpointer value, gpointer user_data)
-{
-	ECalComponentAttendee *ca;
-	const char *str, *name;
-	GSList **attendees = user_data;
-
-	if (!camel_internet_address_get (value, 0, &name, &str))
-		return;
-
-	ca = g_new0 (ECalComponentAttendee, 1);
-	ca->value = str;
-	ca->cn = name;
-	/* FIXME: missing many fields */
-
-	*attendees = g_slist_append (*attendees, ca);
-}
-
-static void
 set_attendees (ECalComponent *comp, CamelMimeMessage *message)
 {
 	GSList *attendees = NULL, *l;
+	ECalComponentAttendee *ca;
+	const CamelInternetAddress *to, *cc, *bcc, *arr[3];
+	int len, i, j;
+
+	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);
+
+	arr[0] = to, arr[1] = cc, arr[2] = bcc;
+
+	for(j = 0; j < 3; j++)
+	{
+		len = CAMEL_ADDRESS (arr[j])->addresses->len;
+		for (i = 0; i < len; i++) {
+			const char *name, *addr;
+
+			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);
 }
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/mail-to-task/ChangeLog,v
retrieving revision 1.15
diff -u -p -r1.15 ChangeLog
--- ChangeLog	3 Oct 2005 10:16:37 -0000	1.15
+++ ChangeLog	14 Oct 2005 09:55:40 -0000
@@ -1,3 +1,10 @@
+2005-10-11  Mubeen Jukaku  <jmubeen novell com>
+
+	* mail-to-task.c (set_attendees): Re-implemented this funciton.
+	(add_attendee_cb): Removed this callback because of above change.
+
+	Fixes bug #301081
+
 2005-10-03  Chenthill Palanisamy  <pchenthill novell com>
 
 	Fixes #315752


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]