1 // This is an empty skeleton of a Citadel server module, included to demonstrate
2 // how to add a new module to the system and how to activate it in the server.
4 // Copyright (c) 1998-2022 by the citadel.org team
6 // This program is open source software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License version 3.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 #include "../../sysdep.h"
22 #include <sys/types.h>
27 #include "../../ctdl_module.h"
30 void CleanupTest(void) {
31 syslog(LOG_DEBUG, "--- test of adding an unload hook --- \n");
34 void NewRoomTest(void) {
35 syslog(LOG_DEBUG, "--- test module was told we're now in a new room ---\n");
38 void SessionStartTest(void) {
39 syslog(LOG_DEBUG, "--- starting up session %d ---\n", CC->cs_pid);
42 void SessionStopTest(void) {
43 syslog(LOG_DEBUG, "--- ending session %d ---\n", CC->cs_pid);
46 void LoginTest(void) {
47 syslog(LOG_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
50 // Initialization function, called from modules_init.c
51 // To insert this module into the server activate the next block by changing the #if 0 to #if 1
52 char *ctdl_module_init_test() {
55 CtdlRegisterCleanupHook(CleanupTest);
56 CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM, 1);
57 CtdlRegisterSessionHook(SessionStartTest, EVT_START, 1);
58 CtdlRegisterSessionHook(SessionStopTest, EVT_STOP, 1);
59 CtdlRegisterSessionHook(LoginTest, EVT_LOGIN, 1);
62 syslog(LOG_DEBUG, "test: module is disabled");
65 // return our module name for the log