Re: [evolution-patches] fix for the bug #314925 [calendar]



Have attached modified patch to fix the issue.

thanks, Chenthill,
.
On Sat, 2005-10-01 at 13:52 +0530, Harish Krishnaswamy wrote:
> On Wed, 2005-09-28 at 16:13 +0530, chen wrote:
> 
> > * libecal/e-cal-component.c: 
> > +       (set_attendee_list): Free the old attendee list after
> > +       adding the new attendees.
> This is a wrong fix. The API expects you to set a new list of attendees.
> The memory corruption happens because the caller attempts to modify the
> existing list and send it back through the call.
> [This case justifies, however, the need for a client API to modify
> properties/parameters to save them overheads].
> 
> -Harish
> 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.510.2.6
diff -u -p -r1.510.2.6 ChangeLog
--- ChangeLog	30 Sep 2005 10:50:37 -0000	1.510.2.6
+++ ChangeLog	1 Oct 2005 09:54:13 -0000
@@ -1,3 +1,10 @@
+2005-10-01  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #314925
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(get_attendee_prop), (set_attendees_to_item): Get the 
+	delegated attendee and remove the delfrom parameter.
+
 2005-09-13  Dinesh Layek  <ldinesh novell com>
 
 	Fixes #316195
Index: backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.64.2.2
diff -u -p -r1.64.2.2 e-cal-backend-groupwise-utils.c
--- backends/groupwise/e-cal-backend-groupwise-utils.c	29 Sep 2005 11:59:31 -0000	1.64.2.2
+++ backends/groupwise/e-cal-backend-groupwise-utils.c	1 Oct 2005 09:54:14 -0000
@@ -336,14 +336,32 @@ e_cal_backend_groupwise_set_attachments_
 
 	e_gw_item_set_attach_id_list (item, attach_list);
 }
-	
+
+/* Returns the icalproperty for the Attendee associted with email id */
+static icalproperty *
+get_attendee_prop (icalcomponent *icalcomp, const char *attendee)
+{
+	icalproperty *prop;	
+
+	for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+			prop;
+			prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
+		const char *att = icalproperty_get_attendee (prop);
+
+		if (!g_ascii_strcasecmp (att, attendee)) {
+			return prop;
+		}
+	}
+
+	return NULL;
+}
+
 /* get_attendee_list from cal comp and convert into
  * egwitemrecipient and set it on recipient_list*/
 static void
 set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default_zone, gboolean delegate, const char *user_email)
 {
 	if (e_cal_component_has_attendees (comp)) {
-		gboolean att_changed = FALSE;
 		GSList *attendee_list, *recipient_list = NULL, *al;
 
 		e_cal_component_get_attendee_list (comp, &attendee_list);	
@@ -355,8 +373,10 @@ set_attendees_to_item (EGwItem *item, EC
 				continue;		
 			
 			if (delegate) {
-				attendee->delfrom = "";
-				att_changed = TRUE;
+				icalproperty *prop = get_attendee_prop (e_cal_component_get_icalcomponent (comp), 
+						attendee->value);
+				if (prop) 
+					icalproperty_remove_parameter_by_kind (prop, ICAL_DELEGATEDFROM_PARAMETER);
 			}
 	
 			recipient = g_new0 (EGwItemRecipient, 1);
@@ -380,10 +400,6 @@ set_attendees_to_item (EGwItem *item, EC
 
 			recipient_list = g_slist_append (recipient_list, recipient);
 		}
-
-		/* Reset the ECalComponent with changes if necessary*/
-		if(att_changed)
-			e_cal_component_set_attendee_list (comp, attendee_list);	
 
 		e_cal_component_free_attendee_list(attendee_list);
 	


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