From c55a6857b24843d83a0fd43a9613f77852ffadc6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 4 Apr 2018 22:42:16 -0400 Subject: [PATCH] libical3 compatibility , patches submitted by Adrian Bunk --- citadel/ical_dezonify.c | 6 +++--- citadel/modules/calendar/serv_calendar.c | 9 ++++----- webcit/calendar_tools.c | 3 +-- webcit/calendar_view.c | 4 ---- webcit/event.c | 6 ++---- webcit/ical_dezonify.c | 6 +++--- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/citadel/ical_dezonify.c b/citadel/ical_dezonify.c index f3425acd9..04d41e7c9 100644 --- a/citadel/ical_dezonify.c +++ b/citadel/ical_dezonify.c @@ -135,13 +135,13 @@ void ical_dezonify_backend(icalcomponent *cal, /* syslog(LOG_DEBUG, " * Was: %s\n", icaltime_as_ical_string(TheTime)); */ - if (TheTime.is_utc) { + if (icaltime_is_utc(TheTime)) { /* syslog(LOG_DEBUG, " * This property is ALREADY UTC.\n"); */ } else if (utc_declared_as_tzid) { /* syslog(LOG_DEBUG, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */ - TheTime.is_utc = 1; + TheTime.zone = icaltimezone_get_utc_timezone(); } else { @@ -161,7 +161,7 @@ void ical_dezonify_backend(icalcomponent *cal, t, icaltimezone_get_utc_timezone() ); - TheTime.is_utc = 1; + TheTime.zone = icaltimezone_get_utc_timezone(); } icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); diff --git a/citadel/modules/calendar/serv_calendar.c b/citadel/modules/calendar/serv_calendar.c index b335dc1d9..6c7071d4e 100644 --- a/citadel/modules/calendar/serv_calendar.c +++ b/citadel/modules/calendar/serv_calendar.c @@ -234,7 +234,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) { /* We found our own address in the attendee list. */ if (me_attend) { /* Change the partstat from NEEDS-ACTION to ACCEPT or DECLINE */ - icalproperty_remove_parameter(me_attend, ICAL_PARTSTAT_PARAMETER); + icalproperty_remove_parameter_by_kind(me_attend, ICAL_PARTSTAT_PARAMETER); if (!strcasecmp(action, "accept")) { partstat = icalparameter_new_partstat(ICAL_PARTSTAT_ACCEPTED); @@ -1369,7 +1369,6 @@ void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal) { if (!icaltime_is_null_time(dtend)) { dtend = icaltime_add(dtstart, dur); dtend.zone = dtstart.zone; - dtend.is_utc = dtstart.is_utc; } ++num_recur; } @@ -1519,7 +1518,7 @@ void ical_freebusy(char *who) { icalcomponent_set_method(fb, ICAL_METHOD_PUBLISH); /* Set the DTSTAMP to right now. */ - icalcomponent_set_dtstamp(fb, icaltime_from_timet(time(NULL), 0)); + icalcomponent_set_dtstamp(fb, icaltime_from_timet_with_zone(time(NULL), 0, icaltimezone_get_utc_timezone())); /* Add the user's email address as ORGANIZER */ sprintf(buf, "MAILTO:%s", who); @@ -1540,10 +1539,10 @@ void ical_freebusy(char *who) { * to yesterday and tomorrow as default values. */ if (icalcomponent_get_first_property(fb, ICAL_DTSTART_PROPERTY) == NULL) { - icalcomponent_set_dtstart(fb, icaltime_from_timet(time(NULL)-86400L, 0)); + icalcomponent_set_dtstart(fb, icaltime_from_timet_with_zone(time(NULL)-86400L, 0, icaltimezone_get_utc_timezone())); } if (icalcomponent_get_first_property(fb, ICAL_DTEND_PROPERTY) == NULL) { - icalcomponent_set_dtend(fb, icaltime_from_timet(time(NULL)+86400L, 0)); + icalcomponent_set_dtend(fb, icaltime_from_timet_with_zone(time(NULL)+86400L, 0, icaltimezone_get_utc_timezone())); } /* Put the freebusy component into the calendar component */ diff --git a/webcit/calendar_tools.c b/webcit/calendar_tools.c index daefe82fd..86da183b8 100644 --- a/webcit/calendar_tools.c +++ b/webcit/calendar_tools.c @@ -151,7 +151,6 @@ void icaltime_from_webform(struct icaltimetype *t, char *prefix) { t->minute = IBSTR(vname); /* time zone is set to the default zone for this server */ - t->is_utc = 0; t->is_date = 0; t->zone = get_default_icaltimezone(); } @@ -170,7 +169,7 @@ void icaltime_from_webform_dateonly(struct icaltimetype *t, char *prefix) { sscanf((char*)BSTR(prefix), "%04d-%02d-%02d", &t->year, &t->month, &t->day); /* time zone is set to the default zone for this server */ - t->is_utc = 1; + t->zone = icaltimezone_get_utc_timezone(); t->is_date = 1; } diff --git a/webcit/calendar_view.c b/webcit/calendar_view.c index 03e80e5d1..1b6e8681e 100644 --- a/webcit/calendar_view.c +++ b/webcit/calendar_view.c @@ -198,7 +198,6 @@ void calendar_month_view_display_events(int year, int month, int day) starting_tm.tm_hour = 0; starting_tm.tm_min = 0; today_start_t = icaltime_from_timet_with_zone(mktime(&starting_tm), 0, icaltimezone_get_utc_timezone()); - today_start_t.is_utc = 1; memset(&ending_tm, 0, sizeof(struct tm)); ending_tm.tm_year = year - 1900; @@ -207,7 +206,6 @@ void calendar_month_view_display_events(int year, int month, int day) ending_tm.tm_hour = 23; ending_tm.tm_min = 59; today_end_t = icaltime_from_timet_with_zone(mktime(&ending_tm), 0, icaltimezone_get_utc_timezone()); - today_end_t.is_utc = 1; /* * Create another one without caring about the timezone for all day events. @@ -854,7 +852,6 @@ void calendar_day_view_display_events(time_t thetime, starting_tm.tm_hour = 0; starting_tm.tm_min = 0; today_start_t = icaltime_from_timet_with_zone(mktime(&starting_tm), 0, icaltimezone_get_utc_timezone()); - today_start_t.is_utc = 1; memset(&ending_tm, 0, sizeof(struct tm)); ending_tm.tm_year = year - 1900; @@ -863,7 +860,6 @@ void calendar_day_view_display_events(time_t thetime, ending_tm.tm_hour = 23; ending_tm.tm_min = 59; today_end_t = icaltime_from_timet_with_zone(mktime(&ending_tm), 0, icaltimezone_get_utc_timezone()); - today_end_t.is_utc = 1; /* * Create another one without caring about the timezone for all day events. diff --git a/webcit/event.c b/webcit/event.c index 6f989a237..d786998ab 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -264,8 +264,6 @@ void display_edit_individual_event(icalcomponent *supplied_vevent, long msgnum, ((yesbstr("alldayevent")) ? 1 : 0), icaltimezone_get_utc_timezone() ); - t_start.is_utc = 1; - } display_icaltimetype_as_webform(&t_start, "dtstart", 0); @@ -854,8 +852,8 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum, char *fr /* Add NOW() to the calendar object... */ icalcomponent_set_dtstamp(vevent, - icaltime_from_timet( - time(NULL), 0)); + icaltime_from_timet_with_zone( + time(NULL), 0, icaltimezone_get_utc_timezone())); if (havebstr("summary")) { icalcomponent_add_property(vevent, diff --git a/webcit/ical_dezonify.c b/webcit/ical_dezonify.c index 537bcc3e1..de444a9d5 100644 --- a/webcit/ical_dezonify.c +++ b/webcit/ical_dezonify.c @@ -116,7 +116,7 @@ void ical_dezonify_backend(icalcomponent *cal, syslog(LOG_DEBUG, " * Was: %s\n", icaltime_as_ical_string(TheTime)); #endif - if (TheTime.is_utc) { + if (icaltime_is_utc(TheTime)) { #ifdef DBG_ICAL syslog(LOG_DEBUG, " * This property is ALREADY UTC.\n"); #endif @@ -126,7 +126,7 @@ void ical_dezonify_backend(icalcomponent *cal, #ifdef DBG_ICAL syslog(LOG_DEBUG, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); #endif - TheTime.is_utc = 1; + TheTime.zone = icaltimezone_get_utc_timezone(); } else { @@ -146,7 +146,7 @@ void ical_dezonify_backend(icalcomponent *cal, t = get_default_icaltimezone(); } icaltimezone_convert_time(&TheTime, t, icaltimezone_get_utc_timezone()); - TheTime.is_utc = 1; + TheTime.zone = icaltimezone_get_utc_timezone(); } icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER); -- 2.30.2