Add serv_sieve.c and initialize it...
authorArt Cancro <ajc@citadel.org>
Mon, 11 Sep 2006 15:46:18 +0000 (15:46 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 11 Sep 2006 15:46:18 +0000 (15:46 +0000)
citadel/Makefile.in
citadel/serv_extensions.c
citadel/serv_sieve.c [new file with mode: 0644]

index d2aced0b28e34ff45247cbcc65482274d0fb742c..e7562db07a00ac6d28595c9dcca20c55ebaa008c 100644 (file)
@@ -49,6 +49,7 @@ SERV_MODULES=serv_chat.o \
        serv_expire.o \
        serv_vandelay.o \
        serv_calendar.o \
+       serv_sieve.o \
        serv_managesieve.o \
        ical_dezonify.o \
        serv_ldap.o \
@@ -100,7 +101,8 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c citadel.c citadel_ipc.c \
        serv_listsub.c serv_mrtg.c serv_netfilter.c serv_network.c \
        serv_newuser.c serv_pas2.c serv_pop3.c serv_rwho.c serv_smtp.c \
        serv_spam.c serv_test.c serv_mrtg.c serv_spam.c serv_upgrade.c \
-       serv_vandelay.c serv_vcard.c serv_managesieve.c server_main.c setup.c snprintf.c \
+       serv_vandelay.c serv_vcard.c serv_managesieve.c server_main.c \
+       serv_sieve.c setup.c snprintf.c \
        stress.c support.c sysdep.c tools.c user_ops.c userlist.c \
        whobbs.c vcard.c serv_notes.c serv_fulltext.c ft_wordbreaker.c \
        crc16.c journaling.c citadel_dirs.c
index dc37cb74e77237950fa29a896969e63b9a5023ce..6f72457d3c9f5e15dacacf197a600c947bc4112a 100644 (file)
@@ -127,9 +127,7 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_fulltext_init());
        lprintf(CTDL_INFO, "%s\n", serv_autocompletion_init());
        lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
-#ifdef HAVE_LIBSIEVE
-       lprintf(CTDL_INFO, "%s\n", "FIXME do serv_libsieve_init() here");
-#endif
+       lprintf(CTDL_INFO, "%s\n", serv_sieve_init());
        lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
 }
 
diff --git a/citadel/serv_sieve.c b/citadel/serv_sieve.c
new file mode 100644 (file)
index 0000000..430f359
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * $Id: serv_test.c 3850 2005-09-13 14:00:24Z ajc $
+ *
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "serv_extensions.h"
+#include "room_ops.h"
+#include "policy.h"
+#include "database.h"
+#include "msgbase.h"
+
+#ifdef HAVE_LIBSIEVE
+
+#include "sieve2.h"
+#include "sieve2_error.h"
+
+/**
+ *     We don't really care about dumping the entire credits to the log
+ *     every time the server is initialized.  The documentation will suffice
+ *     for that purpose.  We are making a call to sieve2_credits() in order
+ *     to demonstrate that we have successfully linked in to libsieve.
+ */
+void log_the_sieve2_credits(void) {
+       char *cred = NULL;
+       char *ptr;
+
+       cred = strdup(sieve2_credits());
+       if (cred == NULL) return;
+
+       if (strlen(cred) > 60) {
+               strcpy(&cred[55], "...");
+       }
+
+       lprintf(CTDL_INFO, "%s\n",cred);
+       free(cred);
+}
+
+
+char *serv_sieve_init(void)
+{
+       log_the_sieve2_credits();
+       return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $";
+}
+
+#else  /* HAVE_LIBSIEVE */
+
+char *serv_sieve_init(void)
+{
+       lprintf(CTDL_INFO, "This server is missing libsieve.  Mailbox filtering will be disabled.\n");
+       return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $";
+}
+
+#endif /* HAVE_LIBSIEVE */