[evolution-patches] patch for using timezones in the http calendar backend
- From: Rodrigo Moya <rodrigo novell com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] patch for using timezones in the http calendar backend
- Date: Wed, 22 Dec 2004 12:20:01 +0100
As someone mentioned on the evo list, the webcal backend is not using
correctly the timezones it gets from the remote ical file. This patch
fixes that. It is for HEAD and 2.0.x, where it should be fixed also.
--
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.362
diff -u -p -r1.362 ChangeLog
--- ChangeLog 21 Dec 2004 13:55:45 -0000 1.362
+++ ChangeLog 22 Dec 2004 11:18:11 -0000
@@ -1,3 +1,9 @@
+2004-12-22 Rodrigo Moya <rodrigo novell com>
+
+ * backends/http/e-cal-backend-http.c (e_cal_backend_http_get_timezone):
+ search timezones in the cache also.
+ (e_cal_backend_http_add_timezone): add the timezones to the cache.
+
2004-12-21 Rodrigo Moya <rodrigo novell com>
* backends/file/e-cal-backend-file.c (e_cal_backend_file_remove_object):
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.24
diff -u -p -r1.24 e-cal-backend-http.c
--- backends/http/e-cal-backend-http.c 20 Dec 2004 15:33:24 -0000 1.24
+++ backends/http/e-cal-backend-http.c 22 Dec 2004 11:18:12 -0000
@@ -589,9 +589,13 @@ e_cal_backend_http_get_timezone (ECalBac
g_return_val_if_fail (tzid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
- zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (!zone)
- return GNOME_Evolution_Calendar_ObjectNotFound;
+ /* first try to get the timezone from the cache */
+ zone = e_cal_backend_cache_get_timezone (priv->cache, tzid);
+ if (!zone) {
+ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+ if (!zone)
+ return GNOME_Evolution_Calendar_ObjectNotFound;
+ }
icalcomp = icaltimezone_get_component (zone);
if (!icalcomp)
@@ -608,6 +612,8 @@ e_cal_backend_http_add_timezone (ECalBac
{
ECalBackendHttp *cbhttp;
ECalBackendHttpPrivate *priv;
+ icalcomponent *tz_comp;
+ icaltimezone *zone;
cbhttp = (ECalBackendHttp *) backend;
@@ -616,7 +622,19 @@ e_cal_backend_http_add_timezone (ECalBac
priv = cbhttp->priv;
- /* FIXME: add the timezone to the cache */
+ tz_comp = icalparser_parse_string (tzobj);
+ if (!tz_comp)
+ return GNOME_Evolution_Calendar_InvalidObject;
+
+ if (icalcomponent_isa (tz_comp) != ICAL_VTIMEZONE_COMPONENT) {
+ icalcomponent_free (tz_comp);
+ return GNOME_Evolution_Calendar_InvalidObject;
+ }
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, tz_comp);
+ e_cal_backend_cache_put_timezone (priv->cache, zone);
+
return GNOME_Evolution_Calendar_Success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]