* serv_ical.c: now creates a My Calendar> personal room, sets attributes
authorMichael Hampton <io_error@uncensored.citadel.org>
Sat, 3 Feb 2001 09:30:47 +0000 (09:30 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sat, 3 Feb 2001 09:30:47 +0000 (09:30 +0000)
citadel/ChangeLog
citadel/serv_ical.c
citadel/sysconfig.h

index b0d32514f1080eca36eb4e2b3e2b60420ba5a83c..c2330ad9be2ec151c4cc4deb70dd841028ab91df 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 170a2347bf5c7120f3216b445467e0757eafccd8..267da1c731ae0b7fbe961c0861122996b13c4995 100644 (file)
@@ -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");
index cb98333238a6ddc33078132452096c3b7d73ce13..2d283ad99483c6803acbad4ab6534c22495a7b4b 100644 (file)
 #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__"