* set up ical_dezonify() to be called at appropriate times
authorArt Cancro <ajc@citadel.org>
Wed, 25 Dec 2002 07:05:26 +0000 (07:05 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 25 Dec 2002 07:05:26 +0000 (07:05 +0000)
  (but it doesn't seem to work correctly yet)

citadel/ChangeLog
citadel/ical_dezonify.c
citadel/ical_dezonify.h [new file with mode: 0644]
citadel/serv_calendar.c

index b3a52ec057d6ea515363be0d2af2f8891881365e..a2f05fb214146226d7818b506a35121d053ef9e5 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 601.94  2002/12/25 07:05:26  ajc
+ * set up ical_dezonify() to be called at appropriate times
+   (but it doesn't seem to work correctly yet)
+
  Revision 601.93  2002/12/25 06:41:44  ajc
  * ical_dezonify.c: added (function to strip localized timestamps out of
    a component and replace them with UTC timestamps)
@@ -4319,4 +4323,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index c2b6022aa9ed959a518ee80ce68620e60c8332aa..d1eb6952115978725d3d1e035ec95bc3069f0efd 100644 (file)
@@ -1,3 +1,14 @@
+/* 
+ * $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>
@@ -5,8 +16,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <ical.h>
-
-void ical_dezonify(icalcomponent *cal);
+#include "ical_dezonify.h"
 
 /*
  * Back end function for ical_dezonify()
@@ -54,12 +64,10 @@ void ical_dezonify_backend(icalcomponent *cal, icalproperty *prop) {
        }
 
        /* Do the conversion.
-        * (I had to specify the 'from' and 'to' timezones backwards.  Is the
-        * API documentation wrong?)
         */
        icaltimezone_convert_time(&TheTime,
-                               icaltimezone_get_utc_timezone(),
-                               t
+                               t,
+                               icaltimezone_get_utc_timezone()
        );
 
        /* Now strip the TZID parameter, because it's incorrect now. */
@@ -133,3 +141,5 @@ void ical_dezonify(icalcomponent *cal) {
                icalcomponent_free(vt);
        }
 }
+
+#endif /* HAVE_ICAL_H */
diff --git a/citadel/ical_dezonify.h b/citadel/ical_dezonify.h
new file mode 100644 (file)
index 0000000..f638de2
--- /dev/null
@@ -0,0 +1 @@
+void ical_dezonify(icalcomponent *cal);
index e6a8ef32d4175c77941b5e20d19dc2527016f2c0..4abbbf776b795d213780a1ba9cd98c6ed5fffa39 100644 (file)
@@ -35,6 +35,7 @@
 #ifdef HAVE_ICAL_H
 
 #include <ical.h>
+#include "ical_dezonify.h"
 
 struct ical_respond_data {
        char desired_partnum[SIZ];
@@ -138,6 +139,7 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
        }
 
        the_reply = icalcomponent_new_clone(request);
+       ical_dezonify(the_reply);
        if (the_reply == NULL) {
                lprintf(3, "ERROR: cannot clone request\n");
                return;
@@ -271,6 +273,7 @@ void ical_locate_part(char *name, char *filename, char *partnum, char *disp,
        }
        if (strcasecmp(partnum, ird->desired_partnum)) return;
        ird->cal = icalcomponent_new_from_string(content);
+       ical_dezonify(ird->cal);
 }
 
 
@@ -412,6 +415,7 @@ void ical_locate_original_event(char *name, char *filename, char *partnum, char
                icalcomponent_free(oec->c);
        }
        oec->c = icalcomponent_new_from_string(content);
+       ical_dezonify(oec->c);
 }
 
 
@@ -447,6 +451,7 @@ void ical_merge_attendee_reply(icalcomponent *event, icalcomponent *reply) {
 
        /* Clone the reply, because we're going to rip its guts out. */
        reply = icalcomponent_new_clone(reply);
+       ical_dezonify(reply);
 
        /* At this point we're looking at the correct subcomponents.
         * Iterate through the attendees looking for a match.
@@ -1065,6 +1070,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
                lprintf(3, "ERROR: cannot clone calendar object\n");
                return;
        }
+       ical_dezonify(the_request);
 
        /* Extract the summary string -- we'll use it as the
         * message subject for the request
@@ -1240,6 +1246,7 @@ void ical_ctdl_set_extended_msgid(char *name, char *filename, char *partnum,
         */
        if (!strcasecmp(cbtype, "text/calendar")) {
                cal = icalcomponent_new_from_string(content);
+               ical_dezonify(cal);
                if (cal != NULL) {
                        p = ical_ctdl_get_subprop(cal, ICAL_UID_PROPERTY);
                        if (p != NULL) {
@@ -1366,6 +1373,7 @@ void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
        if (!strcasecmp(cbtype, "text/calendar")) {
                cal = icalcomponent_new_from_string(content);
                if (cal != NULL) {
+                       ical_dezonify(cal);
                        ical_saving_vevent(cal);
                        icalcomponent_free(cal);
                }