[evolution-ews/gnome-3-36] I#99 - All-day events date shown by one day off
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews/gnome-3-36] I#99 - All-day events date shown by one day off
- Date: Wed, 13 May 2020 15:28:31 +0000 (UTC)
commit 3857adf5c6213ed58ecd9372d86f30f0e5f77cb3
Author: Milan Crha <mcrha redhat com>
Date: Wed May 13 17:30:51 2020 +0200
I#99 - All-day events date shown by one day off
Closes https://gitlab.gnome.org/GNOME/evolution-ews/-/issues/99
src/calendar/e-cal-backend-ews-utils.c | 24 ++++++++++++---------
src/calendar/e-cal-backend-ews.c | 38 +++++++++++++++++++++++++++-------
2 files changed, 44 insertions(+), 18 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index 2bab8fd2..b21e870e 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -1654,7 +1654,8 @@ convert_vevent_component_to_updatexml (ESoapMessage *msg,
/*meeting dates*/
dtstart = e_cal_backend_ews_get_datetime_with_zone (convert_data->timezone_cache,
convert_data->vcalendar, icomp, I_CAL_DTSTART_PROPERTY, i_cal_property_get_dtstart);
dtstart_old = e_cal_backend_ews_get_datetime_with_zone (convert_data->timezone_cache,
convert_data->vcalendar, icomp_old, I_CAL_DTSTART_PROPERTY, i_cal_property_get_dtstart);
- dt_start_changed = dtstart != dtstart_old || (dtstart && dtstart_old && i_cal_time_compare (dtstart,
dtstart_old) != 0);
+ dt_start_changed = ((!dtstart || !dtstart_old) && dtstart != dtstart_old) ||
+ (dtstart && dtstart_old && i_cal_time_compare (dtstart, dtstart_old) != 0);
tzid_start = dtstart ? i_cal_time_get_timezone (dtstart) : NULL;
if (tzid_start) {
ICalTimezone *zone;
@@ -1670,7 +1671,8 @@ convert_vevent_component_to_updatexml (ESoapMessage *msg,
dtend = e_cal_backend_ews_get_datetime_with_zone (convert_data->timezone_cache,
convert_data->vcalendar, icomp, I_CAL_DTEND_PROPERTY, i_cal_property_get_dtend);
dtend_old = e_cal_backend_ews_get_datetime_with_zone (convert_data->timezone_cache,
convert_data->vcalendar, icomp_old, I_CAL_DTEND_PROPERTY, i_cal_property_get_dtend);
- dt_end_changed = dtend != dtend_old || (dtend && dtend_old && i_cal_time_compare (dtend, dtend_old)
!= 0);
+ dt_end_changed = ((!dtend || !dtend_old) && dtend != dtend_old) ||
+ (dtend && dtend_old && i_cal_time_compare (dtend, dtend_old) != 0);
tzid_end = dtend ? i_cal_time_get_timezone (dtend) : NULL;
if (tzid_end) {
ICalTimezone *zone;
@@ -1687,21 +1689,23 @@ convert_vevent_component_to_updatexml (ESoapMessage *msg,
satisfies = e_ews_connection_satisfies_server_version (convert_data->connection, E_EWS_EXCHANGE_2010);
if (satisfies) {
- if (old_ical_location_start != NULL) {
+ if (old_ical_location_start)
old_msdn_location_start = e_cal_backend_ews_tz_util_get_msdn_equivalent
(old_ical_location_start);
+
+ if (ical_location_start)
msdn_location_start = e_cal_backend_ews_tz_util_get_msdn_equivalent
(ical_location_start);
- if (g_strcmp0 (old_msdn_location_start, msdn_location_start) != 0)
- dt_start_changed = TRUE;
- }
+ if (g_strcmp0 (old_msdn_location_start, msdn_location_start) != 0)
+ dt_start_changed = TRUE;
- if (old_ical_location_end != NULL) {
+ if (old_ical_location_end)
old_msdn_location_end = e_cal_backend_ews_tz_util_get_msdn_equivalent
(old_ical_location_end);
+
+ if (ical_location_end)
msdn_location_end = e_cal_backend_ews_tz_util_get_msdn_equivalent (ical_location_end);
- if (g_strcmp0 (old_msdn_location_end, msdn_location_end) != 0)
- dt_end_changed = TRUE;
- }
+ if (g_strcmp0 (old_msdn_location_end, msdn_location_end) != 0)
+ dt_end_changed = TRUE;
if ((dt_start_changed || dt_start_changed_timezone_name) && ical_location_start != NULL)
e_ews_message_add_set_item_field_extended_distinguished_name_string (
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 443839c4..dfd02fa4 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -387,6 +387,12 @@ ecb_ews_maybe_update_datetime (ETimezoneCache *timezone_cache,
dt = e_cal_backend_ews_get_datetime_with_zone (timezone_cache, vcomp, icomp, prop_kind, get_func);
+ if (i_cal_time_is_date (dt)) {
+ g_clear_object (&prop);
+ g_clear_object (&dt);
+ return;
+ }
+
val = i_cal_time_new_from_timet_with_zone (utc_value, i_cal_time_is_date (dt),
i_cal_timezone_get_utc_timezone ());
i_cal_time_convert_to_zone_inplace (val, i_cal_time_get_timezone (dt));
set_func (prop, val);
@@ -728,8 +734,12 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
if (start_zone != NULL) {
dt = e_cal_backend_ews_get_datetime_with_zone (timezone_cache, vcomp, icomp,
I_CAL_DTSTART_PROPERTY, i_cal_property_get_dtstart);
- i_cal_time_convert_to_zone_inplace (dt, start_zone);
- i_cal_component_set_dtstart (icomp, dt);
+
+ if (!i_cal_time_is_date (dt)) {
+ i_cal_time_convert_to_zone_inplace (dt, start_zone);
+ i_cal_component_set_dtstart (icomp, dt);
+ }
+
g_clear_object (&dt);
timezone_set = TRUE;
@@ -737,8 +747,12 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
if (end_zone != NULL) {
dt = e_cal_backend_ews_get_datetime_with_zone (timezone_cache, vcomp,
icomp, I_CAL_DTEND_PROPERTY, i_cal_property_get_dtend);
- i_cal_time_convert_to_zone_inplace (dt, end_zone);
- i_cal_component_set_dtend (icomp, dt);
+
+ if (!i_cal_time_is_date (dt)) {
+ i_cal_time_convert_to_zone_inplace (dt, end_zone);
+ i_cal_component_set_dtend (icomp, dt);
+ }
+
g_clear_object (&dt);
e_timezone_cache_add_timezone (timezone_cache, end_zone);
@@ -811,13 +825,21 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
if (zone != NULL) {
dt = e_cal_backend_ews_get_datetime_with_zone (timezone_cache, vcomp, icomp,
I_CAL_DTSTART_PROPERTY, i_cal_property_get_dtstart);
- i_cal_time_convert_to_zone_inplace (dt, zone);
- i_cal_component_set_dtstart (icomp, dt);
+
+ if (!i_cal_time_is_date (dt)) {
+ i_cal_time_convert_to_zone_inplace (dt, zone);
+ i_cal_component_set_dtstart (icomp, dt);
+ }
+
g_object_unref (dt);
dt = e_cal_backend_ews_get_datetime_with_zone (timezone_cache, vcomp, icomp,
I_CAL_DTEND_PROPERTY, i_cal_property_get_dtend);
- i_cal_time_convert_to_zone_inplace (dt, zone);
- i_cal_component_set_dtend (icomp, dt);
+
+ if (!i_cal_time_is_date (dt)) {
+ i_cal_time_convert_to_zone_inplace (dt, zone);
+ i_cal_component_set_dtend (icomp, dt);
+ }
+
g_object_unref (dt);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]