[evolution-exchange] Adapt to recent ECalBakcend API changes



commit 7288a2e0db151aef3fd1bce1a40ed3c0b6bb1b3e
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 19 15:01:25 2011 +0200

    Adapt to recent ECalBakcend API changes

 calendar/e-cal-backend-exchange-calendar.c |  142 +++++++++++++++-------------
 calendar/e-cal-backend-exchange-tasks.c    |   55 +++++------
 calendar/e-cal-backend-exchange.c          |    6 +-
 3 files changed, 106 insertions(+), 97 deletions(-)
---
diff --git a/calendar/e-cal-backend-exchange-calendar.c b/calendar/e-cal-backend-exchange-calendar.c
index 74ebe42..22b80c7 100644
--- a/calendar/e-cal-backend-exchange-calendar.c
+++ b/calendar/e-cal-backend-exchange-calendar.c
@@ -54,7 +54,7 @@ enum {
 
 #define d(x)
 
-static gboolean modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, gchar **old_object, gchar **new_object, const gchar *href, const gchar *rid_to_remove, GError **error);
+static gboolean modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, GCancellable *cancellable, const gchar *calobj, CalObjModType mod, icalcomponent **old_icalcomp, icalcomponent **new_icalcomp, const gchar *href, const gchar *rid_to_remove, GError **error);
 
 static icalproperty *find_attendee_prop (icalcomponent *ical_comp, const gchar *address);
 static gboolean check_owner_partstatus_for_declined (ECalBackendSync *backend,
@@ -253,9 +253,7 @@ add_ical (ECalBackendExchange *cbex,
 		status = add_vevent (cbex, href, lastmod, icalcomp);
 
 		if (status) {
-			gchar *object = icalcomponent_as_ical_string_r (icalcomp);
-			e_cal_backend_notify_object_created (backend, object);
-			g_free (object);
+			e_cal_backend_notify_component_created (backend, icalcomp);
 		}
 
 		icalcomponent_free (icalcomp);
@@ -296,9 +294,7 @@ add_ical (ECalBackendExchange *cbex,
 			status = add_vevent (cbex, href, lastmod, new_comp);
 
 			if (status) {
-				gchar *object = icalcomponent_as_ical_string_r (new_comp);
-				e_cal_backend_notify_object_created (backend, object);
-				g_free (object);
+				e_cal_backend_notify_component_created (backend, new_comp);
 			}
 
 			icalcomponent_free (new_comp);
@@ -770,7 +766,7 @@ create_object (ECalBackendSync *backend,
                GCancellable *cancellable,
                const gchar *calobj,
                gchar **uid,
-               gchar **new_object,
+               icalcomponent **new_icalcomp,
                GError **error)
 {
 	/* FIXME : Return some value in uid */
@@ -912,15 +908,15 @@ create_object (ECalBackendSync *backend,
 	/* add the timezones information and the component itself
 	 * to the VCALENDAR object */
 	e_cal_component_commit_sequence (comp);
-	*new_object = e_cal_component_get_as_string (comp);
-	if (!*new_object) {
+	*new_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+	if (!*new_icalcomp) {
 		g_object_unref (comp);
 		icalcomponent_free (cbdata->vcal_comp);
 		g_free (cbdata);
 		g_propagate_error (error, EDC_ERROR_EX (OtherError, "Cannot get comp as string"));
 		return;
 	}
-	real_icalcomp = icalparser_parse_string (*new_object);
+	real_icalcomp = icalcomponent_new_clone (*new_icalcomp);
 
 	icalcomponent_foreach_tzid (real_icalcomp, add_timezone_cb, cbdata);
 	icalcomponent_add_component (cbdata->vcal_comp, real_icalcomp);
@@ -1127,13 +1123,13 @@ modify_object (ECalBackendSync *backend,
                GCancellable *cancellable,
                const gchar *calobj,
                CalObjModType mod,
-               gchar **old_object,
-               gchar **new_object,
+               icalcomponent **old_icalcomp,
+               icalcomponent **new_icalcomp,
                GError **perror)
 {
-	d(printf ("ecbexc_modify_object(%p, %p, %d, %s)", backend, cal, mod, *old_object ? *old_object : NULL));
+	d(printf ("ecbexc_modify_object(%p, %p, %d, %s)", backend, cal, mod, calobj));
 
-	modify_object_with_href (backend, cal, cancellable, calobj, mod, old_object, new_object, NULL, NULL, perror);
+	modify_object_with_href (backend, cal, cancellable, calobj, mod, old_icalcomp, new_icalcomp, NULL, NULL, perror);
 }
 
 #define e_return_data_cal_error_and_val_if_fail(expr, _code, _val)		\
@@ -1157,8 +1153,8 @@ modify_object_with_href (ECalBackendSync *backend,
                          GCancellable *cancellable,
                          const gchar *calobj,
                          CalObjModType mod,
-                         gchar **old_object,
-                         gchar **new_object,
+                         icalcomponent **old_icalcomp,
+                         icalcomponent **new_icalcomp,
                          const gchar *href,
                          const gchar *rid_to_remove,
                          GError **error)
@@ -1475,7 +1471,7 @@ modify_object_with_href (ECalBackendSync *backend,
 	e_cal_backend_exchange_cache_unlock (cbex);
 
 	if (!cached_ecomp && remove)
-		*new_object = icalcomponent_as_ical_string_r (icalcomp);
+		*new_icalcomp = icalcomponent_new_clone (icalcomp);
 
 	body_crlf = icalcomponent_as_ical_string_r (cbdata->vcal_comp);
 
@@ -1530,7 +1526,7 @@ modify_object_with_href (ECalBackendSync *backend,
 
 	if (cached_ecomp) {
 		e_cal_component_commit_sequence (cached_ecomp);
-		*old_object = e_cal_component_get_as_string (cached_ecomp);
+		*old_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (cached_ecomp));
 	}
 
 	ctx = exchange_account_get_context (E_CAL_BACKEND_EXCHANGE (cbexc)->account);
@@ -1554,7 +1550,7 @@ modify_object_with_href (ECalBackendSync *backend,
 		e_cal_backend_exchange_cache_unlock (cbex);
 
 		if (!remove)
-			*new_object = e_cal_component_get_as_string (real_ecomp);
+			*new_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (real_ecomp));
 	} else {
 		g_propagate_error (error, EDC_ERROR_HTTP_STATUS (http_status));
 	}
@@ -1580,8 +1576,8 @@ remove_object (ECalBackendSync *backend,
                const gchar *uid,
                const gchar *rid,
                CalObjModType mod,
-               gchar **old_object,
-               gchar **object,
+               icalcomponent **old_icalcomp,
+               icalcomponent **new_icalcomp,
                GError **error)
 {
 	ECalBackendExchangeCalendar *cbexc;
@@ -1590,7 +1586,8 @@ remove_object (ECalBackendSync *backend,
 	E2kHTTPStatus status;
 	E2kContext *ctx;
 	ECalComponent *comp;
-	gchar *calobj, *obj = NULL;
+	gchar *calobj;
+	icalcomponent *obj_icalcomp = NULL;
 	struct icaltimetype time_rid;
 
 	/* Will handle only CALOBJ_MOD_THIS and CALOBJ_MOD_ALL for mod.
@@ -1618,14 +1615,14 @@ remove_object (ECalBackendSync *backend,
 
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (ecomp->icomp));
-	if (old_object) {
+	if (old_icalcomp) {
 		e_cal_component_commit_sequence (comp);
-		*old_object = e_cal_component_get_as_string (comp);
+		*old_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
 	}
 
 	/*TODO How handle multiple detached intances with no master object ?*/
 	if (mod == CALOBJ_MOD_THIS && rid && *rid && ecomp->icomp) {
-		gchar *new_object = NULL;
+		icalcomponent *tmp_new_icalcomp = NULL;
 		gboolean res;
 
 		/*remove a single instance of a recurring event and modify */
@@ -1634,18 +1631,23 @@ remove_object (ECalBackendSync *backend,
 		calobj  = (gchar *) icalcomponent_as_ical_string_r (ecomp->icomp);
 
 		e_cal_backend_exchange_cache_unlock (cbex);
-		res = modify_object_with_href (backend, cal, cancellable, calobj, mod, &obj, &new_object, NULL, rid, error);
+		res = modify_object_with_href (backend, cal, cancellable, calobj, mod, &obj_icalcomp, &tmp_new_icalcomp, NULL, rid, error);
+		if (tmp_new_icalcomp)
+			icalcomponent_free (tmp_new_icalcomp);
+
 		g_object_unref (comp);
 		g_free (calobj);
 		if (!res)
 			return;
-		if (obj) {
-			g_free (*old_object);
-			*old_object = obj;
+		if (obj_icalcomp) {
+			if (old_icalcomp) {
+				icalcomponent_free (*old_icalcomp);
+				*old_icalcomp = obj_icalcomp;
+			} else {
+				icalcomponent_free (obj_icalcomp);
+			}
 		}
 
-		g_free (new_object);
-
 		return;
 	} else
 		e_cal_backend_exchange_cache_unlock (cbex);
@@ -1663,7 +1665,7 @@ remove_object (ECalBackendSync *backend,
 		}
 		e_cal_backend_exchange_cache_unlock (cbex);
 	}
-	*object = NULL;
+	*new_icalcomp = NULL;
 
 	g_propagate_error (error, EDC_ERROR_HTTP_STATUS (status));
 }
@@ -1722,7 +1724,7 @@ receive_objects (ECalBackendSync *backend,
 	for (l = comps; l; l= l->next) {
 		const gchar *uid;
 		gchar *icalobj, *rid = NULL;
-		gchar *object = NULL;
+		icalcomponent *old_icalcomp = NULL, *new_icalcomp = NULL;
 
 		subcomp = l->data;
 
@@ -1743,7 +1745,7 @@ receive_objects (ECalBackendSync *backend,
 		case ICAL_METHOD_REPLY:
 			e_cal_backend_exchange_cache_lock (cbex);
 			if ((ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbexc), uid)) != NULL ) {
-				gchar *old_object = NULL;
+				icalcomponent *old_icalcomp = NULL;
 
 				d(printf ("uid : %s : found in the cache\n", uid));
 
@@ -1751,7 +1753,7 @@ receive_objects (ECalBackendSync *backend,
 				if (check_owner_partstatus_for_declined (backend, subcomp)) {
 					ECalComponentId *id = NULL;
 					remove_object (backend, cal, cancellable, uid, NULL,
-								CALOBJ_MOD_ALL, &old_object,
+								CALOBJ_MOD_ALL, &old_icalcomp,
 								NULL, &err);
 					if (err) {
 						g_free (rid);
@@ -1759,11 +1761,11 @@ receive_objects (ECalBackendSync *backend,
 						goto error;
 					}
 					id = e_cal_component_get_id (comp);
-					e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id,
-									     old_object, NULL);
+					e_cal_backend_notify_component_removed (E_CAL_BACKEND (backend), id,
+									     old_icalcomp, NULL);
 					e_cal_component_free_id (id);
 				} else {
-					gchar *new_object = NULL;
+					icalcomponent *new_icalcomp = NULL;
 					CalObjModType mod = CALOBJ_MOD_ALL;
 					GSList *attachment_list;
 
@@ -1780,20 +1782,22 @@ receive_objects (ECalBackendSync *backend,
 					icalobj = e_cal_component_get_as_string (comp);
 					if (!modify_object_with_href (backend, cal, cancellable, icalobj,
 									  mod,
-									  &old_object, &new_object, NULL, NULL, error)) {
+									  &old_icalcomp, &new_icalcomp, NULL, NULL, error)) {
 						g_free (rid);
 						goto error;
 					}
-					e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend),
-									      old_object, new_object);
-					g_free (new_object);
+					e_cal_backend_notify_component_modified (E_CAL_BACKEND (backend), old_icalcomp, new_icalcomp);
+					if (new_icalcomp)
+						icalcomponent_free (new_icalcomp);
 					d(printf ("Notify that the new object after modication is : %s\n", icalobj));
 					g_free (icalobj);
 				}
 
-				g_free (old_object);
+				if (old_icalcomp)
+					icalcomponent_free (old_icalcomp);
 			} else if (!check_owner_partstatus_for_declined (backend, subcomp)) {
-				gchar *returned_uid, *object;
+				gchar *returned_uid;
+				icalcomponent *new_icalcomp = NULL;
 				GSList *attachment_list;
 
 				attachment_list = receive_attachments (cbex, comp);
@@ -1808,17 +1812,19 @@ receive_objects (ECalBackendSync *backend,
 				d(printf ("Create a new object : %s\n", icalobj));
 
 				e_cal_backend_exchange_cache_unlock (cbex);
-				create_object (backend, cal, cancellable, icalobj, &returned_uid, &object, &err);
-				g_free (icalobj);
+				create_object (backend, cal, cancellable, icalobj, &returned_uid, &new_icalcomp, &err);
 				if (err) {
+					g_free (icalobj);
 					g_propagate_error (error, err);
 					g_free (rid);
 					goto error;
 				}
 
-				e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), icalobj);
+				e_cal_backend_notify_component_created (E_CAL_BACKEND (backend), new_icalcomp);
 				d(printf ("Notify that the new object is created : %s\n", icalobj));
-				g_free (object);
+				g_free (icalobj);
+				if (new_icalcomp)
+					icalcomponent_free (new_icalcomp);
 			} else {
 				e_cal_backend_exchange_cache_unlock (cbex);
 			}
@@ -1829,24 +1835,24 @@ receive_objects (ECalBackendSync *backend,
 			break;
 
 		case ICAL_METHOD_CANCEL:
-			icalobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
 			if (rid)
-				remove_object (backend, cal, cancellable, uid, rid, CALOBJ_MOD_THIS, &icalobj, &object, &err);
+				remove_object (backend, cal, cancellable, uid, rid, CALOBJ_MOD_THIS, &old_icalcomp, &new_icalcomp, &err);
 			else
-				remove_object (backend, cal, cancellable, uid, NULL, CALOBJ_MOD_ALL, &icalobj, &object, &err);
+				remove_object (backend, cal, cancellable, uid, NULL, CALOBJ_MOD_ALL, &old_icalcomp, &new_icalcomp, &err);
 			if (!err) {
 				ECalComponentId *id = e_cal_component_get_id (comp);
-				e_cal_backend_notify_object_removed (E_CAL_BACKEND (backend), id, icalobj, NULL);
+				e_cal_backend_notify_component_removed (E_CAL_BACKEND (backend), id, old_icalcomp, NULL);
 				e_cal_component_free_id (id);
 
 			} else {
 				g_propagate_error (error, err);
 			}
-			if (object) {
-				g_free (object);
-				object = NULL;
+			if (old_icalcomp) {
+				icalcomponent_free (old_icalcomp);
+				old_icalcomp = NULL;
 			}
-			g_free (icalobj);
+			if (new_icalcomp)
+				icalcomponent_free (new_icalcomp);
 			break;
 		default:
 			g_propagate_error (error, EDC_ERROR (UnsupportedMethod));
@@ -1899,7 +1905,8 @@ book_resource (ECalBackendExchange *cbex,
 	const gchar *access_prop = NULL, *meeting_prop = NULL, *cal_uid = NULL;
 	gboolean bookable = TRUE;
 	gchar *top_uri = NULL, *cal_uri = NULL, *returned_uid = NULL, *sanitized_uid;
-	gchar *startz, *endz, *href = NULL, *old_object = NULL, *calobj = NULL, *new_object = NULL;
+	gchar *startz, *endz, *href = NULL, *calobj = NULL;
+	icalcomponent *old_icalcomp = NULL, *new_icalcomp = NULL;
 	E2kRestriction *rn;
 	gint nresult;
 	ECalBackendExchangeBookingResult retval = E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR;
@@ -2098,32 +2105,35 @@ book_resource (ECalBackendExchange *cbex,
 	if (ecomp) {
 		gboolean modify_ok = FALSE;
 		/* Use the PUT method to create the meeting item in the resource's calendar. */
-		if (modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, href, NULL, NULL)) {
+		if (modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_icalcomp, &new_icalcomp, href, NULL, NULL)) {
 			/* Need this to update the participation status of the resource
 			 * in the organizer's calendar. */
-			modify_ok = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_object, &new_object, NULL, NULL, NULL);
+			modify_ok = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, book_all ? CALOBJ_MOD_ALL : CALOBJ_MOD_THIS, &old_icalcomp, &new_icalcomp, NULL, NULL, NULL);
 		} else {
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR;
 			goto cleanup;
 		}
 		if (modify_ok) {
-			e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbex), old_object, calobj);
+			e_cal_backend_notify_component_modified (E_CAL_BACKEND (cbex), old_icalcomp, new_icalcomp);
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_OK;
 		}
-		g_free (old_object);
-		g_free (new_object);
+		if (old_icalcomp)
+			icalcomponent_free (old_icalcomp);
+		if (new_icalcomp)
+			icalcomponent_free (new_icalcomp);
 	} else {
 		GError *err = NULL;
 
-		create_object (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, &returned_uid, &new_object, &err);
+		create_object (E_CAL_BACKEND_SYNC (cbex), cal, NULL, calobj, &returned_uid, &new_icalcomp, &err);
 		if (!err) {
-			e_cal_backend_notify_object_created (E_CAL_BACKEND (cbex), calobj);
+			e_cal_backend_notify_component_created (E_CAL_BACKEND (cbex), new_icalcomp);
 			retval = E_CAL_BACKEND_EXCHANGE_BOOKING_OK;
 		} else {
 			g_error_free (err);
 		}
 
-		g_free (new_object);
+		if (new_icalcomp)
+			icalcomponent_free (new_icalcomp);
 	}
 
  cleanup:
diff --git a/calendar/e-cal-backend-exchange-tasks.c b/calendar/e-cal-backend-exchange-tasks.c
index b343412..c76be1f 100644
--- a/calendar/e-cal-backend-exchange-tasks.c
+++ b/calendar/e-cal-backend-exchange-tasks.c
@@ -1082,7 +1082,7 @@ create_task_object (ECalBackendSync *backend,
                     GCancellable *cancellable,
                     const gchar *calobj,
                     gchar **return_uid,
-                    gchar **new_object,
+                    icalcomponent **new_icalcomp,
                     GError **error)
 {
 	ECalBackendExchange *ecalbex;
@@ -1212,8 +1212,8 @@ create_task_object (ECalBackendSync *backend,
 
 	update_props (comp, &props);
 	e_cal_component_commit_sequence (comp);
-	*new_object = e_cal_component_get_as_string (comp);
-	if (!*new_object) {
+	*new_icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp));
+	if (!*new_icalcomp) {
 		g_object_unref (comp);
 		g_free (from_name);
 		g_free (from_addr);
@@ -1221,7 +1221,7 @@ create_task_object (ECalBackendSync *backend,
 		return;
 	}
 
-	real_icalcomp = icalparser_parse_string (*new_object);
+	real_icalcomp = icalcomponent_new_clone (*new_icalcomp);
 
 	e2kctx = exchange_account_get_context (ecalbex->account);
 	status = e_folder_exchange_proppatch_new (ecalbex->folder, NULL,
@@ -1256,13 +1256,13 @@ modify_task_object (ECalBackendSync *backend,
                     GCancellable *cancellable,
                     const gchar *calobj,
                     CalObjModType mod,
-                    gchar **old_object,
-                    gchar **new_object,
+                    icalcomponent **old_icalcomp,
+                    icalcomponent **new_icalcomp,
                     GError **error)
 {
 	ECalBackendExchangeTasks *ecalbextask;
 	ECalBackendExchangeComponent *ecalbexcomp;
-	ECalComponent *cache_comp, *new_comp;
+	ECalComponent *new_comp;
 	ECalBackendExchange *ecalbex;
 	E2kProperties *props;
 	icalcomponent *icalcomp;
@@ -1318,10 +1318,7 @@ modify_task_object (ECalBackendSync *backend,
 		return;
 	}
 
-	cache_comp = e_cal_component_new ();
-	e_cal_component_set_icalcomponent (cache_comp, icalcomponent_new_clone (ecalbexcomp->icomp));
-	*old_object = e_cal_component_get_as_string (cache_comp);
-	g_object_unref (cache_comp);
+	*old_icalcomp = icalcomponent_new_clone (ecalbexcomp->icomp);
 
 	e_cal_backend_exchange_cache_unlock (ecalbex);
 
@@ -1436,34 +1433,40 @@ receive_task_objects (ECalBackendSync *backend,
 
 		e_cal_backend_exchange_cache_lock (cbex);
 		if (get_exchange_comp (E_CAL_BACKEND_EXCHANGE (ecalbextask), uid)) {
-			gchar *old_object;
+			icalcomponent *old_icalcomp = NULL, *new_icalcomp = NULL;
 
 			e_cal_backend_exchange_cache_unlock (cbex);
-			modify_task_object (backend, cal, cancellable, calobj, CALOBJ_MOD_THIS, &old_object, NULL, &err);
+			modify_task_object (backend, cal, cancellable, calobj, CALOBJ_MOD_THIS, &old_icalcomp, &new_icalcomp, &err);
 			if (err) {
 				g_free (rid);
 				g_propagate_error (error, err);
 				return;
 			}
 
-			e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old_object, calobj);
-			g_free (old_object);
+			e_cal_backend_notify_component_modified (E_CAL_BACKEND (backend), old_icalcomp, new_icalcomp);
+			if (old_icalcomp)
+				icalcomponent_free (old_icalcomp);
+			if (new_icalcomp)
+				icalcomponent_free (new_icalcomp);
 		} else {
-			gchar *returned_uid, *new_object = NULL;
+			gchar *returned_uid;
+			icalcomponent *new_icalcomp = NULL;
 
 			e_cal_backend_exchange_cache_unlock (cbex);
-			calobj = (gchar *) icalcomponent_as_ical_string_r (subcomp);
-			create_task_object (backend, cal, cancellable, calobj, &returned_uid, &new_object, &err);
+			calobj = icalcomponent_as_ical_string_r (subcomp);
+			create_task_object (backend, cal, cancellable, calobj, &returned_uid, &new_icalcomp, &err);
 			g_free (calobj);
 			if (err) {
-				g_free (new_object);
+				if (new_icalcomp)
+					icalcomponent_free (new_icalcomp);
 				g_free (rid);
 				g_propagate_error (error, err);
 				return;
 			}
 
-			e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), new_object);
-			g_free (new_object);
+			e_cal_backend_notify_component_created (E_CAL_BACKEND (backend), new_icalcomp);
+			if (new_icalcomp)
+				icalcomponent_free (new_icalcomp);
 		}
 		g_free (rid);
 	}
@@ -1478,13 +1481,12 @@ remove_task_object (ECalBackendSync *backend,
                     const gchar *uid,
                     const gchar *rid,
                     CalObjModType mod,
-                    gchar **old_object,
-                    gchar **object,
+                    icalcomponent **old_icalcomp,
+                    icalcomponent **new_icalcomp,
                     GError **error)
 {
 	ECalBackendExchange *ecalbex = E_CAL_BACKEND_EXCHANGE (backend);
 	ECalBackendExchangeComponent *ecalbexcomp;
-	ECalComponent *comp;
 	E2kContext *ctx;
 	E2kHTTPStatus status;
 
@@ -1505,10 +1507,7 @@ remove_task_object (ECalBackendSync *backend,
 		return;
 	}
 
-	comp = e_cal_component_new ();
-	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (ecalbexcomp->icomp));
-	*old_object = e_cal_component_get_as_string (comp);
-	g_object_unref (comp);
+	*old_icalcomp = icalcomponent_new_clone (icalcomponent_new_clone (ecalbexcomp->icomp));
 
 	e_cal_backend_exchange_cache_unlock (ecalbex);
 
diff --git a/calendar/e-cal-backend-exchange.c b/calendar/e-cal-backend-exchange.c
index 052d16e..f6610f0 100644
--- a/calendar/e-cal-backend-exchange.c
+++ b/calendar/e-cal-backend-exchange.c
@@ -974,7 +974,7 @@ create_object (ECalBackendSync *backend,
                GCancellable *cancellable,
                const gchar *calobj,
                gchar **uid,
-               gchar **new_object,
+               icalcomponent **new_object,
                GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (NotSupported));
@@ -987,8 +987,8 @@ modify_object (ECalBackendSync *backend,
                GCancellable *cancellable,
                const gchar *calobj,
                CalObjModType mod,
-               gchar **old_object,
-               gchar **new_object,
+               icalcomponent **old_object,
+               icalcomponent **new_object,
                GError **perror)
 {
 	g_propagate_error (perror, EDC_ERROR (NotSupported));



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