[evolution-patches] patch for sendObjects in e-d-s' calendar API



Hi

The attached patch adds a list of users to the sendObjects stuff for the
calendar, so that backends can notify clients about the users for which
they already took care (in IMIP/ITIP), as talked with JP on IRC.

cheers
? config.guess
? config.sub
? depcomp
? install-sh
? ltmain.sh
? missing
? mkinstalldirs
? ylwrap
? libical/src/libicalss/icalssyacc.output
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.190
diff -u -p -r1.190 ChangeLog
--- ChangeLog	10 Feb 2004 14:53:09 -0000	1.190
+++ ChangeLog	12 Feb 2004 12:11:20 -0000
@@ -1,3 +1,37 @@
+2004-02-12  Rodrigo Moya <rodrigo ximian com>
+
+	* idl/Evolution-DataServer-Calendar.idl: added UserList argument to the
+	notifyObjectsSent method for backends to return the list of users for which
+	it operated.
+
+	* libedata-cal/e-data-cal.[ch] (e_data_cal_notify_objects_sent): added
+	user_list argument and call the listener's notifyObjectsSent method with
+	a GNOME_Evolution_Calendar_UserList.
+
+	* libedata-cal/e-cal-backend-sync.[ch] (e_cal_backend_sync_send_objects,
+	_e_cal_backend_send_objects):
+
+	* backends/file/e-cal-backend-file.c (e_cal_backend_file_send_objects):
+	* backends/http/e-cal-backend-http.c (e_cal_backend_http_send_objects):
+	* backends/contacts/e-cal-backend-contacts.c
+	(e_cal_backend_contacts_send_objects):
+	* backends/groupwise/e-cal-backend-groupwise.c
+	(e_cal_backend_groupwise_send_objects): adapted to changes in
+	ECalBackend/ECalBackendSync API.
+
+	* backends/file/e-cal-backend-file.c (e_cal_backend_file_receive_objects,
+	e_cal_backend_file_send_objects): removed wrong return statement.
+
+	* libecal/e-cal.[ch] (e_cal_send_objects): get the user list from the
+	operation's result.
+	(cal_objects_sent_cb): added the GList of users as argument and copy it
+	to the operation's result.
+
+	* libecal/e-cal-listener.[ch]: added user list argument to "send_objects"
+	signal.
+	(impl_notifyObjectsSent): added UserList argument to CORBA method, and
+	convert the CORBA user list to a GList to be passed to the signal handlers.
+
 2004-02-10  Rodrigo Moya <rodrigo ximian com>
 
 	* backends/file/e-cal-backend-file.c (e_cal_backend_file_receive_objects):
Index: backends/contacts/e-cal-backend-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/contacts/e-cal-backend-contacts.c,v
retrieving revision 1.3
diff -u -p -r1.3 e-cal-backend-contacts.c
--- backends/contacts/e-cal-backend-contacts.c	1 Feb 2004 04:32:01 -0000	1.3
+++ backends/contacts/e-cal-backend-contacts.c	12 Feb 2004 12:11:20 -0000
@@ -584,8 +584,9 @@ e_cal_backend_contacts_receive_objects (
 
 static ECalBackendSyncStatus
 e_cal_backend_contacts_send_objects (ECalBackendSync *backend, EDataCal *cal,
-				     const char *calobj)
+				     const char *calobj, GList **users)
 {
+	*users = NULL;
 	/* TODO: Investigate this */
 	return GNOME_Evolution_Calendar_Success;
 }
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.23
diff -u -p -r1.23 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	10 Feb 2004 14:53:10 -0000	1.23
+++ backends/file/e-cal-backend-file.c	12 Feb 2004 12:11:21 -0000
@@ -2157,10 +2157,9 @@ e_cal_backend_file_receive_objects (ECal
 }
 
 static ECalBackendSyncStatus
-e_cal_backend_file_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
+e_cal_backend_file_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users)
 {
-	/* FIXME Put in a util routine to send stuff via email */
-	
+	*users = NULL;
 	return GNOME_Evolution_Calendar_Success;
 }
 
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.47
diff -u -p -r1.47 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	6 Feb 2004 16:31:09 -0000	1.47
+++ backends/groupwise/e-cal-backend-groupwise.c	12 Feb 2004 12:11:22 -0000
@@ -1038,8 +1038,10 @@ e_cal_backend_groupwise_receive_objects 
 }
 
 static ECalBackendSyncStatus
-e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
+e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users)
 {
+	/* FIXME */
+	*users = NULL;
 	return GNOME_Evolution_Calendar_OtherError;
 }
 
Index: backends/http/e-cal-backend-http.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/http/e-cal-backend-http.c,v
retrieving revision 1.13
diff -u -p -r1.13 e-cal-backend-http.c
--- backends/http/e-cal-backend-http.c	3 Feb 2004 22:39:12 -0000	1.13
+++ backends/http/e-cal-backend-http.c	12 Feb 2004 12:11:22 -0000
@@ -745,7 +745,7 @@ e_cal_backend_http_receive_objects (ECal
 }
 
 static ECalBackendSyncStatus
-e_cal_backend_http_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
+e_cal_backend_http_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users)
 {
 	ECalBackendHttp *cbhttp;
 	ECalBackendHttpPrivate *priv;
@@ -753,6 +753,8 @@ e_cal_backend_http_send_objects (ECalBac
 	cbhttp = E_CAL_BACKEND_HTTP (backend);
 	priv = cbhttp->priv;
 
+	*users = NULL;
+
 	return GNOME_Evolution_Calendar_PermissionDenied;
 }
 
Index: idl/Evolution-DataServer-Calendar.idl
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/idl/Evolution-DataServer-Calendar.idl,v
retrieving revision 1.4
diff -u -p -r1.4 Evolution-DataServer-Calendar.idl
--- idl/Evolution-DataServer-Calendar.idl	27 Jan 2004 18:51:14 -0000	1.4
+++ idl/Evolution-DataServer-Calendar.idl	12 Feb 2004 12:11:22 -0000
@@ -235,7 +235,7 @@ module Calendar {
 		oneway void notifyAlarmDiscarded (in CallStatus status);
 	
 		oneway void notifyObjectsReceived (in CallStatus status);
-		oneway void notifyObjectsSent (in CallStatus status);
+		oneway void notifyObjectsSent (in CallStatus status, in UserList users);
 		
 		oneway void notifyDefaultObjectRequested (in CallStatus status, in CalObj object);
 		oneway void notifyObjectRequested (in CallStatus status, in CalObj object);
Index: libecal/e-cal-listener.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-listener.c,v
retrieving revision 1.7
diff -u -p -r1.7 e-cal-listener.c
--- libecal/e-cal-listener.c	1 Feb 2004 20:51:23 -0000	1.7
+++ libecal/e-cal-listener.c	12 Feb 2004 12:11:23 -0000
@@ -309,18 +309,27 @@ impl_notifyObjectsReceived (PortableServ
 static void
 impl_notifyObjectsSent (PortableServer_Servant servant,
 			GNOME_Evolution_Calendar_CallStatus status,
+			GNOME_Evolution_Calendar_UserList *user_list,
 			CORBA_Environment *ev)
 {
 	ECalListener *listener;
 	ECalListenerPrivate *priv;
-	
+	int i;
+	GList *users = NULL;
+
 	listener = E_CAL_LISTENER (bonobo_object_from_servant (servant));
 	priv = listener->priv;
 
 	if (!priv->notify)
 		return;
 
-	g_signal_emit (G_OBJECT (listener), signals[SEND_OBJECTS], 0, convert_status (status));
+	for (i = 0; i < user_list->_length; i++)
+		users = g_list_append (users, g_strdup (user_list->_buffer[i]));
+
+	g_signal_emit (G_OBJECT (listener), signals[SEND_OBJECTS], 0, convert_status (status), users);
+
+	g_list_foreach (users, (GFunc) g_free, NULL);
+	g_list_free (users);
 }
 
 static void 
Index: libecal/e-cal-listener.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-listener.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-cal-listener.h
--- libecal/e-cal-listener.h	1 Feb 2004 20:51:23 -0000	1.4
+++ libecal/e-cal-listener.h	12 Feb 2004 12:11:23 -0000
@@ -67,7 +67,7 @@ typedef struct {
 	void (*discard_alarm) (ECalListener *listener, ECalendarStatus status);
 
  	void (*receive_objects) (ECalListener *listener, ECalendarStatus status);
- 	void (*send_objects) (ECalListener *listener, ECalendarStatus status);
+ 	void (*send_objects) (ECalListener *listener, ECalendarStatus status, GList *users);
 
 	void (*default_object) (ECalListener *listener, ECalendarStatus status, const char *object);
 	void (*object) (ECalListener *listener, ECalendarStatus status, const char *object);
Index: libecal/e-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
retrieving revision 1.44
diff -u -p -r1.44 e-cal.c
--- libecal/e-cal.c	6 Feb 2004 17:19:45 -0000	1.44
+++ libecal/e-cal.c	12 Feb 2004 12:11:24 -0000
@@ -606,7 +606,7 @@ cal_objects_received_cb (ECalListener *l
 }
 
 static void
-cal_objects_sent_cb (ECalListener *listener, ECalendarStatus status, gpointer data)
+cal_objects_sent_cb (ECalListener *listener, ECalendarStatus status, GList *users, gpointer data)
 {
 	ECal *ecal = data;
 	ECalendarOp *op;
@@ -621,6 +621,7 @@ cal_objects_sent_cb (ECalListener *liste
 	g_mutex_lock (op->mutex);
 
 	op->status = status;
+	op->list = g_list_copy (users);
 
 	g_cond_signal (op->cond);
 
@@ -3468,7 +3469,7 @@ e_cal_receive_objects (ECal *ecal, icalc
 }
 
 gboolean
-e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GError **error)
+e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, GError **error)
 {
 	ECalPrivate *priv;
 	CORBA_Environment ev;
@@ -3520,6 +3521,7 @@ e_cal_send_objects (ECal *ecal, icalcomp
 	g_cond_wait (our_op->cond, our_op->mutex);
 
 	status = our_op->status;
+	*users = our_op->list;
 	
 	e_calendar_remove_op (ecal, our_op);
 	g_mutex_unlock (our_op->mutex);
Index: libecal/e-cal.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.h,v
retrieving revision 1.16
diff -u -p -r1.16 e-cal.h
--- libecal/e-cal.h	4 Feb 2004 21:31:37 -0000	1.16
+++ libecal/e-cal.h	12 Feb 2004 12:11:24 -0000
@@ -168,7 +168,7 @@ gboolean e_cal_remove_object_with_mod (E
 gboolean e_cal_discard_alarm (ECal *ecal, ECalComponent *comp, const char *auid, GError **error);
 
 gboolean e_cal_receive_objects (ECal *ecal, icalcomponent *icalcomp, GError **error);
-gboolean e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GError **error);
+gboolean e_cal_send_objects (ECal *ecal, icalcomponent *icalcomp, GList **users, GError **error);
 
 gboolean e_cal_get_timezone (ECal *ecal, const char *tzid, icaltimezone **zone, GError **error);
 gboolean e_cal_add_timezone (ECal *ecal, icaltimezone *izone, GError **error);
Index: libedata-cal/e-cal-backend-sync.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-cal-backend-sync.c
--- libedata-cal/e-cal-backend-sync.c	10 Jan 2004 22:45:38 -0000	1.6
+++ libedata-cal/e-cal-backend-sync.c	12 Feb 2004 12:11:24 -0000
@@ -158,13 +158,13 @@ e_cal_backend_sync_receive_objects (ECal
 }
 
 ECalBackendSyncStatus
-e_cal_backend_sync_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
+e_cal_backend_sync_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users)
 {
 	g_return_val_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), GNOME_Evolution_Calendar_OtherError);
 
 	g_assert (E_CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync);
 	
-	return (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync) (backend, cal, calobj);
+	return (* E_CAL_BACKEND_SYNC_GET_CLASS (backend)->send_objects_sync) (backend, cal, calobj, users);
 }
 
 ECalBackendSyncStatus
@@ -401,10 +401,13 @@ static void
 _e_cal_backend_send_objects (ECalBackend *backend, EDataCal *cal, const char *calobj)
 {
 	ECalBackendSyncStatus status;
+	GList *users;
 
-	status = e_cal_backend_sync_send_objects (E_CAL_BACKEND_SYNC (backend), cal, calobj);
+	status = e_cal_backend_sync_send_objects (E_CAL_BACKEND_SYNC (backend), cal, calobj, &users);
+	e_data_cal_notify_objects_sent (cal, status, users);
 
-	e_data_cal_notify_objects_sent (cal, status);
+	g_list_foreach (users, (GFunc) g_free, NULL);
+	g_list_free (users);
 }
 
 static void
Index: libedata-cal/e-cal-backend-sync.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-cal-backend-sync.h
--- libedata-cal/e-cal-backend-sync.h	19 Dec 2003 16:29:33 -0000	1.4
+++ libedata-cal/e-cal-backend-sync.h	12 Feb 2004 12:11:24 -0000
@@ -49,7 +49,7 @@ struct _ECalBackendSyncClass {
 	ECalBackendSyncStatus (*discard_alarm_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *auid);
 
 	ECalBackendSyncStatus (*receive_objects_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *calobj);
-	ECalBackendSyncStatus (*send_objects_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *calobj);
+	ECalBackendSyncStatus (*send_objects_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *calobj, GList **users);
 
 	ECalBackendSyncStatus (*get_default_object_sync)  (ECalBackendSync *backend, EDataCal *cal, char **object);
 	ECalBackendSyncStatus (*get_object_sync)  (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *rid, char **object);
@@ -116,8 +116,9 @@ ECalBackendSyncStatus e_cal_backend_sync
 							       EDataCal             *cal,
 							       const char      *calobj);
 ECalBackendSyncStatus e_cal_backend_sync_send_objects            (ECalBackendSync  *backend,
-							       EDataCal             *cal,
-							       const char      *calobj);
+								  EDataCal             *cal,
+								  const char      *calobj,
+								  GList **users);
 ECalBackendSyncStatus e_cal_backend_sync_get_default_object         (ECalBackendSync  *backend,
 								 EDataCal             *cal,
 								 char           **object);
Index: libedata-cal/e-cal-backend.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.c,v
retrieving revision 1.4
diff -u -p -r1.4 e-cal-backend.c
--- libedata-cal/e-cal-backend.c	19 Dec 2003 16:29:33 -0000	1.4
+++ libedata-cal/e-cal-backend.c	12 Feb 2004 12:11:25 -0000
@@ -852,7 +852,7 @@ e_cal_backend_receive_objects (ECalBacke
 	g_return_if_fail (calobj != NULL);
 
 	g_assert (CLASS (backend)->receive_objects != NULL);
-	return (* CLASS (backend)->receive_objects) (backend, cal, calobj);
+	(* CLASS (backend)->receive_objects) (backend, cal, calobj);
 }
 
 void
@@ -863,7 +863,7 @@ e_cal_backend_send_objects (ECalBackend 
 	g_return_if_fail (calobj != NULL);
 
 	g_assert (CLASS (backend)->send_objects != NULL);
-	return (* CLASS (backend)->send_objects) (backend, cal, calobj);
+	(* CLASS (backend)->send_objects) (backend, cal, calobj);
 }
 
 /**
Index: libedata-cal/e-data-cal.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.c,v
retrieving revision 1.5
diff -u -p -r1.5 e-data-cal.c
--- libedata-cal/e-data-cal.c	19 Dec 2003 16:29:33 -0000	1.5
+++ libedata-cal/e-data-cal.c	12 Feb 2004 12:11:26 -0000
@@ -888,10 +888,11 @@ e_data_cal_notify_alarm_discarded (EData
 }
 
 void
-e_data_cal_notify_objects_sent (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status)
+e_data_cal_notify_objects_sent (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *users)
 {
 	EDataCalPrivate *priv;
 	CORBA_Environment ev;
+	GNOME_Evolution_Calendar_UserList *corba_users;
 
 	g_return_if_fail (cal != NULL);
 	g_return_if_fail (E_IS_DATA_CAL (cal));
@@ -899,13 +900,25 @@ e_data_cal_notify_objects_sent (EDataCal
 	priv = cal->priv;
 	g_return_if_fail (priv->listener != CORBA_OBJECT_NIL);
 
+	corba_users = GNOME_Evolution_Calendar_UserList__alloc ();
+	corba_users->_length = g_list_length (users);
+	if (users) {
+		GList *l;
+		int n;
+
+		corba_users->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_User_allocbuf (corba_users->_length);
+		for (l = users, n = 0; l != NULL; l = l->next, n++)
+			corba_users->_buffer[n] = CORBA_string_dup (l->data);
+	}
+
 	CORBA_exception_init (&ev);
-	GNOME_Evolution_Calendar_CalListener_notifyObjectsSent (priv->listener, status, &ev);
+	GNOME_Evolution_Calendar_CalListener_notifyObjectsSent (priv->listener, status, corba_users, &ev);
 
 	if (BONOBO_EX (&ev))
 		g_message (G_STRLOC ": could not notify the listener of objects sent");
 
-	CORBA_exception_free (&ev);	
+	CORBA_exception_free (&ev);
+	CORBA_free (corba_users);
 }
 
 void
Index: libedata-cal/e-data-cal.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-data-cal.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-data-cal.h
--- libedata-cal/e-data-cal.h	17 Nov 2003 15:37:34 -0000	1.4
+++ libedata-cal/e-data-cal.h	12 Feb 2004 12:11:26 -0000
@@ -87,7 +87,7 @@ void e_data_cal_notify_object_removed  (
 void e_data_cal_notify_alarm_discarded (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
 
 void e_data_cal_notify_objects_received (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
-void e_data_cal_notify_objects_sent     (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status);
+void e_data_cal_notify_objects_sent     (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status, GList *users);
 
 void e_data_cal_notify_default_object (EDataCal *cal, GNOME_Evolution_Calendar_CallStatus status,
 				       const char *object);


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