Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 9122)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-07-15  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #543069
+
+	* backends/caldav/e-cal-backend-caldav.c: (caldav_modify_object):
+	It only knows how to modify only all instances, thus check for it.
+	When modifying an instance, make a master object from it and always
+	modify all instances.
+
 2008-07-04  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #329571
Index: calendar/backends/caldav/e-cal-backend-caldav.c
===================================================================
--- calendar/backends/caldav/e-cal-backend-caldav.c	(revision 9122)
+++ calendar/backends/caldav/e-cal-backend-caldav.c	(working copy)
@@ -1743,10 +1743,15 @@ caldav_modify_object (ECalBackendSync  *
 	ECalComponent            *cache_comp;
 	gboolean                  online;
 	const char		 *uid = NULL;
+	char			 *rid;
 
 	cbdav = E_CAL_BACKEND_CALDAV (backend);
 	priv  = E_CAL_BACKEND_CALDAV_GET_PRIVATE (cbdav);
 
+	/* here is implemented only modifying of all instances */
+	if (mod != CALOBJ_MOD_ALL)
+		return GNOME_Evolution_Calendar_UnsupportedMethod;
+
 	g_mutex_lock (priv->lock);
 
 	status = check_state (cbdav, &online);
@@ -1771,6 +1776,63 @@ caldav_modify_object (ECalBackendSync  *
 		return GNOME_Evolution_Calendar_ObjectNotFound;
 	}
 
+	rid = e_cal_component_get_recurid_as_string (comp);
+	if (rid && *rid) {
+		/* this is an instance, thus make it a master object */
+		icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp);
+		icaltimetype start, recur = icaltime_from_string (rid);
+
+		start = icalcomponent_get_dtstart (icalcomp);
+
+		/* This means it's an instance generated from master object. So replace
+		    the dates with stored dates from the master object */
+		if (!recur.zone)
+			recur.zone = start.zone;
+
+		if (icaltime_compare_date_only (start, recur) == 0) {
+			icaltimetype end = icalcomponent_get_dtend (icalcomp);
+			ECalComponentDateTime m_sdate, m_endate;
+
+			e_cal_component_get_dtstart (cache_comp, &m_sdate);
+			e_cal_component_get_dtend (cache_comp, &m_endate);
+
+			if (icaltime_compare (start, recur) != 0 ||
+			    !m_endate.value ||
+			    icaltime_compare (end, *(m_endate.value)) != 0) {
+
+				m_sdate.value->hour = start.hour;
+				m_sdate.value->minute = start.minute;
+				m_sdate.value->second = start.second;
+
+				if (!m_endate.value) {
+					/* create one if not exists and make same date
+					   and time zone like start */
+					m_endate.value = g_new (struct icaltimetype, 1);
+					*m_endate.value = *m_sdate.value;
+
+					if (m_endate.tzid)
+						g_free ((char*)m_endate.tzid);
+
+					m_endate.tzid = g_strdup (m_sdate.tzid);
+				}
+
+				m_endate.value->hour = end.hour;
+				m_endate.value->minute = end.minute;
+				m_endate.value->second = end.second;
+			}
+
+			e_cal_component_set_dtstart (comp, &m_sdate);
+			e_cal_component_set_dtend (comp, &m_endate);
+			e_cal_component_set_recurid (comp, NULL);
+			e_cal_component_commit_sequence (comp);
+
+			e_cal_component_free_datetime (&m_sdate);
+			e_cal_component_free_datetime (&m_endate);
+		}
+		e_cal_component_set_recurid (comp, NULL);
+	}
+	g_free (rid);
+
 	if (online) {
 		CalDAVObject object;
 
