evolution-exchange r1857 - in branches/gnome-2-24: . calendar



Author: mcrha
Date: Fri Jan 16 12:04:33 2009
New Revision: 1857
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1857&view=rev

Log:
2009-01-16  Milan Crha  <mcrha redhat com>

	** Fix for bug #360813

	* calendar/e-cal-backend-exchange.h:
	(e_cal_backend_exchange_ensure_utc_zone):
	* calendar/e-cal-backend-exchange.c:
	(e_cal_backend_exchange_ensure_utc_zone):
	* calendar/e-cal-backend-exchange-tasks.c: (get_changed_tasks),
	(modify_task_object), (receive_task_objects):
	* calendar/e-cal-backend-exchange-calendar.c:
	(modify_object_with_href), (receive_objects):
	RFC 2445 - CREATED/DTSTAMP/LAST-MODIFIED always in UTC.




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

Modified: branches/gnome-2-24/calendar/e-cal-backend-exchange-calendar.c
==============================================================================
--- branches/gnome-2-24/calendar/e-cal-backend-exchange-calendar.c	(original)
+++ branches/gnome-2-24/calendar/e-cal-backend-exchange-calendar.c	Fri Jan 16 12:04:33 2009
@@ -1193,7 +1193,7 @@
 
 	update_x_properties (E_CAL_BACKEND_EXCHANGE (cbexc), updated_ecomp);
 
-	last_modified = icaltime_from_timet (time (NULL), 0);
+	last_modified = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
 	e_cal_component_set_last_modified (updated_ecomp, &last_modified);
 
 	if (e_cal_component_has_attachments (updated_ecomp)) {
@@ -1631,7 +1631,7 @@
 		e_cal_component_set_icalcomponent (comp, subcomp);
 
 		/*create time and last modified*/
-		current = icaltime_from_timet (time (NULL), 0);
+		current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
 		e_cal_component_set_created (comp, &current);
 		e_cal_component_set_last_modified (comp, &current);
 

Modified: branches/gnome-2-24/calendar/e-cal-backend-exchange-tasks.c
==============================================================================
--- branches/gnome-2-24/calendar/e-cal-backend-exchange-tasks.c	(original)
+++ branches/gnome-2-24/calendar/e-cal-backend-exchange-tasks.c	Fri Jan 16 12:04:33 2009
@@ -651,8 +651,10 @@
 		e_cal_backend_exchange_add_timezone (cbex, icalcomp);
 
 		itt = icaltime_from_timet (e2k_parse_timestamp (modtime), 0);
-		if (!icaltime_is_null_time (itt))
+		if (!icaltime_is_null_time (itt)) {
+			e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
 			e_cal_component_set_last_modified (ecal, &itt);
+		}
 
 		/* Set Priority */
 		if ((str = e2k_properties_get_prop (result->props,
@@ -683,6 +685,8 @@
 				E2K_PR_HTTPMAIL_DATE))) {
 			itt = icaltime_from_timet (e2k_parse_timestamp (str), 0);
 			if (!icaltime_is_null_time (itt)) {
+				e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
+
 				e_cal_component_set_dtstamp (
 					E_CAL_COMPONENT (ecal), &itt);
 				e_cal_component_set_created (
@@ -790,8 +794,10 @@
 		if ((str = e2k_properties_get_prop (result->props,
 				E2K_PR_CALENDAR_LAST_MODIFIED))) {
 			itt = icaltime_from_timet (e2k_parse_timestamp(str), 0);
-			if (!icaltime_is_null_time (itt))
+			if (!icaltime_is_null_time (itt)) {
+				e_cal_backend_exchange_ensure_utc_zone (E_CAL_BACKEND (cbex), &itt);
 				e_cal_component_set_last_modified (ecal, &itt);
+			}
 		}
 
 		/* Set CATEGORIES */
@@ -1257,7 +1263,7 @@
         e_cal_component_set_icalcomponent (new_comp, icalcomp);
 
 	/* Set the last modified time on the component */
-        current = icaltime_from_timet (time (NULL), 0);
+        current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
         e_cal_component_set_last_modified (new_comp, &current);
 
 	/* Set Attachments */
@@ -1337,7 +1343,7 @@
                 ecalcomp = e_cal_component_new ();
                 e_cal_component_set_icalcomponent (ecalcomp, subcomp);
 
-                current = icaltime_from_timet (time (NULL), 0);
+                current = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ());
                 e_cal_component_set_created (ecalcomp, &current);
                 e_cal_component_set_last_modified (ecalcomp, &current);
 

Modified: branches/gnome-2-24/calendar/e-cal-backend-exchange.c
==============================================================================
--- branches/gnome-2-24/calendar/e-cal-backend-exchange.c	(original)
+++ branches/gnome-2-24/calendar/e-cal-backend-exchange.c	Fri Jan 16 12:04:33 2009
@@ -595,6 +595,29 @@
 	return found;
 }
 
+/**
+ * e_cal_backend_exchange_ensure_utc_zone:
+ * Makes sure the given icaltimetype is in UTC, because
+ * RFC 2445 says CREATED/DTSTAMP/LAST-MODIFIED always in UTC.
+ * @param cb ECalbackendExchage descendant.
+ * @param itt What to convert to UTC, if required.
+ **/
+void
+e_cal_backend_exchange_ensure_utc_zone (ECalBackend *cb, struct icaltimetype *itt)
+{
+	g_return_if_fail (cb != NULL);
+	g_return_if_fail (itt != NULL);
+
+	/* RFC 2445 - CREATED/DTSTAMP/LAST-MODIFIED always in UTC */
+	if (!icaltime_is_null_time (*itt) && !icaltime_is_utc (*itt)) {
+		if (!itt->zone)
+			icaltime_set_timezone (itt, e_cal_backend_internal_get_default_timezone (cb));
+
+		icaltimezone_convert_time (itt, (icaltimezone*) icaltime_get_timezone (*itt), icaltimezone_get_utc_timezone ());
+		icaltime_set_timezone (itt, icaltimezone_get_utc_timezone ());
+	}
+}
+
 gboolean
 e_cal_backend_exchange_in_cache (ECalBackendExchange *cbex,
 				 const char          *uid,

Modified: branches/gnome-2-24/calendar/e-cal-backend-exchange.h
==============================================================================
--- branches/gnome-2-24/calendar/e-cal-backend-exchange.h	(original)
+++ branches/gnome-2-24/calendar/e-cal-backend-exchange.h	Fri Jan 16 12:04:33 2009
@@ -112,6 +112,7 @@
 gchar *e_cal_backend_exchange_get_owner_name (ECalBackendSync *backend);
 void e_cal_backend_exchange_cache_lock (ECalBackendExchange *cbex);
 void e_cal_backend_exchange_cache_unlock (ECalBackendExchange *cbex) ;
+void e_cal_backend_exchange_ensure_utc_zone (ECalBackend *cb, struct icaltimetype *itt);
 
 G_END_DECLS
 



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