From 25c2c5f758f5199c2434308b7db2480b161659df Mon Sep 17 00:00:00 2001 From: Michael Hampton Date: Sat, 3 Feb 2001 09:30:47 +0000 Subject: [PATCH] * serv_ical.c: now creates a My Calendar> personal room, sets attributes --- citadel/ChangeLog | 4 +++- citadel/serv_ical.c | 33 +++++++++++++++++++++++++++++++++ citadel/sysconfig.h | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index b0d32514f..c2330ad9b 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 573.79 2001/02/03 09:30:46 error + * serv_ical.c: now creates a My Calendar> personal room, sets attributes + Revision 573.78 2001/02/03 08:21:00 error * serv_ical.c and serv_ical.h added; skeleton code for now @@ -2358,4 +2361,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/serv_ical.c b/citadel/serv_ical.c index 170a2347b..267da1c73 100644 --- a/citadel/serv_ical.c +++ b/citadel/serv_ical.c @@ -20,6 +20,8 @@ #include "support.h" #include "config.h" #include "dynloader.h" +#include "user_ops.h" +#include "room_ops.h" /* Tell clients what level of support to expect */ @@ -36,12 +38,41 @@ void cmd_ical(char *argbuf) } +/* We can't know if the calendar room exists so we just create it at login */ +void ical_create_room(void) +{ + char roomname[ROOMNAMELEN]; + struct quickroom qr; + + /* Create the room if it doesn't already exist */ + MailboxName(roomname, &CC->usersupp, USERCALENDARROOM); + create_room(roomname, 4, "", 0); + /* Set expiration policy to manual; otherwise objects will be lost! */ + if (lgetroom(&qr, roomname)) { + lprintf(3, "Couldn't get the user calendar room!\n"); + return; + } + qr.QRep.expire_mode = EXPIRE_MANUAL; + lputroom(&qr); + return; +} + + +/* User is reading a message */ +int ical_obj_beforeread(struct CtdlMessage *msg) +{ + return 0; +} + + +/* See if we need to prevent the object from being saved */ int ical_obj_beforesave(struct CtdlMessage *msg) { return 0; } +/* aftersave processing */ int ical_obj_aftersave(struct CtdlMessage *msg) { return 0; @@ -51,6 +82,8 @@ int ical_obj_aftersave(struct CtdlMessage *msg) /* Register this module with the Citadel server. */ char *Dynamic_Module_Init(void) { + CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN); + CtdlRegisterMessageHook(ical_obj_beforeread, EVT_BEFOREREAD); CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE); CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE); CtdlRegisterProtoHook(cmd_ical, "ICAL", "Register iCalendar support"); diff --git a/citadel/sysconfig.h b/citadel/sysconfig.h index cb9833323..2d283ad99 100644 --- a/citadel/sysconfig.h +++ b/citadel/sysconfig.h @@ -106,6 +106,7 @@ #define MAILROOM "Mail" #define AIDEROOM "Aide" #define USERCONFIGROOM "My Citadel Config" +#define USERCALENDARROOM "My Calendar" #define PAGELOGROOM "Sent/Received Pages" #define SYSCONFIGROOM "Local System Configuration" #define SMTP_SPOOLOUT_ROOM "__CitadelSMTPspoolout__" -- 2.30.2