[evolution-ews] Bug 734747 - Fails to provide "Eastern Standard Time" timezone
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug 734747 - Fails to provide "Eastern Standard Time" timezone
- Date: Tue, 25 Nov 2014 13:13:52 +0000 (UTC)
commit 3ef4c01a200a3a868e99c142835fd7d7d8f84ed6
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 25 14:13:04 2014 +0100
Bug 734747 - Fails to provide "Eastern Standard Time" timezone
src/calendar/e-cal-backend-ews-utils.c | 14 ++++--
src/calendar/e-cal-backend-ews.c | 71 ++++++++++++++++++++------------
src/calendar/windowsZones.xml | 9 +----
3 files changed, 56 insertions(+), 38 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index f7e247d..8ad1229 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -123,13 +123,19 @@ e_cal_backend_ews_populate_windows_zones (void)
tokens = g_strsplit ((gchar *) ical, " ", 0);
tokens_len = g_strv_length (tokens);
if (tokens_len == 1) {
- g_hash_table_insert (msdn_to_ical, g_strdup ((gchar *) msdn), g_strdup ((gchar *)
ical));
- g_hash_table_insert (ical_to_msdn, g_strdup ((gchar *) ical), g_strdup ((gchar *)
msdn));
+ if (!g_hash_table_lookup (msdn_to_ical, msdn))
+ g_hash_table_insert (msdn_to_ical, g_strdup ((gchar *) msdn), g_strdup
((gchar *) ical));
+
+ if (!g_hash_table_lookup (ical_to_msdn, ical))
+ g_hash_table_insert (ical_to_msdn, g_strdup ((gchar *) ical), g_strdup
((gchar *) msdn));
} else {
gint j;
for (j = 0; j < tokens_len; j++) {
- g_hash_table_insert (msdn_to_ical, g_strdup ((gchar *) msdn), g_strdup
(tokens[j]));
- g_hash_table_insert (ical_to_msdn, g_strdup (tokens[j]), g_strdup ((gchar *)
msdn));
+ if (!g_hash_table_lookup (msdn_to_ical, msdn))
+ g_hash_table_insert (msdn_to_ical, g_strdup ((gchar *) msdn),
g_strdup (tokens[j]));
+
+ if (!g_hash_table_lookup (ical_to_msdn, tokens[j]))
+ g_hash_table_insert (ical_to_msdn, g_strdup (tokens[j]), g_strdup
((gchar *) msdn));
}
}
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 761948d..4107338 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -443,6 +443,41 @@ e_cal_backend_ews_discard_alarm (ECalBackend *backend,
edad);
}
+static gchar *
+cal_backend_ews_get_builtin_zone_object (const gchar *tzid)
+{
+ icalcomponent *icalcomp = NULL, *free_comp = NULL;
+ icaltimezone *zone;
+ gchar *object = NULL;
+
+ zone = icaltimezone_get_builtin_timezone (tzid);
+ if (!zone) {
+ icalcomp = free_comp = icaltzutil_fetch_timezone (tzid);
+ }
+
+ if (zone)
+ icalcomp = icaltimezone_get_component (zone);
+
+ if (icalcomp) {
+ icalcomponent *clone = icalcomponent_new_clone (icalcomp);
+ icalproperty *prop;
+
+ prop = icalcomponent_get_first_property (clone, ICAL_TZID_PROPERTY);
+ if (prop) {
+ /* change tzid to our, because the component has the buildin tzid */
+ icalproperty_set_tzid (prop, tzid);
+
+ object = icalcomponent_as_ical_string_r (clone);
+ }
+ icalcomponent_free (clone);
+ }
+
+ if (free_comp)
+ icalcomponent_free (free_comp);
+
+ return object;
+}
+
static void
e_cal_backend_ews_get_timezone (ECalBackend *backend,
EDataCal *cal,
@@ -476,37 +511,21 @@ e_cal_backend_ews_get_timezone (ECalBackend *backend,
slashes++;
}
- if (slashes == 1) {
- icalcomponent *icalcomp = NULL, *free_comp = NULL;
+ if (slashes == 1)
+ object = cal_backend_ews_get_builtin_zone_object (tzid);
- icaltimezone *zone = icaltimezone_get_builtin_timezone (tzid);
- if (!zone) {
- icalcomp = free_comp = icaltzutil_fetch_timezone (tzid);
+ if (!object) {
+ /* The timezone can be sometimes the Windows zone, try to convert it to libical */
+ const gchar *ical_location = e_cal_backend_ews_tz_util_get_ical_equivalent (tzid);
+ if (ical_location) {
+ object = cal_backend_ews_get_builtin_zone_object (ical_location);
}
-
- if (zone)
- icalcomp = icaltimezone_get_component (zone);
-
- if (icalcomp) {
- icalcomponent *clone = icalcomponent_new_clone (icalcomp);
- icalproperty *prop;
-
- prop = icalcomponent_get_first_property (clone, ICAL_TZID_PROPERTY);
- if (prop) {
- /* change tzid to our, because the component has the buildin tzid */
- icalproperty_set_tzid (prop, tzid);
-
- object = icalcomponent_as_ical_string_r (clone);
- g_clear_error (&error);
- }
- icalcomponent_free (clone);
- }
-
- if (free_comp)
- icalcomponent_free (free_comp);
}
}
+ if (!object && !error)
+ g_propagate_error (&error, e_data_cal_create_error (ObjectNotFound, NULL));
+
convert_error_to_edc_error (&error);
e_data_cal_respond_get_timezone (cal, context, error, object);
g_free (object);
diff --git a/src/calendar/windowsZones.xml b/src/calendar/windowsZones.xml
index ce1fdc4..d3d197d 100644
--- a/src/calendar/windowsZones.xml
+++ b/src/calendar/windowsZones.xml
@@ -471,7 +471,7 @@ For terms of use, see http://www.unicode.org/copyright.html
<mapZone other="Pakistan Standard Time" territory="PK" type="Asia/Karachi"/>
<!-- (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi -->
- <mapZone other="India Standard Time" territory="001" type="Asia/Calcutta"/>
+ <mapZone other="India Standard Time" territory="001" type="Asia/Kolkata"/>
<mapZone other="India Standard Time" territory="IN" type="Asia/Calcutta"/>
<!-- (UTC+05:30) Sri Jayawardenepura -->
@@ -648,13 +648,6 @@ For terms of use, see http://www.unicode.org/copyright.html
<!-- (UTC+13:00) Samoa -->
<mapZone other="Samoa Standard Time" territory="001" type="Pacific/Apia"/>
<mapZone other="Samoa Standard Time" territory="WS" type="Pacific/Apia"/>
-
- <!-- Internal fixes -->
- <mapZone other="Argentina Standard Time" territory="AR"
type="America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Jujuy
America/Argentina/Catamarca America/Argentina/Mendoza"/>
- <mapZone other="India Standard Time" territory="IN" type="Asia/Kolkata"/>
- <mapZone other="Nepal Standard Time" territory="NP" type="Asia/Kathmandu"/>
- <mapZone other="Eastern Standard Time" territory="US"
type="America/Kentucky/Louisville"/>
- <mapZone other="US Eastern Standard Time" territory="US"
type="America/Indiana/Indianapolis"/>
</mapTimezones>
</windowsZones>
</supplementalData>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]