simple module example showing how to use new remotemsg hook...
authorMatthew Wiggins <lithium@rubiks.net>
Sat, 15 Jan 2005 23:38:00 +0000 (23:38 +0000)
committerMatthew Wiggins <lithium@rubiks.net>
Sat, 15 Jan 2005 23:38:00 +0000 (23:38 +0000)
modules/remotemsg-example.c [new file with mode: 0644]

diff --git a/modules/remotemsg-example.c b/modules/remotemsg-example.c
new file mode 100644 (file)
index 0000000..e167150
--- /dev/null
@@ -0,0 +1,59 @@
+#include <fcntl.h>
+#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;
+}
+