[evolution-activesync/for-master/allday: 4/4] _eas2ical_convert_datetime_property: if time for all day event fails sanity check (not midnight), do



commit 1b8959e29b286fc5682b2849a57f40dcf4bc4d6f
Author: Graham R. Cobb <g+syncevolution cobb uk net>
Date:   Wed Oct 29 18:28:21 2014 +0000

    _eas2ical_convert_datetime_property: if time for all day event fails sanity check (not midnight), do not 
use "date only" time format.
    
    In some circumstances Exchange supplies the wrong timezone information for an
    all day event, so the apparent local time of the event is not midnight. In that
    case there is little we can do -- we do not know which way the time should be
    adjusted, so we do not know on which day the event was intended to fall.
    
    So, in that case, we include the time in the data (not just the date) in the
    hopes that this provides the user with more information to determine the
    correct day.  In most software, this results in the event not being treated
    as an "all day" event but that is better than appearing as an all day event on
    the wrong day.

 eas-daemon/libeas/eas-cal-info-translator.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/eas-daemon/libeas/eas-cal-info-translator.c b/eas-daemon/libeas/eas-cal-info-translator.c
index 16581fa..51bccb9 100644
--- a/eas-daemon/libeas/eas-cal-info-translator.c
+++ b/eas-daemon/libeas/eas-cal-info-translator.c
@@ -481,14 +481,15 @@ static gboolean _eas2ical_convert_datetime_property(icalproperty *prop,
                        if (tt.hour || tt.minute || tt.second)
                                g_warning("All day event with no timezone does not start at UTC midnight: 
%s", icaltime_as_ical_string_r(tt));
                }
-               if (isAllDayEvent)
+               // If the sanity check (see above) failed, don't mark as a date
+               if (isAllDayEvent && !tt.hour && !tt.minute && !tt.second)
                        tt.is_date = 1;
                set (prop, tt);
 
-               // All-day events can and should be defined in local time without time zone.
+               // Date-based events can and should be defined in local time without time zone.
                // UTC time stamps don't need a TZID.
                if (icaltz &&
-                   !isAllDayEvent &&
+                   !tt.is_date &&
                    !icaltime_is_utc (tt)) {
                        const char *tzid = icaltimezone_get_tzid (icaltz);
                        if (tzid && strlen (tzid)) {


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