#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#include <ical.h>
+#include <libical/ical.h>
#include <libcitadel.h>
#include "citadel.h"
#include "server.h"
/* Encapsulate the subcomponent inside */
icalcomponent_add_component(encaps, subcomp);
- /* Convert all timestamps to UTC so we don't have to deal with
- * stupid VTIMEZONE crap.
- */
- ical_dezonify(encaps);
-
/* Return the object we just created. */
return(encaps);
}
return;
}
- ser = icalcomponent_as_ical_string(cal);
+ ser = icalcomponent_as_ical_string_r(cal);
if (ser == NULL) return;
/* If the caller supplied a user, write to that user's default calendar room */
}
/* In either case, now we can free the serialized calendar object */
-// free(ser);
+ free(ser);
}
void ical_add(icalcomponent *cal, int recursion_level) {
icalcomponent *c;
+#if 1
+ /* Write the whole thing because it may need to save timezones etc.
+ * FIXME - if this works, we can probably eliminate this entire function
+ */
+
+ ical_write_to_cal(&CC->user, cal);
+
+#else /* this was the old code to kill everything but the VEVENT component ... probably ng now */
+
/*
* The VEVENT subcomponent is the one we're interested in saving.
*/
/* Recursively process subcomponent */
ical_add(c, recursion_level+1);
}
+#endif
}
}
/* Now generate the reply message and send it out. */
- serialized_reply = strdup(icalcomponent_as_ical_string(the_reply));
+ serialized_reply = icalcomponent_as_ical_string_r(the_reply);
icalcomponent_free(the_reply); /* don't need this anymore */
if (serialized_reply == NULL) return;
*/
void ical_locate_part(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
- void *cbuserdata) {
+ char *cbid, void *cbuserdata) {
struct ical_respond_data *ird = NULL;
}
ird->cal = icalcomponent_new_from_string(content);
- if (ird->cal != NULL) {
- ical_dezonify(ird->cal);
- }
}
*/
void ical_locate_original_event(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
- void *cbuserdata) {
+ char *cbid, void *cbuserdata) {
struct original_event_container *oec = NULL;
ical_merge_attendee_reply(original_event, cal);
/* Serialize it */
- serialized_event = strdup(icalcomponent_as_ical_string(original_event));
+ serialized_event = icalcomponent_as_ical_string_r(original_event);
icalcomponent_free(original_event); /* Don't need this anymore. */
if (serialized_event == NULL) return(2);
}
} while ( (rrule) && (!icaltime_is_null_time(t2start)) && (num_recur < MAX_RECUR) );
+ icalrecur_iterator_free(ritr);
if (num_recur > 0) CtdlLogPrintf(CTDL_DEBUG, "Iterated over existing event %d times.\n", num_recur);
}
}
} while ( (rrule) && (!icaltime_is_null_time(t1start)) && (num_recur < MAX_RECUR) );
+ icalrecur_iterator_free(ritr);
if (num_recur > 0) CtdlLogPrintf(CTDL_DEBUG, "Iterated over proposed event %d times.\n", num_recur);
}
return;
}
- ical_dezonify(cal);
-
/* If this event is not opaque, the user isn't publishing it as
* busy time, so don't bother doing anything else.
*/
/* Serialize it */
CtdlLogPrintf(CTDL_DEBUG, "Serializing\n");
- serialized_request = strdup(icalcomponent_as_ical_string(encaps));
+ serialized_request = icalcomponent_as_ical_string_r(encaps);
icalcomponent_free(encaps); /* Don't need this anymore. */
cprintf("%d Here is the free/busy data:\n", LISTING_FOLLOWS);
(void *) encaps
);
- ser = strdup(icalcomponent_as_ical_string(encaps));
+ ser = icalcomponent_as_ical_string_r(encaps);
client_write(ser, strlen(ser));
free(ser);
cprintf("\n000\n");
cal = icalcomponent_new_from_string(calstream);
free(calstream);
- ical_dezonify(cal);
/* We got our data stream -- now do something with it. */
/* Set the method to REQUEST */
icalcomponent_set_method(encaps, ICAL_METHOD_REQUEST);
- /* Now make sure all of the DTSTART and DTEND properties are UTC. */
- ical_dezonify(the_request);
-
/* Here we go: put the VEVENT into the VCALENDAR. We now no longer
* are responsible for "the_request"'s memory -- it will be freed
* when we free "encaps".
icalcomponent_add_component(encaps, the_request);
/* Serialize it */
- serialized_request = strdup(icalcomponent_as_ical_string(encaps));
+ serialized_request = icalcomponent_as_ical_string_r(encaps);
icalcomponent_free(encaps); /* Don't need this anymore. */
if (serialized_request == NULL) return;
*/
void ical_obj_beforesave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
- char *encoding, void *cbuserdata)
+ char *encoding, char *cbid, void *cbuserdata)
{
icalcomponent *cal, *nested_event, *nested_todo, *whole_cal;
icalproperty *p;
*/
void ical_obj_aftersave_backend(char *name, char *filename, char *partnum,
char *disp, void *content, char *cbtype, char *cbcharset, size_t length,
- char *encoding, void *cbuserdata)
+ char *encoding, char *cbid, void *cbuserdata)
{
icalcomponent *cal;
return;
}
- ical_dezonify(cal);
ical_fixed_output_backend(cal, 0);
/* Free the memory we obtained from libical's constructor */
{
if (!threading)
{
+
+ /* Tell libical to return errors instead of aborting if it gets bad data */
+ icalerror_errors_are_fatal = 0;
+
+ /* Initialize our hook functions */
CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);