[evolution-patches] fix for the bug #266144 [calendar]



Hi, 
   Have attached the patch for the same.

thanks, chenthill.
? .ChangeLog.swp
? .recur.swp
? 266144_eds.diff
? 309674.diff
? 311831.diff
? 312578.diff
? all_day.diff
? freebusy.diff
? recur
? recur_fix
? remove_patch
? temp
? backends/groupwise/temp
? libecal/.e-cal-marshal.c.swp
? tests/ecal/test-recur
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.502
diff -u -p -r1.502 ChangeLog
--- ChangeLog	12 Aug 2005 15:17:43 -0000	1.502
+++ ChangeLog	16 Aug 2005 16:50:45 -0000
@@ -1,3 +1,50 @@
+2005-08-16  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #266144
+	* backends/contacts/e-cal-backend-contacts.c:
+	(contact_record_free): 
+	* backends/http/e-cal-backend-http.c:
+	(notify_and_remove_from_cache):
+	* backends/weather/e-cal-backend-weather.c:
+	(finished_retrieval_cb):
+	* backends/file/e-cal-backend-file.c: (notify_removals_cb),
+	(e_cal_backend_file_receive_objects): Use ECalComponentId.
+	* backends/groupwise/e-cal-backend-groupwise-utils.[ch]:
+	(e_gw_item_to_cal_component): Store the recurrence id in
+	utc.
+	(e_gw_connection_send_appointment): Get the component while
+	accepting/declining from mail component and pass all_instances
+	and get the partstat.
+	the 
+	* backends/groupwise/e-cal-backend-groupwise.c:
+	(e_cal_backend_groupwise_remove_object), (change_status),
+	(receive_object): Change the status of all recurring appointments
+	if all_instances is set true.
+	* idl/Evolution-DataServer-Calendar.idl: Added a structure
+	to hold the recurrence id and uid to notify the component
+	removed.
+	* libecal/e-cal-component.c: (e_cal_component_get_id),
+	(e_cal_component_free_id): Added new API's for getting
+	the recurrence id and uid of a component.
+	* libecal/e-cal-component.h: Added a structure of holding
+	both the recurrence id and the uid.
+	* libecal/e-cal-view-listener.c: (build_id_list),
+	(impl_notifyObjectsRemoved):
+	* libecal/e-cal-view.c: (objects_removed_cb):
+	* libedata-cal/e-cal-backend-sync.c:
+	(_e_cal_backend_remove_object):
+	* libedata-cal/e-cal-backend.c: (match_query_and_notify),
+	(e_cal_backend_notify_object_removed):
+	* libedata-cal/e-cal-backend.h:
+	* libedata-cal/e-data-cal-view.c: (uncache_with_id_cb),
+	(remove_object_from_cache):
+	(e_data_cal_view_notify_objects_removed),
+	(e_data_cal_view_notify_objects_removed_1):
+	* libedata-cal/e-data-cal-view.h:
+	* libedata-cal/e-data-cal.c: (e_data_cal_notify_object_removed):
+	* libedata-cal/e-data-cal.h: Changed the API's to use the 
+	ECalComponentId structure instead of uid.
+
 2005-08-12  P. S. Chakravarthi  <pchakravarthi novell com>
 
 	Fixes #311078
Index: backends/contacts/e-cal-backend-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/contacts/e-cal-backend-contacts.c,v
retrieving revision 1.21
diff -u -p -r1.21 e-cal-backend-contacts.c
--- backends/contacts/e-cal-backend-contacts.c	18 May 2005 08:06:31 -0000	1.21
+++ backends/contacts/e-cal-backend-contacts.c	16 Aug 2005 16:50:45 -0000
@@ -168,15 +168,17 @@ static void
 contact_record_free (ContactRecord *cr)
 {
         char *comp_str;
-        const char *uid;
+	ECalComponentId *id;
 
         g_object_unref (G_OBJECT (cr->contact));
 
 	/* Remove the birthday event */
 	if (cr->comp_birthday) {
 		comp_str = e_cal_component_get_as_string (cr->comp_birthday);
-		e_cal_component_get_uid (cr->comp_birthday, &uid);
-		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str, NULL);
+		id = e_cal_component_get_id (cr->comp_birthday);
+		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), id, comp_str, NULL);
+
+		e_cal_component_free_id (id);
 		g_free (comp_str);
 		g_object_unref (G_OBJECT (cr->comp_birthday));
 	}
@@ -184,8 +186,11 @@ contact_record_free (ContactRecord *cr)
 	/* Remove the anniversary event */
 	if (cr->comp_anniversary) {
 		comp_str = e_cal_component_get_as_string (cr->comp_anniversary);
-		e_cal_component_get_uid (cr->comp_anniversary, &uid);
-		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), uid, comp_str, NULL);
+		id = e_cal_component_get_id (cr->comp_birthday);
+
+		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cr->cbc), id, comp_str, NULL);
+		
+		e_cal_component_free_id (id);
 		g_free (comp_str);
 		g_object_unref (G_OBJECT (cr->comp_anniversary));
 	}
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.57
diff -u -p -r1.57 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	11 Jul 2005 00:51:06 -0000	1.57
+++ backends/file/e-cal-backend-file.c	16 Aug 2005 16:50:45 -0000
@@ -689,6 +689,8 @@ notify_removals_cb (gpointer key, gpoint
 	if (!g_hash_table_lookup (context->new_uid_hash, uid)) {
 		icalcomponent *old_icomp;
 		gchar *old_obj_str;
+		ECalComponent *comp; 
+		ECalComponentId *id;
 
 		/* Object was removed */
 
@@ -699,8 +701,15 @@ notify_removals_cb (gpointer key, gpoint
 		old_obj_str = icalcomponent_as_ical_string (old_icomp);
 		if (!old_obj_str)
 			return;
+		
+		comp = e_cal_component_new_from_string (old_obj_str);
+		id = e_cal_component_get_id (comp);
+		
 
-		e_cal_backend_notify_object_removed (context->backend, uid, old_obj_str, NULL);
+		e_cal_backend_notify_object_removed (context->backend, id, old_obj_str, NULL);
+	
+		e_cal_component_free_id (id);
+		g_object_unref (comp);
 	}
 }
 
@@ -2381,6 +2390,7 @@ e_cal_backend_file_receive_objects (ECal
 			break;
 		case ICAL_METHOD_CANCEL:
 			if (cancel_received_object (cbfile, subcomp)) {
+				ECalComponentId *id;
 				object = (char *) icalcomponent_as_ical_string (subcomp);
 				obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
 				if (obj_data)
@@ -2388,11 +2398,14 @@ e_cal_backend_file_receive_objects (ECal
 				else
 					old_object = NULL;
 
-				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), uid, old_object, object);
+				id = e_cal_component_get_id (comp);
+
+				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, object);
 
 				/* remove the component from the toplevel VCALENDAR */
 				icalcomponent_remove_component (toplevel_comp, subcomp);
 				icalcomponent_free (subcomp);
+				e_cal_component_free_id (id);
 
 				g_free (old_object);
 			}
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.62
diff -u -p -r1.62 e-cal-backend-groupwise-utils.c
--- backends/groupwise/e-cal-backend-groupwise-utils.c	9 Aug 2005 22:41:01 -0000	1.62
+++ backends/groupwise/e-cal-backend-groupwise-utils.c	16 Aug 2005 16:50:45 -0000
@@ -959,7 +959,6 @@ e_gw_item_to_cal_component (EGwItem *ite
 		}	
 
 		e_cal_component_set_dtstart (comp, &dt);
-		g_free (t);
 	}
 	else 
 		return NULL;
@@ -974,11 +973,18 @@ e_gw_item_to_cal_component (EGwItem *ite
 		g_free (recur_key);
 
 		/* set the recurrence id and the X-GW-RECORDID  too */
+		t = e_gw_item_get_start_date (item);
+		itt_utc = icaltime_from_string (t);
+			
+		if (!icaltime_get_timezone (itt_utc))
+			icaltime_set_timezone (&itt_utc, icaltimezone_get_utc_timezone());
+
+		dt.value = &itt_utc;
+		dt.tzid = g_strdup ("UTC");
 		recur_id = g_new0 (ECalComponentRange, 1);
 		recur_id->type = E_CAL_COMPONENT_RANGE_SINGLE;
 		recur_id->datetime = dt;
 		e_cal_component_set_recurid (comp, recur_id);
-
 	} else {
 
 		uid = e_gw_item_get_icalid (item);
@@ -989,6 +995,8 @@ e_gw_item_to_cal_component (EGwItem *ite
 			return NULL;
 		}
 	}
+		
+	g_free (t);
 
 	/* classification */
 	description = e_gw_item_get_classification (item);
@@ -1177,60 +1185,41 @@ e_gw_item_to_cal_component (EGwItem *ite
 }
 
 EGwConnectionStatus
-e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove, ECalComponent **created_comp)
+e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean all_instances, ECalComponent **created_comp, icalparameter_partstat *pstatus)
 {
 	EGwConnection *cnc;
 	EGwConnectionStatus status;
 	icalparameter_partstat partstat;
 	char *item_id = NULL;
 	const char *gw_id;
-	gboolean all_instances = FALSE;
-	icalproperty *icalprop;
-	icalcomponent *icalcomp;
 	const char *recurrence_key = NULL;
+	gboolean need_to_get = FALSE;
 
 	cnc = e_cal_backend_groupwise_get_connection (cbgw);
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
 	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
 	e_cal_component_commit_sequence (comp);
-	/* When the icalcomponent is obtained through the itip message rather
-	 * than from the SOAP protocol, the container id has to be explicitly 
-	 * added to the xgwrecordid inorder to obtain the item id. */
-
-	/* handle recurrences - All */
-	icalcomp = e_cal_component_get_icalcomponent (comp);
-
-	icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
-	while (icalprop) {
-		const char *x_name;
-
-		x_name = icalproperty_get_x_name (icalprop);
-		if (!strcmp (x_name, "X-GW-RECUR-INSTANCES-MOD-TYPE")) {
-			if (!strcmp (icalproperty_get_x (icalprop), "All"))
-				all_instances = TRUE;
-			if (recurrence_key)
-				break;
-		}
-		if (!strcmp (x_name, "X-GW-RECURRENCE-KEY")) {
-			e_cal_component_get_uid (comp, &recurrence_key);
-		}
-		icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
-	}	
-		
+
 	gw_id = e_cal_component_get_gw_id (comp);
 
 	switch  (e_cal_component_get_vtype (comp)) {
 
 		case E_CAL_COMPONENT_EVENT: 
-			if (!g_str_has_suffix (gw_id, container))
+			if (!g_str_has_suffix (gw_id, container)) {
 				item_id = g_strconcat (e_cal_component_get_gw_id (comp), GW_EVENT_TYPE_ID, container, NULL);
+				need_to_get = TRUE;
+				
+			}
 			else 
 				item_id = g_strdup (gw_id);
 			break;
 		case E_CAL_COMPONENT_TODO:
-			if (!g_str_has_suffix (gw_id, container))
+			if (!g_str_has_suffix (gw_id, container)) {
 				item_id = g_strconcat (e_cal_component_get_gw_id (comp), GW_TODO_TYPE_ID, container, NULL);
+				need_to_get = TRUE;
+				
+			}
 			else
 				item_id = g_strdup (gw_id);
 			break;
@@ -1238,6 +1227,21 @@ e_gw_connection_send_appointment (ECalBa
 			return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
 	}
 
+	if (all_instances)
+		e_cal_component_get_uid (comp, &recurrence_key);
+
+	/*FIXME - remove this once the server returns us the same iCalid in both interfaces */
+
+	if (need_to_get) {
+		EGwItem *item = NULL;
+		 
+		status = e_gw_connection_get_item (cnc, container, item_id, "recipients message recipientStatus attachments default", &item);
+		if (status == E_GW_CONNECTION_STATUS_OK)
+			*created_comp = e_gw_item_to_cal_component (item, cbgw);
+
+		g_object_unref (item);
+	}
+
 	switch (method) {
 	case ICAL_METHOD_REQUEST:
 		/* get attendee here and add the list along. */
@@ -1275,6 +1279,7 @@ e_gw_connection_send_appointment (ECalBa
 			status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
 			break;
 		}
+		*pstatus = partstat;
 		switch (partstat) {
 		ECalComponentTransparency transp;
 			
@@ -1299,7 +1304,6 @@ e_gw_connection_send_appointment (ECalBa
 			else
 				status = e_gw_connection_decline_request (cnc, item_id, NULL, NULL);
 			
-			*remove = TRUE;
 			break;
 		case ICAL_PARTSTAT_TENTATIVE:
 			if (all_instances)
@@ -1319,23 +1323,11 @@ e_gw_connection_send_appointment (ECalBa
 
 	case ICAL_METHOD_CANCEL:
 		status = e_gw_connection_retract_request (cnc, item_id, NULL, FALSE, FALSE);
-		*remove = TRUE;
 		break;
 	default:
 		return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
 	}
 	
-	if (status == E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED)
-		return status;
-
-	/*FIXME - handling recurrence items */
-	if (!*remove && status == E_GW_CONNECTION_STATUS_OK) {
-		EGwItem *item;
-
-		status = e_gw_connection_get_item (cnc, container, item_id, "recipients message recipientStatus attachments default", &item);
-		*created_comp = e_gw_item_to_cal_component (item, cbgw);
-	}
-
 	return status;
 }
 
Index: backends/groupwise/e-cal-backend-groupwise-utils.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h,v
retrieving revision 1.14
diff -u -p -r1.14 e-cal-backend-groupwise-utils.h
--- backends/groupwise/e-cal-backend-groupwise-utils.h	21 Jun 2005 05:18:58 -0000	1.14
+++ backends/groupwise/e-cal-backend-groupwise-utils.h	16 Aug 2005 16:50:45 -0000
@@ -44,7 +44,7 @@ void          e_gw_item_set_changes (EGw
  * Connection-related utility functions
  */
 EGwConnectionStatus e_gw_connection_create_appointment (EGwConnection *cnc, const char *container, ECalBackendGroupwise *cbgw, ECalComponent *comp, GSList **id_list);
-EGwConnectionStatus e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove, ECalComponent **created_comp);
+EGwConnectionStatus e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean all_instances, ECalComponent **created_comp, icalparameter_partstat *pstatus);
 EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t start, time_t end, GList **freebusy, icaltimezone *default_zone);
 void e_cal_backend_groupwise_store_settings (EGwSendOptions *opts, ECalBackendGroupwise *cbgw);
 EGwItem * e_gw_item_new_for_delegate_from_cal (ECalBackendGroupwise *cbgw, ECalComponent *comp);
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.161
diff -u -p -r1.161 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	12 Aug 2005 15:20:24 -0000	1.161
+++ backends/groupwise/e-cal-backend-groupwise.c	16 Aug 2005 16:50:46 -0000
@@ -1954,21 +1954,20 @@ e_cal_backend_groupwise_remove_object (E
 		ECalBackendSyncStatus status;
 		const char *id_to_remove = NULL;
 		icalcomponent *icalcomp;
+			
+		status = e_cal_backend_groupwise_get_object (backend, cal, uid, rid, &calobj);
+		if (status != GNOME_Evolution_Calendar_Success)
+			return status;
 
-		if (mod == CALOBJ_MOD_THIS) {
-
-			status = e_cal_backend_groupwise_get_object (backend, cal, uid, rid, &calobj);
-			if (status != GNOME_Evolution_Calendar_Success)
-				return status;
-
-			*old_object = strdup (calobj);
+		*old_object = strdup (calobj);
 
+		if (mod == CALOBJ_MOD_THIS) {
 			icalcomp = icalparser_parse_string (calobj);
 			if (!icalcomp) {
 				g_free (calobj);
 				return GNOME_Evolution_Calendar_InvalidObject;
 			}
-		
+
 			id_to_remove = get_gw_item_id (icalcomp); 
 			if (!id_to_remove) {
 				/* use the iCalId to remove the object */
@@ -2024,10 +2023,10 @@ e_cal_backend_groupwise_remove_object (E
 
 				for (l = comp_list; l; l = l->next) {
 					ECalComponent *comp = E_CAL_COMPONENT (l->data);
+
 					e_cal_backend_cache_remove_component (priv->cache, uid, 
 							e_cal_component_get_recurid_as_string (comp));
-					e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), 
-							     uid, e_cal_component_get_as_string (comp), NULL);
+					
 					g_object_unref (comp);
 				
 				}
@@ -2122,6 +2121,54 @@ fetch_attachments (ECalBackendGroupwise 
 	e_cal_component_set_attachment_list (comp, new_attach_list);
 }
 
+static void 
+change_status (ECalComponent *comp, icalparameter_partstat status, const char *email)
+{	
+	icalproperty *prop;	
+	icalparameter *param;
+	gboolean found = FALSE;
+	icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+
+
+	for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+			prop;
+			prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
+		const char *attendee = icalproperty_get_attendee (prop);
+
+		if (!g_strncasecmp (attendee, "mailto:";, 7))
+			attendee += 7;
+
+		if (!g_ascii_strcasecmp (attendee, email)) {
+			found = TRUE;
+			param = icalparameter_new_partstat (status);
+			icalproperty_set_parameter (prop, param);
+			break;
+		}
+	}
+
+	/* We couldn find the attendee in the component, so add a new attendee */
+	if (!found) {
+		char *temp = g_strdup_printf ("MAILTO:%s", email);
+
+		prop = icalproperty_new_attendee ((const char *) temp);
+		icalcomponent_add_property (icalcomp, prop);
+
+		param = icalparameter_new_partstat (ICAL_PARTSTAT_DELEGATED);
+		icalproperty_add_parameter (prop, param);
+
+		param = icalparameter_new_role (ICAL_ROLE_NONPARTICIPANT);
+		icalproperty_add_parameter (prop, param);
+
+		param = icalparameter_new_cutype (ICAL_CUTYPE_INDIVIDUAL);
+		icalproperty_add_parameter (prop, param);
+
+		param = icalparameter_new_rsvp (ICAL_RSVP_TRUE);
+		icalproperty_add_parameter (prop, param);
+
+		g_free (temp);
+	}
+}
+
 static ECalBackendSyncStatus
 receive_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp)
 {
@@ -2129,65 +2176,112 @@ receive_object (ECalBackendGroupwise *cb
 	ECalBackendGroupwisePrivate *priv;
 	icalproperty_method method;
 	EGwConnectionStatus status;
-	gboolean remove = FALSE;
+	gboolean all_instances = FALSE;
+	icalparameter_partstat pstatus;
+	icalproperty *icalprop;
 
 	priv = cbgw->priv;
 
+	
+	/* When the icalcomponent is obtained through the itip message rather
+	 * than from the SOAP protocol, the container id has to be explicitly 
+	 * added to the xgwrecordid inorder to obtain the item id. */
+	icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+	while (icalprop) {
+		const char *x_name;
+
+		x_name = icalproperty_get_x_name (icalprop);
+		if (!strcmp (x_name, "X-GW-RECUR-INSTANCES-MOD-TYPE")) {
+			if (!strcmp (icalproperty_get_x (icalprop), "All")) {
+				all_instances = TRUE;
+				icalcomponent_remove_property (icalcomp, icalprop);
+				break;
+			}
+		}
+
+		icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+	}
+	
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
 	method = icalcomponent_get_method (icalcomp);
-	
+
 	/* handle attachments */
 	if (e_cal_component_has_attachments (comp))
 		fetch_attachments (cbgw, comp);
 
-	modif_comp = comp;
-	status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, &remove, &modif_comp);
-
+	status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, all_instances, &modif_comp, &pstatus);
+	
 	if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
-		status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, &remove, &modif_comp);
+		status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, all_instances, &modif_comp, &pstatus);
 
-	if (status == E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED) {
-		g_object_unref (comp);
-		return GNOME_Evolution_Calendar_Success;
-	}
+	if (!modif_comp)
+		modif_comp = g_object_ref (comp);
 
 	/* update the cache */
-	if (status == E_GW_CONNECTION_STATUS_OK) {
-		if (remove) {
+	if (status == E_GW_CONNECTION_STATUS_OK || status == E_GW_CONNECTION_STATUS_ITEM_ALREADY_ACCEPTED) {
+		GSList *comps = NULL, *l;
+		gboolean found = FALSE;
+
+		if (all_instances) {
 			const char *uid;
 			
-			e_cal_component_get_uid (comp, (const char **) &uid);
-			if (e_cal_backend_cache_remove_component (priv->cache, uid, NULL))
-				e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), uid, e_cal_component_get_as_string (comp), NULL);
-		}
-		else {
-			char *cache_comp = NULL, *temp, *new_comp = NULL;
-			ECalComponent *cache_component;
-			
-			e_cal_component_commit_sequence (modif_comp);
-			e_cal_component_get_uid (modif_comp, (const char **) &temp);	
-			cache_component = e_cal_backend_cache_get_component (priv->cache, temp, NULL);
-			
-			if (cache_component) {
-				e_cal_component_commit_sequence (cache_component);
-				cache_comp = e_cal_component_get_as_string (cache_component);
+			e_cal_component_get_uid (modif_comp, (const char **) &uid);
+			comps = e_cal_backend_cache_get_components_by_uid (priv->cache, uid);
+
+			if (!comps)
+				comps = g_slist_append (comps, g_object_ref (modif_comp));
+			else
+				found = TRUE;
+		} else {
+			ECalComponentId *id = e_cal_component_get_id (modif_comp);
+			ECalComponent *comp = NULL;
+
+			comp = e_cal_backend_cache_get_component (priv->cache, id->uid, id->rid);
+
+			if (!comp)
+				comps = g_slist_append (comps, g_object_ref (modif_comp));
+			else {
+				comps = g_slist_append (comps, comp);
+				found = TRUE;
 			}
 
-			e_cal_backend_cache_put_component (priv->cache, modif_comp);	
-			e_cal_component_commit_sequence (modif_comp);
-			new_comp = e_cal_component_get_as_string (modif_comp);
+			e_cal_component_free_id (id);
+		}
 
-			if (cache_comp)
-				e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp, new_comp);
-			else
-				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), new_comp);
+		for (l = comps; l != NULL; l = l->next) {
+			ECalComponent *comp = E_CAL_COMPONENT (l->data);
+
+			if (pstatus == ICAL_PARTSTAT_DECLINED) {
+				ECalComponentId *id = e_cal_component_get_id (comp);
+
+				if (e_cal_backend_cache_remove_component (priv->cache, id->uid, id->rid)) {
+
+					e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, e_cal_component_get_as_string (comp), NULL);
+				e_cal_component_free_id (id);
+
+				}
+
+			} else {
+				char *comp_str = NULL;
+
+				change_status (comp, pstatus, e_gw_connection_get_user_email (priv->cnc));
+				e_cal_backend_cache_put_component (priv->cache, comp);	
+				comp_str = e_cal_component_get_as_string (comp);
 				
-			g_free (cache_comp);
-			g_free (new_comp);
-			g_free (temp);
+				if (found)
+					e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), comp_str, comp_str);
+				else
+					e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), comp_str);
+
+				g_free (comp_str);
+			}
 		}
+		
+		g_slist_foreach (comps, (GFunc) g_object_unref, NULL);
+		g_slist_free (comps);
 		g_object_unref (comp);	
+		g_object_unref (modif_comp);
 		return GNOME_Evolution_Calendar_Success;
 	}
 
Index: backends/http/e-cal-backend-http.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/http/e-cal-backend-http.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-cal-backend-http.c
--- backends/http/e-cal-backend-http.c	6 Mar 2005 02:47:03 -0000	1.34
+++ backends/http/e-cal-backend-http.c	16 Aug 2005 16:50:46 -0000
@@ -200,8 +200,13 @@ notify_and_remove_from_cache (gpointer k
 	const char *uid = key;
 	const char *calobj = value;
 	ECalBackendHttp *cbhttp = E_CAL_BACKEND_HTTP (user_data);
+	ECalComponent *comp = e_cal_component_new_from_string (calobj);
+	ECalComponentId *id = e_cal_component_get_id (comp);
 
-	e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), uid, calobj, NULL);
+	e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), id, calobj, NULL);
+
+	e_cal_component_free_id (comp);
+	g_object_unref (comp);
 
 	return TRUE;
 }
Index: backends/weather/e-cal-backend-weather.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/weather/e-cal-backend-weather.c,v
retrieving revision 1.8
diff -u -p -r1.8 e-cal-backend-weather.c
--- backends/weather/e-cal-backend-weather.c	25 Feb 2005 09:59:48 -0000	1.8
+++ backends/weather/e-cal-backend-weather.c	16 Aug 2005 16:50:46 -0000
@@ -145,10 +145,14 @@ finished_retrieval_cb (GList *forecasts,
 	l = e_cal_backend_cache_get_components (priv->cache);
 	for (; l != NULL; l = g_list_next (l)) {
 		icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (l->data));
+		ECalComponentId *id = e_cal_component_get_id (E_CAL_COMPONENT (l->data));
+
 		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbw),
-			icalcomponent_get_uid (icomp),
+			id,
 			icalcomponent_as_ical_string (icomp),
 			NULL);
+
+		e_cal_component_free_id (id);
 		g_object_unref (G_OBJECT (l->data));
 	}
 	g_list_free (l);
Index: idl/Evolution-DataServer-Calendar.idl
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/idl/Evolution-DataServer-Calendar.idl,v
retrieving revision 1.11
diff -u -p -r1.11 Evolution-DataServer-Calendar.idl
--- idl/Evolution-DataServer-Calendar.idl	11 Jul 2005 00:51:07 -0000	1.11
+++ idl/Evolution-DataServer-Calendar.idl	16 Aug 2005 16:50:46 -0000
@@ -28,7 +28,7 @@ module Calendar {
 	/* A unique identifier for a calendar component */
 	typedef string CalObjUID;
 
-	/* A unique identified for an event recurrence */
+	/* A unique identifier for an event recurrence */
 	typedef string CalRecurID;
 
 	/* Simple sequence of strings */
@@ -37,6 +37,15 @@ module Calendar {
 	/* Sequence of unique identifiers */
 	typedef sequence<CalObjUID> CalObjUIDSeq;
 
+	/* A unique identifier and the recurrence id for calendar components */ 
+	struct CalObjID {
+		CalObjUID uid;
+		CalRecurID rid;
+	};
+	
+	/* sequence of ids of calendar components */
+	typedef sequence<CalObjID> CalObjIDSeq;
+
 	/* A VTIMEZONE component, represented as an iCalendar string. */
 	typedef string CalTimezoneObj;
 
@@ -145,7 +154,7 @@ module Calendar {
 	interface CalViewListener : Bonobo::Unknown {
 		oneway void notifyObjectsAdded (in stringlist objects);		
 		oneway void notifyObjectsModified (in stringlist objects);		
-		oneway void notifyObjectsRemoved (in CalObjUIDSeq uids);
+		oneway void notifyObjectsRemoved (in CalObjIDSeq ids);
 		oneway void notifyQueryProgress (in string message, in short percent);
 		oneway void notifyQueryDone (in CallStatus status);
 	};
Index: libecal/e-cal-component.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-component.c,v
retrieving revision 1.15
diff -u -p -r1.15 e-cal-component.c
--- libecal/e-cal-component.c	10 Aug 2005 22:40:43 -0000	1.15
+++ libecal/e-cal-component.c	16 Aug 2005 16:50:47 -0000
@@ -1419,6 +1419,31 @@ e_cal_component_abort_sequence (ECalComp
 }
 
 /**
+ * e_cal_component_get_id:
+ * @comp: A calendar component object.
+ *
+ * Return value: the id of the component
+ * */
+ECalComponentId *
+e_cal_component_get_id (ECalComponent *comp)
+{
+	ECalComponentPrivate *priv;
+	ECalComponentId *id = NULL;
+
+	g_return_if_fail (comp != NULL);
+	g_return_if_fail (E_IS_CAL_COMPONENT (comp));
+
+	priv = comp->priv;
+	g_return_if_fail (priv->icalcomp != NULL);
+	
+	id = g_new0 (ECalComponentId, 1);
+	id->uid = g_strdup (icalproperty_get_uid (priv->uid));
+	id->rid = g_strdup (e_cal_component_get_recurid_as_string (comp));
+
+	return id;
+} 
+
+/**
  * e_cal_component_get_uid:
  * @comp: A calendar component object.
  * @uid: Return value for the UID string.
@@ -4843,6 +4868,30 @@ e_cal_component_free_sequence (int *sequ
 	g_return_if_fail (sequence != NULL);
 
 	g_free (sequence);
+}
+
+/**
+ * e_cal_component_free_id:
+ * @id Component Id.
+ *
+ * Frees the id.
+ **/
+void
+e_cal_component_free_id (ECalComponentId *id)
+{
+	g_return_if_fail (id != NULL);
+
+	if (id->uid) {
+		g_free (id->uid);
+		id->uid = NULL;
+	}
+	
+	if (id->rid) {
+		g_free (id->rid);
+		id->rid = NULL;
+	}
+
+	g_free (id);
 }
 
 /**
Index: libecal/e-cal-component.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-component.h,v
retrieving revision 1.6
diff -u -p -r1.6 e-cal-component.h
--- libecal/e-cal-component.h	8 Jan 2005 07:16:42 -0000	1.6
+++ libecal/e-cal-component.h	16 Aug 2005 16:50:48 -0000
@@ -38,6 +38,11 @@ G_BEGIN_DECLS
 #define E_IS_CAL_COMPONENT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_COMPONENT))
 #define E_IS_CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_COMPONENT))
 
+typedef struct {
+	char *uid;
+	char *rid;
+} ECalComponentId;
+
 /* Types of calendar components to be stored by a ECalComponent, as per RFC 2445.
  * We don't put the alarm component type here since we store alarms as separate
  * structures inside the other "real" components.
@@ -220,6 +225,9 @@ void e_cal_component_abort_sequence (ECa
 
 void e_cal_component_get_uid (ECalComponent *comp, const char **uid);
 void e_cal_component_set_uid (ECalComponent *comp, const char *uid);
+
+ECalComponentId *e_cal_component_get_id (ECalComponent *comp);
+void e_cal_component_free_id (ECalComponentId *id);
 
 void e_cal_component_get_categories (ECalComponent *comp, const char **categories);
 void e_cal_component_set_categories (ECalComponent *comp, const char *categories);
Index: libecal/e-cal-view-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-view-listener.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-cal-view-listener.c
--- libecal/e-cal-view-listener.c	2 Jul 2005 10:04:59 -0000	1.6
+++ libecal/e-cal-view-listener.c	16 Aug 2005 16:50:48 -0000
@@ -97,14 +97,24 @@ build_object_list (const GNOME_Evolution
 }
 
 static GList *
-build_uid_list (const GNOME_Evolution_Calendar_CalObjUIDSeq *seq)
+build_id_list (const GNOME_Evolution_Calendar_CalObjUIDSeq *seq)
 {
 	GList *list;
 	int i;
 
 	list = NULL;
-	for (i = 0; i < seq->_length; i++)
-		list = g_list_prepend (list, g_strdup (seq->_buffer[i]));
+	for (i = 0; i < seq->_length; i++) {
+		GNOME_Evolution_Calendar_CalObjID *corba_id;
+		ECalComponentId *id;
+
+		corba_id = &seq->_buffer[i];
+		id = g_new (ECalComponentId, 1);
+		
+		id->uid = g_strdup (corba_id->uid);
+		id->rid = g_strdup (corba_id->rid);
+
+		list = g_list_prepend (list, id);
+	}
 
 	return list;
 }
@@ -153,23 +163,23 @@ impl_notifyObjectsModified (PortableServ
 
 static void
 impl_notifyObjectsRemoved (PortableServer_Servant servant,
-			   const GNOME_Evolution_Calendar_CalObjUIDSeq *uids,
+			   const GNOME_Evolution_Calendar_CalObjIDSeq *ids,
 			   CORBA_Environment *ev)
 {
 	ECalViewListener *ql;
 	ECalViewListenerPrivate *priv;
-	GList *uid_list, *l;
+	GList *id_list, *l;
 	
 	ql = E_CAL_VIEW_LISTENER (bonobo_object_from_servant (servant));
 	priv = ql->priv;
 
-	uid_list = build_uid_list (uids);
+	id_list = build_id_list (ids);
 	
-	g_signal_emit (G_OBJECT (ql), signals[OBJECTS_REMOVED], 0, uid_list);
+	g_signal_emit (G_OBJECT (ql), signals[OBJECTS_REMOVED], 0, id_list);
 
-	for (l = uid_list; l; l = l->next)
-		g_free (l->data);
-	g_list_free (uid_list);
+	for (l = id_list; l; l = l->next)
+		e_cal_component_free_id (l->data);
+	g_list_free (id_list);
 }
 
 static void
Index: libecal/e-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-view.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-cal-view.c
--- libecal/e-cal-view.c	2 Jul 2005 10:04:59 -0000	1.6
+++ libecal/e-cal-view.c	16 Aug 2005 16:50:48 -0000
@@ -92,14 +92,14 @@ objects_modified_cb (ECalViewListener *l
 }
 
 static void
-objects_removed_cb (ECalViewListener *listener, GList *uids, gpointer data)
+objects_removed_cb (ECalViewListener *listener, GList *ids, gpointer data)
 {
 	ECalView *view;
 
 	view = E_CAL_VIEW (data);
 
 	g_object_ref (view);
-	g_signal_emit (G_OBJECT (view), signals[OBJECTS_REMOVED], 0, uids);
+	g_signal_emit (G_OBJECT (view), signals[OBJECTS_REMOVED], 0, ids);
 	g_object_unref (view);
 }
 
Index: libedata-cal/e-cal-backend-sync.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.c,v
retrieving revision 1.15
diff -u -p -r1.15 e-cal-backend-sync.c
--- libedata-cal/e-cal-backend-sync.c	11 Jul 2005 00:51:08 -0000	1.15
+++ libedata-cal/e-cal-backend-sync.c	16 Aug 2005 16:50:48 -0000
@@ -723,10 +723,20 @@ _e_cal_backend_remove_object (ECalBacken
 		    == GNOME_Evolution_Calendar_Success) {
 			e_data_cal_notify_object_modified (cal, status, old_object, calobj);
 			g_free (calobj);
-		} else
-			e_data_cal_notify_object_removed (cal, status, uid, old_object, object);
+		} else {
+			ECalComponentId *id = g_new0 (ECalComponentId, 1);
+			id->uid = g_strdup (uid);
+			
+			if (mod == CALOBJ_MOD_THIS)
+				id->rid = g_strdup (rid);
+
+			e_data_cal_notify_object_removed (cal, status, id, old_object, object);
+
+			e_cal_component_free_id (id);
+			
+		}
 	} else
-		e_data_cal_notify_object_removed (cal, status, uid, old_object, object);
+		e_data_cal_notify_object_removed (cal, status, NULL, old_object, object);
 
 	g_free (object);
 }
Index: libedata-cal/e-cal-backend.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.c,v
retrieving revision 1.19
diff -u -p -r1.19 e-cal-backend.c
--- libedata-cal/e-cal-backend.c	11 Jul 2005 02:19:28 -0000	1.19
+++ libedata-cal/e-cal-backend.c	16 Aug 2005 16:50:48 -0000
@@ -1139,12 +1139,16 @@ match_query_and_notify (EDataCalView *qu
 	else if (new_match)
 		e_data_cal_view_notify_objects_added_1 (query, object);
 	else if (old_match) {
-		icalcomponent *icalcomp;
+		ECalComponent *comp = NULL;
 	
-		icalcomp = icalcomponent_new_from_string ((char *) old_object);
-		if (icalcomp) {
-			e_data_cal_view_notify_objects_removed_1 (query, icalcomponent_get_uid (icalcomp));
-			icalcomponent_free (icalcomp);
+		comp = e_cal_component_new_from_string (old_object);
+		if (comp) {
+			ECalComponentId *id = e_cal_component_get_id (comp);
+
+			e_data_cal_view_notify_objects_removed_1 (query, id);
+			
+			e_cal_component_free_id (id);
+			g_object_unref (comp);
 		}
 	}
 }
@@ -1274,7 +1278,7 @@ e_cal_backend_notify_object_modified (EC
 /**
  * e_cal_backend_notify_object_removed:
  * @backend: A calendar backend.
- * @uid: the UID of the removed object
+ * @id: the Id of the removed object
  * @old_object: iCalendar representation of the removed object
  * @new_object: iCalendar representation of the object after the removal. This
  * only applies to recurrent appointments that had an instance removed. In that
@@ -1287,7 +1291,7 @@ e_cal_backend_notify_object_modified (EC
  * removed by non-EDS clients.
  **/
 void
-e_cal_backend_notify_object_removed (ECalBackend *backend, const char *uid,
+e_cal_backend_notify_object_removed (ECalBackend *backend, const ECalComponentId *id,
 				     const char *old_object, const char *object)
 {
 	ECalBackendPrivate *priv;
@@ -1298,7 +1302,7 @@ e_cal_backend_notify_object_removed (ECa
 	priv = backend->priv;
 
 	if (priv->notification_proxy) {
-		e_cal_backend_notify_object_removed (priv->notification_proxy, uid, old_object, object);
+		e_cal_backend_notify_object_removed (priv->notification_proxy, id, old_object, object);
 		return;
 	}
 
@@ -1314,7 +1318,7 @@ e_cal_backend_notify_object_removed (ECa
 			/* if object == NULL, it means the object has been completely
 			   removed from the backend */
 			if (e_data_cal_view_object_matches (query, old_object))
-				e_data_cal_view_notify_objects_removed_1 (query, uid);
+				e_data_cal_view_notify_objects_removed_1 (query, id);
 		} else
 			match_query_and_notify (query, old_object, object);
 
Index: libedata-cal/e-cal-backend.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.h,v
retrieving revision 1.13
diff -u -p -r1.13 e-cal-backend.h
--- libedata-cal/e-cal-backend.h	11 Jul 2005 02:19:28 -0000	1.13
+++ libedata-cal/e-cal-backend.h	16 Aug 2005 16:50:48 -0000
@@ -169,7 +169,7 @@ void e_cal_backend_last_client_gone (ECa
 void e_cal_backend_set_notification_proxy (ECalBackend *backend, ECalBackend *proxy);
 void e_cal_backend_notify_object_created  (ECalBackend *backend, const char *calobj);
 void e_cal_backend_notify_object_modified (ECalBackend *backend, const char *old_object, const char *object);
-void e_cal_backend_notify_object_removed  (ECalBackend *backend, const char *uid, const char *old_object, const char *object);
+void e_cal_backend_notify_object_removed  (ECalBackend *backend, const ECalComponentId *id, const char *old_object, const char *object);
 
 void e_cal_backend_notify_mode      (ECalBackend *backend,
 				     GNOME_Evolution_Calendar_CalListener_SetModeStatus status, 
Index: libedata-cal/e-data-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal-view.c,v
retrieving revision 1.5
diff -u -p -r1.5 e-data-cal-view.c
--- libedata-cal/e-data-cal-view.c	16 May 2005 09:05:51 -0000	1.5
+++ libedata-cal/e-data-cal-view.c	16 Aug 2005 16:50:48 -0000
@@ -117,37 +117,44 @@ add_object_to_cache (EDataCalView *query
 }
 
 static gboolean
-uncache_with_uid_cb (gpointer key, gpointer value, gpointer user_data)
+uncache_with_id_cb (gpointer key, gpointer value, gpointer user_data)
 {
 	ECalComponent *comp;
+	ECalComponentId *id;
 	const char *this_uid;
-	char *uid, *object;
+	char *object;
+	gboolean remove = FALSE;
 
-	uid = user_data;
+	id = user_data;
 	object = value;
 
 	comp = e_cal_component_new_from_string (object);
 	if (comp) {
 		e_cal_component_get_uid (comp, &this_uid);
-		if (this_uid && *this_uid && !strcmp (uid, this_uid)) {
-			g_object_unref (comp);
-			return TRUE;
+		if (this_uid && *this_uid && !strcmp (id->uid, this_uid)) {
+			if (id->rid && *id->rid) {
+				const char *rid = e_cal_component_get_recurid_as_string (comp);	
+
+				if (rid && *rid && !strcmp (id->rid, rid))
+					remove = TRUE;
+			} else
+				remove = TRUE;
 		}
 
 		g_object_unref (comp);
 	}
 
-	return FALSE;
+	return remove;
 }
 
 static void
-remove_object_from_cache (EDataCalView *query, const char *uid)
+remove_object_from_cache (EDataCalView *query, const ECalComponentId *id)
 {
 	EDataCalViewPrivate *priv;
 
 	priv = query->priv;
 
-	g_hash_table_foreach_remove (priv->matched_objects, (GHRFunc) uncache_with_uid_cb, (gpointer) uid);
+	g_hash_table_foreach_remove (priv->matched_objects, (GHRFunc) uncache_with_id_cb, (gpointer) id);
 }
 
 static void
@@ -766,18 +773,18 @@ e_data_cal_view_notify_objects_modified_
 /**
  * e_data_cal_view_notify_objects_removed:
  * @query: A query object.
- * @uids: List of UIDs for the objects that have been removed.
+ * @ids: List of IDs for the objects that have been removed.
  *
  * Notifies all query listener of the removal of a list of objects.
  */
 void
-e_data_cal_view_notify_objects_removed (EDataCalView *query, const GList *uids)
+e_data_cal_view_notify_objects_removed (EDataCalView *query, const GList *ids)
 {
 	EDataCalViewPrivate *priv;
-	GNOME_Evolution_Calendar_CalObjUIDSeq uid_list;
+	GNOME_Evolution_Calendar_CalObjIDSeq id_list;
 	CORBA_Environment ev;
 	const GList *l;
-	int num_uids, i;
+	int num_ids, i;
 	
 	g_return_if_fail (query != NULL);
 	g_return_if_fail (IS_QUERY (query));
@@ -785,16 +792,24 @@ e_data_cal_view_notify_objects_removed (
 	priv = query->priv;
 	g_return_if_fail (priv->listeners != CORBA_OBJECT_NIL);
 
-	num_uids = g_list_length ((GList*)uids);
-	if (num_uids <= 0)
+	num_ids = g_list_length ((GList*)ids);
+	if (num_ids <= 0)
 		return;
 
-	uid_list._buffer = GNOME_Evolution_Calendar_CalObjUIDSeq_allocbuf (num_uids);
-	uid_list._maximum = num_uids;
-	uid_list._length = num_uids;
-
-	for (l = uids, i = 0; l; l = l->next, i ++) {
-		uid_list._buffer[i] = CORBA_string_dup (l->data);
+	id_list._buffer = GNOME_Evolution_Calendar_CalObjIDSeq_allocbuf (num_ids);
+	id_list._maximum = num_ids;
+	id_list._length = num_ids;
+
+	for (l = ids, i = 0; l; l = l->next, i ++) {
+		ECalComponentId *id = l->data;
+		GNOME_Evolution_Calendar_CalObjID *c_id = &id_list._buffer[i];
+
+		c_id->uid = CORBA_string_dup (id->uid);
+		
+		if (id->rid)
+			c_id->rid = CORBA_string_dup (id->rid);
+		else
+			c_id->rid = CORBA_string_dup ("");	
 
 		/* update our cache */
 		remove_object_from_cache (query, l->data);
@@ -805,40 +820,40 @@ e_data_cal_view_notify_objects_removed (
 
 		CORBA_exception_init (&ev);
 
-		GNOME_Evolution_Calendar_CalViewListener_notifyObjectsRemoved (ld->listener, &uid_list, &ev);
+		GNOME_Evolution_Calendar_CalViewListener_notifyObjectsRemoved (ld->listener, &id_list, &ev);
 		if (BONOBO_EX (&ev))
 			g_warning (G_STRLOC ": could not notify the listener of object removal");
 
 		CORBA_exception_free (&ev);
 	}
 
-	CORBA_free (uid_list._buffer);
+	CORBA_free (id_list._buffer);
 }
 
 /**
  * e_data_cal_view_notify_objects_removed:
  * @query: A query object.
- * @uid: UID of the removed object.
+ * @id: Id of the removed object.
  *
  * Notifies all query listener of the removal of a single object.
  */
 void
-e_data_cal_view_notify_objects_removed_1 (EDataCalView *query, const char *uid)
+e_data_cal_view_notify_objects_removed_1 (EDataCalView *query, const ECalComponentId *id)
 {
 	EDataCalViewPrivate *priv;
-	GList uids;
+	GList ids;
 	
 	g_return_if_fail (query != NULL);
 	g_return_if_fail (IS_QUERY (query));
-	g_return_if_fail (uid != NULL);
+	g_return_if_fail (id != NULL);
 
 	priv = query->priv;
 	g_return_if_fail (priv->listeners != CORBA_OBJECT_NIL);
 
-	uids.next = uids.prev = NULL;
-	uids.data = (gpointer)uid;
+	ids.next = ids.prev = NULL;
+	ids.data = (gpointer)id;
 	
-	e_data_cal_view_notify_objects_removed (query, &uids);
+	e_data_cal_view_notify_objects_removed (query, &ids);
 }
 
 /**
Index: libedata-cal/e-data-cal-view.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal-view.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-data-cal-view.h
--- libedata-cal/e-data-cal-view.h	23 Sep 2004 21:06:46 -0000	1.4
+++ libedata-cal/e-data-cal-view.h	16 Aug 2005 16:50:48 -0000
@@ -74,9 +74,9 @@ void                  e_data_cal_view_no
 void                  e_data_cal_view_notify_objects_modified_1 (EDataCalView       *query,
 								 const char *object);
 void                  e_data_cal_view_notify_objects_removed (EDataCalView       *query,
-							      const GList *uids);
+							      const GList *ids);
 void                  e_data_cal_view_notify_objects_removed_1 (EDataCalView       *query,
-								const char *uid);
+								const ECalComponentId *id);
 void                  e_data_cal_view_notify_progress (EDataCalView      *query,
 						       const char *message,
 						       int         percent);
Index: libedata-cal/e-data-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.c,v
retrieving revision 1.15
diff -u -p -r1.15 e-data-cal.c
--- libedata-cal/e-data-cal.c	11 Jul 2005 00:51:08 -0000	1.15
+++ libedata-cal/e-data-cal.c	16 Aug 2005 16:50:48 -0000
@@ -966,7 +966,7 @@ e_data_cal_notify_object_modified (EData
  */
 void
 e_data_cal_notify_object_removed (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
-				  const char *uid, const char *old_object, const char *object)
+				  const ECalComponentId *id, const char *old_object, const char *object)
 {
 	EDataCalPrivate *priv;
 	CORBA_Environment ev;
@@ -978,7 +978,7 @@ e_data_cal_notify_object_removed (EDataC
 	g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
 
 	if (status == GNOME_Evolution_Calendar_Success)
-		e_cal_backend_notify_object_removed (priv->backend, uid, old_object, object);
+		e_cal_backend_notify_object_removed (priv->backend, id, old_object, object);
 
 	CORBA_exception_init (&ev);
 	GNOME_Evolution_Calendar_CalListener_notifyObjectRemoved (priv->listener, status, &ev);
Index: libedata-cal/e-data-cal.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.h,v
retrieving revision 1.10
diff -u -p -r1.10 e-data-cal.h
--- libedata-cal/e-data-cal.h	11 Jul 2005 00:51:08 -0000	1.10
+++ libedata-cal/e-data-cal.h	16 Aug 2005 16:50:48 -0000
@@ -83,7 +83,7 @@ void e_data_cal_notify_object_created  (
 void e_data_cal_notify_object_modified (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
 					const char *old_object, const char *object);
 void e_data_cal_notify_object_removed  (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, 
-					const char *uid, const char *old_object, const char *object);
+					const ECalComponentId *id, const char *old_object, const char *object);
 void e_data_cal_notify_alarm_discarded (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
 
 void e_data_cal_notify_objects_received (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2795
diff -u -p -r1.2795 ChangeLog
--- ChangeLog	12 Aug 2005 14:33:55 -0000	1.2795
+++ ChangeLog	16 Aug 2005 17:05:16 -0000
@@ -1,3 +1,21 @@
+2005-08-16  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #266144
+	* gui/e-cal-model.c: 
+	(search_by_id_and_client): Use ECalComponentId.
+	(set_instance_times): Use the proper time zone.
+	(e_cal_view_objects_added_cb): generate the instances
+	only if its a master object.
+	(e_cal_view_objects_modified_cb): removed the redundant
+	code.
+	(e_cal_view_objects_removed_cb): Use ECalComponentId.
+	(e_cal_model_get_component_for_uid):
+	* gui/e-calendar-view.c: (delete_event): Need to send
+        the recurrence id to backends which dont support master
+	object for recurrences.       
+	* gui/gnome-cal.c: (dn_e_cal_view_objects_removed_cb): renamed
+	uid to ids.
+
 2005-08-12  Viren.L  <lviren novell com>
 
 	Fixes #312739
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.60
diff -u -p -r1.60 e-cal-model.c
--- gui/e-cal-model.c	22 Jul 2005 11:41:35 -0000	1.60
+++ gui/e-cal-model.c	16 Aug 2005 17:05:17 -0000
@@ -1242,22 +1242,35 @@ find_client_data (ECalModel *model, ECal
 	return NULL;
 }
 
-/* Pass NULL for the client if we just want to find based on uid */
 /* FIXME how do we prevent the same UID is different calendars? */
+/* If the get_det is set, return detached instances also */
 static ECalModelComponent *
-search_by_uid_and_client (ECalModelPrivate *priv, ECal *client, const char *uid)
+search_by_id_and_client (ECalModelPrivate *priv, ECal *client, const ECalComponentId *id, gboolean get_det)
 {
 	gint i;
 
 	for (i = 0; i < priv->objects->len; i++) {
 		ECalModelComponent *comp_data = g_ptr_array_index (priv->objects, i);
 
-		if (comp_data) {
-			const char *tmp_uid;
+		if (comp_data && comp_data->client == client) {
+			const char *uid, *rid;
+			gboolean has_rid = (id->rid && *id->rid);
+
+			uid = icalcomponent_get_uid (comp_data->icalcomp);
+			rid = icaltime_as_ical_string (icalcomponent_get_recurrenceid (comp_data->icalcomp));
+			
+			if (!get_det && !has_rid) {
+				if (e_cal_util_component_is_instance (comp_data->icalcomp))
+					continue;
+			}
+ 
+			if (has_rid) {
+				if (!(rid && *rid && !strcmp (rid, id->rid)))	
+					continue;
+			}
 
-			tmp_uid = icalcomponent_get_uid (comp_data->icalcomp);
-			if (tmp_uid && *tmp_uid) {
-				if (comp_data->client == client && !strcmp (uid, tmp_uid))
+			if (uid && *uid) {
+				if (!strcmp (id->uid, uid))
 					return comp_data;
 			}
 		}
@@ -1320,10 +1333,10 @@ set_instance_times (ECalModelComponent *
 	start_time = icalcomponent_get_dtstart (comp_data->icalcomp);
 	end_time = icalcomponent_get_dtend (comp_data->icalcomp);
 
-	comp_data->instance_start = icaltime_as_timet (start_time);
+	comp_data->instance_start = icaltime_as_timet_with_zone (start_time, zone);
 
 	comp_data->instance_end = comp_data->instance_start +
-		(icaltime_as_timet (end_time) - icaltime_as_timet (start_time));
+		(icaltime_as_timet_with_zone (end_time, zone) - icaltime_as_timet_with_zone (start_time, zone));
 }
 
 /* We do this check since the calendar items are downloaded from the server in the open_method,
@@ -1361,10 +1374,15 @@ e_cal_view_objects_added_cb (ECalView *q
 
 	for (l = objects; l; l = l->next) {
 		ECalModelComponent *comp_data;
+		ECalComponent *comp = e_cal_component_new ();
+		ECalComponentId *id;
+
+		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data));
+		id = e_cal_component_get_id (comp);
 
 		/* remove the components if they are already present and re-add them */
-		while ((comp_data = search_by_uid_and_client (priv, e_cal_view_get_client (query),
-							      icalcomponent_get_uid (l->data)))) {
+		while ((comp_data = search_by_id_and_client (priv, e_cal_view_get_client (query),
+							      id, FALSE))) {
 			int pos;
 
 			pos = get_position_in_array (priv->objects, comp_data);
@@ -1374,9 +1392,10 @@ e_cal_view_objects_added_cb (ECalView *q
  			e_cal_model_free_component_data (comp_data);
  		}
 
+		e_cal_component_free_id (id);
 		ensure_dates_are_in_default_zone (l->data);
 
-		if ((priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) {
+		if (e_cal_util_component_has_recurrences (l->data) && (priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) {
 			RecurrenceExpansionData rdata;
 
 			rdata.client = e_cal_view_get_client (query);
@@ -1412,28 +1431,12 @@ e_cal_view_objects_modified_cb (ECalView
 	
 	priv = model->priv;
 
-	for (l = objects; l; l = l->next) {
-		ECalModelComponent *comp_data;
-
-		/* remove all recurrences and re-add them after generating them */
-		while ((comp_data = search_by_uid_and_client (priv, e_cal_view_get_client (query),
-							      icalcomponent_get_uid (l->data)))) {
-			int pos;
-
-			pos = get_position_in_array (priv->objects, comp_data);
-			e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
-
-			g_ptr_array_remove (priv->objects, comp_data);
-			e_cal_model_free_component_data (comp_data);
-		}
-	}
-
 	/* now re-add all objects */
 	e_cal_view_objects_added_cb (query, objects, model);
 }
 
 static void
-e_cal_view_objects_removed_cb (ECalView *query, GList *uids, gpointer user_data)
+e_cal_view_objects_removed_cb (ECalView *query, GList *ids, gpointer user_data)
 {
 	ECalModelPrivate *priv;
 	ECalModel *model = (ECalModel *) user_data;
@@ -1441,14 +1444,15 @@ e_cal_view_objects_removed_cb (ECalView 
 	
 	priv = model->priv;
 
-	for (l = uids; l; l = l->next) {
+	for (l = ids; l; l = l->next) {
 		ECalModelComponent *comp_data;
+		ECalComponentId *id = l->data;
 		int pos;
 
 		e_table_model_pre_change (E_TABLE_MODEL (model));
 		
 		/* make sure we remove all objects with this UID */
-		while ((comp_data = search_by_uid_and_client (priv, e_cal_view_get_client (query), l->data))) {
+		while ((comp_data = search_by_id_and_client (priv, e_cal_view_get_client (query), id, TRUE))) {
 			pos = get_position_in_array (priv->objects, comp_data);
 			e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
 
@@ -1937,7 +1941,7 @@ e_cal_model_get_component_at (ECalModel 
 }
 
 ECalModelComponent *
-e_cal_model_get_component_for_uid  (ECalModel *model, const char *uid)
+e_cal_model_get_component_for_uid  (ECalModel *model, const ECalComponentId *id)
 {
 	ECalModelPrivate *priv;
 
@@ -1945,8 +1949,8 @@ e_cal_model_get_component_for_uid  (ECal
 
 	priv = model->priv;
 
-	return search_by_uid_and_client (priv, NULL, uid);
-}
+	return search_by_id_and_client (priv, NULL, id, FALSE);
+} 
 
 /**
  * e_cal_model_date_value_to_string
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.90
diff -u -p -r1.90 e-calendar-view.c
--- gui/e-calendar-view.c	5 Aug 2005 12:15:34 -0000	1.90
+++ gui/e-calendar-view.c	16 Aug 2005 17:05:18 -0000
@@ -846,7 +846,9 @@ delete_event (ECalendarView *cal_view, E
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 	vtype = e_cal_component_get_vtype (comp);
-	e_cal_component_set_recurid (comp, NULL);
+	
+	if (!e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER))
+		e_cal_component_set_recurid (comp, NULL);
 
 	if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) {
 		const char *uid;
@@ -865,8 +867,9 @@ delete_event (ECalendarView *cal_view, E
 			return;
 		}
 
-		if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_is_instance (event->comp_data->icalcomp))
-			e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_ALL, &error);
+		if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_has_recurrences (event->comp_data->icalcomp))
+			e_cal_remove_object_with_mod (event->comp_data->client, uid, 
+					e_cal_component_get_recurid_as_string (comp), CALOBJ_MOD_ALL, &error);
 		else
 			e_cal_remove_object (event->comp_data->client, uid, &error);
 		
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.385
diff -u -p -r1.385 gnome-cal.c
--- gui/gnome-cal.c	4 Aug 2005 10:17:43 -0000	1.385
+++ gui/gnome-cal.c	16 Aug 2005 17:05:19 -0000
@@ -515,7 +515,7 @@ dn_e_cal_view_objects_modified_cb (ECalV
 
 /* Callback used when the calendar query reports of a removed object */
 static void
-dn_e_cal_view_objects_removed_cb (ECalView *query, GList *uids, gpointer data)
+dn_e_cal_view_objects_removed_cb (ECalView *query, GList *ids, gpointer data)
 {
 	GnomeCalendar *gcal;
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/itip-formatter/ChangeLog,v
retrieving revision 1.56
diff -u -p -r1.56 ChangeLog
--- ChangeLog	12 Aug 2005 14:25:20 -0000	1.56
+++ ChangeLog	16 Aug 2005 16:53:38 -0000
@@ -1,3 +1,11 @@
+2005-08-16  Chenthill Palanisamy  <pchenthill novell com>
+
+	Fixes #313534
+	* itip-formatter.c: (cal_opened_cb), 
+	(find_cal_opened_cb): Moved the code to display recur check
+	box to cal_opened_cb.
+	(format_itip_object): Set the recurrence id in utc format.
+
 2005-08-11  Dinesh Layek  <LDinesh novell com>
 
 	Fixes #305627
Index: itip-formatter.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/itip-formatter/itip-formatter.c,v
retrieving revision 1.49
diff -u -p -r1.49 itip-formatter.c
--- itip-formatter.c	12 Aug 2005 14:25:20 -0000	1.49
+++ itip-formatter.c	16 Aug 2005 16:53:39 -0000
@@ -278,6 +278,14 @@ cal_opened_cb (ECal *ecal, ECalendarStat
 		return;
 	}
 	
+	if (e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+		icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
+
+		if (check_is_instance (icalcomp))
+			itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
+		else
+			itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
+	}
 
 	zone = calendar_config_get_icaltimezone ();
 	e_cal_set_default_timezone (ecal, zone, NULL);
@@ -425,14 +433,6 @@ find_cal_opened_cb (ECal *ecal, ECalenda
 						      "Found the appointment in the calendar '%s'", e_source_peek_name (source));
 
 		set_buttons_sensitive (pitip);
-		if (e_cal_get_static_capability (ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
-			icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
-			
-			if (check_is_instance (icalcomp))
-				itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
-			else
-				itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
-		}
 	}
 
 	zone = calendar_config_get_icaltimezone ();
@@ -1701,9 +1701,6 @@ format_itip_object (EMFormatHTML *efh, G
 	/* Set the recurrence id */
 	if (check_is_instance (icalcomp) && datetime.value) {
 		ECalComponentRange *recur_id;
-
-		*datetime.value = icaltime_convert_to_zone (*datetime.value, to_zone);
-		datetime.tzid = icaltimezone_get_tzid (to_zone);
 
 		recur_id = g_new0 (ECalComponentRange, 1);
 		recur_id->type = E_CAL_COMPONENT_RANGE_SINGLE;


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