Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:jberkman
evolution-exchange-2.6
bnc-254525-update-latest-zones.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc-254525-update-latest-zones.diff of Package evolution-exchange-2.6
Index: calendar/e-cal-backend-exchange.c =================================================================== --- calendar/e-cal-backend-exchange.c (revision 1330) +++ calendar/e-cal-backend-exchange.c (working copy) @@ -1094,6 +1094,27 @@ return priv->default_timezone; } +static icaltimetype +get_timestamp_from_tzcomp (icalcomponent *icalcomp) +{ + icalproperty *icalprop; + icaltimetype dtstamp = icaltime_null_time (); + + for (icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); icalprop != NULL; + icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY)) { + const char *name = icalproperty_get_x_name (icalprop); + + if (name && g_str_equal (name, "X-EVOLUTION-TZ-TIMESTAMP")) { + const char *value = icalproperty_get_x (icalprop); + dtstamp = icaltime_from_string (value); + break; + } + } + + return dtstamp; +} + + ECalBackendSyncStatus e_cal_backend_exchange_add_timezone (ECalBackendExchange *cbex, icalcomponent *vtzcomp) @@ -1109,9 +1130,19 @@ return GNOME_Evolution_Calendar_InvalidObject; tzid = icalproperty_get_tzid (prop); d(printf("ecbe_add_timezone: tzid = %s\n", tzid)); - if (g_hash_table_lookup (cbex->priv->timezones, tzid)) - return GNOME_Evolution_Calendar_ObjectIdAlreadyExists; + if ((zone = g_hash_table_lookup (cbex->priv->timezones, tzid))) { + icalcomponent *tzcomp_old; + icaltimetype dtstamp_old, dtstamp_new; + tzcomp_old = icaltimezone_get_component (zone); + + dtstamp_old = get_timestamp_from_tzcomp (tzcomp_old); + dtstamp_new = get_timestamp_from_tzcomp (vtzcomp); + + if (icaltime_is_null_time (dtstamp_new) || (!icaltime_is_null_time (dtstamp_old) && icaltime_compare (dtstamp_new, dtstamp_old) <= 0)) + return GNOME_Evolution_Calendar_ObjectIdAlreadyExists; + } + zone = icaltimezone_new (); if (!icaltimezone_set_component (zone, icalcomponent_new_clone (vtzcomp))) { icaltimezone_free (zone, TRUE); Index: calendar/e-cal-backend-exchange-calendar.c =================================================================== --- calendar/e-cal-backend-exchange-calendar.c (revision 1330) +++ calendar/e-cal-backend-exchange-calendar.c (working copy) @@ -65,12 +65,25 @@ static void update_x_properties (ECalBackendExchange *cbex, ECalComponent *comp); static void -add_timezones_from_comp (ECalBackendExchange *cbex, icalcomponent *icalcomp) +add_timestamp_to_tzcomp (icalcomponent *tzcomp, icaltimetype dtstamp) { + icalproperty *icalprop; + const char *timestamp; + + timestamp = icaltime_as_ical_string (dtstamp); + icalprop = icalproperty_new_x (timestamp); + icalproperty_set_x_name (icalprop, "X-EVOLUTION-TZ-TIMESTAMP"); + icalcomponent_add_property (tzcomp, icalprop); +} + +static void +add_timezones_from_comp (ECalBackendExchange *cbex, icalcomponent *icalcomp, icaltimetype dtstamp) +{ icalcomponent *subcomp; switch (icalcomponent_isa (icalcomp)) { case ICAL_VTIMEZONE_COMPONENT: + add_timestamp_to_tzcomp (icalcomp, dtstamp); e_cal_backend_exchange_add_timezone (cbex, icalcomp); break; @@ -78,6 +91,7 @@ subcomp = icalcomponent_get_first_component ( icalcomp, ICAL_VTIMEZONE_COMPONENT); while (subcomp) { + add_timestamp_to_tzcomp (subcomp, dtstamp); e_cal_backend_exchange_add_timezone (cbex, subcomp); subcomp = icalcomponent_get_next_component ( icalcomp, ICAL_VTIMEZONE_COMPONENT); @@ -196,6 +210,7 @@ GSList *attachment_list = NULL; gboolean status; ECalBackend *backend = E_CAL_BACKEND (cbex); + icaltimetype dtstamp; /* Check for attachments */ if (uid) @@ -250,11 +265,15 @@ } return FALSE; } + - add_timezones_from_comp (cbex, icalcomp); - subcomp = icalcomponent_get_first_component ( icalcomp, ICAL_VEVENT_COMPONENT); + + /* Add the timezones with the dtstamp */ + dtstamp = icalcomponent_get_dtstamp (subcomp); + add_timezones_from_comp (cbex, icalcomp, dtstamp); + while (subcomp) { if (uid && !strcmp (uid, icalcomponent_get_uid (subcomp)) && attachment_list) { ecomp = e_cal_component_new (); @@ -1538,7 +1557,7 @@ ECalBackendExchangeComponent *ecomp; ECalComponent *comp = NULL; GList *comps, *l; - struct icaltimetype current; + struct icaltimetype current, dtstamp; icalproperty_method method; icalcomponent *subcomp, *icalcomp; ECalBackendSyncStatus status = GNOME_Evolution_Calendar_Success; @@ -1558,9 +1577,13 @@ status = e_cal_backend_exchange_extract_components (calobj, &method, &comps); if (status != GNOME_Evolution_Calendar_Success) return GNOME_Evolution_Calendar_InvalidObject; - + + dtstamp = icaltime_null_time (); + if (comps && comps->data) + dtstamp = icalcomponent_get_dtstamp (comps->data); + icalcomp = icalparser_parse_string (calobj); - add_timezones_from_comp (E_CAL_BACKEND_EXCHANGE (backend), icalcomp); + add_timezones_from_comp (E_CAL_BACKEND_EXCHANGE (backend), icalcomp, dtstamp); icalcomponent_free (icalcomp); for (l = comps; l; l= l->next) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor