]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_test.c
* Removed all of the thread cancellation cruft that is no longer necessary
[citadel.git] / citadel / serv_test.c
index 57002db5dc9eb0393e55b980bab934e2130b349a..0d3ce30bce1604542171850c960a77627e295c66 100644 (file)
@@ -1,3 +1,5 @@
+/* $Id$ */
+#include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include <string.h>
-#include <pthread.h>
+#include <limits.h>
 #include "citadel.h"
 #include "server.h"
-#include <syslog.h>
+#include <time.h>
 #include "sysdep_decls.h"
 #include "citserver.h"
 #include "support.h"
 #include "config.h"
 #include "dynloader.h"
-
-symtab *My_Symtab = NULL;      /* dyn */
+#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");
        }
 
-void NewRoomTest(char *RoomName) {
-       lprintf(9, "--- test module was told we're now in %s ---\n", RoomName);
+void NewRoomTest(void) {
+       lprintf(9, "--- 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(9, "--- starting up session %d ---\n",
+               CC->cs_pid);
        }
 
-void SessionStopTest(int WhichSession) {
-       lprintf(9, "--- ending session %d ---\n", WhichSession);
+void SessionStopTest(void) {
+       lprintf(9, "--- ending session %d ---\n", 
+               CC->cs_pid);
        }
 
 void LoginTest(void) {
        lprintf(9, "--- Hello, %s ---\n", CC->curr_user);
        }
 
-void Dynamic_Module_Init(struct DLModule_Info *info)
-{
-   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 Ygorl(char *username, long usernum) {
+       if (!strcasecmp(username, "Unsuspecting User")) {
+               strcpy(username, "Flaming Asshole");
+               }
+       }
 
-}
+void LogTest(char *buf) {
+       fprintf(stderr,"%c[1m%s%c[0m", 27, buf, 27);
+       fflush(stderr);
+       }
 
-void Get_Symtab(symtab **the_symtab)
+
+char *Dynamic_Module_Init(void)
 {
-   (*the_symtab) = My_Symtab;
-   return;
+   CtdlRegisterCleanupHook(CleanupTest);
+   CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
+   CtdlRegisterSessionHook(SessionStartTest, EVT_START);
+   CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
+   CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
+   CtdlRegisterUserHook(Ygorl, EVT_OUTPUTMSG);
+   CtdlRegisterLogHook(LogTest, 1);
+   return "$Id$";
 }