summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-12-14 07:46:32 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2018-01-03 10:39:13 +0100
commitd5ecc1b468b7c2582e0aca8341c23ab76fd1a1bd (patch)
tree3eca97bac93d05ec74faaf3f9699c8ce30db1652
parent7a2c76607de71883c1f27ddc19ff3e392f1a0b11 (diff)
libical: support libical v3 (FDO #104220)
libical v3 removes some deprecated functions (like icaltime_from_timet) and removes the "is_utc" member from icaltimetype. The replacement code works with old and new libical and thus needs no ifdefs. However, that struct is part of the ABI, which impacts the tricks that syncevolution.org binaries use to get built against libical v2 and then run with more recent libs like libical v3. Depending on the platform ABI, it may still be okay, because the calling code in SyncEvolution reserves and copies enough bytes for the icaltimetype instances and because that code never directly accesses any member (is_date, is_daylight, zone) whose offset changes. Original author: Milan Crha <mcrha@redhat.com> Slightly modified it so that icaltime_t.zone is not set. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--src/backends/webdav/CalDAVSource.cpp3
-rw-r--r--src/syncevo/icaltz-util.c10
2 files changed, 6 insertions, 7 deletions
diff --git a/src/backends/webdav/CalDAVSource.cpp b/src/backends/webdav/CalDAVSource.cpp
index fa16935a..9c4a1c8d 100644
--- a/src/backends/webdav/CalDAVSource.cpp
+++ b/src/backends/webdav/CalDAVSource.cpp
@@ -721,8 +721,7 @@ SubSyncSource::SubItemResult CalDAVSource::insertSubItem(const std::string &luid
eptr<icalcomponent> fullcal = event.m_calendar;
loadItem(event);
event.m_sequence++;
- lastmodtime = icaltime_from_timet(event.m_lastmodtime, false);
- lastmodtime.is_utc = 1;
+ lastmodtime = icaltime_from_timet_with_zone(event.m_lastmodtime, false, icaltimezone_get_utc_timezone());
event.m_calendar = fullcal;
for (icalcomponent *comp = icalcomponent_get_first_component(event.m_calendar, ICAL_VEVENT_COMPONENT);
comp;
diff --git a/src/syncevo/icaltz-util.c b/src/syncevo/icaltz-util.c
index 202a2cd9..abb9a758 100644
--- a/src/syncevo/icaltz-util.c
+++ b/src/syncevo/icaltz-util.c
@@ -224,7 +224,7 @@ find_transidx (time_t *transitions, ttinfo *types, int *trans_idx, long int num_
struct icaltimetype itime;
now = time (NULL);
- itime = icaltime_from_timet (now, 0);
+ itime = icaltime_from_timet_with_zone (now, 0, NULL);
itime.month = itime.day = 1;
itime.hour = itime.minute = itime.second = 0;
year_start = icaltime_as_timet(itime);
@@ -304,13 +304,13 @@ adjust_dtstart_day_to_rrule (icalcomponent *comp, struct icalrecurrencetype rule
icalrecur_iterator *iter;
now = time (NULL);
- itime = icaltime_from_timet (now, 0);
+ itime = icaltime_from_timet_with_zone (now, 0, NULL);
itime.month = itime.day = 1;
itime.hour = itime.minute = itime.second = 0;
year_start = icaltime_as_timet(itime);
comp_start = icalcomponent_get_dtstart (comp);
- start = icaltime_from_timet (year_start, 0);
+ start = icaltime_from_timet_with_zone (year_start, 0, NULL);
iter = icalrecur_iterator_new (rule, start);
iter_start = icalrecur_iterator_next (iter);
@@ -478,7 +478,7 @@ icaltzutil_fetch_timezone (const char *location)
trans = transitions [stdidx] + types [zp_idx].gmtoff;
else
trans = types [zp_idx].gmtoff;
- icaltime = icaltime_from_timet (trans, 0);
+ icaltime = icaltime_from_timet_with_zone (trans, 0, NULL);
dtstart = icaltime;
dtstart.year = 1970;
dtstart.minute = dtstart.second = 0;
@@ -520,7 +520,7 @@ icaltzutil_fetch_timezone (const char *location)
trans = transitions [dstidx] + types [zp_idx].gmtoff;
else
trans = types [zp_idx].gmtoff;
- icaltime = icaltime_from_timet (trans, 0);
+ icaltime = icaltime_from_timet_with_zone (trans, 0, NULL);
dtstart = icaltime;
dtstart.year = 1970;
dtstart.minute = dtstart.second = 0;