public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Martin Osvald <mosvald@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/cyrus-imapd] rawhide: Adapt to libical 4.x API changes (rhbz#2523444)
Date: Thu, 05 Nov 2026 16:09:35 GMT [thread overview]
Message-ID: <179389497522.1.15158808804294864701.rpms-cyrus-imapd-9d75a6e9d599@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/cyrus-imapd
Branch : rawhide
Commit : 9d75a6e9d599348f313716ebe6e5db5c2b38b7f2
Author : Martin Osvald <mosvald@redhat.com>
Date : 2026-10-12T15:51:49+02:00
Stats : +1404/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/cyrus-imapd/c/9d75a6e9d599348f313716ebe6e5db5c2b38b7f2?branch=rawhide
Log:
Adapt to libical 4.x API changes (rhbz#2523444)
---
diff --git a/cyrus-imapd-3.12.4-libical4-api.patch b/cyrus-imapd-3.12.4-libical4-api.patch
new file mode 100644
index 0000000..b1e29f5
--- /dev/null
+++ b/cyrus-imapd-3.12.4-libical4-api.patch
@@ -0,0 +1,1401 @@
+diff --git a/cassandane/data/icalendar/floatingtzid.ics b/cassandane/data/icalendar/floatingtzid.ics
+deleted file mode 100644
+index 95fc363e7..000000000
+--- a/cassandane/data/icalendar/floatingtzid.ics
++++ /dev/null
+@@ -1,17 +0,0 @@
+-BEGIN:VCALENDAR
+-VERSION:2.0
+-PRODID:-//Apple Inc.//Mac OS X 10.9.5//EN
+-CALSCALE:GREGORIAN
+-BEGIN:VEVENT
+-TRANSP:TRANSPARENT
+-DTSTART:20190310T111500
+-DTEND;TZID=Europe/Amsterdam:20190310T130000
+-UID:2a358cee-6489-4f14-a57f-c104db4dc357
+-DTSTAMP:20150928T132434Z
+-CREATED:20150928T125212Z
+-SEQUENCE:9
+-SUMMARY:floatingtzid
+-LAST-MODIFIED:20150928T132434Z
+-END:VEVENT
+-END:VCALENDAR
+-
+diff --git a/cassandane/tiny-tests/Carddav/bulk_import_export b/cassandane/tiny-tests/Carddav/bulk_import_export
+index fea9ade78..e0df4ee64 100644
+--- a/cassandane/tiny-tests/Carddav/bulk_import_export
++++ b/cassandane/tiny-tests/Carddav/bulk_import_export
+@@ -8,7 +8,7 @@ sub test_bulk_import_export
+ my $CardDAV = $self->{carddav};
+ my $Id = $CardDAV->NewAddressBook('foo');
+
+- my $uid1 = "3b678b69-ca41-461e-b2c7-f96b9fe48d68";
++ my $uid1 = "urn:uuid:3b678b69-ca41-461e-b2c7-f96b9fe48d68";
+ my $uid2 = "addr1\@example.com";
+ my $uid3 = "addr2\@example.com";
+
+@@ -35,7 +35,7 @@ END:VCARD
+ BEGIN:VCARD
+ VERSION:4.0
+ NICKNAME:eric
+-UID:urn:uuid:$uid1
++UID:$uid1
+ FN:Eric York
+ END:VCARD
+ EOF
+@@ -64,7 +64,7 @@ EOF
+
+ $xml = XMLin($res->{content});
+ $self->assert_str_equals($uid2, $xml->{'D:response'}[0]{'D:propstat'}{'D:prop'}{'CS:uid'});
+- $self->assert_str_equals("urn:uuid:$uid1", $xml->{'D:response'}[1]{'D:propstat'}{'D:prop'}{'CS:uid'});
++ $self->assert_str_equals($uid1, $xml->{'D:response'}[1]{'D:propstat'}{'D:prop'}{'CS:uid'});
+
+ xlog $self, "Export the vCards";
+ $res = $CardDAV->{ua}->request('GET', $CardDAV->request_url($Id), {
+diff --git a/cassandane/tiny-tests/Carddav/put_get_v3_v4 b/cassandane/tiny-tests/Carddav/put_get_v3_v4
+index 58674aa3b..5d6f23afb 100644
+--- a/cassandane/tiny-tests/Carddav/put_get_v3_v4
++++ b/cassandane/tiny-tests/Carddav/put_get_v3_v4
+@@ -70,7 +70,7 @@ EOF
+ 'Accept' => 'text/vcard; version=4.0');
+ my $newcard = $response->{content};
+ $newcard =~ s/\r?\n[ \t]+//gs; # unfold long properties
+- $self->assert_matches(qr/UID:urn:uuid:$uid/, $newcard);
++ $self->assert_matches(qr/UID(;VALUE=TEXT)?:$uid/, $newcard);
+ $self->assert_matches(qr/PHOTO;TYPE=$video:data:image\/gif;base64,$photo/,
+ $newcard);
+ $self->assert_matches(qr/LOGO;MEDIATYPE=image\/jpeg:$logo/, $newcard);
+diff --git a/cassandane/tiny-tests/JMAPCalendars/calendarevent_get_floatingtzid b/cassandane/tiny-tests/JMAPCalendars/calendarevent_get_floatingtzid
+deleted file mode 100644
+index 17c9b490d..000000000
+--- a/cassandane/tiny-tests/JMAPCalendars/calendarevent_get_floatingtzid
++++ /dev/null
+@@ -1,18 +0,0 @@
+-#!perl
+-use Cassandane::Tiny;
+-
+-sub test_calendarevent_get_floatingtzid
+- :min_version_3_1
+-{
+- my ($self) = @_;
+-
+- my ($id, $ical) = $self->icalfile('floatingtzid');
+-
+- # As seen in the wild: A floating DTSTART and a DTEND with TZID.
+-
+- my $event = $self->putandget_vevent($id, $ical);
+- $self->assert_not_null($event);
+- $self->assert_str_equals("2019-03-10T11:15:00", $event->{start});
+- $self->assert_str_equals("Europe/Amsterdam", $event->{timeZone});
+- $self->assert_str_equals("PT1H45M", $event->{duration});
+-}
+diff --git a/cassandane/tiny-tests/JMAPCalendars/calendarevent_utcstart_customtz b/cassandane/tiny-tests/JMAPCalendars/calendarevent_utcstart_customtz
+index 4e245eefc..c8897e5c8 100644
+--- a/cassandane/tiny-tests/JMAPCalendars/calendarevent_utcstart_customtz
++++ b/cassandane/tiny-tests/JMAPCalendars/calendarevent_utcstart_customtz
+@@ -76,7 +76,7 @@ EOF
+
+ # Floating event time falls back to custom calendar time zone.
+ $self->assert_str_equals('2019-12-01T07:30:00Z', $event->{utcStart});
+- $self->assert_str_equals('2019-12-01T12:30:00Z', $event->{utcEnd});
++ $self->assert_str_equals('2019-12-01T13:30:00Z', $event->{utcEnd});
+
+ # Assert event updates.
+ $res = $jmap->CallMethods([
+@@ -97,7 +97,7 @@ EOF
+ $event = $res->[1][1]{list}[0];
+ $self->assert_str_equals('2019-11-30T22:30:00', $event->{start});
+ $self->assert_str_equals('2019-12-01T06:30:00Z', $event->{utcStart});
+- $self->assert_str_equals('2019-12-01T11:30:00Z', $event->{utcEnd});
++ $self->assert_str_equals('2019-12-01T12:30:00Z', $event->{utcEnd});
+ $self->assert_null($event->{timeZone});
+ $self->assert_str_equals('PT6H', $event->{duration});
+ }
+diff --git a/cassandane/tiny-tests/JMAPContacts/card_get_v3 b/cassandane/tiny-tests/JMAPContacts/card_get_v3
+index 4d753d2f0..b955715cf 100644
+--- a/cassandane/tiny-tests/JMAPContacts/card_get_v3
++++ b/cassandane/tiny-tests/JMAPContacts/card_get_v3
+@@ -33,7 +33,7 @@ ORG;PROP-ID=O1:Bubba Gump Shrimp Co.;foo
+ TITLE;PROP-ID=T1:Shrimp Man
+ PHOTO;PROP-ID=P1;ENCODING=b;TYPE=JPEG:c29tZSBwaG90bw==
+ foo.ADR;PROP-ID=A1;JSCOMPS="s, ;2;3;4;5;6":;;1501 Broadway;New York;NY;10036;USA
+-foo.GEO:40.7571383482188;-73.98695548990568
++foo.GEO:40.757138348218;-73.98695548990
+ foo.TZ:-05:00
+ REV:2008-04-24T19:52:43Z
+ END:VCARD
+@@ -95,7 +95,7 @@ EOF
+ { kind => 'postcode', value => '10036' },
+ { kind => 'country', value => 'USA' }
+ ],
+- 'coordinates' => 'geo:40.7571383482188,-73.98695548990568',
++ 'coordinates' => 'geo:40.757138348218,-73.98695548990',
+ 'timeZone' => 'Etc/GMT+5'
+ }
+ },
+diff --git a/cassandane/tiny-tests/JMAPContacts/card_set_update b/cassandane/tiny-tests/JMAPContacts/card_set_update
+index 892395a63..470208ce2 100644
+--- a/cassandane/tiny-tests/JMAPContacts/card_set_update
++++ b/cassandane/tiny-tests/JMAPContacts/card_set_update
+@@ -155,7 +155,7 @@ sub test_card_set_update
+ $card = $res->{content};
+ $card =~ s/\r?\n[ \t]+//gs; # unfold long properties
+
+- $self->assert_matches(qr/UID:$id/, $card);
++ $self->assert_matches(qr/UID(;VALUE=TEXT)?:$id/, $card);
+ $self->assert_matches(qr/NICKNAME;PROP-ID=foo:Doey/, $card);
+ $self->assert_matches(qr/CATEGORIES:foo/, $card);
+ $self->assert_matches(qr/REV:/, $card);
+diff --git a/configure.ac b/configure.ac
+index ad6b8c195..8b996ccbd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1680,34 +1680,6 @@ dnl
+ ],
+ AC_MSG_ERROR([Need libical 3.0.10 for http]))
+
+- dnl libical may have been built without RSCALE support
+- AC_CHECK_LIB(ical, icalrecurrencetype_rscale_is_supported,
+- [AC_DEFINE(HAVE_RSCALE,[], [Build RSCALE support into httpd?])],
+- [AC_MSG_NOTICE([Your version of libical can not support non-gregorian recurrences])])
+-
+- dnl icalcomponent_clone will be new in libical 3.1.0
+- AC_CHECK_LIB(ical, icalcomponent_clone,
+- AC_DEFINE(HAVE_NEW_CLONE_API,[],
+- [Do we have support for new clone API?]))
+-
+- dnl ical_set_invalid_rrule_handling_setting will be new in libical 3.1.0
+- AC_CHECK_LIB(ical, ical_set_invalid_rrule_handling_setting,
+- AC_DEFINE(HAVE_INVALID_RRULE_HANDLING,[],
+- [Do we have support for controlling invalid RRULE handline?]))
+-
+- dnl icalcomponent_get_component_name will be new in libical 3.1.0
+- AC_CHECK_LIB(ical, icalcomponent_get_component_name,
+- AC_DEFINE(HAVE_GET_COMPONENT_NAME,[],
+- [Do we have support for fetching X- component names?]))
+-
+- dnl Check if libical parser allows setting CONTROL char handling
+- AC_CHECK_LIB(ical, icalparser_get_ctrl,
+- [
+- AC_DEFINE(HAVE_ICALPARSER_CTRL,[], [Can we omit CONTROL characters?])
+- have_ical_ctrl=yes
+- ],
+- have_ical_ctrl=no)
+-
+ dnl Check if libical supports PARTICIPANT-TYPE=VOTER
+ AC_CHECK_DECL([ICAL_PARTICIPANTTYPE_VOTER],
+ AC_DEFINE(HAVE_PARTTYPE_VOTER,[],
+@@ -2675,9 +2647,6 @@ Search engine:
+ xapian: $enable_xapian
+ xapian_cjk_tokens: $xapian_cjk_tokens
+
+-iCalendar features:
+- ctrl: $have_ical_ctrl
+-
+ Documentation dependencies:
+ sphinx-build: $SPHINX_BUILD
+ sphinx_rtd_theme: $HAVE_PYMOD_SPHINX_RTD_THEME
+diff --git a/imap/caldav_alarm.c b/imap/caldav_alarm.c
+index eb2504fb1..0e9d355c2 100644
+--- a/imap/caldav_alarm.c
++++ b/imap/caldav_alarm.c
+@@ -593,7 +593,7 @@ static int process_alarm_cb(icalcomponent *comp,
+ base = end;
+ }
+ base.is_date = 0; /* need an actual time for triggers */
+- alarmtime = icaltime_add(base, trigger.duration);
++ alarmtime = icalduration_extend(base, trigger.duration);
+ }
+ else {
+ /* absolute */
+@@ -846,7 +846,7 @@ static int is_supported_component(icalcomponent *ical)
+
+ if (!is_supported) {
+ xsyslog(LOG_DEBUG, "alarms are not supported for iCalendar component",
+- "kind=<%s>", icalenum_component_kind_to_string(kind));
++ "kind=<%s>", icalcomponent_kind_to_string(kind));
+ }
+
+ return is_supported;
+diff --git a/imap/carddav_db.c b/imap/carddav_db.c
+index 78dd5d6d3..369a3c246 100644
+--- a/imap/carddav_db.c
++++ b/imap/carddav_db.c
+@@ -1480,7 +1480,8 @@ EXPORTED int carddav_writecard_x(struct carddav_db *carddavdb,
+ VCARD_TYPE_PARAMETER))) {
+ vcardenumarray *types = vcardparameter_get_type(param);
+ vcardenumarray_element pref = { .val = VCARD_TYPE_PREF };
+- if (vcardenumarray_find(types, &pref) >= 0) ispref = 1;
++ if (vcardenumarray_find(types, &pref) < vcardenumarray_size(types))
++ ispref = 1;
+ }
+ strarray_appendm(&emails, propval);
+ strarray_append(&emails, ispref ? "1" : "");
+diff --git a/imap/cyr_buildinfo.c b/imap/cyr_buildinfo.c
+index e613a0802..d63ee1484 100644
+--- a/imap/cyr_buildinfo.c
++++ b/imap/cyr_buildinfo.c
+@@ -304,13 +304,6 @@ static json_t *buildinfo()
+ #endif
+ json_object_set_new(search, "xapian_cjk_tokens", json_string(XAPIAN_CJK_TOKENS));
+
+- /* iCalendar features */
+-#ifdef HAVE_ICALPARSER_CTRL
+- json_object_set_new(ical, "ctrl", json_true());
+-#else
+- json_object_set_new(ical, "ctrl", json_false());
+-#endif
+-
+ /* Internal version numbers */
+ #ifdef USE_SIEVE
+ json_object_set_new(version, "BYTECODE_MIN_VERSION",
+diff --git a/imap/http_caldav.c b/imap/http_caldav.c
+index 15642ab06..73137bf7f 100644
+--- a/imap/http_caldav.c
++++ b/imap/http_caldav.c
+@@ -108,7 +108,6 @@
+ #include "imap/imap_err.h"
+
+
+-#ifdef HAVE_RSCALE
+ #include <unicode/uversion.h>
+
+ static int rscale_cmp(const void *a, const void *b)
+@@ -116,7 +115,6 @@ static int rscale_cmp(const void *a, const void *b)
+ /* Convert to uppercase since that's what we prefer to output */
+ return strcmp(ucase(*((char **) a)), ucase(*((char **) b)));
+ }
+-#endif /* HAVE_RSCALE */
+
+
+ static time_t compile_time;
+@@ -704,13 +702,11 @@ static const struct cal_comp_t {
+ static void my_caldav_init(struct buf *serverinfo)
+ {
+ buf_printf(serverinfo, " LibiCal/%s", ICAL_VERSION);
+-#ifdef HAVE_RSCALE
+ if ((rscale_calendars = icalrecurrencetype_rscale_supported_calendars())) {
+ icalarray_sort(rscale_calendars, &rscale_cmp);
+
+ buf_printf(serverinfo, " ICU4C/%s", U_ICU_VERSION);
+ }
+-#endif
+
+ namespace_calendar.enabled =
+ config_httpmodules & IMAP_ENUM_HTTPMODULES_CALDAV;
+@@ -733,12 +729,7 @@ static void my_caldav_init(struct buf *serverinfo)
+ namespace_calendar.allow |= ALLOW_CAL_ATTACH;
+
+ if (config_getswitch(IMAPOPT_CALDAV_ACCEPT_INVALID_RRULES)) {
+-#ifdef HAVE_INVALID_RRULE_HANDLING
+ ical_set_invalid_rrule_handling_setting(ICAL_RRULE_IGNORE_INVALID);
+-#else
+- syslog(LOG_WARNING,
+- "Your version of libical can not accept invalid RRULEs");
+-#endif
+ }
+
+ if (namespace_tzdist.enabled) {
+@@ -3769,7 +3760,7 @@ static int validate_dtend_duration(icalcomponent *comp, struct error_t *error)
+ if (prop) {
+ struct icaldurationtype duration = icalproperty_get_duration(prop);
+
+- if (icaldurationtype_as_int(duration) < 0) {
++ if (icaldurationtype_as_utc_seconds(duration) < 0) {
+ /* NOTE: Per RFC 5545, Section 3.8.2.5, DURATION > 0,
+ but DURATION == 0 occurs frequently enough in the wild
+ for us to allow it */
+@@ -4030,7 +4021,6 @@ static int caldav_put(struct transaction_t *txn, void *obj,
+
+ hashu64_enumerate(&overrides, &strip_past_override, &orock);
+
+-#ifdef HAVE_RSCALE
+ /* Make sure we support the provided RSCALE in an RRULE */
+ if (rscale_calendars && rt->rscale && *rt->rscale) {
+ /* Perform binary search on sorted icalarray */
+@@ -4053,7 +4043,6 @@ static int caldav_put(struct transaction_t *txn, void *obj,
+ goto done;
+ }
+ }
+-#endif /* HAVE_RSCALE */
+ }
+
+ /* Check for changed UID */
+@@ -4760,7 +4749,7 @@ static int apply_prop_timerange(struct icalperiodtype *range,
+
+ if (!icaldurationtype_is_null_duration(period.duration)) {
+ /* Calculate end time from duration */
+- period.end = icaltime_add(period.start, period.duration);
++ period.end = icalduration_extend(period.start, period.duration);
+ }
+ else if (icaltime_is_null_time(period.end)) period.end = period.start;
+
+@@ -4832,7 +4821,7 @@ static int apply_propfilter(struct prop_filter *propfilter,
+ }
+
+ static void in_range(icalcomponent *comp __attribute__((unused)),
+- struct icaltime_span *span __attribute__((unused)),
++ const struct icaltime_span *span __attribute__((unused)),
+ void *rock)
+ {
+ int *pass = (int *) rock;
+@@ -5346,7 +5335,7 @@ static int expand_cb(icalcomponent *comp,
+
+ case ICAL_DURATION_PROPERTY:
+ /* Set DURATION to be for this occurrence */
+- icalproperty_set_duration(prop, icaltime_subtract(end, start));
++ icalproperty_set_duration(prop, icalduration_from_times(end, start));
+ break;
+
+ case ICAL_RECURRENCEID_PROPERTY:
+@@ -5437,7 +5426,7 @@ static void limit_caldata(icalcomponent *ical, struct icalperiodtype *limit)
+ /* Calculate duration of master component */
+ dtstart = icalcomponent_get_dtstart(comp);
+ dtend = icalcomponent_get_dtend(comp);
+- dtduration = icaltime_subtract(dtend, dtstart);
++ dtduration = icalduration_from_times(dtend, dtstart);
+ break;
+ }
+ }
+@@ -5462,7 +5451,7 @@ static void limit_caldata(icalcomponent *ical, struct icalperiodtype *limit)
+
+ /* Check span of original occurrence */
+ dtstart = recurid;
+- dtend = icaltime_add(dtstart, dtduration);
++ dtend = icalduration_extend(dtstart, dtduration);
+ recurspan = icaltime_span_new(dtstart, dtend, 1);
+ if (icaltime_span_overlaps(&recurspan, &limitspan)) continue;
+
+@@ -7266,7 +7255,7 @@ static void add_freebusy(struct icaltimetype *recurid,
+ if (recurid) newfb->recurid = *recurid;
+
+ if (icaltime_is_date(*start)) {
+- newfb->per.duration = icaltime_subtract(*end, *start);
++ newfb->per.duration = icalduration_from_times(*end, *start);
+ newfb->per.end = icaltime_null_time();
+ start->is_date = 0; /* MUST be DATE-TIME */
+ newfb->per.start = icaltime_convert_to_zone(*start, utc_zone);
+@@ -7763,7 +7752,7 @@ HIDDEN icalcomponent *busytime_to_ical(struct freebusy_filter *fbfilter,
+
+ isdur = !icaldurationtype_is_null_duration(fb->per.duration);
+ end = !isdur ? fb->per.end :
+- icaltime_add(fb->per.start, fb->per.duration);
++ icalduration_extend(fb->per.start, fb->per.duration);
+
+ /* Skip periods of different type or that don't overlap */
+ if ((fb->type != next_fb->type) ||
+@@ -7772,7 +7761,7 @@ HIDDEN icalcomponent *busytime_to_ical(struct freebusy_filter *fbfilter,
+ /* Coalesce into next busytime */
+ next_isdur = !icaldurationtype_is_null_duration(next_fb->per.duration);
+ next_end = !next_isdur ? next_fb->per.end :
+- icaltime_add(next_fb->per.start, next_fb->per.duration);
++ icalduration_extend(next_fb->per.start, next_fb->per.duration);
+
+ if (icaltime_compare(end, next_end) >= 0) {
+ /* Current period subsumes next */
+@@ -7782,7 +7771,7 @@ HIDDEN icalcomponent *busytime_to_ical(struct freebusy_filter *fbfilter,
+ else if (isdur && next_isdur) {
+ /* Both periods are durations */
+ struct icaldurationtype overlap =
+- icaltime_subtract(end, next_fb->per.start);
++ icalduration_from_times(end, next_fb->per.start);
+
+ next_fb->per.duration.days += fb->per.duration.days - overlap.days;
+ }
+@@ -8129,7 +8118,7 @@ static int meth_get_head_fb(struct transaction_t *txn, void *params)
+ }
+ else {
+ /* Set end based on period */
+- fbfilter.end = icaltime_add(fbfilter.start, period);
++ fbfilter.end = icalduration_extend(fbfilter.start, period);
+ }
+
+
+diff --git a/imap/http_caldav_sched.c b/imap/http_caldav_sched.c
+index 389aeaa8e..bdddc2c21 100644
+--- a/imap/http_caldav_sched.c
++++ b/imap/http_caldav_sched.c
+@@ -1501,7 +1501,7 @@ static unsigned propcmp(icalcomponent *oldical, icalcomponent *newical,
+ struct icaldurationtype olddur = icalproperty_get_duration(oldprop);
+ struct icaldurationtype newdur = icalproperty_get_duration(newprop);
+
+- return (icaldurationtype_as_int(olddur) != icaldurationtype_as_int(newdur));
++ return (icaldurationtype_as_utc_seconds(olddur) != icaldurationtype_as_seconds(newdur));
+ }
+ else if ((kind == ICAL_RDATE_PROPERTY) || (kind == ICAL_EXDATE_PROPERTY) ||
+ (kind == ICAL_ATTACH_PROPERTY)) {
+diff --git a/imap/http_tzdist.c b/imap/http_tzdist.c
+index 777456c31..6abb3f368 100644
+--- a/imap/http_tzdist.c
++++ b/imap/http_tzdist.c
+@@ -1556,10 +1556,10 @@ static int action_expand(struct transaction_t *txn)
+
+ /* UT and local time 1 second before onset */
+ off.seconds = -1;
+- ut = icaltime_add(obs->onset, off);
++ ut = icalduration_extend(obs->onset, off);
+
+ off.seconds = obs->offset_from;
+- local = icaltime_add(ut, off);
++ local = icalduration_extend(ut, off);
+
+ buf_printf(body,
+ "%s " CTIME_FMT " UT = " CTIME_FMT " %s"
+@@ -1571,7 +1571,7 @@ static int action_expand(struct transaction_t *txn)
+ icaltime_adjust(&ut, 0, 0, 0, 1);
+
+ off.seconds = obs->offset_to;
+- local = icaltime_add(ut, off);
++ local = icalduration_extend(ut, off);
+
+ buf_printf(body,
+ "%s " CTIME_FMT " UT = " CTIME_FMT " %s"
+@@ -1815,13 +1815,11 @@ static unsigned buf_append_rrule_as_posix_string(struct buf *buf,
+ if (prop) rrule = icalproperty_get_recurrence(prop);
+ if (!rrule) return 0;
+
+-#ifdef HAVE_RSCALE
+ if (rrule->rscale && strcasecmp(rrule->rscale, "GREGORIAN")) {
+ /* POSIX rules are based on Gregorian calendar only */
+ icalrecurrencetype_unref(rrule);
+ return 0;
+ }
+-#endif
+
+ prop = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ at = icalproperty_get_dtstart(prop);
+diff --git a/imap/ical_support.c b/imap/ical_support.c
+index ea0262303..731a8041c 100644
+--- a/imap/ical_support.c
++++ b/imap/ical_support.c
+@@ -103,13 +103,16 @@ EXPORTED void ical_support_init(void)
+ EX_CONFIG);
+ }
+
+-#ifdef HAVE_ICALPARSER_CTRL
+ icalparser_set_ctrl(ICALPARSER_CTRL_OMIT);
+-#endif
+
+ syslog(LOG_DEBUG, "%s: found " SIZE_T_FMT " timezones",
+ __func__, timezones->num_elements);
+
++ icalproperty_set_allow_empty_properties(true);
++
++ /* Instruct libical to not drop unknown IANA elements */
++ ical_set_unknown_token_handling_setting(ICAL_ASSUME_IANA_TOKEN);
++
+ initialized = 1;
+ }
+
+@@ -313,7 +316,7 @@ static icaltimetype icalcomponent_get_mydtend(icalcomponent *comp)
+ } else {
+ duration = icaldurationtype_null_duration();
+ }
+- dtend = icaltime_add(dtstart, duration);
++ dtend = icalduration_extend(dtstart, duration);
+ }
+ else dtend = dtstart;
+
+@@ -614,7 +617,7 @@ EXPORTED int icalcomponent_myforeach(icalcomponent *ical,
+ if (!range_span.start) range_span.start = epoch;
+ if (!range_span.end) {
+ if (!icaldurationtype_is_null_duration(range.duration)) {
+- icaltimetype end = icaltime_add(range.start, range.duration);
++ icaltimetype end = icalduration_extend(range.start, range.duration);
+ range_span.end = icaltime_to_timet(end, NULL);
+ }
+ else range_span.end = eternity;
+@@ -654,7 +657,7 @@ EXPORTED int icalcomponent_myforeach(icalcomponent *ical,
+ event_length = icalcomponent_get_duration(mastercomp);
+ if (icaldurationtype_is_null_duration(event_length) &&
+ icaltime_is_date(dtstart)) {
+- event_length = icaldurationtype_from_int(60 * 60 * 24); /* P1D */
++ event_length = icaldurationtype_from_seconds(60 * 60 * 24); /* P1D */
+ }
+
+ /* add any RDATEs first, since EXDATE items can override them */
+@@ -669,14 +672,14 @@ EXPORTED int icalcomponent_myforeach(icalcomponent *ical,
+ icaltimetype mystart, myend;
+ if (icalperiodtype_is_null_period(rdate.period)) {
+ mystart = rdate.time;
+- myend = icaltime_add(mystart, event_length);
++ myend = icalduration_extend(mystart, event_length);
+ }
+ else {
+ mystart = rdate.period.start;
+ if (icaldurationtype_is_null_duration(rdate.period.duration))
+ myend = rdate.period.end;
+ else
+- myend = icaltime_add(mystart, rdate.period.duration);
++ myend = icalduration_extend(mystart, rdate.period.duration);
+ }
+ if (icaltime_is_null_time(mystart))
+ continue;
+@@ -771,7 +774,7 @@ EXPORTED int icalcomponent_myforeach(icalcomponent *ical,
+ }
+ if (icaltime_compare(xitem, ritem)) {
+ /* not excluded - process this recurrence-id */
+- struct icaltimetype thisend = icaltime_add(ritem, event_length);
++ struct icaltimetype thisend = icalduration_extend(ritem, event_length);
+ icaltime_span this_span = {
+ rtime, icaltime_to_timet(thisend, floatingtz), 0 /* is_busy */
+ };
+@@ -1322,7 +1325,7 @@ icalcomponent_get_utc_timespan(icalcomponent *comp,
+ struct icaldurationtype dur = icaldurationtype_null_duration();
+
+ dur.days = 1;
+- period.end = icaltime_add(period.start, dur);
++ period.end = icalduration_extend(period.start, dur);
+ }
+ else
+ memcpy(&period.end, &period.start, sizeof(struct icaltimetype));
+@@ -1401,8 +1404,8 @@ icalcomponent_get_utc_timespan(icalcomponent *comp,
+ /* DTSTART is not DATE-TIME */
+ struct icaldurationtype dur;
+
+- dur = icaldurationtype_from_int(60*60*24 - 1); /* P1D */
+- icaltime_add(period.end, dur);
++ dur = icaldurationtype_from_seconds(60*60*24 - 1); /* P1D */
++ icalduration_extend(period.end, dur);
+ }
+ }
+ else {
+@@ -1451,7 +1454,7 @@ icalcomponent_get_utc_timespan(icalcomponent *comp,
+
+
+ /* icalcomponent_foreach_recurrence() callback to find earliest/latest time */
+-static void utc_timespan_cb(icalcomponent *comp, struct icaltime_span *span, void *rock)
++static void utc_timespan_cb(icalcomponent *comp, const struct icaltime_span *span, void *rock)
+ {
+ struct icalperiodtype *period = (struct icalperiodtype *) rock;
+ int is_date = icaltime_is_date(icalcomponent_get_mydtstart(comp));
+@@ -1514,9 +1517,9 @@ icalrecurrenceset_get_utc_timespan(icalcomponent *ical,
+ struct icaldurationtype duration;
+ icaltimezone *utc = icaltimezone_get_utc_timezone();
+
+- duration = icaltime_subtract(period.end, period.start);
++ duration = icalduration_from_times(period.end, period.start);
+ icaltimetype end =
+- icaltime_add(icaltime_convert_to_zone(recur->until, utc),
++ icalduration_extend(icaltime_convert_to_zone(recur->until, utc),
+ duration);
+
+ if (icaltime_compare(period.end, end) < 0)
+@@ -1825,20 +1828,14 @@ static void apply_patch_parameter(struct path_segment_t *path_seg,
+ case ICAL_MEMBER_PARAMETER:
+ /* Multi-valued parameter */
+ if (path_seg->data) {
+- /* Check if entire parameter value == single value */
+- const char *single = (const char *) path_seg->data;
+- const char *param_val = icalparameter_get_value_as_string(param);
+-
+- if (strcmp(param_val, single)) {
+- /* Not an exact match, try to remove single value */
+- char *newval = remove_single_value(param_val, single);
+- if (newval) {
+- *num_changes += 1;
+- icalparameter_set_member(param, newval);
+- free(newval);
+- }
+- continue;
+- }
++ icalstrarray *member = icalparameter_get_member(param);
++ size_t old_size = icalstrarray_size(member);
++ icalstrarray_remove(member, path_seg->data);
++ size_t new_size = icalstrarray_size(member);
++ if (old_size != new_size) *num_changes += 1;
++ if (!icalstrarray_size(member))
++ icalproperty_remove_parameter_by_ref(parent, param);
++ continue;
+ }
+ break;
+
+@@ -1978,7 +1975,7 @@ static void apply_patch_property(struct path_segment_t *path_seg,
+ }
+ }
+
+-static void create_override(icalcomponent *master, struct icaltime_span *span,
++static void create_override(icalcomponent *master, const struct icaltime_span *span,
+ void *rock)
+ {
+ icalcomponent *new;
+@@ -2220,7 +2217,7 @@ static void apply_patch_component(struct path_segment_t *path_seg,
+ icalcomponent *override = NULL;
+ struct icaltimetype start = path_seg->match.comp.rid;
+ struct icaltimetype end =
+- icaltime_add(start, icalcomponent_get_duration(master));
++ icalduration_extend(start, icalcomponent_get_duration(master));
+ icalcomponent_foreach_recurrence(master, start, end,
+ &create_override,
+ &override);
+diff --git a/imap/ical_support.h b/imap/ical_support.h
+index 850fc4360..b4eb5b386 100644
+--- a/imap/ical_support.h
++++ b/imap/ical_support.h
+@@ -113,19 +113,6 @@ extern short icalrecur_byrule_size(icalrecurrencetype_t *rt,
+ #define HAVE_VPOLL_SUPPORT
+ #endif
+
+-#ifndef HAVE_NEW_CLONE_API
+-/* Allow us to compile without #ifdef HAVE_NEW_CLONE_API everywhere */
+-#define icalcomponent_clone icalcomponent_new_clone
+-#define icalproperty_clone icalproperty_new_clone
+-#define icalparameter_clone icalparameter_new_clone
+-#endif
+-
+-#ifndef HAVE_GET_COMPONENT_NAME
+-/* This should never match anything in the wild
+- which means that we can't patch X- components */
+-#define icalcomponent_get_component_name(comp) "X-CYR-"
+-#endif
+-
+ /* Initialize libical timezones. */
+ extern void ical_support_init(void);
+
+@@ -296,7 +283,6 @@ extern void icalcomponent_set_jmapid(icalcomponent *comp, const char *id);
+ #endif
+
+ /* Functions that should be declared in libical */
+-#define icaltimezone_set_zone_directory set_zone_directory
+
+ #define icalcomponent_get_tzuntil_property(comp) \
+ icalcomponent_get_first_property(comp, ICAL_TZUNTIL_PROPERTY)
+@@ -304,16 +290,6 @@ extern void icalcomponent_set_jmapid(icalcomponent *comp, const char *id);
+ #define icalcomponent_get_acknowledged_property(comp) \
+ icalcomponent_get_first_property(comp, ICAL_ACKNOWLEDGED_PROPERTY)
+
+-#ifndef HAVE_RSCALE
+-
+-/* Functions to replace those not available in libical < v1.0 */
+-
+-#define icalrecurrencetype_month_is_leap(month) 0
+-#define icalrecurrencetype_month_month(month) month
+-
+-#endif /* HAVE_RSCALE */
+-
+-
+ /* Wrappers to fetch managed attachment parameters by kind */
+
+ #define icalproperty_get_filename_parameter(prop) \
+diff --git a/imap/index.c b/imap/index.c
+index 12f0249c7..ff21380a2 100644
+--- a/imap/index.c
++++ b/imap/index.c
+@@ -5533,8 +5533,6 @@ static int extract_vcardbuf(struct buf *raw, charset_t charset, int encoding,
+ for (prop = vcardcomponent_get_first_property(vcard, VCARD_ANY_PROPERTY);
+ prop;
+ prop = vcardcomponent_get_next_property(vcard, VCARD_ANY_PROPERTY)) {
+- vcardstructuredtype *stp = NULL;
+- vcardstructuredtype st = { 1, { 0 } };
+ const char *val;
+
+ switch (vcardproperty_isa(prop)) {
+@@ -5565,23 +5563,26 @@ static int extract_vcardbuf(struct buf *raw, charset_t charset, int encoding,
+ break;
+
+ case VCARD_ORG_PROPERTY: {
+- unsigned f;
+- size_t v;
+-
+- st.field[0] = vcardproperty_get_org(prop);
+- stp = &st;
+-
+- GCC_FALLTHROUGH
++ vcardstrarray *sa = vcardproperty_get_org(prop);
++ for (size_t i = 0; i < vcardstrarray_size(sa); i++) {
++ val = vcardstrarray_element_at(sa, i);
++ if (val && val[0]) {
++ if (buf_len(&buf)) buf_putc(&buf, ' ');
++ buf_appendcstr(&buf, val);
++ }
++ }
++ break;
++ }
+
+ case VCARD_N_PROPERTY:
+- case VCARD_ADR_PROPERTY:
+- if (!stp) stp = vcardproperty_get_adr(prop);
+-
+- for (f = 0; f < stp->num_fields; f++) {
+- vcardstrarray *vals = stp->field[f];
+-
+- for (v = 0; vals && v < vcardstrarray_size(vals); v++) {
+- val = vcardstrarray_element_at(vals, v);
++ case VCARD_ADR_PROPERTY: {
++ vcardstructuredtype *stt =
++ vcardvalue_get_structured(vcardproperty_get_value(prop));
++
++ for (size_t i = 0; i < vcardstructured_num_fields(stt); i++) {
++ vcardstrarray *sa = vcardstructured_field_at(stt, i);
++ for (size_t j = 0; j < vcardstrarray_size(sa); j++) {
++ val = vcardstrarray_element_at(sa, j);
+ if (val && val[0]) {
+ if (buf_len(&buf)) buf_putc(&buf, ' ');
+ buf_appendcstr(&buf, val);
+diff --git a/imap/itip_support.c b/imap/itip_support.c
+index 0a7899c05..d4ce8d3fd 100644
+--- a/imap/itip_support.c
++++ b/imap/itip_support.c
+@@ -404,8 +404,8 @@ HIDDEN icalcomponent *master_to_recurrence(icalcomponent *master,
+ struct icaltimetype end = _get_datetime(master, endprop);
+
+ // calculate and re-apply the diff
+- struct icaldurationtype diff = icaltime_subtract(end, start);
+- struct icaltimetype newend = icaltime_add(newstart, diff);
++ struct icaldurationtype diff = icalduration_from_times(end, start);
++ struct icaltimetype newend = icalduration_extend(newstart, diff);
+
+ icaltimezone *endzone = (icaltimezone *)icaltime_get_timezone(end);
+ icalproperty_set_dtend(endprop,
+@@ -1009,8 +1009,8 @@ static int deliver_merge_add(icalcomponent *ical, // current iCalendar
+ };
+
+ if (!icaldurationtype_is_null_duration(duration) &&
+- icaldurationtype_as_int(duration) !=
+- icaldurationtype_as_int(icalcomponent_get_duration(master_comp))) {
++ icaldurationtype_as_utc_seconds(duration) !=
++ icaldurationtype_as_utc_seconds(icalcomponent_get_duration(master_comp))) {
+ /* Change in event duration */
+ rdate.period.start = dtstart;
+ rdate.period.duration = duration;
+@@ -1441,7 +1441,7 @@ HIDDEN enum sched_deliver_outcome sched_deliver_local(const char *userid,
+ default:
+ /* Unknown METHOD -- ignore it */
+ syslog(LOG_ERR, "Unknown iTIP method: %s",
+- icalenum_method_to_string(method));
++ icalproperty_method_to_string(method));
+
+ sched_data->flags &= ~SCHEDFLAG_IS_REPLY;
+ goto inbox;
+diff --git a/imap/jcal.c b/imap/jcal.c
+index 32e758035..4ad9c50db 100644
+--- a/imap/jcal.c
++++ b/imap/jcal.c
+@@ -128,7 +128,7 @@ static json_t *icalreqstattype_as_json_array(struct icalreqstattype stat)
+ json_t *jstat;
+ char code[22];
+
+- icalerror_check_arg_rz((stat.code != ICAL_UNKNOWN_STATUS),"Status");
++ if (stat.code == ICAL_UNKNOWN_STATUS) return NULL;
+
+ if (!stat.desc) stat.desc = icalenum_reqstat_desc(stat.code);
+
+@@ -683,7 +683,7 @@ static icalproperty *json_array_to_icalproperty(json_t *jprop)
+
+ /* Get the property type */
+ propname = ucase(icalmemory_tmp_copy(json_string_value(jtype)));
+- kind = icalenum_string_to_property_kind(propname);
++ kind = icalproperty_string_to_kind(propname);
+ if (kind == ICAL_NO_PROPERTY) {
+ syslog(LOG_WARNING, "Unknown jCal property type: %s", propname);
+ return NULL;
+@@ -692,7 +692,7 @@ static icalproperty *json_array_to_icalproperty(json_t *jprop)
+ /* Get the value type */
+ typestr = json_string_value(jvaltype);
+ valkind = !strcmp(typestr, "unknown") ? ICAL_X_VALUE :
+- icalenum_string_to_value_kind(ucase(icalmemory_tmp_copy(typestr)));
++ icalvalue_string_to_kind(ucase(icalmemory_tmp_copy(typestr)));
+ if (valkind == ICAL_NO_VALUE) {
+ syslog(LOG_WARNING, "Unknown jCal value type for %s property: %s",
+ propname, typestr);
+@@ -791,7 +791,7 @@ EXPORTED icalcomponent *jcal_array_as_icalcomponent(json_t *jobj)
+ }
+
+ type = json_string_value(jtype);
+- kind = icalenum_string_to_component_kind(ucase(icalmemory_tmp_copy(type)));
++ kind = icalcomponent_string_to_kind(ucase(icalmemory_tmp_copy(type)));
+ if (kind == ICAL_NO_COMPONENT) {
+ syslog(LOG_WARNING, "Unknown jCal component type: %s", type);
+ return NULL;
+diff --git a/imap/jmap_backup.c b/imap/jmap_backup.c
+index 7b44f1b27..abf4bf1bc 100644
+--- a/imap/jmap_backup.c
++++ b/imap/jmap_backup.c
+@@ -192,7 +192,7 @@ static void jmap_restore_parse(jmap_req_t *req,
+ icaldurationtype_from_string(json_string_value(arg));
+
+ if (!icaldurationtype_is_bad_duration(dur)) {
+- restore->cutoff = time(0) - icaldurationtype_as_int(dur);
++ restore->cutoff = time(0) - icaldurationtype_as_utc_seconds(dur);
+ }
+ }
+
+diff --git a/imap/jmap_calendar.c b/imap/jmap_calendar.c
+index 2900321dc..3e0801bf2 100644
+--- a/imap/jmap_calendar.c
++++ b/imap/jmap_calendar.c
+@@ -2767,7 +2767,7 @@ static void getcalendarevents_get_utctimes_internal(json_t *jsevent,
+ struct jmapical_datetime enddt = JMAPICAL_DATETIME_INITIALIZER;
+ icaltimetype startical = jmapical_datetime_to_icaltime(&startdt, tz);
+ struct icaldurationtype durical = jmapical_duration_to_icalduration(&dur);
+- icaltimetype endical = icaltime_add(startical, durical);
++ icaltimetype endical = icalduration_extend(startical, durical);
+ jmapical_datetime_from_icaltime(endical, &enddt);
+
+ /* Convert start and end to UTC */
+diff --git a/imap/jmap_contact.c b/imap/jmap_contact.c
+index 0d09f1580..97bdeb983 100644
+--- a/imap/jmap_contact.c
++++ b/imap/jmap_contact.c
+@@ -6533,7 +6533,7 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
+
+ json_object_set_new(obj, "isOrdered", json_true());
+
+- sa = jscomps->field[0];
++ sa = vcardstructured_field_at(jscomps, 0);
+ if (sa) {
+ /* add default separator, if not " " */
+ val = vcardstrarray_element_at(sa, 1);
+@@ -6542,10 +6542,10 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
+ }
+ }
+
+- for (i = 1; i < jscomps->num_fields; i++) {
++ for (i = 1; i < vcardstructured_num_fields(jscomps); i++) {
+ const char *kind;
+
+- sa = jscomps->field[i];
++ sa = vcardstructured_field_at(jscomps, i);
+ val = vcardstrarray_element_at(sa, 0);
+ if (*val == 's') {
+ kind = "separator";
+@@ -6555,14 +6555,14 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
+ int field_idx = atoi(val);
+ int val_idx = 0;
+
+- if (field_idx >= (int) st->num_fields) continue;
++ if (field_idx >= (int) vcardstructured_num_fields(st)) continue;
+
+ kind = comp_kinds[field_idx].name;
+
+ if (vcardstrarray_size(sa) > 1)
+ val_idx = atoi(vcardstrarray_element_at(sa, 1));
+
+- val = vcardstrarray_element_at(st->field[field_idx], val_idx);
++ val = vcardstrarray_element_at(vcardstructured_field_at(st, field_idx), val_idx);
+ }
+
+ if (*val) {
+@@ -6589,19 +6589,21 @@ static void jscomps_from_vcard(json_t *obj, vcardproperty *prop,
+
+ /* Iterate through all components and values */
+ for (const struct comp_kind *ckind = comp_kinds;
+- ckind->name && ckind->idx < st->num_fields; ckind++) {
+- if ((ckind->flags & FIELD_SKIP) && st->num_fields > ckind->alt_idx)
++ ckind->name && ckind->idx < vcardstructured_num_fields(st); ckind++) {
++ if ((ckind->flags & FIELD_SKIP) && vcardstructured_num_fields(st) > ckind->alt_idx)
+ continue;
+
+- sa = st->field[ckind->idx];
++ sa = vcardstructured_field_at(st, ckind->idx);
+ for (i = 0; sa && i < vcardstrarray_size(sa); i++) {
+ val = vcardstrarray_element_at(sa, i);
+
+ if (*val) {
+ /* Skip values that appear in other fields */
+ if (ckind->flags & FIELD_EXT) {
+- vcardstrarray *alt_sa = st->field[ckind->alt_idx];
+- if (alt_sa && vcardstrarray_find(alt_sa, val) >= 0)
++ vcardstrarray *alt_sa = vcardstructured_field_at(st, ckind->alt_idx);
++ if (alt_sa
++ && vcardstrarray_find(alt_sa, val)
++ < vcardstrarray_size(alt_sa))
+ continue;
+ }
+
+@@ -9195,8 +9197,8 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ return 0;
+ }
+
+- vcardstructuredtype vals = { args->num_comps, { 0 } };
+- vcardstructuredtype ph = { args->num_comps, { 0 } };
++ vcardstructuredtype *vals = vcardstructured_new(args->num_comps);
++ vcardstructuredtype *ph = vcardstructured_new(args->num_comps);
+ size_t i, size = json_array_size(comps);
+ vcardstructuredtype *jscomps = NULL;
+ vcardproperty *prop = NULL;
+@@ -9226,9 +9228,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ }
+
+ if (isordered) {
+- jscomps = xzmalloc(sizeof(vcardstructuredtype));
+-
+- jscomps->num_fields = 1; // for separator, regardless if specified
++ jscomps = vcardstructured_new(1); // for separator, regardless if specified
+
+ jprop = json_object_get(obj, "defaultSeparator");
+ if (json_is_string(jprop)) {
+@@ -9239,7 +9239,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ entry = vcardstrarray_new(2);
+ vcardstrarray_append(entry, "s");
+ vcardstrarray_append(entry, defsep);
+- jscomps->field[0] = entry;
++ vcardstructured_set_field_at(jscomps, 0, entry);
+ }
+ }
+ else if (jprop) {
+@@ -9301,7 +9301,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ entry = vcardstrarray_new(2);
+ vcardstrarray_append(entry, "s");
+ vcardstrarray_append(entry, buf_cstring(&buf));
+- jscomps->field[jscomps->num_fields++] = entry;
++ vcardstructured_set_field_at(jscomps, vcardstructured_num_fields(jscomps), entry);
+ }
+ else {
+ jmap_parser_invalid(parser, "kind");
+@@ -9311,7 +9311,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ else {
+ const struct comp_kind *ckind =
+ _field_name_to_kind(kind, args->comp_kinds);
+- vcardstrarray **field;
++ vcardstrarray *field;
+
+ if (!ckind) {
+ jmap_parser_pop(parser);
+@@ -9321,15 +9321,21 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+
+ /* Add phonetic to proper field */
+ if (phonetic) {
+- field = &ph.field[ckind->idx];
+- if (!*field) *field = vcardstrarray_new(1);
+- vcardstrarray_append(*field, phonetic);
++ field = vcardstructured_field_at(ph, ckind->idx);
++ if (!field) {
++ field = vcardstrarray_new(1);
++ vcardstructured_set_field_at(ph, ckind->idx, field);
++ }
++ vcardstrarray_append(field, phonetic);
+ }
+
+ /* Add value to proper field */
+- field = &vals.field[ckind->idx];
+- if (!*field) *field = vcardstrarray_new(1);
+- vcardstrarray_append(*field, val);
++ field = vcardstructured_field_at(vals, ckind->idx);
++ if (!field) {
++ field = vcardstrarray_new(1);
++ vcardstructured_set_field_at(vals, ckind->idx, field);
++ }
++ vcardstrarray_append(field, val);
+
+ if (isordered) {
+ /* Add positional entry (field idx [value idx]) to JSCOMPS */
+@@ -9337,12 +9343,12 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ buf_reset(&buf);
+ buf_printf(&buf, "%d", ckind->idx);
+ vcardstrarray_append(entry, buf_cstring(&buf));
+- if (vcardstrarray_size(*field) > 1) {
++ if (vcardstrarray_size(field) > 1) {
+ buf_reset(&buf);
+- buf_printf(&buf, "%lu", vcardstrarray_size(*field) - 1);
++ buf_printf(&buf, "%lu", vcardstrarray_size(field) - 1);
+ vcardstrarray_append(entry, buf_cstring(&buf));
+ }
+- jscomps->field[jscomps->num_fields++] = entry;
++ vcardstructured_set_field_at(jscomps, vcardstructured_num_fields(jscomps), entry);
+ }
+
+ if (args->derived) {
+@@ -9354,9 +9360,12 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+
+ /* Also add values from ext fields to backward-compat fields */
+ if (ckind->flags & FIELD_BWD) {
+- field = &vals.field[ckind->alt_idx];
+- if (!*field) *field = vcardstrarray_new(1);
+- vcardstrarray_append(*field, val);
++ field = vcardstructured_field_at(vals, ckind->alt_idx);
++ if (!field) {
++ field = vcardstrarray_new(1);
++ vcardstructured_set_field_at(vals, ckind->alt_idx, field);
++ }
++ vcardstrarray_append(field, val);
+ }
+ }
+
+@@ -9368,7 +9377,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ goto fail;
+ }
+
+- prop = args->vanew_prop(&vals,
++ prop = args->vanew_prop(vals,
+ jscomps ? vcardparameter_new_jscomps(jscomps) : NULL,
+ NULL);
+
+@@ -9380,7 +9389,7 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+
+ vcardparameter_set_value_from_string(param, ph_system);
+ vcardcomponent_add_property(card,
+- args->vanew_prop(&ph,
++ args->vanew_prop(ph,
+ vcardparameter_new_altid(args->id),
+ param,
+ NULL));
+@@ -9396,26 +9405,9 @@ static vcardproperty *_jscomps_to_vcard(struct jmap_parser *parser, json_t *obj,
+ return prop;
+
+ fail:
+- for (unsigned i = 0; i < vals.num_fields; i++) {
+- vcardstrarray *sa = vals.field[i];
+-
+- if (sa) vcardstrarray_free(sa);
+- }
+- if (ph_system) {
+- for (unsigned i = 0; i < ph.num_fields; i++) {
+- vcardstrarray *sa = ph.field[i];
+-
+- if (sa) vcardstrarray_free(sa);
+- }
+- }
+- if (jscomps) {
+- for (unsigned i = 0; i < jscomps->num_fields; i++) {
+- vcardstrarray *sa = jscomps->field[i];
+-
+- if (sa) vcardstrarray_free(sa);
+- }
+- free(jscomps);
+- }
++ vcardstructured_unref(vals);
++ vcardstructured_unref(ph);
++ if (jscomps) vcardstructured_unref(jscomps);
+ if (args->derived) {
+ buf_reset(args->derived);
+ }
+@@ -9530,7 +9522,7 @@ static unsigned _jsname_to_vcard(struct jmap_parser *parser, json_t *jval,
+ }
+
+ /* Add SORT-AS parameter */
+- vcardproperty_add_parameter(prop, vcardparameter_new_sortas(sortas));
++ vcardproperty_add_parameter(prop, vcardparameter_new_sortas_list(sortas));
+
+ jmap_parser_pop(parser);
+ }
+@@ -9700,7 +9692,7 @@ static vcardproperty *_jsorg_to_vcard(struct jmap_parser *parser, json_t *obj,
+
+ prop = vcardproperty_new_org(units);
+ if (sortas) {
+- vcardproperty_add_parameter(prop, vcardparameter_new_sortas(sortas));
++ vcardproperty_add_parameter(prop, vcardparameter_new_sortas_list(sortas));
+ }
+
+ if (!props) {
+diff --git a/imap/jmap_ical.c b/imap/jmap_ical.c
+index 9d117d006..de250e1fb 100644
+--- a/imap/jmap_ical.c
++++ b/imap/jmap_ical.c
+@@ -1448,7 +1448,8 @@ HIDDEN void jmapical_duration_between_unixtime(time_t t1, bit64 t1nanos,
+
+ icaltimetype icaltx = icaltime_from_timet_with_zone(tx, 0, utc);
+ icaltimetype icalty = icaltime_from_timet_with_zone(ty, 0, utc);
+- struct icaldurationtype icaldur = icaltime_subtract(icalty, icaltx);
++ struct icaldurationtype icaldur = icalduration_from_times(icalty, icaltx);
++ icaldur = icaldurationtype_normalize(icaldur);
+ icaldur.is_neg = is_neg;
+ jmapical_duration_from_icalduration(icaldur, dur);
+ dur->nanos = nanos;
+@@ -1596,48 +1597,6 @@ static struct icaltimetype dtstart_from_ical(icalcomponent *comp,
+ return dt;
+ }
+
+-static struct icaltimetype dtend_from_ical(icalcomponent *comp,
+- jstimezones_t *jstzones)
+-{
+- struct icaltimetype dtend;
+- icalproperty *end_prop = icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY);
+- icalproperty *dur_prop = icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY);
+- struct icaltimetype dtstart = dtstart_from_ical(comp, jstzones);
+-
+- if (end_prop) {
+- dtend = icalproperty_get_dtend(end_prop);
+- const char *tzid = tzid_from_icalprop(end_prop, 1, jstzones);
+- icaltimezone* tz = jstimezones_lookup_tzid(jstzones, tzid);
+- if (tz && tz != dtend.zone) {
+- icaltimezone *utc = icaltimezone_get_utc_timezone();
+- if (dtend.zone != utc) {
+- // Prefer our IANA timezone definition
+- dtend.zone = tz;
+- }
+- else {
+- // Bogus UTC datetime with TZID
+- dtend = icaltime_convert_to_zone(dtend, tz);
+- }
+- }
+- }
+- else if (dur_prop) {
+- struct icaldurationtype duration;
+- if (icalproperty_get_value(dur_prop)) {
+- duration = icalproperty_get_duration(dur_prop);
+- } else {
+- duration = icaldurationtype_null_duration();
+- }
+- dtend = icaltime_add(dtstart, duration);
+- }
+- else dtend = dtstart;
+-
+- /* Normalize floating DTEND to DTSTART time zone, if any */
+- if (!dtend.zone) dtend.zone = dtstart.zone;
+-
+- return dtend;
+-}
+-
+-
+ /* Compare int in ascending order. */
+ static int compare_int(const void *aa, const void *bb)
+ {
+@@ -1767,7 +1726,6 @@ static json_t* recurrencerule_from_ical(icalproperty *prop, icaltimezone *untilt
+
+ json_object_set_new(recur, "interval", json_integer(rrule->interval));
+
+-#ifdef HAVE_RSCALE
+ /* rscale */
+ if (rrule->rscale) {
+ s = xstrdup(rrule->rscale);
+@@ -1791,7 +1749,6 @@ static json_t* recurrencerule_from_ical(icalproperty *prop, icaltimezone *untilt
+ skip = "omit";
+ }
+ json_object_set_new(recur, "skip", json_string(skip));
+-#endif
+
+ /* firstDayOfWeek */
+ s = xstrdup(icalrecur_weekday_to_string(rrule->week_start));
+@@ -1987,7 +1944,8 @@ override_rdate_from_ical(icalproperty *prop)
+ /* Determine duration */
+ struct icaldurationtype icaldur;
+ if (!icaltime_is_null_time(rdate.period.end)) {
+- icaldur = icaltime_subtract(rdate.period.end, rdate.period.start);
++ icaldur = icalduration_from_times(rdate.period.end, rdate.period.start);
++ icaldur = icaldurationtype_normalize(icaldur);
+ } else {
+ icaldur = rdate.period.duration;
+ }
+@@ -2605,7 +2563,7 @@ static json_t *participant_from_ical(icalproperty *prop,
+ param;
+ param = icalproperty_get_next_parameter(prop, ICAL_DELEGATEDTO_PARAMETER)) {
+
+- char *uri = normalized_uri(icalparameter_get_delegatedto(param));
++ char *uri = normalized_uri(icalparameter_get_delegatedto_nth(param, 0));
+ const char *to_id = hash_lookup(uri, id_by_uri);
+ free(uri);
+ if (to_id) json_object_set_new(delegatedTo, to_id, json_true());
+@@ -2623,7 +2581,7 @@ static json_t *participant_from_ical(icalproperty *prop,
+ param;
+ param = icalproperty_get_next_parameter(prop, ICAL_DELEGATEDFROM_PARAMETER)) {
+
+- char *uri = normalized_uri(icalparameter_get_delegatedfrom(param));
++ char *uri = normalized_uri(icalparameter_get_delegatedfrom_nth(param, 0));
+ const char *from_id = hash_lookup(uri, id_by_uri);
+ free(uri);
+ if (from_id) json_object_set_new(delegatedFrom, from_id, json_true());
+@@ -2641,7 +2599,7 @@ static json_t *participant_from_ical(icalproperty *prop,
+ param;
+ param = icalproperty_get_next_parameter(prop, ICAL_MEMBER_PARAMETER)) {
+
+- char *uri = normalized_uri(icalparameter_get_member(param));
++ char *uri = normalized_uri(icalparameter_get_member_nth(param, 0));
+ const char *id = hash_lookup(uri, id_by_uri);
+ char keybuf[JMAPICAL_SHA1HEXSTR_LEN];
+ if (!id) id = sha1hexstr(uri, keybuf);
+@@ -3337,7 +3295,7 @@ virtuallocations_from_ical(icalcomponent *comp)
+ param;
+ param = icalproperty_get_next_parameter(prop, ICAL_FEATURE_PARAMETER)) {
+
+- switch (icalparameter_get_feature(param)) {
++ switch (icalparameter_get_feature_nth(param, 0)) {
+ case ICAL_FEATURE_AUDIO:
+ json_object_set_new(features, "audio", json_true());
+ break;
+@@ -3385,13 +3343,40 @@ virtuallocations_from_ical(icalcomponent *comp)
+ static void duration_from_vevent(icalcomponent *comp, struct jmapical_duration *dur,
+ jstimezones_t *jstzones)
+ {
+- struct icaltimetype dtstart = dtstart_from_ical(comp, jstzones);
+- struct icaltimetype dtend = dtend_from_ical(comp, jstzones);
+- if (!icaltime_is_null_time(dtend)) {
+- time_t tstart = icaltime_as_timet_with_zone(dtstart, dtstart.zone);
+- time_t tend = icaltime_as_timet_with_zone(dtend, dtend.zone);
+- jmapical_duration_between_unixtime(tstart, 0, tend, 0, dur);
++ struct icaldurationtype icaldur = icaldurationtype_null_duration();
++ icalproperty *dur_prop =
++ icalcomponent_get_first_property(comp, ICAL_DURATION_PROPERTY);
++ icalproperty *end_prop =
++ icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY);
++
++ if (dur_prop) {
++ icaldur = icalproperty_get_duration(dur_prop);
+ }
++ else if (end_prop) {
++ struct icaltimetype dtstart = dtstart_from_ical(comp, jstzones);
++ icaltimetype dtend = icalproperty_get_dtend(end_prop);
++ const char *tzid = tzid_from_icalprop(end_prop, 1, jstzones);
++ icaltimezone* tz = jstimezones_lookup_tzid(jstzones, tzid);
++ if (tz && tz != dtend.zone) {
++ icaltimezone *utc = icaltimezone_get_utc_timezone();
++ if (dtend.zone != utc) {
++ dtend.zone = tz;
++ }
++ else {
++ dtend = icaltime_convert_to_zone(dtend, tz);
++ }
++ }
++ else if (!dtend.zone) {
++ dtend.zone = dtstart.zone;
++ }
++
++ if (!icaltime_is_null_time(dtend)) {
++ icaldur = icalduration_from_times(dtend, dtstart);
++ icaldur = icaldurationtype_normalize(icaldur);
++ }
++ }
++
++ jmapical_duration_from_icalduration(icaldur, dur);
+ }
+
+ static json_t*
+@@ -3944,7 +3929,7 @@ calendarevent_from_ical(icalcomponent *comp,
+ if (ical) {
+ icalproperty_method icalmethod = icalcomponent_get_method(ical);
+ if (icalmethod != ICAL_METHOD_NONE) {
+- char *method = xstrdupsafe(icalenum_method_to_string(icalmethod));
++ char *method = xstrdupsafe(icalproperty_method_to_string(icalmethod));
+ lcase(method);
+ json_object_set_new(event, "method", json_string(method));
+ free(method);
+@@ -4846,7 +4831,7 @@ startend_to_ical(icalcomponent *comp, struct jmap_parser *parser,
+ if (tzstart != tzend) {
+ /* Add DTEND */
+ struct icaldurationtype icaldur = jmapical_duration_to_icalduration(&dur);
+- icaltimetype dtend = icaltime_add(dtstart, icaldur);
++ icaltimetype dtend = icalduration_extend(dtstart, icaldur);
+ dtend = icaltime_convert_to_zone(dtend, tzend);
+ icalproperty *prop = insert_icaltimeprop(comp, dtend, 1, ICAL_DTEND_PROPERTY);
+ if (prop) xjmapid_to_ical(prop, endzone_location_id);
+@@ -7944,7 +7929,7 @@ static void calendarevent_to_ical(icalcomponent *comp,
+ jprop = json_object_get(event, "method");
+ if (json_is_string(jprop) && !is_exc) {
+ const char *val = json_string_value(jprop);
+- icalproperty_method method = icalenum_string_to_method(val);
++ icalproperty_method method = icalproperty_string_to_method(val);
+ if (method == ICAL_METHOD_NONE) {
+ jmap_parser_invalid(parser, "method");
+ }
+diff --git a/imap/vcard_support.c b/imap/vcard_support.c
+index 0ccadc1b6..8a6d05701 100644
+--- a/imap/vcard_support.c
++++ b/imap/vcard_support.c
+@@ -811,7 +811,7 @@ EXPORTED void vcardproperty_add_type_parameter(vcardproperty *prop,
+ }
+ else {
+ types = vcardenumarray_new(1);
+- param = vcardparameter_new_type(types);
++ param = vcardparameter_new_type_list(types);
+ vcardproperty_add_parameter(prop, param);
+ }
+ vcardenumarray_append(types, type);
+diff --git a/imap/xcal.c b/imap/xcal.c
+index 47ff10ae6..30cd35de6 100644
+--- a/imap/xcal.c
++++ b/imap/xcal.c
+@@ -90,22 +90,58 @@ const char *icalproperty_value_kind_as_string(icalproperty *prop)
+ }
+
+ switch (kind) {
++
++ case ICAL_ANY_VALUE:
++ case ICAL_NO_VALUE:
+ case ICAL_X_VALUE:
+ return "unknown";
+
+ case ICAL_ACTION_VALUE:
++ case ICAL_BUSYTYPE_VALUE:
+ case ICAL_CARLEVEL_VALUE:
+ case ICAL_CLASS_VALUE:
++ case ICAL_COLOR_VALUE:
+ case ICAL_CMD_VALUE:
+ case ICAL_METHOD_VALUE:
++ case ICAL_PARTICIPANTTYPE_VALUE:
++ case ICAL_POLLCOMPLETION_VALUE:
++ case ICAL_POLLMODE_VALUE:
++ case ICAL_PROXIMITY_VALUE:
++ case ICAL_REQUESTSTATUS_VALUE:
+ case ICAL_QUERYLEVEL_VALUE:
++ case ICAL_RESOURCETYPE_VALUE:
+ case ICAL_STATUS_VALUE:
++ case ICAL_STRING_VALUE:
+ case ICAL_TRANSP_VALUE:
+ return "text";
+
+- default:
++ case ICAL_QUERY_VALUE:
++ return "cal-query";
++
++ case ICAL_ATTACH_VALUE:
++ case ICAL_BINARY_VALUE:
++ case ICAL_BOOLEAN_VALUE:
++ case ICAL_CALADDRESS_VALUE:
++ case ICAL_DATE_VALUE:
++ case ICAL_DATETIME_VALUE:
++ case ICAL_DATETIMEDATE_VALUE:
++ case ICAL_DATETIMEPERIOD_VALUE:
++ case ICAL_DURATION_VALUE:
++ case ICAL_FLOAT_VALUE:
++ case ICAL_GEO_VALUE:
++ case ICAL_INTEGER_VALUE:
++ case ICAL_PERIOD_VALUE:
++ case ICAL_RECUR_VALUE:
++ case ICAL_TEXT_VALUE:
++ case ICAL_TRIGGER_VALUE:
++ case ICAL_UID_VALUE:
++ case ICAL_URI_VALUE:
++ case ICAL_UTCOFFSET_VALUE:
++ case ICAL_XMLREFERENCE_VALUE:
+ return icalvalue_kind_to_string(kind);
+ }
++
++ return "unknown";
+ }
+
+
+@@ -676,7 +712,7 @@ static icalvalue *xml_element_to_icalvalue(xmlNodePtr xtype,
+ struct icalperiodtype p;
+
+ p.start = p.end = icaltime_null_time();
+- p.duration = icaldurationtype_from_int(0);
++ p.duration = icaldurationtype_from_seconds(0);
+
+ node = xmlFirstElementChild(xtype);
+ if (!node) {
+@@ -708,7 +744,7 @@ static icalvalue *xml_element_to_icalvalue(xmlNodePtr xtype,
+ xmlFree(content);
+ content = xmlNodeGetContent(node);
+ p.duration = icaldurationtype_from_string((const char *) content);
+- if (icaldurationtype_as_int(p.duration) == 0) break;
++ if (icaldurationtype_as_utc_seconds(p.duration) == 0) break;
+ }
+ else {
+ syslog(LOG_WARNING,
+@@ -883,7 +919,7 @@ static icalproperty *xml_element_to_icalproperty(xmlNodePtr xprop)
+
+ /* Get the property type */
+ propname = ucase(icalmemory_tmp_copy((const char *) xprop->name));
+- kind = icalenum_string_to_property_kind(propname);
++ kind = icalproperty_string_to_kind(propname);
+ if (kind == ICAL_NO_PROPERTY) {
+ syslog(LOG_WARNING, "Unknown xCal property type: %s", propname);
+ return NULL;
+@@ -927,7 +963,7 @@ static icalproperty *xml_element_to_icalproperty(xmlNodePtr xprop)
+ }
+ typestr = ucase(icalmemory_tmp_copy((const char *) node->name));
+ valkind = !strcmp(typestr, "UNKNOWN") ? ICAL_X_VALUE :
+- icalenum_string_to_value_kind(typestr);
++ icalvalue_string_to_kind(typestr);
+ if (valkind == ICAL_NO_VALUE) {
+ syslog(LOG_WARNING, "Unknown xCal value type for %s property: %s",
+ propname, typestr);
+@@ -1005,7 +1041,7 @@ static icalcomponent *xml_element_to_icalcomponent(xmlNodePtr xcomp)
+
+ /* Get component type */
+ kind =
+- icalenum_string_to_component_kind(
++ icalcomponent_string_to_kind(
+ ucase(icalmemory_tmp_copy((const char *) xcomp->name)));
+ if (kind == ICAL_NO_COMPONENT) {
+ syslog(LOG_WARNING, "Unknown xCal component type: %s", xcomp->name);
diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec
index 8ab5e1d..9ace3f5 100644
--- a/cyrus-imapd.spec
+++ b/cyrus-imapd.spec
@@ -68,6 +68,9 @@ Patch2: cyrus-imapd-rename-quota.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2223951
Patch3: cyrus-imapd-remove-always-inline-for-buf-len.patch
Patch4: cyrus-imapd-rename-imtest.patch
+# Adapt to libical 4.x API changes
+# https://bugzilla.redhat.com/show_bug.cgi?id=2523444
+Patch5: cyrus-imapd-3.12.4-libical4-api.patch
# Cassandane patches:
# Prevent cassandane from trying to syslog things
reply other threads:[~2026-11-05 16:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179389497522.1.15158808804294864701.rpms-cyrus-imapd-9d75a6e9d599@fedoraproject.org \
--to=mosvald@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox