From: Dave West Date: Sat, 28 Jul 2007 11:30:54 +0000 (+0000) Subject: Begun phase 2 of modules stuff. X-Git-Tag: v7.86~3199 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=faeb1a94a174222e60a7bd6669bc12cf576c63b6;p=citadel.git Begun phase 2 of modules stuff. Moved serv_test.c into modules/test modified Makefile.in to build it. Fixed a bug in mk_module_init.sh that stopped it scanning the subdirs --- diff --git a/citadel/Makefile.in b/citadel/Makefile.in index 7cfddeb59..1b0261fdb 100644 --- a/citadel/Makefile.in +++ b/citadel/Makefile.in @@ -65,7 +65,7 @@ SERV_MODULES=serv_chat.o \ serv_ldap.o \ serv_autocompletion.o \ serv_funambol.o \ - serv_test.o + modules/test/serv_test.o UTIL_TARGETS=aidepost msgform \ citmail userlist sendcommand \ @@ -113,12 +113,13 @@ SOURCES=aidepost.c auth.c base64.c chkpwd.c chkpw.c citadel.c citadel_ipc.c \ serv_crypto.c serv_expire.c serv_imap.c serv_inetcfg.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_spam.c serv_mrtg.c serv_spam.c serv_upgrade.c \ serv_vandelay.c serv_vcard.c serv_managesieve.c server_main.c \ serv_sieve.c serv_funambol.c setup.c snprintf.c imap_acl.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 imap_list.c imap_metadata.c + crc16.c journaling.c citadel_dirs.c imap_list.c imap_metadata.c \ + modules/test/serv_test.c DEP_FILES=$(SOURCES:.c=.d) modules_init.d diff --git a/citadel/mk_module_init.sh b/citadel/mk_module_init.sh index 3b8a2ed60..775013aa0 100755 --- a/citadel/mk_module_init.sh +++ b/citadel/mk_module_init.sh @@ -73,12 +73,13 @@ if [ -d "modules" ] ; then 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 -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 + cd .. fi done fi @@ -98,12 +99,13 @@ if [ -d "user_modules" ] ; then 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 -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 + cd .. fi done fi diff --git a/citadel/modules/test/serv_test.c b/citadel/modules/test/serv_test.c new file mode 100644 index 000000000..356b167b5 --- /dev/null +++ b/citadel/modules/test/serv_test.c @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * A skeleton module to test the dynamic loader. + * + */ + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#if TIME_WITH_SYS_TIME +# include +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + +#include +#include +#include +#include "ctdl_module.h" + +extern struct CitContext *ContextList; + +void CleanupTest(void) { + lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n"); + } + +void NewRoomTest(void) { + lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n"); + } + +void SessionStartTest(void) { + lprintf(CTDL_DEBUG, "--- starting up session %d ---\n", + CC->cs_pid); + } + +void SessionStopTest(void) { + lprintf(CTDL_DEBUG, "--- ending session %d ---\n", + CC->cs_pid); + } + +void LoginTest(void) { + lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user); + } + +/* 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$"; +} diff --git a/citadel/serv_test.c b/citadel/serv_test.c deleted file mode 100644 index 356b167b5..000000000 --- a/citadel/serv_test.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id$ - * - * A skeleton module to test the dynamic loader. - * - */ - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include -#include -#include -#include "ctdl_module.h" - -extern struct CitContext *ContextList; - -void CleanupTest(void) { - lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n"); - } - -void NewRoomTest(void) { - lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n"); - } - -void SessionStartTest(void) { - lprintf(CTDL_DEBUG, "--- starting up session %d ---\n", - CC->cs_pid); - } - -void SessionStopTest(void) { - lprintf(CTDL_DEBUG, "--- ending session %d ---\n", - CC->cs_pid); - } - -void LoginTest(void) { - lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user); - } - -/* 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$"; -}