]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Add auth module, I've written this at least 50 times...
authorChris Porter <redacted>
Sat, 20 Sep 2008 15:45:59 +0000 (16:45 +0100)
committerChris Porter <redacted>
Sat, 20 Sep 2008 15:45:59 +0000 (16:45 +0100)
auth/Makefile.in [new file with mode: 0644]
auth/auth.c [new file with mode: 0644]

diff --git a/auth/Makefile.in b/auth/Makefile.in
new file mode 100644 (file)
index 0000000..06c6a51
--- /dev/null
@@ -0,0 +1,6 @@
+@include@ @includel@../build.mk@includel@
+
+.PHONY: all
+all: auth.so
+
+auth.so: auth.o
diff --git a/auth/auth.c b/auth/auth.c
new file mode 100644 (file)
index 0000000..af7920e
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+
+#include "../control/control.h"
+#include "../nick/nick.h"
+#include "../irc/irc.h"
+#include "../localuser/localuser.h"
+
+int au_auth(void *source, int cargc, char **cargv) {
+  nick *sender=(nick *)source;
+  char *authname, *dummy;
+  int authid;
+
+  if(cargc < 2)
+    return CMD_USAGE;
+
+  if(sscanf(myserver->content, "%s.quakenet.org", dummy) == 1) {
+    controlreply(sender, "Sorry, you can't use this command on QuakeNet.");
+    return CMD_ERROR;
+  }
+
+  authname = cargv[0];
+  authid = atoi(cargv[1]);
+
+  controlwall(NO_OPER, NL_OPERATIONS, "AUTH'ed at %s:%d", authname, authid);
+
+  localusersetaccount(sender, authname, authid, 0, 0);
+  controlreply(sender, "Done.");
+
+  return CMD_OK;
+}
+
+void _init() {
+  registercontrolhelpcmd("auth", NO_OPER, 1, au_auth, "Usage: auth <authname> <authid>");
+}
+
+void _fini() {
+  deregistercontrolcmd("auth", au_auth);
+}
+