$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)
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
+/*
+ * $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 <fcntl.h>
#include <sys/types.h>
#include <ical.h>
-
-void ical_dezonify(icalcomponent *cal);
+#include "ical_dezonify.h"
/*
* Back end function for ical_dezonify()
}
/* 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. */
icalcomponent_free(vt);
}
}
+
+#endif /* HAVE_ICAL_H */
#ifdef HAVE_ICAL_H
#include <ical.h>
+#include "ical_dezonify.h"
struct ical_respond_data {
char desired_partnum[SIZ];
}
the_reply = icalcomponent_new_clone(request);
+ ical_dezonify(the_reply);
if (the_reply == NULL) {
lprintf(3, "ERROR: cannot clone request\n");
return;
}
if (strcasecmp(partnum, ird->desired_partnum)) return;
ird->cal = icalcomponent_new_from_string(content);
+ ical_dezonify(ird->cal);
}
icalcomponent_free(oec->c);
}
oec->c = icalcomponent_new_from_string(content);
+ ical_dezonify(oec->c);
}
/* 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.
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
*/
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) {
if (!strcasecmp(cbtype, "text/calendar")) {
cal = icalcomponent_new_from_string(content);
if (cal != NULL) {
+ ical_dezonify(cal);
ical_saving_vevent(cal);
icalcomponent_free(cal);
}