From c27a1c5252e7429fc620792ec155567601293904 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Fri, 23 Sep 2022 00:28:59 +0200 Subject: [PATCH] oxcical: avoid emitting allday as YMD when no tzinfo is present The logical day on which an allday event occurs is determined by applying timezone shift to the timepoint in PR_START_DATE. Without timezone information, that's not computable. Fixes: gromox-0~666 Refrences: GXL-323 --- lib/mapi/oxcical.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mapi/oxcical.cpp b/lib/mapi/oxcical.cpp index dc7c6c31f..e4152ed91 100644 --- a/lib/mapi/oxcical.cpp +++ b/lib/mapi/oxcical.cpp @@ -3571,7 +3571,7 @@ static const char *oxcical_export_internal(const char *method, const char *tzid, if (!ical_utc_to_datetime(ptz_component, start_time, &itime)) return "E-2221"; char tmp_buff[1024]; - if (b_allday && g_oxcical_allday_ymd) + if (b_allday && g_oxcical_allday_ymd && ptz_component != nullptr) sprintf_dt(tmp_buff, std::size(tmp_buff), itime); else if (ptz_component != nullptr) sprintf_dtlcl(tmp_buff, std::size(tmp_buff), itime); @@ -3579,7 +3579,7 @@ static const char *oxcical_export_internal(const char *method, const char *tzid, sprintf_dtutc(tmp_buff, std::size(tmp_buff), itime); auto &pilineDTS = pcomponent->append_line("DTSTART", tmp_buff); - if (b_allday && g_oxcical_allday_ymd) + if (b_allday && g_oxcical_allday_ymd && ptz_component != nullptr) pilineDTS.append_param("VALUE", "DATE"); else if (ptz_component != nullptr) pilineDTS.append_param("TZID", tzid); @@ -3587,14 +3587,14 @@ static const char *oxcical_export_internal(const char *method, const char *tzid, if (start_time != end_time) { if (!ical_utc_to_datetime(ptz_component, end_time, &itime)) return "E-2222"; - if (b_allday && g_oxcical_allday_ymd) + if (b_allday && g_oxcical_allday_ymd && ptz_component != nullptr) sprintf_dt(tmp_buff, std::size(tmp_buff), itime); else if (ptz_component != nullptr) sprintf_dtlcl(tmp_buff, std::size(tmp_buff), itime); else sprintf_dtutc(tmp_buff, std::size(tmp_buff), itime); auto piline = &pcomponent->append_line("DTEND", tmp_buff); - if (b_allday && g_oxcical_allday_ymd) + if (b_allday && g_oxcical_allday_ymd && ptz_component != nullptr) piline->append_param("VALUE", "DATE"); else if (ptz_component != nullptr) piline->append_param("TZID", tzid);