[evolution-patches] patch for #54280



The attached patch adds the missing implementation of send_objects for
the GW backend. It still misses the code for sending back the modified
icalcomponent and list of users to the client, but I haven't found out a
good way yet of doing that, apart from fetching the events from the
server again, and comparing them to the ones passed from the client.
That could be a bit too much overhead, I guess.

cheers
? config.guess
? config.sub
? depcomp
? install-sh
? ltmain.sh
? missing
? mkinstalldirs
? ylwrap
? libical/src/libicalss/icalssyacc.output
? libical/src/python/Makefile
? libical/src/python/Makefile.in
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.197
diff -u -p -r1.197 ChangeLog
--- ChangeLog	2 Mar 2004 22:48:54 -0000	1.197
+++ ChangeLog	4 Mar 2004 10:00:46 -0000
@@ -1,3 +1,10 @@
+2004-03-03  Rodrigo Moya <rodrigo ximian com>
+
+	Fixes #54280
+
+	* backends/groupwise/e-cal-backend-groupwise.c
+	(e_cal_backend_groupwise_send_objects): added missing implementation.
+
 2004-03-01  Rodrigo Moya <rodrigo ximian com>
 
 	Fixes #33243
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.48
diff -u -p -r1.48 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	1 Mar 2004 15:45:55 -0000	1.48
+++ backends/groupwise/e-cal-backend-groupwise.c	4 Mar 2004 10:00:46 -0000
@@ -1038,13 +1038,73 @@ e_cal_backend_groupwise_receive_objects 
 }
 
 static ECalBackendSyncStatus
+send_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp)
+{
+	ECalComponent *comp;
+	ECalBackendGroupwisePrivate *priv;
+	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
+
+	priv = cbgw->priv;
+
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+
+	switch (priv->mode) {
+	case CAL_MODE_ANY :
+	case CAL_MODE_REMOTE :
+		/* when online, send the item to the server */
+		status = e_gw_connection_send_appointment (priv->cnc, priv->container_id, comp);
+		break;
+	case CAL_MODE_LOCAL :
+		/* in offline mode, we just update the cache */
+		e_cal_backend_cache_put_component (priv->cache, comp);
+		break;
+	}
+
+	g_object_unref (comp);
+
+	return status;
+}
+
+static ECalBackendSyncStatus
 e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users,
 				      char **modified_calobj)
 {
-	/* FIXME */
+	ECalBackendSyncStatus status = GNOME_Evolution_Calendar_OtherError;
+	icalcomponent *icalcomp, *subcomp;
+	icalcomponent_kind kind;
+	ECalBackendGroupwise *cbgw;
+	ECalBackendGroupwisePrivate *priv;
+
 	*users = NULL;
 	*modified_calobj = NULL;
-	return GNOME_Evolution_Calendar_OtherError;
+
+	cbgw = E_CAL_BACKEND_GROUPWISE (backend);
+	priv = cbgw->priv;
+
+	icalcomp = icalparser_parse_string (calobj);
+	if (!icalcomp)
+		return GNOME_Evolution_Calendar_InvalidObject;
+
+	kind = icalcomponent_isa (icalcomp);
+	if (kind == ICAL_VCALENDAR_COMPONENT) {
+		subcomp = icalcomponent_get_first_component (icalcomp,
+							     e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
+		while (subcomp) {
+			status = send_object (cbgw, cal, subcomp);
+			if (status != GNOME_Evolution_Calendar_Success)
+				break;
+			subcomp = icalcomponent_get_next_component (icalcomp,
+								    e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
+		}
+	} else if (kind == e_cal_backend_get_kind (E_CAL_BACKEND (backend))) {
+		status = send_object (cbgw, cal, icalcomp);
+	} else
+		status = GNOME_Evolution_Calendar_InvalidObject;
+
+	icalcomponent_free (icalcomp);
+
+	return status;
 }
 
 


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