4 * This module implements iCalendar object processing and the My Calendar>
5 * room on a Citadel/UX server. It handles iCalendar objects using the
6 * iTIP protocol. See RFCs 2445 and 2446.
11 #include <sys/types.h>
15 #include "serv_ical.h"
18 #include "citserver.h"
19 #include "sysdep_decls.h"
22 #include "dynloader.h"
27 /* Tell clients what level of support to expect */
28 void cmd_ical(char *argbuf)
30 /* argbuf is not used */
31 if (!(CC->logged_in)) {
32 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
36 cprintf("%d I (will) support|ICAL,ITIP\n", OK);
41 /* We can't know if the calendar room exists so we just create it at login */
42 void ical_create_room(void)
44 char roomname[ROOMNAMELEN];
47 /* Create the room if it doesn't already exist */
48 MailboxName(roomname, &CC->usersupp, USERCALENDARROOM);
49 create_room(roomname, 4, "", 0);
50 /* Set expiration policy to manual; otherwise objects will be lost! */
51 if (lgetroom(&qr, roomname)) {
52 lprintf(3, "Couldn't get the user calendar room!\n");
55 qr.QRep.expire_mode = EXPIRE_MANUAL;
61 /* User is reading a message */
62 int ical_obj_beforeread(struct CtdlMessage *msg)
68 /* See if we need to prevent the object from being saved */
69 int ical_obj_beforesave(struct CtdlMessage *msg)
75 /* aftersave processing */
76 int ical_obj_aftersave(struct CtdlMessage *msg)
82 /* Register this module with the Citadel server. */
83 char *Dynamic_Module_Init(void)
85 CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
86 CtdlRegisterMessageHook(ical_obj_beforeread, EVT_BEFOREREAD);
87 CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
88 CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
89 CtdlRegisterProtoHook(cmd_ical, "ICAL", "Register iCalendar support");