]> code.citadel.org Git - citadel.git/blobdiff - webcit/ical_dezonify.c
* Header file adjustments to make it work on FreeBSD
[citadel.git] / webcit / ical_dezonify.c
index 751b80e8142184de3fcf50a0ff61ffa80804739b..0748bc91766b73786170d0bc44c22af50db96c40 100644 (file)
@@ -5,19 +5,45 @@
  * date/time properties to UTC.  It also strips out any VTIMEZONE
  * subcomponents afterwards, because they're irrelevant.
  *
+ * Everything here will work on both a fully encapsulated VCALENDAR component
+ * or any type of subcomponent.
+ *
  */
 
 
+#include <ctype.h>
+#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
 #include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_LIMITS_H
 #include <limits.h>
-#include <stdio.h>
+#endif
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
 #include <string.h>
-#include <strings.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
 #include "webcit.h"
+#include "webserver.h"
+
 
-#ifdef HAVE_ICAL_H
-#include <ical.h>
+#ifdef WEBCIT_WITH_CALENDAR_SERVICE
 
 
 /*
@@ -31,7 +57,7 @@ void ical_dezonify_backend(icalcomponent *cal,
                        icalcomponent *rcal,
                        icalproperty *prop) {
 
-       icaltimezone *t;
+       icaltimezone *t = NULL;
        icalparameter *param;
        const char *tzid;
        struct icaltimetype TheTime;
@@ -41,15 +67,17 @@ void ical_dezonify_backend(icalcomponent *cal,
 
        /* Hunt for a TZID parameter in this property. */
        param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER);
-       if (param == NULL) return;
 
        /* Get the stringish name of this TZID. */
-       tzid = icalparameter_get_tzid(param);
-       if (tzid == NULL) return;
+       if (param != NULL) {
+               tzid = icalparameter_get_tzid(param);
 
-       /* Convert it to an icaltimezone type. */
-       t = icalcomponent_get_timezone(cal, tzid);
-       if (t == NULL) return;
+               /* Convert it to an icaltimezone type. */
+               if (tzid != NULL) {
+                       t = icalcomponent_get_timezone(cal, tzid);
+               }
+
+       }
 
        /* Now we know the timezone.  Convert to UTC. */
 
@@ -70,10 +98,12 @@ void ical_dezonify_backend(icalcomponent *cal,
        }
 
        /* Do the conversion. */
-       icaltimezone_convert_time(&TheTime,
-                               t,
-                               icaltimezone_get_utc_timezone()
-       );
+       if (t != NULL) {
+               icaltimezone_convert_time(&TheTime,
+                                       t,
+                                       icaltimezone_get_utc_timezone()
+               );
+       }
        TheTime.is_utc = 1;
        icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
 
@@ -156,4 +186,4 @@ void ical_dezonify(icalcomponent *cal) {
 }
 
 
-#endif /* HAVE_ICAL_H */
+#endif /* WEBCIT_WITH_CALENDAR_SERVICE */