evolution-data-server r9043 - in trunk/calendar: . backends/file



Author: mcrha
Date: Wed Jun 25 12:32:37 2008
New Revision: 9043
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9043&view=rev

Log:
2008-06-25  Milan Crha  <mcrha redhat com>

	** Fix for bug #476640

	* backends/file/e-cal-backend-file.c: (cancel_received_object):
	Pass back old and new object after the remove.
	* backends/file/e-cal-backend-file.c:
	(e_cal_backend_file_receive_objects): Cancel event properly.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/file/e-cal-backend-file.c

Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c	(original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c	Wed Jun 25 12:32:37 2008
@@ -2301,7 +2301,7 @@
 }
 
 static gboolean
-cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp)
+cancel_received_object (ECalBackendFile *cbfile, icalcomponent *icalcomp, char **old_object, char **new_object)
 {
 	ECalBackendFileObject *obj_data;
 	ECalBackendFilePrivate *priv;
@@ -2310,6 +2310,9 @@
 
 	priv = cbfile->priv;
 
+	*old_object = NULL;
+	*new_object = NULL;
+
 	/* Find the old version of the component. */
 	obj_data = g_hash_table_lookup (priv->comp_uid_hash, icalcomponent_get_uid (icalcomp));
 	if (!obj_data)
@@ -2322,10 +2325,14 @@
 		return FALSE;
 	}
 
+	*old_object = e_cal_component_get_as_string (obj_data->full_object);
+
+	/* new_object is kept NULL if not removing the instance */
 	rid = e_cal_component_get_recurid_as_string (comp);
-	if (rid && *rid)
+	if (rid && *rid) {
 		remove_instance (cbfile, obj_data, rid);
-	else
+		*new_object = e_cal_component_get_as_string (obj_data->full_object);
+	} else
 		remove_component (cbfile, icalcomponent_get_uid (icalcomp), obj_data);
 
 	g_free (rid);
@@ -2517,7 +2524,7 @@
 	/* Now we manipulate the components we care about */
 	for (l = comps; l; l = l->next) {
 		const char *uid;
-		char *object, *old_object, *rid;
+		char *object, *old_object, *rid, *new_object;
 		ECalBackendFileObject *obj_data;
 
 		subcomp = l->data;
@@ -2585,26 +2592,22 @@
 			goto error;
 			break;
 		case ICAL_METHOD_CANCEL:
-			if (cancel_received_object (cbfile, subcomp)) {
+			old_object = NULL;
+			new_object = NULL;
+			if (cancel_received_object (cbfile, subcomp, &old_object, &new_object)) {
 				ECalComponentId *id;
-				object =  icalcomponent_as_ical_string (subcomp);
-				obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
-				if (obj_data)
-					old_object = e_cal_component_get_as_string (obj_data->full_object);
-				else
-					old_object = NULL;
 
 				id = e_cal_component_get_id (comp);
 
-				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, object);
+				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, old_object, new_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 (new_object);
 				g_free (old_object);
-				g_free (object);
 			}
 			g_free (rid);
 			break;



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