* [EXPERIMENTAL] Link in the "libical" calendar library if present
authorArt Cancro <ajc@citadel.org>
Wed, 11 Sep 2002 03:17:18 +0000 (03:17 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 11 Sep 2002 03:17:18 +0000 (03:17 +0000)
* Rename serv_ical to serv_calendar (because the resulting module would be
  named "libical" which conflicts with the external library by that name)

citadel/ChangeLog
citadel/Makefile.in
citadel/acconfig.h
citadel/citadel.spec
citadel/configure.ac
citadel/serv_calendar.c [new file with mode: 0644]
citadel/serv_calendar.h [new file with mode: 0644]
citadel/serv_ical.c [deleted file]
citadel/serv_ical.h [deleted file]

index 2a6f875e870788d363c6bbf52c2101fd2aaf8812..4facbdcaca68abd5b34f57fce1c800734946e6c7 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 601.4  2002/09/11 03:17:18  ajc
+ * [EXPERIMENTAL] Link in the "libical" calendar library if present
+ * Rename serv_ical to serv_calendar (because the resulting module would be
+   named "libical" which conflicts with the external library by that name)
+
  Revision 601.3  2002/09/10 08:07:38  error
  * update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00* update citadel.spec for 6.00
 
@@ -3991,4 +3996,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 e3bf0f17ebfb4112f8bb0cbd93ae16fb27ad752e..c2e82861e32f0f69e7597538adeb33100afb99d4 100644 (file)
@@ -41,7 +41,7 @@ SERV_MODULES=modules/libchat.la modules/libvcard.la \
        modules/libbio.la \
        modules/libexpire.la \
        modules/libvandelay.la \
-       modules/libical.la
+       modules/libcalendar.la
 UTIL_TARGETS=aidepost msgform readlog \
        stats citmail userlist sendcommand \
        base64 migratenet$(EXEEXT)
@@ -91,7 +91,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c \
        client_passwords.c imap_misc.c serv_netfilter.c serv_mrtg.c \
        serv_spam.c citadel_ipc.c serv_listsub.c \
        serv_imap.c imap_tools.c imap_fetch.c imap_search.c imap_store.c \
-       serv_network.c serv_pas2.c serv_ical.c md5.c server_main.c
+       serv_network.c serv_pas2.c serv_calendar.c md5.c server_main.c
 
 DEP_FILES=$(SOURCES:.c=.d)
 
@@ -213,8 +213,8 @@ aidepost: aidepost.o libcitserver.la $(LIBOBJS)
 modules/libpas2.la: serv_pas2.lo md5.lo $(LIBTOOL) libcitserver.la
        $(LTSHARE) -o libpas2.la ../serv_pas2.lo ../md5.lo ../libcitserver.la
 
-modules/libical.la: serv_ical.lo $(LIBTOOL) libcitserver.la
-       $(LTSHARE) -o libical.la ../serv_ical.lo ../libcitserver.la
+modules/libcalendar.la: serv_calendar.lo $(LIBTOOL) libcitserver.la
+       $(LTSHARE) -o libcalendar.la ../serv_calendar.lo ../libcitserver.la
 
 citmail: citmail.o config.o
        $(CC) citmail.o config.o $(LDFLAGS) -o citmail $(LIBS)
index 6c9b2abd8d87ad0ec510ff1ac5d4095afdacdbfb..ceecff046adfad3b4f1f49b428d02b8731a43c35 100644 (file)
@@ -27,3 +27,6 @@
 
 /* define this if you have zlib compression available */
 #undef HAVE_ZLIB
+
+/* define this if you have the libical calendaring library available */
+#undef HAVE_LIBICAL
index 5fa93b3224f8da69fd1f9692433742678abb7e92..ec70db82837569b7836576c44e75349fcfba01fb 100644 (file)
@@ -105,8 +105,8 @@ upgrading this package.
 /usr/local/citadel/modules/libexpire.la
 /usr/local/citadel/modules/libvandelay.so
 /usr/local/citadel/modules/libvandelay.la
-/usr/local/citadel/modules/libical.so
-/usr/local/citadel/modules/libical.la
+/usr/local/citadel/modules/libcalendar.so
+/usr/local/citadel/modules/libcalendar.la
 /usr/local/citadel/modules/liblistsub.so
 /usr/local/citadel/modules/liblistsub.la
 /usr/local/citadel/modules/libmrtg.so
index fdf845fa788c2acb2df6accffd7122ec7717c003..2d54e4dedcb88700f219026c02c2e7c9aed52e72 100644 (file)
@@ -32,6 +32,7 @@ AC_ARG_WITH(ssl,
 AC_ARG_WITH(ncurses, [  --without-ncurses       don't use ncurses])
 
 AC_ARG_WITH(with_zlib, [  --with-zlib             use zlib compression if present])
+AC_ARG_WITH(with_libical, [  --with-libical          use libical calendaring library])
 
 if test "x$with_gdbm" != xno -a "x$with_gdbm" != xyes -a "$with_gdbm"; then
        db_dir="$with_gdbm"
@@ -366,6 +367,8 @@ if test "x$with_gdbm" != xno -a "x$with_db" != xyes; then
                 with_db=no])
 fi
 
+
+
 dnl Checks for the zlib compression library.
 if test "x$with_zlib" != xno ; then
        AC_CHECK_HEADERS(zlib.h,
@@ -379,6 +382,23 @@ if test "x$ok_zlib" != xno ; then
        AC_DEFINE(HAVE_ZLIB)
 fi
 
+
+
+dnl Checks for the libical calendaring library.
+if test "x$with_libical" != xno ; then
+       AC_CHECK_HEADERS(ical.h,
+               [AC_CHECK_LIB(ical, icalcomponent_new,
+                       [ok_libical=yes],,
+       )])
+fi
+
+if test "x$ok_libical" != xno ; then
+       LIBS="-lical $LIBS"
+       AC_DEFINE(HAVE_LIBICAL)
+fi
+
+
+
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
diff --git a/citadel/serv_calendar.c b/citadel/serv_calendar.c
new file mode 100644 (file)
index 0000000..bae86f4
--- /dev/null
@@ -0,0 +1,118 @@
+/* 
+ * $Id$ 
+ *
+ * This module implements iCalendar object processing and the My Calendar>
+ * room on a Citadel/UX server.  It handles iCalendar objects using the
+ * iTIP protocol.  See RFCs 2445 and 2446.
+ *
+ */
+
+#include "sysdep.h"
+#include <unistd.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#include "serv_ical.h"
+#include "citadel.h"
+#include "server.h"
+#include "citserver.h"
+#include "sysdep_decls.h"
+#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 */
+void cmd_ical(char *argbuf)
+{
+       /* argbuf is not used */
+       if (!(CC->logged_in)) {
+               cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
+               return;
+       }
+
+       cprintf("%d I support|ICAL\n", CIT_OK);
+       return;
+}
+
+
+/* We don't know if the calendar room exists so we just create it at login */
+void ical_create_room(void)
+{
+       struct quickroom qr;
+
+       /* Create the room if it doesn't already exist */
+       create_room(USERCALENDARROOM, 4, "", 0, 1, 0);
+       /* Set expiration policy to manual; otherwise objects will be lost! */
+       if (lgetroom(&qr, USERCALENDARROOM)) {
+               lprintf(3, "Couldn't get the user calendar room!\n");
+               return;
+       }
+       qr.QRep.expire_mode = EXPIRE_MANUAL;
+       lputroom(&qr);
+       lprintf(9, "Set user calendar room to manual expire\n");
+       return;
+}
+
+
+/* See if we need to prevent the object from being saved */
+int ical_obj_beforesave(struct CtdlMessage *msg)
+{
+       char roomname[ROOMNAMELEN];
+       char *p;
+       int a;
+       
+       /*
+        * Only messages with content-type text/calendar or text/x-calendar
+        * may be saved to My Calendar>.  If the message is bound for
+        * My Calendar> but doesn't have this content-type, throw an error
+        * so that the message may not be posted.
+        */
+
+       /* First determine if this is our room */
+       MailboxName(roomname, sizeof roomname, &CC->usersupp, USERCALENDARROOM);
+       if (strncmp(roomname, msg->cm_fields['O'], ROOMNAMELEN))
+               return 0;       /* It's not us... */
+
+       /* Then determine content-type of the message */
+       
+       /* It must be an RFC822 message! */
+       /* FIXME: Not handling MIME multipart messages; implement with IMIP */
+       if (msg->cm_format_type != 4)
+               return 1;       /* You tried to save a non-RFC822 message! */
+       
+       /* Find the Content-Type: header */
+       p = msg->cm_fields['M'];
+       a = strlen(p);
+       while (--a > 0) {
+               if (!strncasecmp(p, "Content-Type: ", 14)) {    /* Found it */
+                       if (!strncasecmp(p + 14, "text/x-calendar", 15) ||
+                           !strncasecmp(p + 14, "text/calendar", 13))
+                               return 0;
+                       else
+                               return 1;
+               }
+               p++;
+       }
+       
+       /* Oops!  No Content-Type in this message!  How'd that happen? */
+       lprintf(7, "RFC822 message with no Content-Type header!\n");
+       return 1;
+}
+
+
+
+/* Register this module with the Citadel server. */
+char *Dynamic_Module_Init(void)
+{
+       CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
+       CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
+       CtdlRegisterProtoHook(cmd_ical, "ICAL", "Register iCalendar support");
+       return "$Id$";
+}
diff --git a/citadel/serv_calendar.h b/citadel/serv_calendar.h
new file mode 100644 (file)
index 0000000..059ba2d
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * $Id$
+ *
+ * iCalendar implementation for Citadel/UX
+ *
+ */
+
+
+/* Hrm, we don't have anything to put here yet... */
diff --git a/citadel/serv_ical.c b/citadel/serv_ical.c
deleted file mode 100644 (file)
index bae86f4..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 
- * $Id$ 
- *
- * This module implements iCalendar object processing and the My Calendar>
- * room on a Citadel/UX server.  It handles iCalendar objects using the
- * iTIP protocol.  See RFCs 2445 and 2446.
- *
- */
-
-#include "sysdep.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#include "serv_ical.h"
-#include "citadel.h"
-#include "server.h"
-#include "citserver.h"
-#include "sysdep_decls.h"
-#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 */
-void cmd_ical(char *argbuf)
-{
-       /* argbuf is not used */
-       if (!(CC->logged_in)) {
-               cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
-               return;
-       }
-
-       cprintf("%d I support|ICAL\n", CIT_OK);
-       return;
-}
-
-
-/* We don't know if the calendar room exists so we just create it at login */
-void ical_create_room(void)
-{
-       struct quickroom qr;
-
-       /* Create the room if it doesn't already exist */
-       create_room(USERCALENDARROOM, 4, "", 0, 1, 0);
-       /* Set expiration policy to manual; otherwise objects will be lost! */
-       if (lgetroom(&qr, USERCALENDARROOM)) {
-               lprintf(3, "Couldn't get the user calendar room!\n");
-               return;
-       }
-       qr.QRep.expire_mode = EXPIRE_MANUAL;
-       lputroom(&qr);
-       lprintf(9, "Set user calendar room to manual expire\n");
-       return;
-}
-
-
-/* See if we need to prevent the object from being saved */
-int ical_obj_beforesave(struct CtdlMessage *msg)
-{
-       char roomname[ROOMNAMELEN];
-       char *p;
-       int a;
-       
-       /*
-        * Only messages with content-type text/calendar or text/x-calendar
-        * may be saved to My Calendar>.  If the message is bound for
-        * My Calendar> but doesn't have this content-type, throw an error
-        * so that the message may not be posted.
-        */
-
-       /* First determine if this is our room */
-       MailboxName(roomname, sizeof roomname, &CC->usersupp, USERCALENDARROOM);
-       if (strncmp(roomname, msg->cm_fields['O'], ROOMNAMELEN))
-               return 0;       /* It's not us... */
-
-       /* Then determine content-type of the message */
-       
-       /* It must be an RFC822 message! */
-       /* FIXME: Not handling MIME multipart messages; implement with IMIP */
-       if (msg->cm_format_type != 4)
-               return 1;       /* You tried to save a non-RFC822 message! */
-       
-       /* Find the Content-Type: header */
-       p = msg->cm_fields['M'];
-       a = strlen(p);
-       while (--a > 0) {
-               if (!strncasecmp(p, "Content-Type: ", 14)) {    /* Found it */
-                       if (!strncasecmp(p + 14, "text/x-calendar", 15) ||
-                           !strncasecmp(p + 14, "text/calendar", 13))
-                               return 0;
-                       else
-                               return 1;
-               }
-               p++;
-       }
-       
-       /* Oops!  No Content-Type in this message!  How'd that happen? */
-       lprintf(7, "RFC822 message with no Content-Type header!\n");
-       return 1;
-}
-
-
-
-/* Register this module with the Citadel server. */
-char *Dynamic_Module_Init(void)
-{
-       CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
-       CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
-       CtdlRegisterProtoHook(cmd_ical, "ICAL", "Register iCalendar support");
-       return "$Id$";
-}
diff --git a/citadel/serv_ical.h b/citadel/serv_ical.h
deleted file mode 100644 (file)
index 059ba2d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- * $Id$
- *
- * iCalendar implementation for Citadel/UX
- *
- */
-
-
-/* Hrm, we don't have anything to put here yet... */