[evolution-patches] Resent in text format - gw connector update for the GW server fixes in recurrence, group events.



hi,
 resending this in txt format... 
 The patch is an update following the server fixes for recurrence
creation and group events. 
Bugs 57651, 58643 and 58637 that were blocked by the server defects are
resolved by this patch.
The interface changes are in conformance to the schema available in the
cvs.

thanks,
harish

Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.299
diff -u -p -r1.299 ChangeLog
--- calendar/ChangeLog	23 Jul 2004 07:01:32 -0000	1.299
+++ calendar/ChangeLog	23 Jul 2004 10:14:41 -0000
@@ -1,3 +1,31 @@
+2004-07-23  Harish Krishnaswamy  <kharish novell com>
+
+	Fixes #57651, #58637 and #58643
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(e_gw_connection_send_appointment) : Append the container id to
+	the gwrecordid obtained via ITIP to match the representation 
+	in the SOAP interface.
+	(e_gw_item_set_changes): Updates to 'completed' field in the Task
+	is not sticky in the server, when using the modifyRequest. Using a 
+	separate completeRequest call to update the same.
+	* backends/groupwise/e-cal-backend-groupwise-utils.h: removed the
+	unused default_zone parameter from e_gw_connection_send_appointment.
+	* backends/groupwise/e-cal-backend-groupwise.c: 
+	(get_deltas): negated the return values to enable the g_timeout_add
+	calls get_deltas if the previous call is succesful.
+	(sanitize_component): renamed set_container_id function, so it
+	correctly depicts what it does.
+	(e_cal_backend_groupwise_create_object): Make a getItemsRequest to the 
+	server to obtain the items while creating recurring events. The original
+	call returns only the item ids and the client requires the icalids too
+	to keep the cache valid.
+	(e_cal_backend_groupwise_modify_object) : Use the completeRequest method
+	to update task completion. 
+	(receive_object) : The call to e_gw_connection_send_appointment updated
+	to reflect the change in its signature. 
+	(e_cal_backend_groupwise_receive_objects): set the method on the subcomp
+	created before passing it over to receive_object.
+
 2004-07-23  Chenthill Palanisamy <pchenthill novell com>
 	
 	Fixes #60463
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.77
diff -u -p -r1.77 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	23 Jul 2004 07:01:32 -0000	1.77
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	23 Jul 2004 10:14:42 -0000
@@ -122,7 +122,7 @@ get_deltas (gpointer handle)
 
 	if (status != E_GW_CONNECTION_STATUS_OK) {
 		e_cal_backend_groupwise_notify_error_code (cbgw, status);
-		return status;
+		return !status;
 	}
 	
 	if (deletes) {
@@ -156,7 +156,7 @@ get_deltas (gpointer handle)
 		}
 	}
 
-        return E_GW_CONNECTION_STATUS_OK;        
+        return !E_GW_CONNECTION_STATUS_OK;        
 }
 
 
@@ -939,7 +939,7 @@ e_cal_backend_groupwise_internal_get_tim
 }
 
 static void
-set_container_id (ECalBackendSync *backend, ECalComponent *comp, char *server_uid)
+sanitize_component (ECalBackendSync *backend, ECalComponent *comp, char *server_uid)
 {
 	ECalBackendGroupwise *cbgw;
 	icalproperty *icalprop;
@@ -1012,31 +1012,35 @@ e_cal_backend_groupwise_create_object (E
 
 		if (uid_list && (g_slist_length (uid_list) == 1)) {
 			server_uid = (char *) uid_list->data;
-			set_container_id (backend, comp, server_uid);	
+			sanitize_component (backend, comp, server_uid);	
 			g_free (server_uid);
 			/* if successful, update the cache */
 			e_cal_backend_cache_put_component (priv->cache, comp);
 		} else {
-			/* clone components and set individual ids to them */
-			for (i=0, l = uid_list; l ; l = g_slist_next (l), i++) {
+			
+			GList *list = NULL, *tmp;
+			GPtrArray *uid_array = g_ptr_array_new ();
+			for (l = uid_list; l; l = g_slist_next (l)) {
+				g_ptr_array_add (uid_array, l->data);
+			}
+			
+			/* convert uid_list to GPtrArray and get the items in a list */
+			e_gw_connection_get_items_from_ids (priv->cnc, priv->container_id, "recipients message",
+					uid_array, &list);
+			/* convert items into components and add them to the cache */
+			for (i=0, tmp = list; tmp ; tmp = g_list_next (tmp), i++) {
 				ECalComponent *e_cal_comp;
-				char *new_uid, *uid;
+				EGwItem *item;
 
-				server_uid = (char *) l->data;
-				e_cal_comp = e_cal_component_clone (comp);
-				/* set a new uid*/
-				e_cal_component_get_uid (comp, (const char **) &uid);
-				new_uid = g_strdup_printf ("%s%d", uid, i);
-				e_cal_component_set_uid (comp, new_uid); 
-				g_free (new_uid);
-				set_container_id (backend, e_cal_comp, server_uid);
-				g_free (server_uid);
+				item = (EGwItem *) tmp->data;
+				e_cal_comp = e_gw_item_to_cal_component (item, priv->default_zone); 
+				e_cal_component_commit_sequence (e_cal_comp);
+				sanitize_component (backend, e_cal_comp, g_ptr_array_index (uid_array, i));
 				e_cal_backend_cache_put_component (priv->cache, e_cal_comp);
 				g_object_unref (e_cal_comp);
 			}
-			/* FIXME  comp is not set to anything meaningful here.*/
+			g_ptr_array_free (uid_array, TRUE);
 		}
-
 		break;
 	default :
 		break;
@@ -1088,6 +1092,22 @@ e_cal_backend_groupwise_modify_object (E
 		}
 
 		cache_item =  e_gw_item_new_from_cal_component (priv->container_id, priv->default_zone, cache_comp);
+		if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
+			gboolean completed, cache_completed;
+			
+			completed = e_gw_item_get_completed (item);
+			cache_completed = e_gw_item_get_completed (cache_item);
+			if (completed && !cache_completed) {
+				/*FIXME  return values. */
+				status = e_gw_connection_complete_request (priv->cnc, e_gw_item_get_id (item));
+				if (status != E_GW_CONNECTION_STATUS_OK) {
+					g_object_unref (comp);
+					g_object_unref (cache_comp);
+					return GNOME_Evolution_Calendar_OtherError;
+				}
+				break;
+			}
+		}
 		e_gw_item_set_changes (item, cache_item); 
 
 		/* the second argument is redundant */
@@ -1207,7 +1227,7 @@ receive_object (ECalBackendGroupwise *cb
 	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, priv->default_zone, comp, method);
+	return e_gw_connection_send_appointment (priv->cnc, priv->container_id, comp, method);
 }
 
 /* Update_objects handler for the file backend. */
@@ -1232,6 +1252,7 @@ e_cal_backend_groupwise_receive_objects 
 		subcomp = icalcomponent_get_first_component (icalcomp,
 							     e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
 		while (subcomp) {
+			icalcomponent_set_method (subcomp, icalcomponent_get_method (icalcomp));
 			status = receive_object (cbgw, cal, subcomp);
 			if (status != GNOME_Evolution_Calendar_Success)
 				break;
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.25
diff -u -p -r1.25 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	23 Jul 2004 07:01:32 -0000	1.25
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	23 Jul 2004 10:14:42 -0000
@@ -578,18 +578,23 @@ e_gw_item_to_cal_component (EGwItem *ite
 }
 
 EGwConnectionStatus
-e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, icaltimezone *default_zone, ECalComponent *comp, icalproperty_method method)
+e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method)
 {
 	EGwConnectionStatus status;
 	icalparameter_partstat partstat;
+	char *item_id;
 	
 
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
 	g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
-
+	e_cal_component_commit_sequence (comp);
+	/* 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 (method) {
-	case ICAL_METHOD_REPLY:
+	case ICAL_METHOD_REQUEST:
 		/* get attendee here and add the list along. */
 		if (e_cal_component_has_attendees (comp))
 		{
@@ -628,18 +633,18 @@ e_gw_connection_send_appointment (EGwCon
 		case ICAL_PARTSTAT_ACCEPTED: 
 			e_cal_component_get_transparency (comp, &transp);
 			if (transp == E_CAL_COMPONENT_TRANSP_OPAQUE) 
-				status = e_gw_connection_accept_request (cnc, e_cal_component_get_gw_id (comp), "Busy");
+				status = e_gw_connection_accept_request (cnc, item_id, "Busy");
 			else 
-				status = e_gw_connection_accept_request (cnc, e_cal_component_get_gw_id (comp), "Free");
+				status = e_gw_connection_accept_request (cnc, item_id, "Free");
 			break;
 		case ICAL_PARTSTAT_DECLINED:
-			status = e_gw_connection_decline_request (cnc, e_cal_component_get_gw_id (comp));
+			status = e_gw_connection_decline_request (cnc, item_id);
 			break;
 		case ICAL_PARTSTAT_TENTATIVE:
-			status = e_gw_connection_accept_request (cnc, e_cal_component_get_gw_id (comp), "Tentative");
+			status = e_gw_connection_accept_request (cnc, item_id, "Tentative");
 			break;
 		case ICAL_PARTSTAT_COMPLETED:
-			status = e_gw_connection_complete_request (cnc, e_cal_component_get_gw_id (comp));
+			status = e_gw_connection_complete_request (cnc, item_id);
 
 		default :
 			status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
@@ -649,7 +654,7 @@ e_gw_connection_send_appointment (EGwCon
 		break;
 
 	case ICAL_METHOD_CANCEL:
-		status = e_gw_connection_retract_request (cnc, e_cal_component_get_gw_id (comp), NULL, FALSE, FALSE);
+		status = e_gw_connection_retract_request (cnc, item_id, NULL, FALSE, FALSE);
 		break;
 	default:
 		status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
@@ -988,14 +993,7 @@ e_gw_item_set_changes (EGwItem *item, EG
 			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_ADD, "alarm", &trigger);
 	}
 	else if ( e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_TASK) {
-		gboolean completed, cache_completed;
-		
 		SET_DELTA(due_date);
-		
-		completed = e_gw_item_get_completed (item);
-		cache_completed = e_gw_item_get_completed (cache_item);
-		if ((completed && !cache_completed) || (!completed && cache_completed))
-			e_gw_item_set_change (item, E_GW_ITEM_CHANGE_TYPE_UPDATE, "completed", &completed);
 		SET_DELTA (priority);
 	}
 }
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.8
diff -u -p -r1.8 e-cal-backend-groupwise-utils.h
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	23 Jul 2004 07:01:32 -0000	1.8
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	23 Jul 2004 10:14:42 -0000
@@ -40,8 +40,8 @@ void          e_gw_item_set_changes (EGw
  * Connection-related utility functions
  */
 EGwConnectionStatus e_gw_connection_create_appointment (EGwConnection *cnc, const char *container, icaltimezone *default_zone, ECalComponent *comp, GSList **id_list);
-EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, icaltimezone *default_zone, ECalComponent *comp, icalproperty_method method);
-EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users,						       time_t start, time_t end, GList **freebusy, icaltimezone *default_zone);
+EGwConnectionStatus e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method);
+EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t start, time_t end, GList **freebusy, icaltimezone *default_zone);
 
 /*
  * Component related utility functions
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.56
diff -u -p -r1.56 ChangeLog
--- servers/groupwise/ChangeLog	13 Jul 2004 12:58:27 -0000	1.56
+++ servers/groupwise/ChangeLog	23 Jul 2004 10:14:42 -0000
@@ -1,3 +1,10 @@
+2004-07-23  Harish Krishnaswamy  <kharish novell com>
+
+	* e-gw-item.c: (e_gw_item_set_calendar_item_elements):
+	Do not set the icalid on the request while saving recurring calender 
+	events. The icalids for the created objects are obtained subsequently
+	from the server through a getItemsRequest call. 
+
 2004-07-12  Harish Krishnaswamy  <kharish novell com>
 
 	* e-gw-connection.c: 
Index: servers/groupwise/e-gw-item.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.c,v
retrieving revision 1.40
diff -u -p -r1.40 e-gw-item.c
--- servers/groupwise/e-gw-item.c	13 Jul 2004 12:58:27 -0000	1.40
+++ servers/groupwise/e-gw-item.c	23 Jul 2004 10:14:42 -0000
@@ -1869,8 +1869,11 @@ e_gw_item_set_calendar_item_elements (EG
 		}
 		soup_soap_message_end_element (msg);
 	}
-
-	e_gw_message_write_string_parameter (msg, "iCalId", NULL, priv->icalid ? priv->icalid : "");
+	else {
+		/*the icalid is fed to the server only if we are not saving
+		 * recurring items */
+		e_gw_message_write_string_parameter (msg, "iCalId", NULL, priv->icalid ? priv->icalid : "");
+	}
 }
 
 gboolean





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