c79e6aace2f60098956ed0db00df166148867691
[citadel.git] / citadel / serv_test.c
1 /*
2  * $Id$
3  *
4  * A skeleton module to test the dynamic loader.
5  *
6  */
7
8 #include "sysdep.h"
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <stdio.h>
12 #include <fcntl.h>
13 #include <signal.h>
14 #include <pwd.h>
15 #include <errno.h>
16 #include <sys/types.h>
17
18 #if TIME_WITH_SYS_TIME
19 # include <sys/time.h>
20 # include <time.h>
21 #else
22 # if HAVE_SYS_TIME_H
23 #  include <sys/time.h>
24 # else
25 #  include <time.h>
26 # endif
27 #endif
28
29 #include <sys/wait.h>
30 #include <string.h>
31 #include <limits.h>
32 #include "citadel.h"
33 #include "server.h"
34 #include "sysdep_decls.h"
35 #include "citserver.h"
36 #include "support.h"
37 #include "config.h"
38 #include "serv_extensions.h"
39 #include "room_ops.h"
40 #include "policy.h"
41 #include "database.h"
42 #include "msgbase.h"
43
44 extern struct CitContext *ContextList;
45
46 void CleanupTest(void) {
47         lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
48         }
49
50 void NewRoomTest(void) {
51         lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
52         }
53
54 void SessionStartTest(void) {
55         lprintf(CTDL_DEBUG, "--- starting up session %d ---\n",
56                 CC->cs_pid);
57         }
58
59 void SessionStopTest(void) {
60         lprintf(CTDL_DEBUG, "--- ending session %d ---\n", 
61                 CC->cs_pid);
62         }
63
64 void LoginTest(void) {
65         lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
66         }
67
68 char *serv_test_init(void)
69 {
70    CtdlRegisterCleanupHook(CleanupTest);
71    CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
72    CtdlRegisterSessionHook(SessionStartTest, EVT_START);
73    CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
74    CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
75
76    /* return our Subversion id for the Log */
77    return "$Id$";
78 }