evolution-exchange r1701 - in branches/gnome-2-22: . calendar



Author: pchen
Date: Thu Jul 24 08:29:13 2008
New Revision: 1701
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1701&view=rev

Log:
2008-07-24  Chenthill Palanisamy  <pchenthill novell com>

        Fixes #208394 (bnc)
        * calendar/e-cal-backend-exchange.h: Include rid to check if the
        * event
        is in the cache.
        * calendar/e-cal-backend-exchange-calendar.c:
        * (get_changed_events):
        Use the new function, find_instance to search for the instance
        (open_calendar): 
        * calendar/e-cal-backend-exchange-tasks.c: (get_changed_tasks),
        (create_task_object):
        * calendar/e-cal-backend-exchange.c: (find_instance),
        (e_cal_backend_exchange_in_cache): Use rid along with uid while
        searching for recurring instances.                                         



Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c
   branches/gnome-2-22/calendar/e-cal-backend-exchange-tasks.c
   branches/gnome-2-22/calendar/e-cal-backend-exchange.c
   branches/gnome-2-22/calendar/e-cal-backend-exchange.h

Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c	(original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange-calendar.c	Thu Jul 24 08:29:13 2008
@@ -312,6 +312,7 @@
 
 static const char *event_properties[] = {
 	E2K_PR_CALENDAR_UID,
+	PR_CAL_RECURRING_ID,
 	E2K_PR_DAV_LAST_MODIFIED,
 	E2K_PR_HTTPMAIL_HAS_ATTACHMENT,
 	PR_READ_RECEIPT_REQUESTED,
@@ -335,7 +336,7 @@
 	E2kRestriction *rn;
 	E2kResultIter *iter;
 	E2kResult *result;
-	const char *prop, *uid, *modtime, *attach_prop, *receipts;
+	const char *prop, *uid, *modtime, *attach_prop, *receipts, *rid;
 	guint status;
 	E2kContext *ctx;
 	int i, status_tracking = EX_NO_RECEIPTS;
@@ -394,6 +395,7 @@
 			continue;
 		modtime = e2k_properties_get_prop (result->props,
 						   E2K_PR_DAV_LAST_MODIFIED);
+		rid = e2k_properties_get_prop (result->props, PR_CAL_RECURRING_ID);
 
 		attach_prop = e2k_properties_get_prop (result->props,
 						E2K_PR_HTTPMAIL_HAS_ATTACHMENT);
@@ -414,7 +416,7 @@
 		}
 
 		e_cal_backend_exchange_cache_lock (cbex);
-		if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href)) {
+		if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href, rid)) {
 			g_ptr_array_add (hrefs, g_strdup (result->href));
 			g_hash_table_insert (modtimes, g_strdup (result->href),
 					     g_strdup (modtime));
@@ -575,6 +577,8 @@
 	GError *error = NULL;
 	ECalBackendExchangeCalendar *cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
 
+
+
 	/* Do the generic part */
 	status = E_CAL_BACKEND_SYNC_CLASS (parent_class)->open_sync (
 		backend, cal, only_if_exists, username, password);
@@ -589,8 +593,8 @@
 		return GNOME_Evolution_Calendar_Success;
 
 	e_folder_exchange_subscribe (E_CAL_BACKEND_EXCHANGE (backend)->folder,
-                                        E2K_CONTEXT_OBJECT_CHANGED, 30,
-                                        notify_changes, backend);
+			E2K_CONTEXT_OBJECT_CHANGED, 30,
+			notify_changes, backend);
 
 	thread = g_thread_create ((GThreadFunc) get_changed_events, E_CAL_BACKEND_EXCHANGE (backend), FALSE, &error);
 	if (!thread) {

Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange-tasks.c
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange-tasks.c	(original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange-tasks.c	Thu Jul 24 08:29:13 2008
@@ -641,7 +641,7 @@
 						   E2K_PR_DAV_LAST_MODIFIED);
 
 		e_cal_backend_exchange_cache_lock (cbex);
-		if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href)) {
+		if (!e_cal_backend_exchange_in_cache (cbex, uid, modtime, result->href, NULL)) {
 			g_ptr_array_add (hrefs, g_strdup (result->href));
 			g_hash_table_insert (modtimes, g_strdup (result->href),
 					     g_strdup (modtime));
@@ -1085,7 +1085,7 @@
 	e_cal_backend_exchange_cache_lock (ecalbex);
 	/* check if the object is already present in our cache */
 	if (e_cal_backend_exchange_in_cache (E_CAL_BACKEND_EXCHANGE (backend),
-					     temp_comp_uid, modtime, NULL)) {
+					     temp_comp_uid, modtime, NULL, NULL)) {
 		e_cal_backend_exchange_cache_unlock (ecalbex);
 		icalcomponent_free (icalcomp);
 		return GNOME_Evolution_Calendar_ObjectIdAlreadyExists;

Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange.c
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange.c	(original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange.c	Thu Jul 24 08:29:13 2008
@@ -49,6 +49,7 @@
 #include <exchange-account.h>
 #include "exchange-component.h"
 #include <exchange-hierarchy.h>
+#include <e2k-utils.h>
 
 struct ECalBackendExchangePrivate {
 	gboolean read_only;
@@ -75,6 +76,9 @@
 
 #define d(x)
 
+static icaltimezone *
+internal_get_timezone (ECalBackend *backend, const char *tzid);
+
 static ECalBackendSyncStatus
 is_read_only (ECalBackendSync *backend, EDataCal *cal, gboolean *read_only)
 {
@@ -527,11 +531,50 @@
 	g_hash_table_foreach (cbex->priv->objects, add_to_unseen, cbex);
 }
 
+static gboolean
+find_instance (ECalBackendExchange *cbex, ECalBackendExchangeComponent *ecomp, const char *rid, const char *lastmod)
+{
+	GList *l;
+	gboolean found = FALSE;
+
+	if (!ecomp->instances)	
+		return FALSE;
+
+	for (l = ecomp->instances; l != NULL; l = l->next) {
+		ECalComponent *comp = e_cal_component_new ();
+		ECalComponentRange recur_id;
+		struct icaltimetype inst_rid, new_rid;
+		time_t rtime;
+		icaltimezone *f_zone;
+
+		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data));
+		e_cal_component_get_recurid (comp, &recur_id);
+
+		rtime = e2k_parse_timestamp (rid);
+		new_rid = icaltime_from_timet (rtime, FALSE);
+
+		f_zone = internal_get_timezone ((ECalBackend *) cbex, recur_id.datetime.tzid);
+		recur_id.datetime.value->zone = f_zone;
+		inst_rid = icaltime_convert_to_zone (*recur_id.datetime.value, icaltimezone_get_utc_timezone ());
+
+		e_cal_component_free_datetime (&recur_id.datetime);
+		g_object_unref (comp);
+		
+		if (icaltime_compare (inst_rid, new_rid) == 0) {
+			found = TRUE;
+			break;
+		}
+	}
+	return found;
+}
+
 gboolean
 e_cal_backend_exchange_in_cache (ECalBackendExchange *cbex,
 				 const char          *uid,
 				 const char          *lastmod,
-				 const char	     *href)
+				 const char	     *href,
+				 const char	     *rid
+				 )
 {
 	ECalBackendExchangeComponent *ecomp;
 
@@ -542,6 +585,9 @@
 		return FALSE;
 	g_hash_table_remove (cbex->priv->cache_unseen, ecomp->uid);
 
+	if (rid) 
+		return find_instance (cbex, ecomp, rid, lastmod);
+
 	if (strcmp (ecomp->lastmod, lastmod) < 0) {
 		g_hash_table_remove (cbex->priv->objects, uid);
 		return FALSE;

Modified: branches/gnome-2-22/calendar/e-cal-backend-exchange.h
==============================================================================
--- branches/gnome-2-22/calendar/e-cal-backend-exchange.h	(original)
+++ branches/gnome-2-22/calendar/e-cal-backend-exchange.h	Thu Jul 24 08:29:13 2008
@@ -54,7 +54,9 @@
 gboolean  e_cal_backend_exchange_in_cache         (ECalBackendExchange *cbex,
 						   const char          *uid,
 						   const char          *lastmod,
-						   const char	       *href);
+						   const char	       *href,
+						   const char  	       *rid
+						   );
 
 void      e_cal_backend_exchange_cache_sync_end   (ECalBackendExchange *cbex);
 



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