* In the wholist, only show <private room> if the user viewing the list
[citadel.git] / citadel / serv_test.c
1 /* $Id$ */
2 #include "sysdep.h"
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <stdio.h>
6 #include <fcntl.h>
7 #include <signal.h>
8 #include <pwd.h>
9 #include <errno.h>
10 #include <sys/types.h>
11 #include <sys/time.h>
12 #include <sys/wait.h>
13 #include <string.h>
14 #include <limits.h>
15 #ifdef HAVE_PTHREAD_H
16 #include <pthread.h>
17 #endif
18 #include "citadel.h"
19 #include "server.h"
20 #include <syslog.h>
21 #include <time.h>
22 #include "sysdep_decls.h"
23 #include "citserver.h"
24 #include "support.h"
25 #include "config.h"
26 #include "dynloader.h"
27 #include "room_ops.h"
28 #include "policy.h"
29 #include "database.h"
30 #include "msgbase.h"
31
32 extern struct CitContext *ContextList;
33
34 void CleanupTest(void) {
35         lprintf(9, "--- test of adding an unload hook --- \n");
36         }
37
38 void NewRoomTest(void) {
39         lprintf(9, "--- test module was told we're now in a new room ---\n");
40         }
41
42 void SessionStartTest(void) {
43         lprintf(9, "--- starting up session %d ---\n",
44                 CC->cs_pid);
45         }
46
47 void SessionStopTest(void) {
48         lprintf(9, "--- ending session %d ---\n", 
49                 CC->cs_pid);
50         }
51
52 void LoginTest(void) {
53         lprintf(9, "--- Hello, %s ---\n", CC->curr_user);
54         }
55
56
57 void Ygorl(char *username, long usernum) {
58         if (!strcasecmp(username, "Unsuspecting User")) {
59                 strcpy(username, "Flaming Asshole");
60                 }
61         }
62
63 void LogTest(char *buf) {
64         fprintf(stderr,"%c[1m%s%c[0m", 27, buf, 27);
65         fflush(stderr);
66         }
67
68
69 char *Dynamic_Module_Init(void)
70 {
71    CtdlRegisterCleanupHook(CleanupTest);
72    CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
73    CtdlRegisterSessionHook(SessionStartTest, EVT_START);
74    CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
75    CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
76    CtdlRegisterUserHook(Ygorl, EVT_OUTPUTMSG);
77    CtdlRegisterLogHook(LogTest, 1);
78    return "$Id$";
79 }