evolution-data-server r8702 - in trunk/calendar: . backends/caldav



Author: mcrha
Date: Tue Apr 29 13:57:16 2008
New Revision: 8702
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8702&view=rev

Log:
2008-04-29  Milan Crha  <mcrha redhat com>

	** Fix for bug #330990

	* backends/caldav/e-cal-backend-caldav.c: (caldav_remove_object):
	Allow remove only one instance of the recurring event.



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

Modified: trunk/calendar/backends/caldav/e-cal-backend-caldav.c
==============================================================================
--- trunk/calendar/backends/caldav/e-cal-backend-caldav.c	(original)
+++ trunk/calendar/backends/caldav/e-cal-backend-caldav.c	Tue Apr 29 13:57:16 2008
@@ -1834,11 +1834,22 @@
 	}
 
 	cache_comp = e_cal_backend_cache_get_component (priv->cache, uid, rid);
+
+	if (cache_comp == NULL && rid && *rid) {
+		/* we do not have this instance in cache directly, thus try to get master object */
+		cache_comp = e_cal_backend_cache_get_component (priv->cache, uid, "");
+	}
+
 	if (cache_comp == NULL) {
 		g_mutex_unlock (priv->lock);
 		return GNOME_Evolution_Calendar_ObjectNotFound;
 	}
 
+	*old_object = e_cal_component_get_as_string (cache_comp);
+
+	if (mod == CALOBJ_MOD_THIS)
+		e_cal_util_remove_instances (e_cal_component_get_icalcomponent (cache_comp), icaltime_from_string (rid), mod);
+
 	if (online) {
 		CalDAVObject caldav_object;
 
@@ -1846,14 +1857,20 @@
 		caldav_object.etag  = e_cal_component_get_etag (cache_comp);
 		caldav_object.cdata = NULL;
 
-		status = caldav_server_delete_object (cbdav, &caldav_object);
+		if (mod == CALOBJ_MOD_THIS) {
+			caldav_object.cdata = pack_cobj (cbdav, cache_comp);
 
-		caldav_object_free (&caldav_object, FALSE);
+			status = caldav_server_put_object (cbdav, &caldav_object);
+		} else
+			status = caldav_server_delete_object (cbdav, &caldav_object);
 
+		caldav_object_free (&caldav_object, FALSE);
 	} else {
 		/* mark component as out of synch */
-		e_cal_component_set_synch_state (cache_comp,
-				E_CAL_COMPONENT_LOCALLY_DELETED);
+		if (mod == CALOBJ_MOD_THIS)
+			e_cal_component_set_synch_state (cache_comp, E_CAL_COMPONENT_LOCALLY_MODIFIED);
+		else
+			e_cal_component_set_synch_state (cache_comp, E_CAL_COMPONENT_LOCALLY_DELETED);
 	}
 
 	if (status != GNOME_Evolution_Calendar_Success) {
@@ -1861,13 +1878,13 @@
 		return status;
 	}
 
-	*old_object = e_cal_component_get_as_string (cache_comp);
-
 	/* We should prolly check for cache errors
 	 * but when that happens we are kinda hosed anyway */
-	e_cal_backend_cache_remove_component (priv->cache, uid, rid);
-
-	/* FIXME: set new_object when removing instances of a recurring appointment */
+	if (mod == CALOBJ_MOD_THIS) {
+		e_cal_backend_cache_put_component (priv->cache, cache_comp);
+		*object = e_cal_component_get_as_string (cache_comp);
+	} else
+		e_cal_backend_cache_remove_component (priv->cache, uid, rid);
 
 	g_mutex_unlock (priv->lock);
 



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