]> code.citadel.org Git - citadel.git/blob - citadel/serv_test.c
* Implemented separate structs, lists, and functions for each type
[citadel.git] / citadel / serv_test.c
1 #include <stdlib.h>
2 #include <unistd.h>
3 #include <stdio.h>
4 #include <fcntl.h>
5 #include <signal.h>
6 #include <pwd.h>
7 #include <errno.h>
8 #include <sys/types.h>
9 #include <sys/time.h>
10 #include <sys/wait.h>
11 #include <string.h>
12 #include <pthread.h>
13 #include "citadel.h"
14 #include "server.h"
15 #include <syslog.h>
16 #include "sysdep_decls.h"
17 #include "citserver.h"
18 #include "support.h"
19 #include "config.h"
20 #include "dynloader.h"
21
22 symtab *My_Symtab = NULL;       /* dyn */
23
24 extern struct CitContext *ContextList;
25
26 #define MODULE_NAME     "Dummy test module"
27 #define MODULE_AUTHOR   "Art Cancro"
28 #define MODULE_EMAIL    "ajc@uncnsrd.mt-kisco.ny.us"
29 #define MAJOR_VERSION   0
30 #define MINOR_VERSION   1
31
32 void CleanupTest(void) {
33         lprintf(9, "--- test of adding an unload hook --- \n");
34         }
35
36 void NewRoomTest(char *RoomName) {
37         lprintf(9, "--- test module was told we're now in %s ---\n", RoomName);
38         }
39
40 void SessionStartTest(int WhichSession) {
41         lprintf(9, "--- starting up session %d ---\n", WhichSession);
42         }
43
44 void SessionStopTest(int WhichSession) {
45         lprintf(9, "--- ending session %d ---\n", WhichSession);
46         }
47
48 void LoginTest(void) {
49         lprintf(9, "--- Hello, %s ---\n", CC->curr_user);
50         }
51
52 void Dynamic_Module_Init(struct DLModule_Info *info)
53 {
54    strncpy(info->module_name, MODULE_NAME, 30);
55    strncpy(info->module_author, MODULE_AUTHOR, 30);
56    strncpy(info->module_author_email, MODULE_EMAIL, 30);
57    info->major_version = MAJOR_VERSION;
58    info->minor_version = MINOR_VERSION;
59
60    CtdlRegisterCleanupHook(CleanupTest);
61    CtdlRegisterNewRoomHook(NewRoomTest);
62    CtdlRegisterSessionHook(SessionStartTest, 1);
63    CtdlRegisterSessionHook(SessionStopTest, 0);
64    CtdlRegisterLoginHook(LoginTest);
65
66 }
67
68 void Get_Symtab(symtab **the_symtab)
69 {
70    (*the_symtab) = My_Symtab;
71    return;
72 }