* room on a Citadel server. It handles iCalendar objects using the
* iTIP protocol. See RFCs 2445 and 2446.
*
- * Copyright (c) 1987-2018 by the citadel.org team
+ * Copyright (c) 1987-2020 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
#define PRODID "-//Citadel//NONSGML Citadel Calendar//EN"
#include "ctdl_module.h"
-
#include <libical/ical.h>
-
#include "msgbase.h"
#include "internet_addressing.h"
#include "serv_calendar.h"
#include "default_timezone.h"
#include "config.h"
-
struct ical_respond_data {
char desired_partnum[SIZ];
icalcomponent *cal;
msg->cm_format_type = 4;
CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname));
- CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
MsgBody = NewStrBufPlain(NULL, serlen + 100);
StrBufAppendBufPlain(MsgBody, HKEY("Content-type: text/calendar\r\n\r\n"), 0);
CM_SetAsFieldSB(msg, eMesageText, &MsgBody);
/* Now write the data */
- CtdlSubmitMsg(msg, NULL, "", QP_EADDR);
+ CtdlSubmitMsg(msg, NULL, "");
CM_Free(msg);
}
if (msg != NULL) {
valid = validate_recipients(organizer_string, NULL, 0);
- CtdlSubmitMsg(msg, valid, "", QP_EADDR);
+ CtdlSubmitMsg(msg, valid, "");
CM_Free(msg);
free_recipients(valid);
}
}
-
/*
* Callback function for mime parser that hunts for calendar content types
* and turns them into calendar objects. If something is found, it is placed
return;
}
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) {
cprintf("%d Message %ld not found.\n",
ERROR + ILLEGAL_VALUE,
}
-
-
/*
* Handle an incoming RSVP (object with method==ICAL_METHOD_REPLY) for a
* calendar event. The object has already been deserialized for us; all
* us the ability to load the event into memory so we can diddle the
* attendees.
*/
- msg = CtdlFetchMessage(msgnum_being_replaced, 1, 1);
+ msg = CtdlFetchMessage(msgnum_being_replaced, 1);
if (msg == NULL) {
return(2); /* internal error */
}
if (msg != NULL) {
CIT_ICAL->avoid_sending_invitations = 1;
- CtdlSubmitMsg(msg, NULL, roomname, QP_EADDR);
+ CtdlSubmitMsg(msg, NULL, roomname);
CM_Free(msg);
CIT_ICAL->avoid_sending_invitations = 0;
}
return;
}
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) {
cprintf("%d Message %ld not found.\n",
ERROR + ILLEGAL_VALUE,
return(1);
}
+
/*
* Phase 6 of "hunt for conflicts"
* called by ical_conflicts_phase5()
}
-
/*
* Phase 5 of "hunt for conflicts"
* Called by ical_conflicts_phase4()
}
-
-
/*
* Phase 4 of "hunt for conflicts"
* Called by ical_hunt_for_conflicts_backend()
}
-
/*
* Phase 3 of "hunt for conflicts"
* Called by ical_hunt_for_conflicts()
proposed_event = (icalcomponent *)data;
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
}
-
/*
* Phase 2 of "hunt for conflicts" operation.
* At this point we have a calendar object which represents the VEVENT that
}
-
/*
* Hunt for conflicts (Phase 1 -- retrieve the object and call Phase 2)
*/
struct CtdlMessage *msg = NULL;
struct ical_respond_data ird;
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) {
cprintf("%d Message %ld not found\n",
ERROR + ILLEGAL_VALUE,
}
-
/*
* Look for busy time in a VEVENT and add it to the supplied VFREEBUSY.
*
}
-
/*
* Backend for ical_freebusy()
*
fb = (icalcomponent *)data; /* User-supplied data will be the VFREEBUSY component */
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
}
-
/*
* Grab another user's free/busy times
*/
}
-
/*
* Backend for ical_getics()
*
/* Look for the calendar event... */
- msg = CtdlFetchMessage(msgnum, 1, 1);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
memset(&ird, 0, sizeof ird);
strcpy(ird.desired_partnum, "_HUNT_");
}
-
/*
* Retrieve all of the calendar items in the current room, and output them
* as a single icalendar object.
}
if (!strcasecmp(subcmd, "sgi")) {
- CIT_ICAL->server_generated_invitations =
- (extract_int(argbuf, 1) ? 1 : 0) ;
- cprintf("%d %d\n",
- CIT_OK, CIT_ICAL->server_generated_invitations);
+ CIT_ICAL->server_generated_invitations = (extract_int(argbuf, 1) ? 1 : 0) ;
+ cprintf("%d %d\n", CIT_OK, CIT_ICAL->server_generated_invitations);
return;
}
}
-
/*
* We don't know if the calendar room exists so we just create it at login
*/
return;
}
-
/* If this is a VCALENDAR component, look for a VEVENT subcomponent. */
if (icalcomponent_isa(cal) == ICAL_VCALENDAR_COMPONENT) {
ical_send_out_invitations(top_level_cal,
attached_zones[num_zones_attached++] = z;
}
- icalproperty_set_parameter(p,
- icalparameter_new_tzid(icaltimezone_get_tzid(z))
+ icalproperty_set_parameter(p, icalparameter_new_tzid(icaltimezone_get_tzid(z))
);
}
}
if (msg != NULL) {
valid = validate_recipients(attendees_string, NULL, 0);
- CtdlSubmitMsg(msg, valid, "", QP_EADDR);
+ CtdlSubmitMsg(msg, valid, "");
CM_Free(msg);
free_recipients(valid);
}
}
-
/*
* Back end for ical_obj_beforesave()
* This hunts for the UID of the calendar event (becomes Citadel msg EUID),
}
-
-
/*
* See if we need to prevent the object from being saved (we don't allow
* MIME types other than text/calendar in "calendar" or "tasks" rooms).
memset(CIT_ICAL, 0, sizeof(struct cit_ical));
}
+
void ical_session_shutdown(void) {
free(CIT_ICAL);
}
/*
* Back end for ical_fixed_output()
*/
-void ical_fixed_output_backend(icalcomponent *cal,
- int recursion_level
-) {
+void ical_fixed_output_backend(icalcomponent *cal, int recursion_level) {
icalcomponent *c;
icalproperty *p;
char buf[256];
}
-
/*
* Function to output iCalendar data as plain text. Nobody uses MSG0
* anymore, so really this is just so we expose the vCard data to the full
}
-void serv_calendar_destroy(void)
-{
+void serv_calendar_destroy(void) {
icaltimezone_free_builtin_timezones();
}
CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
CtdlRegisterSessionHook(ical_CtdlCreateRoom, EVT_LOGIN, PRIO_LOGIN + 1);
- CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCal commands");
+ CtdlRegisterProtoHook(cmd_ical, "ICAL", "Citadel iCalendar commands");
CtdlRegisterSessionHook(ical_session_startup, EVT_START, PRIO_START + 1);
CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP, PRIO_STOP + 80);
CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);