Moved to new module init structure.
authorDave West <davew@uncensored.citadel.org>
Thu, 26 Jul 2007 07:46:53 +0000 (07:46 +0000)
committerDave West <davew@uncensored.citadel.org>
Thu, 26 Jul 2007 07:46:53 +0000 (07:46 +0000)
Added file include/ctdl_module.h
Added script mk_modules_init.sh to build files modules_init.c and modules_init.h
removed #include "serv_extensions.h" from files that don't need it
Begun creation of new module dir structure.

davew.

61 files changed:
citadel/Makefile.in
citadel/citserver.c
citadel/clientsocket.c
citadel/config.c
citadel/control.c
citadel/database_sleepycat.c
citadel/euidindex.c
citadel/file_ops.c
citadel/ft_wordbreaker.c
citadel/html.c
citadel/imap_acl.c
citadel/imap_fetch.c
citadel/imap_list.c
citadel/imap_metadata.c
citadel/imap_misc.c
citadel/imap_search.c
citadel/imap_store.c
citadel/include/ctdl_module.h [new file with mode: 0644]
citadel/internet_addressing.c
citadel/journaling.c
citadel/locate_host.c
citadel/mime_parser.c
citadel/mk_module_init.sh [new file with mode: 0755]
citadel/policy.c
citadel/room_ops.c
citadel/sendcommand.c
citadel/serv_autocompletion.c
citadel/serv_bio.c
citadel/serv_calendar.c
citadel/serv_chat.c
citadel/serv_crypto.c
citadel/serv_expire.c
citadel/serv_extensions.c
citadel/serv_extensions.h
citadel/serv_fulltext.c
citadel/serv_funambol.c
citadel/serv_imap.c
citadel/serv_inetcfg.c
citadel/serv_ldap.c
citadel/serv_listsub.c
citadel/serv_managesieve.c
citadel/serv_mrtg.c
citadel/serv_netfilter.c
citadel/serv_network.c
citadel/serv_newuser.c
citadel/serv_notes.c
citadel/serv_pas2.c
citadel/serv_pop3.c
citadel/serv_rwho.c
citadel/serv_sieve.c
citadel/serv_smtp.c
citadel/serv_spam.c
citadel/serv_test.c
citadel/serv_upgrade.c
citadel/serv_vandelay.c
citadel/serv_vcard.c
citadel/server_main.c
citadel/sysdep.c
citadel/sysdep_decls.h
citadel/techdoc/test_suite.txt [new file with mode: 0644]
citadel/user_ops.c

index c51cf122b8001198ab25474a039e068e1e2b0c71..7cfddeb59fed94dfdee90db854608e8279e2c024 100644 (file)
@@ -64,7 +64,8 @@ SERV_MODULES=serv_chat.o \
        ical_dezonify.o \
        serv_ldap.o \
        serv_autocompletion.o \
-       serv_funambol.o
+       serv_funambol.o \
+       serv_test.o
 
 UTIL_TARGETS=aidepost msgform \
        citmail userlist sendcommand \
@@ -119,7 +120,7 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c chkpw.c citadel.c citadel_ipc.c \
        whobbs.c vcard.c serv_notes.c serv_fulltext.c ft_wordbreaker.c \
        crc16.c journaling.c citadel_dirs.c imap_list.c imap_metadata.c
 
-DEP_FILES=$(SOURCES:.c=.d)
+DEP_FILES=$(SOURCES:.c=.d) modules_init.d
 
 client: $(CLIENT_TARGETS)
 
@@ -144,6 +145,9 @@ citadel$(EXEEXT): citadel.o citadel_ipc.o client_chat.o client_passwords.o \
 
 parsedate.o: parsedate.c
 
+modules_init.c: mk_module_init.sh $(SOURCES)
+               $(srcdir)/mk_module_init.sh
+
 SERV_OBJS = server_main.o \
        user_ops.o citserver.o sysdep.o serv_extensions.o \
        tools.o $(DATABASE:.c=.o) domain.o \
@@ -152,7 +156,7 @@ SERV_OBJS = server_main.o \
        locate_host.o housekeeping.o mime_parser.o html.o \
        internet_addressing.o journaling.o \
        serv_crypto.o parsedate.o genstamp.o \
-       clientsocket.o $(AUTH) $(SERV_MODULES)
+       clientsocket.o modules_init.o $(AUTH) $(SERV_MODULES)
 
 citserver: $(SERV_OBJS)
        $(CC) $(SERV_OBJS) $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) $(SERVER_LIBS) $(RESOLV) -o citserver
@@ -336,10 +340,11 @@ install-exec-new: all
        done
 
 clean:
-       rm -f *.o
+       rm -f *.o 
 
 cleaner: clean
        rm -rf $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) $(UTILBIN_TARGETS) database_cleanup.sh *.la
+       rm -rf modules_init.c modules_init.h
 
 distclean: cleaner
        find . -name '*~' -o -name '.#*' | xargs rm -f
index 8c2c4cde4c3a052796e4d6eda120bcb26371c00d..39f0fb66daa394cd0196e32c83227550cf4c895a 100644 (file)
@@ -38,7 +38,6 @@
 #include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "config.h"
index 83f06ad6cd44cefa7d5b21865e3ffff34c45178b..cd375db2d016fc1c7607ac8b588deace27b764ed 100644 (file)
@@ -25,7 +25,6 @@
 #include <stdarg.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
 #endif
index d938065a2ab166b931d7b83937e6fc44d5be9c43..a8d4ca6b7f45b7c100f54ef57faccdb5e3aacbe1 100644 (file)
@@ -16,7 +16,6 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "config.h"
 
 struct config config;
index a6d61f82d4fbf44591f93c604da6033fddf914b2..83c1eb086e1f6ad430fd3bd9da2aee19407a9444 100644 (file)
@@ -32,7 +32,6 @@
 #include "citadel.h"
 #include "server.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "config.h"
index c5d6c4b8e4ad50c5749477e8a1f287aa794c531d..e01c0adadc3667bc812fa437e9c46f5f82ca4cef 100644 (file)
 #include <pthread.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "citserver.h"
 #include "database.h"
 #include "msgbase.h"
 #include "sysdep_decls.h"
 #include "config.h"
 
+#include "ctdl_module.h"
+
+
 static DB *dbp[MAXCDB];                /* One DB handle for each Citadel database */
 static DB_ENV *dbenv;          /* The DB environment (global) */
 
index 752437777ce979bbe4a544fde879ecd0e5ae7163..5f25615f98f9d0b6baa8709e75f0ef6edaa21368 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "msgbase.h"
 #include "support.h"
index a6cf80b7a087c8ef2d74b867d7a97811b10bf2dd..015e989ea761f18f25e10a08f0a58214e9a06331 100644 (file)
@@ -30,7 +30,6 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "config.h"
 #include "file_ops.h"
 #include "sysdep_decls.h"
index a580879157c9c0c3078df363714ff1cf38fea32a..6b9fb2d243b54122f4c8a6453ba77c6888b73777 100644 (file)
@@ -37,7 +37,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "msgbase.h"
 #include "control.h"
index c0359a6a7994871401a96e1f475f4e02b1382438..6a86d323a998db85a3b9db23274e8ee626dbeabc 100644 (file)
@@ -30,7 +30,6 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "control.h"
 #include "sysdep_decls.h"
 #include "support.h"
index 1281fa30fce94c0abd797e59f2bda748479bc046..1632532db3675e21f73983dc17a03295fad1b946 100644 (file)
@@ -37,7 +37,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index bc0aaf41ec59e185cfb97ec811ee7ac7aca60beb..66d5b44addce658164315f1c2e25e011b42760c0 100644 (file)
@@ -38,7 +38,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index edfa1ddb037e8b12cf20874d9d411e19d8e49f8e..be01c99a77ac4204644c41b09a36b4412fd9b41a 100644 (file)
@@ -39,7 +39,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index 2b0b5fc2843098200e6f2aa0e3cfec708fce2d63..3266c27cec18c50c652266585f473db2e0bf51fe 100644 (file)
@@ -40,7 +40,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index 58c649c316d205b5c387808ac2783d32e56650d7..350f9ad108d32c9cb3a23a16e5f6d18bf70b7f72 100644 (file)
@@ -36,7 +36,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index 3dd552192b9d0c4c8c2f957d613aa2fe82961859..1c647774bbe8deee7d87a50890c7c2dd7e5d6c3f 100644 (file)
@@ -36,7 +36,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
index e4204cfc32ddc1447ce4dce15cdfb6b082a7e1c6..7e163787b227a2880ff548426e23721fdaf61edc 100644 (file)
@@ -37,7 +37,6 @@
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
diff --git a/citadel/include/ctdl_module.h b/citadel/include/ctdl_module.h
new file mode 100644 (file)
index 0000000..ed8e7c9
--- /dev/null
@@ -0,0 +1,65 @@
+/* $Id:$ */
+
+#ifndef CTDL_MODULE_H
+#define CTDL_MODULE_H
+
+
+#include "server.h"
+#include "sysdep_decls.h"
+/*
+ * define macros for module init stuff
+ */
+#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (void)
+
+#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init ()
+
+void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
+void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
+
+void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+
+void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
+void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
+
+void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
+                                                       int EventType);
+void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
+                                                       int EventType);
+
+void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
+void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
+
+void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
+void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
+
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
+
+void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
+void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
+
+void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
+void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
+
+void CtdlRegisterServiceHook(int tcp_port,
+                       char *sockpath,
+                        void (*h_greeting_function) (void),
+                        void (*h_command_function) (void),
+                        void (*h_async_function) (void)
+);
+void CtdlUnregisterServiceHook(int tcp_port,
+                       char *sockpath,
+                        void (*h_greeting_function) (void),
+                        void (*h_command_function) (void),
+                        void (*h_async_function) (void)
+);
+
+void CtdlRegisterFixedOutputHook(char *content_type,
+                       void (*output_function) (char *supplied_data, int len)
+);
+void CtdlUnRegisterFixedOutputHook(char *content_type);
+
+#endif /* CTDL_MODULE_H */
index 3bbf8245423a483b77b05d3c5ab5b205c189913f..123b5280dcdf7ee519fcf3551647858568723380 100644 (file)
@@ -32,7 +32,6 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
index 38629ab41eff073c82f6406e0e1216d33032296e..4d18623c57e838f10145abfd40a8862842608dc5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id:  $
+ * $Id$
  *
  * Message journaling functions.
  *
@@ -31,7 +31,6 @@
 #include <sys/stat.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "msgbase.h"
 #include "support.h"
index da0594df489b9ea4375f21ec9d39a8a2db790164..bb2463dae9616bff444dde7dca6706dda704c9ec 100644 (file)
@@ -19,7 +19,6 @@
 #include <string.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "locate_host.h"
 #include "sysdep_decls.h"
 #include "config.h"
index 869327ecbc0a475f754753ea2f1129fc06915d58..f7b9681a0ad9e40bf62307ea94b513dc7a335cad 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "tools.h"
 
diff --git a/citadel/mk_module_init.sh b/citadel/mk_module_init.sh
new file mode 100755 (executable)
index 0000000..3b8a2ed
--- /dev/null
@@ -0,0 +1,120 @@
+#!/bin/sh
+#
+# Script to generate $C_FILE
+#
+
+
+
+CUR_DIR=`pwd`
+C_FILE="$CUR_DIR/modules_init.c"
+H_FILE="$CUR_DIR/modules_init.h"
+
+echo -e "Scanning extension modules for entry points."
+
+
+#start ofs the files which inturn removes any existing file
+#
+echo -e "/*" > $C_FILE
+echo -e " * $C_FILE" >> $C_FILE
+echo -e " * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE" >> $C_FILE
+echo -e " */\n\n\n" >> $C_FILE
+
+#echo -e "#include \"sysdep.h\"\n" >> $C_FILE
+echo -e "#include <stdlib.h>\n" >> $C_FILE
+#echo -e "#include <ctype.h>\n" >> $C_FILE
+#echo -e "#include \"citadel.h\"\n" >> $C_FILE
+echo -e "#include \"modules_init.h\"\n" >> $C_FILE
+echo -e "#include \"sysdep_decls.h\"\n" >> $C_FILE
+echo -e "\n\n\n" >> $C_FILE
+echo -e "void LogPrintMessages(long err);" >> $C_FILE
+echo -e "static long DetailErrorFlags;" >> $C_FILE
+echo -e "\n\n\n" >> $C_FILE
+
+echo -e "void initialise_modules (void)" >> $C_FILE
+echo -e "{" >> $C_FILE
+echo -e "\tlong filter;\n\n" >> $C_FILE
+echo -e -n "\t" >> $C_FILE
+echo -E "lprintf(CTDL_INFO, \"New citadel module init proceedure.\n\");" >> $C_FILE
+
+#start the header file
+echo -e "/*" > $H_FILE
+echo -e " * $H_FILE" >> $H_FILE
+echo -e " * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE" >> $H_FILE
+echo -e " */\n\n\n" >> $H_FILE
+echo -e "#ifndef MODULES_INIT_H" >> $H_FILE
+echo -e "#define MODULES_INIT_H\n" >> $H_FILE
+echo -e "#include \"ctdl_module.h\"\n" >> $H_FILE
+echo -e "void initialise_modules (void) ;\n" >> $H_FILE
+
+
+for i in serv_*.c
+do
+       RES=X`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
+       if [ $RES != "X" ] ; then
+               RES_OUT=`echo $RES | cut -b2-`
+               echo -e "Found entry point in file $i"
+               echo -e -n "\t" >> $C_FILE
+               echo -E "lprintf (CTDL_INFO, \"%s\n\", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+               echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+       fi
+done
+
+
+if [ -d "modules" ] ; then
+       cd modules
+       for j in *
+       do
+               if [ -d $j ] ; then
+                       cd $j
+                       for k in *.c
+                       do
+                               if [ -f "$k" ] ; then
+                                       RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
+                                       if [ $RES != "X" ] ; then
+                                               RES_OUT=`echo $RES | cut -b2-`
+                                               echo -e "Found entry point in file modules/$j/$k"
+                                               echo -n "\t" >> $C_FILE
+                                               echo -E "lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+                                               echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+                                       fi
+                               fi
+                       done
+               fi
+       done
+fi
+
+cd $CUR_DIR
+
+if [ -d "user_modules" ] ; then
+       cd user_modules
+       for j in *
+       do
+               if [ -d $j ] ; then
+                       cd $j
+                       for k in *.c
+                       do
+                               if [ -f "$k" ] ; then
+                                       RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
+                                       if [ $RES != "X" ] ; then
+                                               RES_OUT=`echo $RES | cut -b2-`
+                                               echo -e "Found entry point in file user_modules/$j/$k"
+                                               echo -n "\t" >> $C_FILE
+                                               echo -E "lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+                                               echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+                                       fi
+                               fi
+                       done
+               fi
+       done
+fi
+
+cd $CUR_DIR
+
+echo -e "\n\n" >> $C_FILE
+echo -e "\tfor (filter = 1; filter != 0; filter = filter << 1)" >> $C_FILE
+echo -e "\t\tif ((filter & DetailErrorFlags) != 0)" >> $C_FILE
+echo -e "\t\t\tLogPrintMessages(filter);" >> $C_FILE
+echo -e "}" >> $C_FILE
+
+
+echo -e "\n#endif /* MODULES_INIT_H */" >> $H_FILE
index 079c3cda088ba90c381150201671e8d896512fff..804416e71df443932841ac0627b12041445c7ff9 100644 (file)
@@ -26,7 +26,6 @@
 #include "citadel.h"
 #include "server.h"
 #include "database.h"
-#include "serv_extensions.h"
 #include "config.h"
 #include "room_ops.h"
 #include "sysdep_decls.h"
index d2ce223e17ca3bf37e9d211704942d10d4cb76db..93e8b4486cf75486dbd108fd425e39f2c0e34941 100644 (file)
@@ -28,7 +28,6 @@
 #include <errno.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "config.h"
 #include "room_ops.h"
index d1619fea55037004d802bddb4c9fd14f4a29835a..cc47df4af80cff048d7fc0dfd761412858ee9898 100644 (file)
@@ -33,7 +33,6 @@
 #include "tools.h"
 #include "citadel_ipc.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "config.h"
 
 #define LOCKFILE "/tmp/LCK.sendcommand"
index 239985c655b294cd9193f12c121b7546cb58a7b6..ddea4f0dcc0077b015eeb7424b23fe62d2087ef4 100644 (file)
@@ -31,8 +31,6 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
@@ -45,6 +43,8 @@
 #include "serv_fulltext.h"
 #include "serv_autocompletion.h"
 
+#include "ctdl_module.h"
+
 
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -250,7 +250,7 @@ void cmd_auto(char *argbuf) {
 }
 
 
-char *serv_autocompletion_init(void) {
+CTDL_MODULE_INIT(autocompletion) {
        CtdlRegisterProtoHook(cmd_auto, "AUTO", "Do recipient autocompletion");
 
        /* return our Subversion id for the Log */
index 19820a956090175d66801541fdce7de50bb55a79..9f5589b3b2434af55248a65e177375a58a8c5931 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -46,7 +44,7 @@
 #include "tools.h"
 #include "citadel_dirs.h"
 
-
+#include "ctdl_module.h"
 
 /*
  * enter user bio
@@ -134,7 +132,7 @@ void cmd_lbio(char *cmdbuf) {
 
 
 
-char *serv_bio_init(void)
+CTDL_MODULE_INIT(bio)
 {
         CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
         CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
index 2171f381b173aa332c0e1c2fd6f94ee417bd8c7d..de35044412af7d29c44c283cb159b2e309bc9464 100644 (file)
 #include "citadel.h"
 #include "server.h"
 #include "citserver.h"
-#include "sysdep_decls.h"
 #include "support.h"
 #include "config.h"
-#include "serv_extensions.h"
 #include "user_ops.h"
 #include "room_ops.h"
 #include "tools.h"
 #include "internet_addressing.h"
 #include "serv_calendar.h"
 #include "euidindex.h"
+#include "ctdl_module.h"
 
 #ifdef CITADEL_WITH_CALENDAR_SERVICE
 
 #include <ical.h>
 #include "ical_dezonify.h"
 
+
+
 struct ical_respond_data {
        char desired_partnum[SIZ];
        icalcomponent *cal;
@@ -2136,7 +2137,7 @@ void ical_fixed_output(char *ptr, int len) {
 /*
  * Register this module with the Citadel server.
  */
-char *serv_calendar_init(void)
+CTDL_MODULE_INIT(calendar)
 {
 #ifdef CITADEL_WITH_CALENDAR_SERVICE
        CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
index 765d486d9a51d347d71f142a4b3f5d5f0034afac..a34f7efc390ce2f2032ccc15918657942a8a7307 100644 (file)
@@ -31,9 +31,7 @@
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "serv_chat.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "snprintf.h"
 #endif
 
+
+#include "ctdl_module.h"
+
+
+
 struct ChatLine *ChatQueue = NULL;
 int ChatLastMsg = 0;
 
@@ -810,7 +813,7 @@ void cmd_reqt(char *argbuf) {
 
 
 
-char *serv_chat_init(void)
+CTDL_MODULE_INIT(chat)
 {
        CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat");
        CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for instant messages");
index 0db01ac47b8fdcd0bb8dafadf63f87bf65c2c1e0..a9dd5934bc58e357ad62878c3edc20b263462d53 100644 (file)
 #include "server.h"
 #include "serv_crypto.h"
 #include "sysdep_decls.h"
-#include "serv_extensions.h"
 #include "citadel.h"
 #include "config.h"
 
 
+#include "ctdl_module.h"
+/* TODO: should we use the standard module init stuff to start this? */
+/* TODO: should we register an event handler to call destruct_ssl? */
+
 #ifdef HAVE_OPENSSL
 SSL_CTX *ssl_ctx;              /* SSL context */
 pthread_mutex_t **SSLCritters; /* Things needing locking */
index ab0a95214663a0b1bec10de98dec894a75d1aa53..66b46570d54153bd0b202af2b454ca053ceb2b94 100644 (file)
 #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"
@@ -66,6 +64,9 @@
 #include "tools.h"
 
 
+#include "ctdl_module.h"
+
+
 struct PurgeList {
        struct PurgeList *next;
        char name[ROOMNAMELEN]; /* use the larger of username or roomname */
@@ -836,7 +837,7 @@ void cmd_fsck(char *argbuf) {
 
 /*****************************************************************************/
 
-char *serv_expire_init(void)
+CTDL_MODULE_INIT(expire)
 {
        CtdlRegisterSessionHook(purge_databases, EVT_TIMER);
        CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts");
index 1b1390f59fdb67432051ee904ca75d48c12c1d45..1acd40e099cbce6bc63c9785c5bebd6243858f40 100644 (file)
@@ -249,13 +249,14 @@ int DLoader_Exec_Cmd(char *cmdbuf)
        return 0;
 }
 
+#if 0
 void initialize_server_extensions(void)
 {
        long filter;
 
        nSizErrmsg = 0;
 
-       lprintf(CTDL_INFO, "%s\n", serv_bio_init());
+       /*lprintf(CTDL_INFO, "%s\n", serv_bio_init());
        lprintf(CTDL_INFO, "%s\n", serv_calendar_init());
        lprintf(CTDL_INFO, "%s\n", serv_notes_init());
        lprintf(CTDL_INFO, "%s\n", serv_ldap_init());
@@ -273,22 +274,22 @@ void initialize_server_extensions(void)
        lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
        lprintf(CTDL_INFO, "%s\n", serv_pop3_init());
        lprintf(CTDL_INFO, "%s\n", serv_rwho_init());
-       lprintf(CTDL_INFO, "%s\n", serv_spam_init());
+       lprintf(CTDL_INFO, "%s\n", serv_spam_init());*/
        /* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */
-       lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
+       /*lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
        lprintf(CTDL_INFO, "%s\n", serv_vcard_init());
        lprintf(CTDL_INFO, "%s\n", serv_fulltext_init());
        lprintf(CTDL_INFO, "%s\n", serv_autocompletion_init());
        lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
        lprintf(CTDL_INFO, "%s\n", serv_sieve_init());
        lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
-       lprintf(CTDL_INFO, "%s\n", serv_funambol_init());
+       lprintf(CTDL_INFO, "%s\n", serv_funambol_init());*/
        for (filter = 1; filter != 0; filter = filter << 1)
                if ((filter & DetailErrorFlags) != 0)
                        LogPrintMessages(filter);
 }
 
-
+#endif
 
 void CtdlRegisterCleanupHook(void (*fcn_ptr) (void))
 {
index ccdd95979ca5c58d42fb9f96a20382d41cffd264..f0e1cedb097baf6d5fe58670ee0bef406048d488 100644 (file)
  * We'll probably start moving these to a more sane location in the near
  * future.  For now, this just shuts up the compiler.
  */
-char *serv_bio_init(void);
-char *serv_calendar_init(void);
 void serv_calendar_destroy(void);
-char *serv_notes_init(void);
-char *serv_ldap_init(void);
-char *serv_chat_init(void);
-char *serv_expire_init(void);
-char *serv_imap_init(void);
-char *serv_inetcfg_init(void);
-char *serv_listsub_init(void);
-char *serv_mrtg_init(void);
-char *serv_netfilter_init(void);
-char *serv_network_init(void);
-char *serv_newuser_init(void);
-char *serv_pas2_init(void);
-char *serv_pop3_init(void);
-char *serv_rwho_init(void);
-char *serv_smtp_init(void);
-char *serv_spam_init(void);
 char *serv_test_init(void);
-char *serv_upgrade_init(void);
-char *serv_vandelay_init(void);
-char *serv_vcard_init(void);
-char *serv_fulltext_init(void);
-char *serv_autocompletion_init(void);
 char *serv_postfix_tcpdict(void);
-char *serv_managesieve_init(void);
-char *serv_sieve_init(void);
-char *serv_funambol_init(void);
 /*
  */
 
@@ -46,72 +20,38 @@ void initialize_server_extensions(void);
 int DLoader_Exec_Cmd(char *cmdbuf);
 char *Dynamic_Module_Init(void);
 
-void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
-void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
 void CtdlDestroySessionHooks(void);
 void PerformSessionHooks(int EventType);
 
-void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
 void CtdlDestroyUserHooks(void);
 void PerformUserHooks(struct ctdluser *usbuf, int EventType);
 
-void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
-void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
 int PerformXmsgHooks(char *, char *, char *);
 void CtdlDestroyXmsgHooks(void);
 
 
 
-void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
-                                                       int EventType);
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
-                                                       int EventType);
 void CtdlDestroyMessageHook(void);
 int PerformMessageHooks(struct CtdlMessage *, int EventType);
 
 
-void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
-void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
 void CtdlDestroyNetprocHooks(void);
 int PerformNetprocHooks(struct CtdlMessage *, char *);
 
-void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
-void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
 void CtdlDestroyRoomHooks(void);
 int PerformRoomHooks(struct ctdlroom *);
 
 
-void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
-void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
 void CtdlDestroyDeleteHooks(void);
 void PerformDeleteHooks(char *, long);
 
 
-void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
 void CtdlDestroyCleanupHooks(void);
-void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
-void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
+
 void CtdlDestroyProtoHooks(void);
-void CtdlRegisterServiceHook(int tcp_port,
-                       char *sockpath,
-                        void (*h_greeting_function) (void),
-                        void (*h_command_function) (void),
-                        void (*h_async_function) (void)
-);
-void CtdlUnregisterServiceHook(int tcp_port,
-                       char *sockpath,
-                        void (*h_greeting_function) (void),
-                        void (*h_command_function) (void),
-                        void (*h_async_function) (void)
-);
+
 void CtdlDestroyServiceHook(void);
 
-void CtdlRegisterFixedOutputHook(char *content_type,
-                       void (*output_function) (char *supplied_data, int len)
-);
-void CtdlUnRegisterFixedOutputHook(char *content_type);
 void CtdlDestroyFixedOutputHooks(void);
 int PerformFixedOutputHooks(char *, char *, int);
 
index 028f958680b5699f3174dde5f433b8140bea0be3..f6e2c672a8902f0a07be23f3a4c18b7a39e27fa9 100644 (file)
 #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 "database.h"
 #include "msgbase.h"
 #include "control.h"
 #include "ft_wordbreaker.h"
 
 
+#include "ctdl_module.h"
+
+
+
 long ft_newhighest = 0L;
 long *ft_newmsgs = NULL;
 int ft_num_msgs = 0;
@@ -467,7 +469,7 @@ void initialize_ft_cache(void) {
 
 /*****************************************************************************/
 
-char *serv_fulltext_init(void)
+CTDL_MODULE_INIT(fulltext)
 {
        initialize_ft_cache();
        CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search");
index 9e0601246221ce93e21961fdc2c926ae3d8695c2..561be098664567f7c88a7d2eb3364b23573836cd 100644 (file)
 #include <sys/socket.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "domain.h"
 #include "clientsocket.h"
 #include "serv_funambol.h"
+
+
+
+#include "ctdl_module.h"
+
+
 /*
  * Create the notify message queue
  */
@@ -219,7 +223,7 @@ void notify_funambol(long msgnum, void *userdata) {
 
 
 
-char *serv_funambol_init(void)
+CTDL_MODULE_INIT(funambol)
 {
        create_notify_queue();
        CtdlRegisterSessionHook(do_notify_queue, EVT_TIMER);
index 9599d19ed16b450cc1f5d100bebaa2fb055a0147..be4132ea3cf4698ee7df433de28484e165872535 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
 #include "serv_crypto.h"
 #endif
 
+
+#include "ctdl_module.h"
+
+
 /* imap_rename() uses this struct containing list of rooms to rename */
 struct irl {
        struct irl *next;
@@ -1587,7 +1589,7 @@ void imap_command_loop(void)
 /*
  * This function is called to register the IMAP extension with Citadel.
  */
-char *serv_imap_init(void)
+CTDL_MODULE_INIT(imap)
 {
        CtdlRegisterServiceHook(config.c_imap_port,
                                NULL, imap_greeting, imap_command_loop, NULL);
index d5623d989a60a0c8835b6426fff0ff7a10e3d165..eaab32d370102438debb031c02257f72813cc933 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
@@ -50,6 +48,7 @@
 #include "domain.h"
 
 
+#include "ctdl_module.h"
 
 
 void inetcfg_setTo(struct CtdlMessage *msg) {
@@ -177,7 +176,7 @@ void inetcfg_init(void) {
 /*****************************************************************************/
 
 
-char *serv_inetcfg_init(void)
+CTDL_MODULE_INIT(inetcfg)
 {
        CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
        inetcfg_init();
index 6d8acc1f77156adea325f90114ce3670456f20d8..f3e5a774a64b37cda558ac3f7fe8748f87527167 100644 (file)
 #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 "vcard.h"
 #include "tools.h"
 
+
+#include "ctdl_module.h"
+
+
+
 #ifdef HAVE_LDAP
 
 #include <ldap.h>
@@ -587,7 +590,7 @@ void ctdl_vcard_to_ldap(struct CtdlMessage *msg, int op) {
 /*
  * Initialize the LDAP connector module ... or don't, if we don't have LDAP.
  */
-char *serv_ldap_init(void)
+CTDL_MODULE_INIT(ldap)
 {
 #ifdef HAVE_LDAP
        CtdlRegisterCleanupHook(serv_ldap_cleanup);
index be09537284153ecc86edd777125daac683dba5d9..93e93553b5a54c92618cb64125e6596b93baeced 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
 #endif
 
 
+
+#include "ctdl_module.h"
+
+
 /*
  * Generate a randomizationalisticized token to use for authentication of
  * a subscribe or unsubscribe request.
@@ -562,7 +564,7 @@ void cmd_subs(char *cmdbuf) {
 /*
  * Module entry point
  */
-char *serv_listsub_init(void)
+CTDL_MODULE_INIT(listsub)
 {
        CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
 
index 9b53968e13cc4c09ef41d5c394ec4a8f3e60a76c..c43d8aa192ceac085610b4da2eba4f147f98ac22 100644 (file)
 #include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "snprintf.h"
 #endif
 
+
+#include "ctdl_module.h"
+
+
+
 #ifdef HAVE_LIBSIEVE
 
 #include "serv_sieve.h"
@@ -571,27 +574,27 @@ void managesieve_command_loop(void) {
 }
 
 
+#endif /* HAVE_LIBSIEVE */
 
-char *serv_managesieve_init(void)
+CTDL_MODULE_INIT(managesieve)
 {
 
+#ifdef HAVE_LIBSIEVE
+
        CtdlRegisterServiceHook(config.c_managesieve_port,      /* MGSVE */
                                NULL,
                                managesieve_greeting,
                                managesieve_command_loop,
                                NULL);
 
-       return "$Id$";
-}
-
 #else  /* HAVE_LIBSIEVE */
 
-char *serv_managesieve_init(void)
-{
        lprintf(CTDL_INFO, "This server is missing libsieve.  Managesieve protocol is disabled..\n");
 
+#endif /* HAVE_LIBSIEVE */
+
        /* return our Subversion id for the Log */
        return "$Id$";
 }
 
-#endif /* HAVE_LIBSIEVE */
+
index ec2493d767b0c60ffe6c9b6037df8d89b1499fa6..12e09f0f0ec89c96c93b5b005ae21c4ae37627d4 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -49,6 +47,9 @@
 #include "tools.h"
 
 
+#include "ctdl_module.h"
+
+
 /*
  * Other functions call this one to output data in MRTG format
  */
@@ -127,7 +128,7 @@ void cmd_mrtg(char *argbuf) {
 }
 
 
-char *serv_mrtg_init(void)
+CTDL_MODULE_INIT(mrtg)
 {
         CtdlRegisterProtoHook(cmd_mrtg, "MRTG", "Supply stats to MRTG");
 
index 4f6f53bd0b8647b7bf19ae075dcfd314d2e25526..31fced57ba0b4a543b82990ead58068a291e540d 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "serv_network.h"
 #include "tools.h"
 
+
+#include "ctdl_module.h"
+
+
 /*
  * This handler detects whether an incoming network message is from some
  * moron user who the site operator has elected to filter out.  If a match
@@ -103,7 +105,7 @@ int filter_the_idiots(struct CtdlMessage *msg, char *target_room) {
 }
 
 
-char *serv_netfilter_init(void)
+CTDL_MODULE_INIT(netfilter)
 {
        CtdlRegisterNetprocHook(filter_the_idiots);
 
index 840ebd5088fc380f51ec2e97badf61384f12553f..1c8260b9b47497db60f36846499d87d6b284e541 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
 #include "snprintf.h"
 #endif
 
+
+#include "ctdl_module.h"
+
+
+
 /* Nonzero while we are doing network processing */
 static int doing_queue = 0;
 
@@ -2064,7 +2067,7 @@ int network_room_handler (struct ctdlroom *room)
 /*
  * Module entry point
  */
-char *serv_network_init(void)
+CTDL_MODULE_INIT(network)
 {
        create_spool_dirs();
        CtdlRegisterProtoHook(cmd_gnet, "GNET", "Get network config");
index ffde5e3b2f742f5f1c12b887c5539f664e5fa03d..ac47feb102d71a7971e6f9184dd6d54b7844eb2b 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 
+
+#include "ctdl_module.h"
+
+
+
 extern struct CitContext *ContextList;
 
 
@@ -92,7 +95,7 @@ void CopyNewUserGreetings(void) {
 }
 
 
-char *serv_newuser_init(void)
+CTDL_MODULE_INIT(newuser)
 {
    CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN);
 
index 23a8d583230f7f44b71ce72a2ed85745bbf0bfa4..47e968b03bd22cfc8ba6b00947e2edda66a9742a 100644 (file)
 #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 "user_ops.h"
 #include "policy.h"
@@ -43,6 +41,9 @@
 #include "msgbase.h"
 #include "tools.h"
 
+#include "ctdl_module.h"
+
+
 
 /*
  * If we are in a "notes" view room, and the client has sent an RFC822
@@ -102,7 +103,7 @@ int serv_notes_beforesave(struct CtdlMessage *msg)
 }
 
 
-char *serv_notes_init(void)
+CTDL_MODULE_INIT(notes)
 {
        CtdlRegisterMessageHook(serv_notes_beforesave, EVT_BEFORESAVE);
 
index f2bc4e62f2b8f15afe4ee66c3b749e4f6f30cc4d..fd7fbf246dc94513c684bffe5a28ca3264ccfa9b 100644 (file)
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
-#include "sysdep_decls.h"
 #include "citadel.h"
 #include "server.h"
 #include "citserver.h"
 #include "support.h"
-#include "serv_extensions.h"
 #include "user_ops.h"
 #include "md5.h"
 #include "tools.h"
 
 
+#include "ctdl_module.h"
+
+
 void cmd_pas2(char *argbuf)
 {
        char pw[256];
@@ -85,7 +86,7 @@ void cmd_pas2(char *argbuf)
 
 
 
-char *serv_pas2_init(void)
+CTDL_MODULE_INIT(pas2)
 {
         CtdlRegisterProtoHook(cmd_pas2, "PAS2", "APOP-based login");
 
index a03c6ee6ed1b410ce739211af450066f77af81c5..c49c5cad98da96edb683b99bcc1135a0697fc2f9 100644 (file)
 #include <ctype.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 "user_ops.h"
 #include "policy.h"
@@ -63,6 +61,9 @@
 #endif
 
 
+#include "ctdl_module.h"
+
+
 
 /*
  * This cleanup function blows away the temporary memory and files used by
@@ -710,7 +711,7 @@ void pop3_command_loop(void) {
 
 
 
-char *serv_pop3_init(void)
+CTDL_MODULE_INIT(pop3)
 {
        CtdlRegisterServiceHook(config.c_pop3_port,
                                NULL,
index 6af26ab09043a3ea4fc6debfce39bed6f9b51299..553049c9b3bf61da5140f91605f5851066f0f548 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -46,6 +44,8 @@
 #include "tools.h"
 
 
+#include "ctdl_module.h"
+
 
 /*
  * display who's online
@@ -253,7 +253,7 @@ void cmd_stel(char *cmdbuf)
 
 
 
-char *serv_rwho_init(void)
+CTDL_MODULE_INIT(rwho)
 {
         CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");
         CtdlRegisterProtoHook(cmd_hchg, "HCHG", "Masquerade hostname");
index 525bafb2da3e0d05f789f525e0780f924a277cad..508f8d2188ce71ecf06889f181de4704f235b7db 100644 (file)
 #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 "internet_addressing.h"
 #include "tools.h"
 
+
+#include "ctdl_module.h"
+
+
 #ifdef HAVE_LIBSIEVE
 
 #include "serv_sieve.h"
@@ -1247,9 +1249,13 @@ int serv_sieve_room(struct ctdlroom *room)
        return 0;
 }
 
+#endif /* HAVE_LIBSIEVE */
 
-char *serv_sieve_init(void)
+CTDL_MODULE_INIT(sieve)
 {
+
+#ifdef HAVE_LIBSIEVE
+
        ctdl_sieve_init();
        CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts");
 
@@ -1257,18 +1263,13 @@ char *serv_sieve_init(void)
 
         CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE);
 
-        /* return our Subversion id for the Log */
-       return "$Id$";
-}
-
 #else  /* HAVE_LIBSIEVE */
 
-char *serv_sieve_init(void)
-{
        lprintf(CTDL_INFO, "This server is missing libsieve.  Mailbox filtering will be disabled.\n");
 
-       /* return our Subversion id for the Log */
+#endif /* HAVE_LIBSIEVE */
+
+        /* return our Subversion id for the Log */
        return "$Id$";
 }
 
-#endif /* HAVE_LIBSIEVE */
index 65476a9f4515d1c5fc2e6cc4baa7f12001da25f3..bfd4f9d506554ea88dab0f100c14ea18a9a578b6 100644 (file)
 #include <arpa/inet.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "snprintf.h"
 #endif
 
+
+#include "ctdl_module.h"
+
+
+
 struct citsmtp {               /* Information about the current session */
        int command_state;
        char helo_node[SIZ];
@@ -1810,7 +1813,7 @@ void smtp_cleanup_function(void) {
 
 
 
-char *serv_smtp_init(void)
+CTDL_MODULE_INIT(smtp)
 {
 
        CtdlRegisterServiceHook(config.c_smtp_port,     /* SMTP MTA */
index 468a09737a2421886277b58352750aedb152458c..64ad1f5cba100bdd7d9703c176e19f2422d2c8d9 100644 (file)
 #include <sys/socket.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
@@ -53,6 +51,9 @@
 #include "clientsocket.h"
 
 
+#include "ctdl_module.h"
+
+
 
 /*
  * Connect to the SpamAssassin server and scan a message.
@@ -145,7 +146,7 @@ bail:       close(sock);
 
 
 
-char *serv_spam_init(void)
+CTDL_MODULE_INIT(spam)
 {
        CtdlRegisterMessageHook(spam_assassin, EVT_SMTPSCAN);
 
index c79e6aace2f60098956ed0db00df166148867691..356b167b5607c0d54dfd7435992ffd8a135aa89f 100644 (file)
 #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"
+#include "ctdl_module.h"
 
 extern struct CitContext *ContextList;
 
@@ -65,13 +55,16 @@ void LoginTest(void) {
        lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
        }
 
-char *serv_test_init(void)
+/* To insert this module into the server activate the next block by changing the #if 0 to #if 1 */
+CTDL_MODULE_INIT(test)
 {
+#if 0
    CtdlRegisterCleanupHook(CleanupTest);
    CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
    CtdlRegisterSessionHook(SessionStartTest, EVT_START);
    CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
    CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
+#endif
 
    /* return our Subversion id for the Log */
    return "$Id$";
index 1c3012a512b1159d1b4b4646765f154b35066d1c..2956e79a088382d9f1ed178b6374b011a348d552 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "database.h"
 #include "room_ops.h"
 #include "user_ops.h"
@@ -46,6 +44,8 @@
 #include "euidindex.h"
 
 
+#include "ctdl_module.h"
+
 
 /* 
  * Back end processing function for cmd_bmbx
@@ -226,7 +226,7 @@ void check_server_upgrades(void) {
 }
 
 
-char *serv_upgrade_init(void)
+CTDL_MODULE_INIT(upgrade)
 {
        check_server_upgrades();
 
index f5451a5557368f1d6d50dddc520b36b1861e76a5..b1c3630c0cdf9a3facc2a41d4c6db96e536e01ea 100644 (file)
 #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 "database.h"
 #include "msgbase.h"
 #include "tools.h"
 #include "control.h"
 #include "euidindex.h"
 
+
+#include "ctdl_module.h"
+
+
+
+
 #define END_OF_MESSAGE "---eom---dbd---"
 
 char artv_tempfilename1[PATH_MAX];
@@ -726,7 +730,7 @@ void cmd_artv(char *cmdbuf) {
 
 
 
-char *serv_vandelay_init(void)
+CTDL_MODULE_INIT(vandelay)
 {
        CtdlRegisterProtoHook(cmd_artv, "ARTV", "import/export data store");
 
index b8f7a4a0cdab66d4dacf1eff047fc9dc3e34760b..ba292dfebbfff248efae9d45c2ee31f8767401b9 100644 (file)
 #include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "serv_extensions.h"
 #include "room_ops.h"
 #include "user_ops.h"
 #include "policy.h"
 #include "serv_ldap.h"
 #include "serv_vcard.h"
 
+
+#include "ctdl_module.h"
+
+
+
 /*
  * set global flag calling for an aide to validate new users
  */
@@ -1326,19 +1329,9 @@ void vcard_fixed_output(char *ptr, int len) {
 }
 
 
-char *serv_postfix_tcpdict(void)
-{
-       CtdlRegisterServiceHook(config.c_pftcpdict_port,        /* Postfix */
-                               NULL,
-                               check_get_greeting,
-                               check_get,
-                               NULL);
-       return "$Id$";
-}
-
 
 
-char *serv_vcard_init(void)
+CTDL_MODULE_INIT(vcard)
 {
        struct ctdlroom qr;
        char filename[256];
@@ -1384,6 +1377,13 @@ char *serv_vcard_init(void)
                chown(filename, CTDLUID, (-1));
        }
 
+       /* for postfix tcpdict */
+       CtdlRegisterServiceHook(config.c_pftcpdict_port,        /* Postfix */
+                               NULL,
+                               check_get_greeting,
+                               check_get,
+                               NULL);
+       
        /* return our Subversion id for the Log */
        return "$Id$";
 }
index e4c72ab42591308dbcd2cb46fe284b711e393c2e..2d2309b09407bec9213a19b973a0376bdba84f40 100644 (file)
@@ -58,6 +58,9 @@
 #include "tools.h"
 #include "citadel_dirs.c"
 
+#include "modules_init.h"
+
+
 #ifdef HAVE_SYS_SELECT_H
 #include <sys/select.h>
 #endif
@@ -235,7 +238,14 @@ int main(int argc, char **argv)
         */
        lprintf(CTDL_INFO, "Initializing server extensions\n");
        size = strlen(ctdl_home_directory) + 9;
+       
+/*
        initialize_server_extensions();
+*/
+       
+       initialise_modules();
+       
+       
 
        /*
         * If we need host auth, start our chkpwd daemon.
index ae90340fc7ac21f3ab6a3f456063a93ca3d4cebf..761b225c746ca6620b3a8f3c6ac9029af952c5f5 100644 (file)
@@ -54,7 +54,6 @@
 #endif
 #include "citadel.h"
 #include "server.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
index 1efd903e384edbe9c0422b116a8e3c430f9b3256..f77d6e4a5d6f886453f83592bee01aea9e743ede 100644 (file)
@@ -1,5 +1,7 @@
 /* $Id$ */
 
+#ifndef SYSDEP_DECLS_H
+#define SYSDEP_DECLS_H
 
 /*
  * Uncomment this #define if you are a Citadel developer tracking
@@ -13,6 +15,7 @@
 #include "sysdep.h"
 #include "server.h"
 
+
 /* Logging levels - correspond to syslog(3) */
 enum LogLevel {
        /* When about to exit the server for an unrecoverable error */
@@ -103,3 +106,5 @@ void dump_heap(void);
 void create_maintenance_threads(void);
 extern pthread_t indexer_thread_tid;
 extern pthread_t checkpoint_thread_tid;
+
+#endif /* SYSDEP_DECLS_H */
diff --git a/citadel/techdoc/test_suite.txt b/citadel/techdoc/test_suite.txt
new file mode 100644 (file)
index 0000000..bb975e6
--- /dev/null
@@ -0,0 +1,45 @@
+SYSTEM TESTING PROPOSAL
+
+This document is intended as a discussion of possible automated tests. It does
+not describe any existing tests.
+
+
+---
+
+
+First we should create a client that leverages expect (or something similar) to
+perform automated testing of the client interface. Tests can be written as
+expect scripts.
+
+Each system being tested will need to create an aide level user for the test
+client to connect as.
+
+The test client will create another user to carry out the tests. This allows the
+aide level user to vary the level of the test user and check the access level
+code.
+
+----
+
+
+For a first step each test site should create a test user that can send internet
+mail.
+This test user needs some sieve rules to forward mail around (eventually this
+will be created automatically by the test client). These rules will forward mail
+to other test users at other sites participating in the test system and to a
+networked room.
+Each system participating in the test should share some rooms.
+
+The idea is:
+       1. A test site posts a message to its test user using citmail or some
+other email prog.
+       2. The sieve rules forward the message to each of the other test users
+at the other sites.
+       3. The sieve rules for the other test users detect that the message was
+forwarded to them and they file it into a networked room
+       4. By virtue of the networked room the message returns to the
+originating system where the administrator can see it.
+
+Once I (davew) have written my module to alter the message body we can have it
+add text to the message to indicate the full path of the message.
+
+
index 4c29bd692bd81f725591663e476b11ce6b3108c5..02639007fda0fe3f4fb91d2a7a427bf20cd87e21 100644 (file)
@@ -38,7 +38,6 @@
 #include "server.h"
 #include "database.h"
 #include "user_ops.h"
-#include "serv_extensions.h"
 #include "sysdep_decls.h"
 #include "support.h"
 #include "room_ops.h"