[evolution-patches] Fix for #58643 ( Calendar - GW backend) - deriving the gw item id from the itip message



hi,

 The patch adds code for correctly deriving the gw item id from the itip
message by inserting the type markers for event and todo items.
(macros GW_EVENT_TYPE_ID and GW_TODO_TYPE_ID). This enables us to
assemble the id and handle accept/decline requests even if we have not 
received an update from the soap interface.

harish
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.306
diff -u -p -r1.306 ChangeLog
--- calendar/ChangeLog	4 Aug 2004 05:38:29 -0000	1.306
+++ calendar/ChangeLog	9 Aug 2004 16:00:53 -0000
@@ -1,3 +1,20 @@
+2004-08-09  Harish Krishnaswamy  <kharish novell com>
+
+	Fixes #58643 - the gw backend assembles the xgwrecordid
+	to be used for accept/decline requests using the type markers.
+
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(e_gw_connection_send_appointment): use the event and todo type
+	markers while assembling the gwrecordid from the itip message.
+	set flag 'remove' for decline/retract requests to indicate 
+	these should be removed from cache.
+	* backends/groupwise/e-cal-backend-groupwise-utils.h:
+	Add parameter to e_gw_connection_send_appointment and define macros
+	GW_EVENT_TYPE_ID and GW_TODO_TYPE_ID.
+	* backends/groupwise/e-cal-backend-groupwise.c: (receive_object):
+	update the cache based on the remove flag set by 
+	e_gw_connection_send_appointment.
+
 2004-08-04  Chenthill Palanisamy <pchenthill novell com>
 
        Fixes #60265
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.28
diff -u -p -r1.28 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	3 Aug 2004 06:25:57 -0000	1.28
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	9 Aug 2004 16:00:53 -0000
@@ -655,7 +655,7 @@ e_gw_item_to_cal_component (EGwItem *ite
 }
 
 EGwConnectionStatus
-e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method)
+e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove)
 {
 	EGwConnectionStatus status;
 	icalparameter_partstat partstat;
@@ -669,7 +669,17 @@ e_gw_connection_send_appointment (EGwCon
 	/* When the icalcomponent is obtained through the itip message rather
 	 * than from the SOAP protocol, the container id has to be explicitly 
 	 * added to the xgwrecordid inorder to obtain the item id. */
-	item_id = g_strconcat (e_cal_component_get_gw_id (comp), ":", container, NULL);
+	
+	switch  (e_cal_component_get_vtype (comp)) {
+	case E_CAL_COMPONENT_EVENT: 
+		item_id = g_strconcat (e_cal_component_get_gw_id (comp), GW_EVENT_TYPE_ID, container, NULL);
+		break;
+	case E_CAL_COMPONENT_TODO:
+		item_id = g_strconcat (e_cal_component_get_gw_id (comp), GW_TODO_TYPE_ID, container, NULL);
+		break;
+	default:
+		return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
+	}
 	switch (method) {
 	case ICAL_METHOD_REQUEST:
 		/* get attendee here and add the list along. */
@@ -701,8 +711,6 @@ e_gw_connection_send_appointment (EGwCon
 			status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
 			break;
 		}
-		
-		
 		switch (partstat) {
 		ECalComponentTransparency transp;
 			
@@ -715,6 +723,7 @@ e_gw_connection_send_appointment (EGwCon
 			break;
 		case ICAL_PARTSTAT_DECLINED:
 			status = e_gw_connection_decline_request (cnc, item_id);
+			*remove = TRUE;
 			break;
 		case ICAL_PARTSTAT_TENTATIVE:
 			status = e_gw_connection_accept_request (cnc, item_id, "Tentative");
@@ -731,6 +740,7 @@ e_gw_connection_send_appointment (EGwCon
 
 	case ICAL_METHOD_CANCEL:
 		status = e_gw_connection_retract_request (cnc, item_id, NULL, FALSE, FALSE);
+		*remove = TRUE;
 		break;
 	default:
 		status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-backend-groupwise-utils.h
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	2 Aug 2004 10:13:20 -0000	1.10
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	9 Aug 2004 16:00:53 -0000
@@ -30,6 +30,9 @@
 
 G_BEGIN_DECLS
 
+#define GW_EVENT_TYPE_ID "@4:"
+#define GW_TODO_TYPE_ID "@3:"
+
 /*
  * Items management
  */
@@ -41,7 +44,7 @@ void          e_gw_item_set_changes (EGw
  * Connection-related utility functions
  */
 EGwConnectionStatus e_gw_connection_create_appointment (EGwConnection *cnc, const char *container, ECalBackendGroupwise *cbgw, ECalComponent *comp, GSList **id_list);
-EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method);
+EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove);
 EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t start, time_t end, GList **freebusy, icaltimezone *default_zone);
 
 /*
Index: calendar/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.81
diff -u -p -r1.81 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	4 Aug 2004 05:38:29 -0000	1.81
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	9 Aug 2004 16:00:54 -0000
@@ -1257,15 +1257,31 @@ receive_object (ECalBackendGroupwise *cb
 	ECalComponent *comp;
 	ECalBackendGroupwisePrivate *priv;
 	icalproperty_method method;
+	EGwConnectionStatus status;
+	gboolean remove = FALSE;
 
 	priv = cbgw->priv;
 
-	/* search the object in the cache */
 	comp = e_cal_component_new ();
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
 	method = icalcomponent_get_method (icalcomp);
 	
-	return e_gw_connection_send_appointment (priv->cnc, priv->container_id, comp, method);
+	status = e_gw_connection_send_appointment (priv->cnc, priv->container_id, comp, method, &remove);
+
+	/* update the cache */
+	if (status == E_GW_CONNECTION_STATUS_OK) {
+		if (remove) {
+			const char *uid;
+			
+			e_cal_component_get_uid (comp, (const char **) &uid);
+			e_cal_backend_cache_remove_component (priv->cache, uid, NULL);
+		}
+		else
+			e_cal_backend_cache_put_component (priv->cache, comp);	
+	}
+
+	/*FIXME  return the correct backend status */
+	return status;
 }
 
 /* Update_objects handler for the file backend. */


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