Did away with lprintf all together now its called CtdlLogPrintf()
[citadel.git] / citadel / modules / test / 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 "ctdl_module.h"
33
34 extern struct CitContext *ContextList;
35
36 void CleanupTest(void) {
37         CtdlLogPrintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
38         }
39
40 void NewRoomTest(void) {
41         CtdlLogPrintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
42         }
43
44 void SessionStartTest(void) {
45         CtdlLogPrintf(CTDL_DEBUG, "--- starting up session %d ---\n",
46                 CC->cs_pid);
47         }
48
49 void SessionStopTest(void) {
50         CtdlLogPrintf(CTDL_DEBUG, "--- ending session %d ---\n", 
51                 CC->cs_pid);
52         }
53
54 void LoginTest(void) {
55         CtdlLogPrintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
56         }
57
58 /* To insert this module into the server activate the next block by changing the #if 0 to #if 1 */
59 CTDL_MODULE_INIT(test)
60 {
61 #if 0
62         if (!threading)
63         {
64                 CtdlRegisterCleanupHook(CleanupTest);
65                 CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
66                 CtdlRegisterSessionHook(SessionStartTest, EVT_START);
67                 CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
68                 CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
69         }
70 #endif
71
72    /* return our Subversion id for the Log */
73    return "$Id$";
74 }