[evolution-patches] Fix for the bug #61865 and 'delta' related issues[GW Calendar]



hi,

 The adjoining patch addresses the bug #61865 and all other bugs related
to the issue of not getting changes from the server. It uses the
getQuickMessagesRequest and computes the deltas (for deletes) and
discontinues the use of getDeltasRequest, which was not working as
expected. One utility method has been added to e-file-cache and e-cal-
backend-cache,  as part of the fix.

The calendar cache is being wiped clean and recreated once per eds
session as a work-around for getDeltas issue. With the current fix in,
the cache is built only once when the account is set up. All subsequent
sessions merely obtain the deltas, this should hopefully solve a big
chunk of performance problems (#63374) by speeding up the calendar load-
time.

The patch also includes a small change to address an as yet unreported
problem, one that would have been uncovered by this fix - When a
calendar item that originated from a GW client (other than evo) and
processed by us, a duplicate item was being created as the same item
retrieved from the itip interface and the SOAP interface carried
different iCalIds. This was unobservable to most users, since the client
did not receive the changes  properly while it was running- the
duplicate item was not visible to the user and when s/he restarted the
client - the cache was wiped clean.
The same has been addressed by forcing a read from the server before
adding the items retrieved from itip, onto the cache.


harish

Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.331
diff -u -p -r1.331 ChangeLog
--- calendar/ChangeLog	8 Sep 2004 11:38:58 -0000	1.331
+++ calendar/ChangeLog	14 Sep 2004 14:58:01 -0000
@@ -1,3 +1,28 @@
+2004-09-14  Harish Krishnaswamy  <kharish novell com>
+
+	* backends/groupwise/e-cal-backend-groupwise-utils.[ch]:
+	(e_gw_connection_send_appointment): Allow callers to get the 
+	sent item from the server to ensure the iCalId of the component
+	is in sync with the server - even if it had been obtained from
+	a different client via itip.
+
+	Fixes #61865	
+	* backends/groupwise/e-cal-backend-groupwise.c: 
+	(get_deltas) : Replace getDeltasRequest by getQuickMessages calls
+	and compute deltas like adds, modify and deletes.
+	(connect_to_server): Do not recreate cache everytime and use the 
+	getQuickMessages to pull in the changes from server. The existing
+	code was a work-around till this fix was in place.
+
+	(e_cal_backend_groupwise_create_object), (receive_object):
+	Use the modified  e_gw_connection_send_appointment calls and
+	update the cache and cal clients appropriately.
+
+	* libedata-cal/e-cal-backend-cache.[ch]:
+	(e_cal_backend_cache_get_keys): Adding a function that allows to 
+	retrieve a list of the keys of all components from the cache.
+	
+
 2004-09-08  Chenthill Palanisamy <pchenthill novell com>
 
 	* backends/groupwise/e-cal-backend-groupwise-utils.c
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.94
diff -u -p -r1.94 e-cal-backend-groupwise.c
--- calendar/backends/groupwise/e-cal-backend-groupwise.c	8 Sep 2004 07:48:31 -0000	1.94
+++ calendar/backends/groupwise/e-cal-backend-groupwise.c	14 Sep 2004 14:58:02 -0000
@@ -56,7 +56,6 @@ struct _ECalBackendGroupwisePrivate {
 	GHashTable *categories_by_id;
 	GHashTable *categories_by_name;
 
-
 	/* fields for storing info while offline */
 	char *user_email;
 };
@@ -175,61 +174,122 @@ static gboolean
 get_deltas (gpointer handle)
 {
  	ECalBackendGroupwise *cbgw;
+	ECalBackendGroupwisePrivate *priv;
 	EGwConnection *cnc; 
  	ECalBackendCache *cache; 
         EGwConnectionStatus status; 
-	GSList *deletes = NULL, *updates = NULL, *adds = NULL, *l;
+	GSList *item_list, *cache_keys, *l;
+	const char *cache_file_name;
+	static time_t mod_time = NULL;
+	GTimeVal time_val;
+	char time_string[100];
+	const struct tm *tm;
+	struct stat buf;
         
 	if (!handle)
 		return FALSE;
 	
 	cbgw = (ECalBackendGroupwise *) handle;
- 	cnc = cbgw->priv->cnc; 
- 	cache = cbgw->priv->cache; 
-
-	/* Call e-gw-connection_get_deltas*/
-	status = e_gw_connection_get_deltas (cnc, &adds, &deletes, &updates);
+	priv= cbgw->priv;
+ 	cnc = priv->cnc; 
+ 	cache = priv->cache; 
+	item_list = NULL;
+	
+	if (!mod_time) {
+		cache_file_name = e_file_cache_get_filename (E_FILE_CACHE (priv->cache));
+		printf ("%s %d\n", cache_file_name, stat (cache_file_name, &buf));
+		mod_time = buf.st_mtime;
+	}
 
+	tm = gmtime (&mod_time);
+	strftime (time_string, 100, "%Y-%m-%dT%H:%M:%SZ", tm);
+	
+	status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id, "recipients message recipientStatus", time_string, "New", "CalendarItem", NULL,  -1,  &item_list);
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		e_cal_backend_groupwise_notify_error_code (cbgw, status);
+		return FALSE;
+	}
+	for (; item_list != NULL; item_list = g_slist_next(item_list)) {
+		EGwItem *item = E_GW_ITEM(item_list->data);
+		ECalComponent *comp = e_gw_item_to_cal_component (item, cbgw);
+		e_cal_component_commit_sequence (comp);
+		if (!comp)
+			g_message ("Invalid component returned");
+		else if (!e_cal_backend_cache_put_component (cache, comp)) 
+			g_message ("Could not add the component");
+		e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), e_cal_component_get_as_string (comp));
+		g_object_unref (comp);
+		g_object_unref (item);
+	}
+	if (item_list) {
+		g_slist_free (item_list);
+		item_list = NULL;
+	}
+	status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id,"recipients message recipientStatus iCalId", time_string, "Modified", "CalendarItem", NULL,  -1,  &item_list);
+	
 	if (status != E_GW_CONNECTION_STATUS_OK) {
 		e_cal_backend_groupwise_notify_error_code (cbgw, status);
 		return FALSE;
 	}
 	
-	if (deletes) {
-		for (l = deletes; l != NULL; l = g_slist_next(l)) {
-			if (!e_cal_backend_cache_remove_component (cache, (char *)l->data, NULL)) 
-				g_message ("Could not remove %s", (char *)l->data);
-		}
+	for (; item_list != NULL; item_list = g_slist_next(item_list)) {
+		EGwItem *item = E_GW_ITEM(item_list->data);
+		ECalComponent *modified_comp, *cache_comp;
+		
+		modified_comp = e_gw_item_to_cal_component (item, cbgw);
+		if (!modified_comp) {
+			g_message ("Invalid component returned in update");
+			continue;
+		}
+		cache_comp = e_cal_backend_cache_get_component (cache, e_gw_item_get_icalid (item), NULL);
+		e_cal_component_commit_sequence (modified_comp);
+		e_cal_component_commit_sequence (cache_comp);
+		e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), e_cal_component_get_as_string (cache_comp), e_cal_component_get_as_string (modified_comp) );
+		e_cal_backend_cache_remove_component (cache, e_gw_item_get_icalid (item), NULL);
+		e_cal_backend_cache_put_component (cache, modified_comp);
+		g_object_unref (item);
+		g_object_unref (modified_comp);
 	}
 
-	if (adds) {
-		for (l = adds; l != NULL; l = g_slist_next (l)) {
-			EGwItem *item = (EGwItem *) l->data;
-			ECalComponent *comp = e_gw_item_to_cal_component (item, cbgw);
-			if (!comp)
-				g_message ("Invalid component returned");
-			else if (!e_cal_backend_cache_put_component (cache, comp)) 
-				g_message ("Could not add the component");
-		}
-	}	
-
-	if (updates) {
-		for (l = updates; l != NULL; l = g_slist_next (l)) {
-			EGwItem *item = (EGwItem *) l->data;
-			ECalComponent *comp = e_cal_backend_cache_get_component (cache, e_gw_item_get_id (item), NULL);
-			if (!comp) /* FIXME  Error in updates. Skipping the element*/
-				continue;
-			/* FIXME  currently, just overwrite the fields with the
-			 * update.*/
-			e_cal_backend_cache_remove_component (cache, e_gw_item_get_id (item), NULL);
-			e_cal_backend_cache_put_component (cache, e_gw_item_to_cal_component (item, cbgw));
+	status = e_gw_connection_get_quick_messages (cnc, cbgw->priv->container_id,"iCalId", NULL, "All", "CalendarItem", NULL,  -1,  &item_list);
+
+	if (status != E_GW_CONNECTION_STATUS_OK) {
+		e_cal_backend_groupwise_notify_error_code (cbgw, status);
+		return FALSE;
+	}
+
+	/* handle deleted items here by going over the entire cache and
+	 * checking for deleted items.*/
+	
+	cache_keys = e_cal_backend_cache_get_keys (cache);
+	for (l = item_list; l; l = g_slist_next (l)) {
+		/* this works assuming rid is null*/
+		cache_keys = g_slist_delete_link (cache_keys, 
+				g_slist_find_custom (cache_keys, l->data, (GCompareFunc) strcmp));
+	}
+	
+	for (l = cache_keys; l ; l = g_slist_next (l)) {
+		/* assumes rid is null - which works for now */
+		ECalComponent *comp = NULL;
+		ECalComponentVType vtype;
+
+		comp = e_cal_backend_cache_get_component (cache, (const char *) l->data, NULL);	
+		vtype = e_cal_component_get_vtype (comp);
+		if ((vtype == E_CAL_COMPONENT_EVENT) ||
+				(vtype == E_CAL_COMPONENT_TODO)) {
+			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), 
+								(char *) l->data, e_cal_component_get_as_string (comp));
+			e_cal_backend_cache_remove_component (cache, (const char *) l->data, NULL);
 		}
+		g_object_unref (comp);
 	}
+		
+	g_get_current_time (&time_val);
+	mod_time = time_val.tv_sec;
 
         return TRUE;        
 }
 
-
 static char* 
 form_uri (ESource *source)
 {
@@ -327,38 +387,55 @@ connect_to_server (ECalBackendGroupwise 
 			} else
 				priv->container_id = NULL;
 
-				priv->cache = e_cal_backend_cache_new (e_cal_backend_get_uri (E_CAL_BACKEND (cbgw)));
-				if (!priv->cache) {
-					g_mutex_unlock (priv->mutex);
-					e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), _("Could not create cache file"));
-					return GNOME_Evolution_Calendar_OtherError;
-				}
+			priv->cache = e_cal_backend_cache_new (e_cal_backend_get_uri (E_CAL_BACKEND (cbgw)));
+			if (!priv->cache) {
+				g_mutex_unlock (priv->mutex);
+				e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), _("Could not create cache file"));
+				return GNOME_Evolution_Calendar_OtherError;
+			}
 			
 			/* read the default timezone*/
 			priv->default_zone = e_cal_backend_cache_get_default_timezone (priv->cache);
 
-			/* Clear the cache before populating it */
-			e_file_cache_clean (E_FILE_CACHE (priv->cache));
-
-			if (priv->default_zone)
-				e_cal_backend_cache_put_default_timezone (priv->cache, priv->default_zone);
-	
-			/* Populate the cache for the first time.*/
-			/* start a timed polling thread set to 10 minutes*/
-			cnc_status = populate_cache (cbgw);
-			if (cnc_status != E_GW_CONNECTION_STATUS_OK) {
-				g_object_unref (priv->cnc);
-				g_object_unref (priv->cache);
-				priv->cnc = NULL;
-				priv->cache = NULL;
-				g_warning (G_STRLOC ": Could not populate the cache");
-				return GNOME_Evolution_Calendar_PermissionDenied;
+			/* We poke the cache for a default timezone. Its
+			 * absence indicates that the cache file has not been
+			 * populated before. */
+			if (!priv->default_zone) {
+				/* Populate the cache for the first time.*/
+				/* start a timed polling thread set to 10 minutes*/
+				cnc_status = populate_cache (cbgw);
+				if (cnc_status != E_GW_CONNECTION_STATUS_OK) {
+					g_object_unref (priv->cnc);
+					g_object_unref (priv->cache);
+					priv->cnc = NULL;
+					priv->cache = NULL;
+					g_warning (G_STRLOC ": Could not populate the cache");
+					/*FIXME  why dont we do a notify here */
+					return GNOME_Evolution_Calendar_PermissionDenied;
+				} else {
+					g_object_ref (priv->cnc);
+					g_object_ref (priv->cache);
+					priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas, (gpointer) cbgw);
+					priv->mode = CAL_MODE_REMOTE;
+					return GNOME_Evolution_Calendar_Success;
+				}
 			} else {
-				g_object_ref (priv->cnc);
-				g_object_ref (priv->cache);
-				priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas, (gpointer) cbgw);
-				priv->mode = CAL_MODE_REMOTE;
-				return GNOME_Evolution_Calendar_Success;
+				/* get the deltas from the cache */
+				if (get_deltas (cbgw)) {
+					g_object_ref (priv->cache);
+					priv->timeout_id = g_timeout_add (CACHE_REFRESH_INTERVAL, (GSourceFunc) get_deltas, (gpointer) cbgw);
+					priv->mode = CAL_MODE_REMOTE;
+					return GNOME_Evolution_Calendar_Success;
+				} else {
+					/*Is this what we want to do ?*/
+					g_object_unref (priv->cnc);
+					g_object_unref (priv->cache);
+					priv->cnc = NULL;
+					priv->cache = NULL;
+					g_warning (G_STRLOC ": Could not populate the cache");
+					/*FIXME  why dont we do a notify here */
+					return GNOME_Evolution_Calendar_PermissionDenied;	
+				}
 			}
 		} else {
 			e_cal_backend_notify_error (E_CAL_BACKEND (cbgw), _("Authentication failed"));
@@ -518,7 +595,7 @@ e_cal_backend_groupwise_get_static_capab
 	                          CAL_STATIC_CAPABILITY_NO_THISANDPRIOR "," \
 				  CAL_STATIC_CAPABILITY_NO_THISANDFUTURE "," \
 				  CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK "," \
-				  CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR "," \ 
+				  CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR "," \
 				  CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
 
 	return GNOME_Evolution_Calendar_Success;
@@ -1116,6 +1193,9 @@ e_cal_backend_groupwise_create_object (E
 			/* 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);
+			/* FIXME  check if list is null and status may have
+			 * failed. */
+			comp = g_object_ref ( (ECalComponent *) list->data );
 			/* 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;
@@ -1315,7 +1395,7 @@ e_cal_backend_groupwise_remove_object (E
 static ECalBackendSyncStatus
 receive_object (ECalBackendGroupwise *cbgw, EDataCal *cal, icalcomponent *icalcomp)
 {
-	ECalComponent *comp;
+	ECalComponent *comp, *modif_comp;
 	ECalBackendGroupwisePrivate *priv;
 	icalproperty_method method;
 	EGwConnectionStatus status;
@@ -1327,7 +1407,7 @@ receive_object (ECalBackendGroupwise *cb
 	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
 	method = icalcomponent_get_method (icalcomp);
 	
-	status = e_gw_connection_send_appointment (priv->cnc, priv->container_id, comp, method, &remove);
+	status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, &remove, &modif_comp);
 
 	/* update the cache */
 	if (status == E_GW_CONNECTION_STATUS_OK) {
@@ -1337,24 +1417,27 @@ receive_object (ECalBackendGroupwise *cb
 			e_cal_component_get_uid (comp, (const char **) &uid);
 			e_cal_backend_cache_remove_component (priv->cache, uid, NULL);
 			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), uid, e_cal_component_get_as_string (comp));
+			g_free (comp);
 		}
 		else {
-			char *cache_comp = NULL, *modif_comp, *temp;
+			char *cache_comp = NULL, *temp;
 			ECalComponent *cache_component;
 			
-			e_cal_component_get_uid (comp, &temp);	
+			e_cal_component_commit_sequence (modif_comp);
+			e_cal_component_get_uid (modif_comp, (const char **) &temp);	
 			cache_component = e_cal_backend_cache_get_component (priv->cache, temp, NULL);
 			
-			if (cache_component)
+			if (cache_component) {
+				e_cal_component_commit_sequence (cache_component);
 				cache_comp = e_cal_component_get_as_string (cache_component);
+			}
 
-			e_cal_backend_cache_put_component (priv->cache, comp);	
-			modif_comp = e_cal_component_get_as_string (comp);
+			e_cal_backend_cache_put_component (priv->cache, modif_comp);	
 			
 			if (cache_comp)
-				e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp, modif_comp);
+				e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp, e_cal_component_get_as_string (modif_comp));
 			else
-				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), e_cal_component_get_as_string (comp));
+				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), e_cal_component_get_as_string (modif_comp));
 				
 			g_free (cache_comp);
 			g_free (modif_comp);
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.34
diff -u -p -r1.34 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	8 Sep 2004 11:38:58 -0000	1.34
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	14 Sep 2004 14:58:02 -0000
@@ -670,13 +670,15 @@ e_gw_item_to_cal_component (EGwItem *ite
 }
 
 EGwConnectionStatus
-e_gw_connection_send_appointment (EGwConnection *cnc, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove)
+e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove, ECalComponent **created_comp)
 {
+	EGwConnection *cnc;
 	EGwConnectionStatus status;
 	icalparameter_partstat partstat;
 	char *item_id;
 	
 
+	cnc = e_cal_backend_groupwise_get_connection (cbgw);
 	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);
 
@@ -764,8 +766,14 @@ e_gw_connection_send_appointment (EGwCon
 		*remove = TRUE;
 		break;
 	default:
-		status = E_GW_CONNECTION_STATUS_INVALID_OBJECT;
-	}	
+		return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
+	}
+	if (!*remove) {
+		EGwItem *item;
+
+		status = e_gw_connection_get_item (cnc, container, item_id, &item);
+		*created_comp = e_gw_item_to_cal_component (item, cbgw);
+	}
 
 	return status;
 }
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.11
diff -u -p -r1.11 e-cal-backend-groupwise-utils.h
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	10 Aug 2004 12:27:43 -0000	1.11
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	14 Sep 2004 14:58:02 -0000
@@ -44,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, gboolean *remove);
+EGwConnectionStatus e_gw_connection_send_appointment (ECalBackendGroupwise *cbgw, const char *container, ECalComponent *comp, icalproperty_method method, gboolean *remove, ECalComponent **created_comp);
 EGwConnectionStatus e_gw_connection_get_freebusy_info (EGwConnection *cnc, GList *users, time_t start, time_t end, GList **freebusy, icaltimezone *default_zone);
 
 /*
Index: calendar/libedata-cal/e-cal-backend-cache.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.c,v
retrieving revision 1.16
diff -u -p -r1.16 e-cal-backend-cache.c
--- calendar/libedata-cal/e-cal-backend-cache.c	18 May 2004 17:16:54 -0000	1.16
+++ calendar/libedata-cal/e-cal-backend-cache.c	14 Sep 2004 14:58:02 -0000
@@ -582,3 +582,13 @@ e_cal_backend_cache_remove_timezone (ECa
 
 	return e_file_cache_remove_object (E_FILE_CACHE (cache), tzid);
 }
+
+GSList *
+e_cal_backend_cache_get_keys (ECalBackendCache *cache)
+{
+	char *comp_str;
+        
+        /* return null if cache is not a valid Backend Cache.  */
+	g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), NULL);
+        return e_file_cache_get_keys (E_FILE_CACHE (cache));
+}
Index: calendar/libedata-cal/e-cal-backend-cache.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-cache.h,v
retrieving revision 1.10
diff -u -p -r1.10 e-cal-backend-cache.h
--- calendar/libedata-cal/e-cal-backend-cache.h	18 May 2004 17:16:54 -0000	1.10
+++ calendar/libedata-cal/e-cal-backend-cache.h	14 Sep 2004 14:58:02 -0000
@@ -56,12 +56,15 @@ gboolean            e_cal_backend_cache_
 							  const char *rid);
 GList              *e_cal_backend_cache_get_components (ECalBackendCache *cache);
 
+
 const icaltimezone *e_cal_backend_cache_get_timezone (ECalBackendCache *cache, const char *tzid);
 gboolean            e_cal_backend_cache_put_timezone (ECalBackendCache *cache, const icaltimezone *zone);
 gboolean            e_cal_backend_cache_remove_timezone (ECalBackendCache *cache, const char *tzid);
 
 gboolean            e_cal_backend_cache_put_default_timezone (ECalBackendCache *cache, icaltimezone *default_zone);
 icaltimezone       *e_cal_backend_cache_get_default_timezone (ECalBackendCache *cache);
+
+GSList             *e_cal_backend_cache_get_keys (ECalBackendCache *cache);
 
 
 G_END_DECLS
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/ChangeLog,v
retrieving revision 1.157
diff -u -p -r1.157 ChangeLog
--- ChangeLog	14 Sep 2004 00:44:41 -0000	1.157
+++ ChangeLog	14 Sep 2004 14:58:02 -0000
@@ -1,3 +1,10 @@
+2004-09-14  Harish Krishnaswamy  <kharish novell com>
+
+	* libedataserver/e-file-cache.[ch]: 
+	(e_file_cache_get_keys): utility function that allows to get 
+	 a list of the keys of all the items in the cache. Used by 
+	 the fix for bug #61865	
+
 2004-09-14  Tomasz Kłoczko <kloczek pld org pl>
 
 	* servers/groupwise/Makefile.am: automake fix for paralel build ("make -j<N>").
Index: libedataserver/e-file-cache.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-file-cache.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-file-cache.c
--- libedataserver/e-file-cache.c	25 Aug 2004 14:39:18 -0000	1.10
+++ libedataserver/e-file-cache.c	14 Sep 2004 14:58:02 -0000
@@ -366,6 +366,24 @@ e_file_cache_get_objects (EFileCache *ca
 }
 
 /**
+ * e_file_cache_get_keys:
+ */
+GSList *
+e_file_cache_get_keys (EFileCache *cache)
+{
+	EFileCachePrivate *priv;
+	GSList *list = NULL;
+
+	g_return_val_if_fail (E_IS_FILE_CACHE (cache), NULL);
+
+	priv = cache->priv;
+
+	e_xmlhash_foreach_key (priv->xml_hash, (EXmlHashFunc) add_key_to_list, &list);
+
+	return list;
+}
+
+/**
  * e_file_cache_add_object:
  */
 gboolean
Index: libedataserver/e-file-cache.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-file-cache.h,v
retrieving revision 1.4
diff -u -p -r1.4 e-file-cache.h
--- libedataserver/e-file-cache.h	27 May 2004 15:26:30 -0000	1.4
+++ libedataserver/e-file-cache.h	14 Sep 2004 14:58:02 -0000
@@ -51,6 +51,7 @@ gboolean    e_file_cache_clean (EFileCac
 
 const char *e_file_cache_get_object (EFileCache *cache, const char *key);
 GSList     *e_file_cache_get_objects (EFileCache *cache);
+GSList     *e_file_cache_get_keys (EFileCache *cache);
 gboolean    e_file_cache_add_object (EFileCache *cache, const char *key, const char *value);
 gboolean    e_file_cache_replace_object (EFileCache *cache, const char *key, const char *new_value);
 gboolean    e_file_cache_remove_object (EFileCache *cache, const char *key);
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.65
diff -u -p -r1.65 ChangeLog
--- servers/groupwise/ChangeLog	8 Sep 2004 11:34:12 -0000	1.65
+++ servers/groupwise/ChangeLog	14 Sep 2004 14:58:02 -0000
@@ -1,3 +1,11 @@
+2004-09-14  Harish Krishnaswamy  <kharish novell com>
+
+	Fixes #61865	
+	* e-gw-connection.[ch]: 
+	(e_gw_connection_get_quick_messages): implements
+	sending a getQuickMessagesRequest to the server and
+	parsing the response.
+
 2004-09-08  Chenthill Palanisamy <pchenthill novell com>
 	
 	Fixes #64062
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.80
diff -u -p -r1.80 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c	25 Aug 2004 14:39:18 -0000	1.80
+++ servers/groupwise/e-gw-connection.c	14 Sep 2004 14:58:03 -0000
@@ -1701,3 +1701,96 @@ e_gw_connection_read_cursor (EGwConnecti
 	g_object_unref (msg);
         return E_GW_CONNECTION_STATUS_OK;
 }
+
+EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const char *container, const char *view, const char *start_date, const char *message_list, const char *item_types, const char *item_sources, int count, GSList **item_list)
+{
+	SoupSoapMessage *msg;
+	SoupSoapResponse *response;
+        EGwConnectionStatus status;
+	SoupSoapParameter *param, *subparam;
+	
+	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_UNKNOWN);
+	g_return_val_if_fail (message_list != NULL, E_GW_CONNECTION_STATUS_UNKNOWN);
+
+	msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getQuickMessagesRequest");
+	e_gw_message_write_string_parameter (msg, "list", NULL, message_list);
+	if (start_date)
+		e_gw_message_write_string_parameter (msg, "startDate", NULL, start_date);
+	if (container)
+		e_gw_message_write_string_parameter (msg, "container", NULL, container);
+	if (item_types) 
+		e_gw_message_write_string_parameter (msg, "types", NULL, item_types);
+	if (item_sources)
+		e_gw_message_write_string_parameter (msg, "source", NULL, item_sources);
+	if (view)
+		e_gw_message_write_string_parameter (msg, "view", NULL, view);
+	if (count > 0)
+		e_gw_message_write_int_parameter (msg, "count", NULL, count);
+	
+	e_gw_message_write_footer (msg);
+
+	response = e_gw_connection_send_message (cnc, msg);
+        if (!response) {
+                g_object_unref (msg);
+                return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
+        }
+	
+	status = e_gw_connection_parse_response_status (response);
+        if (status != E_GW_CONNECTION_STATUS_OK) {
+		g_object_unref (response);
+                g_object_unref (msg);
+		return status;
+	}
+
+	/* if status is OK - parse result. return the list */	
+	*item_list = NULL;
+	param = soup_soap_response_get_first_parameter_by_name (response, "items");
+        if (!param) {
+                g_object_unref (response);
+                g_object_unref (msg);
+                return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
+        }
+
+	if (!strcmp (message_list, "All")) { 
+		/* We are  interested only in getting the ids */
+		for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
+	     	     subparam != NULL;
+	             subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
+			SoupSoapParameter *param_id;
+		     	char *id;
+			
+			param_id = soup_soap_parameter_get_first_child_by_name (subparam, "iCalId");
+			if (!param_id) {
+				g_object_unref (response);
+		                g_object_unref (msg);
+                		return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
+			}
+		     
+			id = g_strdup (soup_soap_parameter_get_string_value (param_id));
+			if (id)
+				*item_list = g_slist_append (*item_list, id);
+		}
+		
+		g_object_unref (response);
+		g_object_unref (msg);
+		return E_GW_CONNECTION_STATUS_OK;
+
+	}
+
+	for (subparam = soup_soap_parameter_get_first_child_by_name (param, "item");
+	     subparam != NULL;
+	     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
+		EGwItem *item;
+
+		item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
+		if (item)
+			*item_list = g_slist_append (*item_list, item);
+        }
+               
+	/* free memory */
+        g_object_unref (response);
+	g_object_unref (msg);
+        return E_GW_CONNECTION_STATUS_OK;
+	
+
+}
Index: servers/groupwise/e-gw-connection.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.h,v
retrieving revision 1.34
diff -u -p -r1.34 e-gw-connection.h
--- servers/groupwise/e-gw-connection.h	24 Aug 2004 16:07:41 -0000	1.34
+++ servers/groupwise/e-gw-connection.h	14 Sep 2004 14:58:03 -0000
@@ -111,6 +111,8 @@ EGwConnectionStatus e_gw_connection_crea
 EGwConnectionStatus e_gw_connection_destroy_cursor (EGwConnection *cnc, const char *container,  int cursor);
 EGwConnectionStatus e_gw_connection_read_cursor (EGwConnection *cnc, const char *container, int cursor, int forward, int count, GList **item_list);
 
+EGwConnectionStatus e_gw_connection_get_quick_messages (EGwConnection *cnc, const char *container, const char *view, const char *start_date, const char *message_list, const char *item_types, const char *item_sources, int count, GSList **item_list);
+
 G_END_DECLS
 
 #endif


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