From 2a5a95a7b1cb730a7e3360c7e8475daf50f95167 Mon Sep 17 00:00:00 2001 From: Matthew Wiggins Date: Sat, 15 Jan 2005 23:38:00 +0000 Subject: [PATCH] simple module example showing how to use new remotemsg hook... --- modules/remotemsg-example.c | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 modules/remotemsg-example.c diff --git a/modules/remotemsg-example.c b/modules/remotemsg-example.c new file mode 100644 index 0000000..e167150 --- /dev/null +++ b/modules/remotemsg-example.c @@ -0,0 +1,59 @@ +#include +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "channel.h" +#include "throttle.h" +#include "h.h" +#include "hooks.h" +#include "find.h" + + +#define MODULEVERSION 1006 +#define MODULE_VERSION_STRING "0.0.1" +#define MODULE_DESCRIPTION_STRING "testatron" + +/* gcc -I../include -shared remotemsg-test.c -o /usr/IRCd/modules/test.so */ + +int +hook_rmsg(aClient *serv, aClient *src, int notice, char *dest, char *text) +{ + sendto_serv_butone(&me, ":%s NOTICE %s :Hey %s i got your msg to %s [%s]", + me.name, src->name, src->name, dest, text); + return 0; +} + +int bircmodule_init(void *self) +{ + bircmodule_add_hook(CHOOK_REMOTEMSG, self, hook_rmsg); + return 0; +} + +/*** all the following is stuff required for every module + ***/ + +void bircmodule_check(int *acsz) +{ + *acsz = MODULEVERSION; +} +void bircmodule_getinfo(char **ver, char **desc) +{ + *ver = MODULE_VERSION_STRING; + *desc = MODULE_DESCRIPTION_STRING; +} +void bircmodule_shutdown(void) +{ + return; +} +int bircmodule_command(aClient *aptr, int parc, char **parv) +{ + return 0; +} +int bircmodule_globalcommand(aClient *sptr, aClient *dst, int parc, char **parv) +{ + return 0; +} + -- 2.9.0