]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_test.c
* Removed "Log Hooks." This enabled the removal of a buf[SIZ] in lprintf,
[citadel.git] / citadel / serv_test.c
index 57002db5dc9eb0393e55b980bab934e2130b349a..f3bf3c59cdb12f2c8d0133ad260fb2d4d1934f0a 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * $Id$
+ *
+ * A skeleton module to test the dynamic loader.
+ *
+ */
+
+#include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <pwd.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/time.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 <pthread.h>
+#include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include <syslog.h>
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
-#include "dynloader.h"
-
-symtab *My_Symtab = NULL;      /* dyn */
+#include "serv_extensions.h"
+#include "room_ops.h"
+#include "policy.h"
+#include "database.h"
+#include "msgbase.h"
 
 extern struct CitContext *ContextList;
 
-#define MODULE_NAME    "Dummy test module"
-#define MODULE_AUTHOR  "Art Cancro"
-#define MODULE_EMAIL   "ajc@uncnsrd.mt-kisco.ny.us"
-#define MAJOR_VERSION  0
-#define MINOR_VERSION  1
-
 void CleanupTest(void) {
-       lprintf(9, "--- test of adding an unload hook --- \n");
+       lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
        }
 
-void NewRoomTest(char *RoomName) {
-       lprintf(9, "--- test module was told we're now in %s ---\n", RoomName);
+void NewRoomTest(void) {
+       lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
        }
 
-void SessionStartTest(int WhichSession) {
-       lprintf(9, "--- starting up session %d ---\n", WhichSession);
+void SessionStartTest(void) {
+       lprintf(CTDL_DEBUG, "--- starting up session %d ---\n",
+               CC->cs_pid);
        }
 
-void SessionStopTest(int WhichSession) {
-       lprintf(9, "--- ending session %d ---\n", WhichSession);
+void SessionStopTest(void) {
+       lprintf(CTDL_DEBUG, "--- ending session %d ---\n", 
+               CC->cs_pid);
        }
 
 void LoginTest(void) {
-       lprintf(9, "--- Hello, %s ---\n", CC->curr_user);
+       lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
        }
 
-void Dynamic_Module_Init(struct DLModule_Info *info)
+char *serv_test_init(void)
 {
-   strncpy(info->module_name, MODULE_NAME, 30);
-   strncpy(info->module_author, MODULE_AUTHOR, 30);
-   strncpy(info->module_author_email, MODULE_EMAIL, 30);
-   info->major_version = MAJOR_VERSION;
-   info->minor_version = MINOR_VERSION;
-
    CtdlRegisterCleanupHook(CleanupTest);
-   CtdlRegisterNewRoomHook(NewRoomTest);
-   CtdlRegisterSessionHook(SessionStartTest, 1);
-   CtdlRegisterSessionHook(SessionStopTest, 0);
-   CtdlRegisterLoginHook(LoginTest);
-
-}
-
-void Get_Symtab(symtab **the_symtab)
-{
-   (*the_symtab) = My_Symtab;
-   return;
+   CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
+   CtdlRegisterSessionHook(SessionStartTest, EVT_START);
+   CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
+   CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
+   return "$Id$";
 }