[evolution-data-server] Calendar: Adapt to libical 3.0.12 change



commit 17e0cde509e29634d841e52f4213545fb95a5c0b
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 5 11:33:14 2022 +0100

    Calendar: Adapt to libical 3.0.12 change
    
    The behavior of the i_cal_component_get_dtend() changed after [1],
    which causes a failure of the internal tests. This commit makes
    the code work the same for the 3.0.12 and previous libical
    versions, also by reading the DTEND only for a VEVENT component.
    
    [1] https://github.com/libical/libical/pull/519

 src/calendar/libecal/e-cal-recur.c |  2 +-
 src/calendar/libecal/e-cal-util.c  | 18 ++++++++++--------
 2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-recur.c b/src/calendar/libecal/e-cal-recur.c
index c23cc59f4..642151e7d 100644
--- a/src/calendar/libecal/e-cal-recur.c
+++ b/src/calendar/libecal/e-cal-recur.c
@@ -423,7 +423,7 @@ e_cal_recur_generate_instances_sync (ICalComponent *icalcomp,
                get_tz_callback, get_tz_callback_user_data, default_timezone, &cached_zones, cancellable, 
error);
 
        duration_seconds = 0;
-       dtend = i_cal_component_get_dtend (icalcomp);
+       dtend = i_cal_component_isa (icalcomp) == I_CAL_VEVENT_COMPONENT ? i_cal_component_get_dtend 
(icalcomp) : NULL;
 
        if (!dtend || i_cal_time_is_null_time (dtend)) {
                g_clear_object (&dtend);
diff --git a/src/calendar/libecal/e-cal-util.c b/src/calendar/libecal/e-cal-util.c
index 8e064cdfa..2db174f99 100644
--- a/src/calendar/libecal/e-cal-util.c
+++ b/src/calendar/libecal/e-cal-util.c
@@ -3145,12 +3145,13 @@ e_cal_util_clamp_vtimezone_by_component (ICalComponent *vtimezone,
 
                recurid = i_cal_property_get_recurrenceid (prop);
 
-               dtend = i_cal_component_get_dtend (component);
+               dtend = i_cal_component_isa (component) == I_CAL_VEVENT_COMPONENT ? i_cal_component_get_dtend 
(component) : NULL;
 
-               if (dtend && (i_cal_time_is_null_time (dtend) || !i_cal_time_is_valid_time (dtend))) {
-                       g_object_unref (dtend);
+               if (dtend && (i_cal_time_is_null_time (dtend) || !i_cal_time_is_valid_time (dtend)))
+                       g_clear_object (&dtend);
+
+               if (!dtend)
                        dtend = i_cal_component_get_due (component);
-               }
 
                if (dtend && i_cal_time_compare (recurid, dtend) >= 0) {
                        g_clear_object (&dtend);
@@ -3161,12 +3162,13 @@ e_cal_util_clamp_vtimezone_by_component (ICalComponent *vtimezone,
                g_clear_object (&recurid);
                g_object_unref (prop);
        } else if (!e_cal_util_component_has_rrules (component)) {
-               dtend = i_cal_component_get_dtend (component);
+               dtend = i_cal_component_isa (component) == I_CAL_VEVENT_COMPONENT ? i_cal_component_get_dtend 
(component) : NULL;
 
-               if (dtend && (i_cal_time_is_null_time (dtend) || !i_cal_time_is_valid_time (dtend))) {
-                       g_object_unref (dtend);
+               if (dtend && (i_cal_time_is_null_time (dtend) || !i_cal_time_is_valid_time (dtend)))
+                       g_clear_object (&dtend);
+
+               if (!dtend)
                        dtend = i_cal_component_get_due (component);
-               }
 
                if (dtend && (i_cal_time_is_null_time (dtend) || !i_cal_time_is_valid_time (dtend)))
                        g_clear_object (&dtend);


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