#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
+#include <libcitadel.h>
#include "citadel.h"
#include "server.h"
#include "citserver.h"
#include "config.h"
#include "user_ops.h"
#include "room_ops.h"
-#include "tools.h"
#include "msgbase.h"
-#include "mime_parser.h"
#include "internet_addressing.h"
#include "serv_calendar.h"
#include "euidindex.h"
char *ser = NULL;
icalcomponent *encaps = NULL;
struct CtdlMessage *msg = NULL;
+ icalcomponent *tmp=NULL;
if (cal == NULL) return;
* a full VCALENDAR component, and save that instead.
*/
if (icalcomponent_isa(cal) != ICAL_VCALENDAR_COMPONENT) {
- encaps = ical_encapsulate_subcomponent(icalcomponent_new_clone(cal));
+ tmp = icalcomponent_new_clone(cal);
+ encaps = ical_encapsulate_subcomponent(tmp);
ical_write_to_cal(u, encaps);
+ icalcomponent_free(tmp);
icalcomponent_free(encaps);
return;
}
}
/* In either case, now we can free the serialized calendar object */
- free(ser);
+// free(ser);
}
if (!strncasecmp(attendee_string, "MAILTO:", 7)) {
strcpy(attendee_string, &attendee_string[7]);
striplt(attendee_string);
- recp = validate_recipients(attendee_string);
+ recp = validate_recipients(attendee_string, NULL, 0);
if (recp != NULL) {
if (!strcasecmp(recp->recp_local, CC->user.fullname)) {
if (me_attend) icalproperty_free(me_attend);
reply_message_text);
if (msg != NULL) {
- valid = validate_recipients(organizer_string);
+ valid = validate_recipients(organizer_string, NULL, 0);
CtdlSubmitMsg(msg, valid, "");
CtdlFreeMessage(msg);
free_recipients(valid);
/* If not found, try it as an unqualified email address. */
if (found_user != 0) {
strcpy(buf, who);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, NULL, 0);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
if (recp != NULL) {
if (recp->num_local == 1) {
if (found_user != 0) {
snprintf(buf, sizeof buf, "%s@%s", who, config.c_fqdn);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, NULL, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
found_user = getuser(&usbuf, recp->recp_local);
|| (!strcasecmp(type, "directory")) ) {
snprintf(buf, sizeof buf, "%s@%s", who, host);
lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
- recp = validate_recipients(buf);
+ recp = validate_recipients(buf, NULL, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
found_user = getuser(&usbuf, recp->recp_local);
if (fb == NULL) {
cprintf("%d Internal error: cannot allocate memory.\n",
ERROR + INTERNAL_ERROR);
- icalcomponent_free(encaps);
getroom(&CC->room, hold_rm);
return;
}
request_message_text);
if (msg != NULL) {
- valid = validate_recipients(attendees_string);
+ valid = validate_recipients(attendees_string, NULL, 0);
CtdlSubmitMsg(msg, valid, "");
CtdlFreeMessage(msg);
free_recipients(valid);
}
+
+void serv_calendar_destroy(void)
+{
+ icaltimezone_free_builtin_timezones();
+}
+
#endif /* CITADEL_WITH_CALENDAR_SERVICE */
/*
*/
CTDL_MODULE_INIT(calendar)
{
+ if (!threading)
+ {
#ifdef CITADEL_WITH_CALENDAR_SERVICE
- CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
- CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
- CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
- CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCal commands");
- CtdlRegisterSessionHook(ical_session_startup, EVT_START);
- CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP);
- CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);
+ CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
+ CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
+ CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
+ CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCal commands");
+ CtdlRegisterSessionHook(ical_session_startup, EVT_START);
+ CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP);
+ CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);
+ CtdlRegisterCleanupHook(serv_calendar_destroy);
#endif
-
+ }
+
/* return our Subversion id for the Log */
return "$Id$";
}
-
-
-void serv_calendar_destroy(void)
-{
-#ifdef CITADEL_WITH_CALENDAR_SERVICE
- icaltimezone_free_builtin_timezones();
-#endif
-}