[evolution-patches] [calendar-http] fix for bug #308037
- From: "Chakravarthi P" <pchakravarthi novell com>
- To: <evolution-patches lists ximian com>
- Subject: [evolution-patches] [calendar-http] fix for bug #308037
- Date: Mon, 22 Aug 2005 07:11:56 -0600
hi
attached is a patch to fix bug# 308037.
the code updates the http backend cache
to concur with the current object list in server.
please review.
regards.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.506
diff -u -p -w -r1.506 ChangeLog
--- ChangeLog 21 Aug 2005 17:35:14 -0000 1.506
+++ ChangeLog 22 Aug 2005 12:56:43 -0000
@@ -1,3 +1,12 @@
+2005-08-22 P. S. Chakravarthi <pchakravarthi novell com>
+
+ Fixes #308037
+ * backends/http/e-cal-backend-http.c:
+ (retrieval_done), (notify_and_remove_from_cache):
+ Build a new cache of objects obtained from server on
+ reload or a fresh open; and remove all those objects
+ from the backend cache, that are in old_cache alone.
+
2005-08-21 Chenthill Palanisamy <pchenthill novell com>
Fixes #271969
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.34
diff -u -p -w -r1.34 e-cal-backend-http.c
--- backends/http/e-cal-backend-http.c 6 Mar 2005 02:47:03 -0000 1.34
+++ backends/http/e-cal-backend-http.c 22 Aug 2005 12:56:45 -0000
@@ -39,7 +39,6 @@
#include "e-cal-backend-http.h"
-
/* Private part of the ECalBackendHttp structure */
struct _ECalBackendHttpPrivate {
/* URI to get remote calendar data from */
@@ -78,7 +77,8 @@ static void e_cal_backend_http_finalize
static gboolean begin_retrieval_cb (ECalBackendHttp *cbhttp);
static ECalBackendSyncClass *parent_class;
-
+/* cache to be build from components obtained from server */
+static GHashTable *build_cache;
/* Dispose handler for the file backend */
@@ -201,6 +201,17 @@ notify_and_remove_from_cache (gpointer k
const char *calobj = value;
ECalBackendHttp *cbhttp = E_CAL_BACKEND_HTTP (user_data);
+ char *rid = NULL;
+ ECalComponent *comp = e_cal_component_new ();
+ e_cal_component_set_icalcomponent (comp, icalparser_parse_string (calobj));
+
+ if (e_cal_component_is_instance (comp))
+ rid = e_cal_component_get_recurid_as_string (comp);
+
+ /* Remove those components from the backend cache that are not there in the current cache build */
+ if (!g_hash_table_lookup (build_cache, uid))
+ e_cal_backend_cache_remove_component (cbhttp->priv->cache, uid, rid);
+
e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbhttp), uid, calobj, NULL);
return TRUE;
@@ -272,14 +283,14 @@ retrieval_done (SoupMessage *msg, ECalBa
return;
}
- /* Update cache */
- old_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ /* Update the old cache and build new cache */
+ build_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ old_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
comps_in_cache = e_cal_backend_cache_get_components (priv->cache);
while (comps_in_cache != NULL) {
const char *uid;
ECalComponent *comp = comps_in_cache->data;
-
e_cal_component_get_uid (comp, &uid);
g_hash_table_insert (old_cache, g_strdup (uid), e_cal_component_get_as_string (comp));
@@ -309,8 +320,12 @@ retrieval_done (SoupMessage *msg, ECalBa
const char *uid, *orig_key, *orig_value;
e_cal_backend_cache_put_component (priv->cache, comp);
-
e_cal_component_get_uid (comp, &uid);
+
+ /*Make entries in the build cache for components from server */
+ g_hash_table_insert (build_cache, g_strdup (uid), e_cal_component_get_as_string (comp));
+
+
if (g_hash_table_lookup_extended (old_cache, uid, (void **)&orig_key, (void **)&orig_value)) {
e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbhttp),
orig_value,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]