[evolution-ews/gnome-40] Calendar: Clamp the timezone component when saving meeting time



commit 14ad1c80805bf6128e0d2c864bfb39947dee4a28
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 4 12:54:59 2021 +0200

    Calendar: Clamp the timezone component when saving meeting time
    
    This is relevant only for 2007 servers, where the time zone is constructed
    from the libical component. The 3.0.10 timezone read fixes uncovered this
    issue for some time zones (like America/New_York). By the clamp only
    the relevant part will be provided to the server, which fixes the issue.

 src/EWS/calendar/e-cal-backend-ews-utils.c | 17 +++++++++++------
 src/EWS/calendar/e-cal-backend-ews-utils.h |  2 +-
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/EWS/calendar/e-cal-backend-ews-utils.c b/src/EWS/calendar/e-cal-backend-ews-utils.c
index d9d016f6..817f4b75 100644
--- a/src/EWS/calendar/e-cal-backend-ews-utils.c
+++ b/src/EWS/calendar/e-cal-backend-ews-utils.c
@@ -641,9 +641,10 @@ ewscal_set_timezone (ESoapMessage *msg,
 
 void
 ewscal_set_meeting_timezone (ESoapMessage *msg,
-                            ICalTimezone *icaltz)
+                            ICalTimezone *icaltz,
+                            ICalComponent *icomp)
 {
-       ICalComponent *comp;
+       ICalComponent *comp, *copy;
        ICalComponent *xstd, *xdaylight;
        ICalDuration *duration;
        const gchar *location;
@@ -657,14 +658,18 @@ ewscal_set_meeting_timezone (ESoapMessage *msg,
        if (!comp)
                return;
 
+       /* Clamp the time zone component, to get the relevant part only */
+       copy = i_cal_component_clone (comp);
+       g_clear_object (&comp);
+       comp = copy;
+       e_cal_util_clamp_vtimezone_by_component (comp, icomp);
+
        /* Exchange needs a BaseOffset, followed by either *both*
         * Standard and Daylight zones, or neither of them. If there's
         * more than one STANDARD or DAYLIGHT component in the VTIMEZONE,
         * we ignore the extra. So fully-specified timezones including
         * historical DST rules cannot be handled by Exchange. */
 
-       /* FIXME: Walk through them all to find the *latest* ones, like
-        * i_cal_timezone_get_tznames_from_vtimezone() does. */
        xstd = i_cal_component_get_first_component (comp, I_CAL_XSTANDARD_COMPONENT);
        xdaylight = i_cal_component_get_first_component (comp, I_CAL_XDAYLIGHT_COMPONENT);
 
@@ -1284,7 +1289,7 @@ convert_vevent_calcomp_to_xml (ESoapMessage *msg,
        } else {
                e_ews_message_replace_server_version (msg, E_EWS_EXCHANGE_2007_SP1);
 
-               ewscal_set_meeting_timezone (msg, tzid_start);
+               ewscal_set_meeting_timezone (msg, tzid_start, icomp);
        }
 
        e_soap_message_end_element (msg); /* "CalendarItem" */
@@ -1836,7 +1841,7 @@ convert_vevent_component_to_updatexml (ESoapMessage *msg,
                e_ews_message_replace_server_version (msg, E_EWS_EXCHANGE_2007_SP1);
 
                e_ews_message_start_set_item_field (msg, "MeetingTimeZone", "calendar", "CalendarItem");
-               ewscal_set_meeting_timezone (msg, tzid_start ? tzid_start : convert_data->default_zone);
+               ewscal_set_meeting_timezone (msg, tzid_start ? tzid_start : convert_data->default_zone, 
icomp);
                e_ews_message_end_set_item_field (msg);
        }
 
diff --git a/src/EWS/calendar/e-cal-backend-ews-utils.h b/src/EWS/calendar/e-cal-backend-ews-utils.h
index 2f0da704..7b84911c 100644
--- a/src/EWS/calendar/e-cal-backend-ews-utils.h
+++ b/src/EWS/calendar/e-cal-backend-ews-utils.h
@@ -42,7 +42,7 @@ const gchar *e_ews_collect_organizer (ICalComponent *comp);
 void e_ews_collect_attendees (ICalComponent *comp, GSList **required, GSList **optional, GSList **resource, 
gboolean *out_rsvp_requested);
 
 void ewscal_set_timezone (ESoapMessage *msg, const gchar *name, EEwsCalendarTimeZoneDefinition *tzd);
-void ewscal_set_meeting_timezone (ESoapMessage *msg, ICalTimezone *icaltz);
+void ewscal_set_meeting_timezone (ESoapMessage *msg, ICalTimezone *icaltz, ICalComponent *icomp);
 void ewscal_set_reccurence (ESoapMessage *msg, ICalProperty *rrule, ICalTime *dtstart);
 void ewscal_set_reccurence_exceptions (ESoapMessage *msg, ICalComponent *comp);
 gchar *e_ews_extract_attachment_id_from_uri (const gchar *uri);


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