-/*
- * $Id$
- *
- * Function to go through an ical component set and convert all non-UTC
- * DTSTART and DTEND properties to UTC. It also strips out any VTIMEZONE
- * subcomponents afterwards, because they're irrelevant.
- *
- */
-
-#ifdef HAVE_ICAL_H
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <ical.h>
-
-/*
- * Back end function for ical_dezonify()
- *
- * We supply this with the master component and the property (which will
- * be a DTSTART or DTEND) which we want to convert to UTC.
- */
-void ical_dezonify_backend(icalcomponent *cal, icalproperty *prop) {
- icaltimezone *t;
+// Go through an ical component set and convert all non-UTC date/time properties to UTC.
+// It also strips out any VTIMEZONE subcomponents afterwards, because they are now unreferenced.
+//
+// Everything here will work on both components and subcomponents. If subcomponents are discovered it will recurse through them.
+//
+// Copyright (c) 2002-2024 by the citadel.org team (Art Cancro et al)
+// This program is open source software. Use, duplication, or disclosure is subject to the GNU General Public License v3.
+
+// NOTE: this file is symlinked between different generations of WebCit. When we retire WebCit-classic, copy the file over.
+
+#include "webcit.h"
+
+
+// Figure out which time zone needs to be used for timestamps that are not UTC and do not have a time zone specified.
+icaltimezone *get_default_icaltimezone(void) {
+
+ icaltimezone *zone = NULL;
+
+ if (!zone) {
+ zone = icaltimezone_get_builtin_timezone(default_zone_name);
+ }
+ if (!zone) {
+ syslog(LOG_WARNING, "ical_dezonify: unable to load '%s' time zone, defaulting to UTC", default_zone_name);
+ zone = icaltimezone_get_utc_timezone();
+ }
+ if (!zone) {
+ syslog(LOG_ERR, "ical_dezonify: unable to load UTC time zone!");
+ }
+ return zone;
+}
+
+
+// Back end function for ical_dezonify()
+//
+// We supply this with the master component, the relevant component, and the property
+// (which will be a DTSTART, DTEND, etc.) which we want to convert to UTC.
+void ical_dezonify_backend(icalcomponent *cal, icalcomponent *rcal, icalproperty *prop) {
+
+ icaltimezone *t = NULL;