]> jfr.im git - irc/quakenet/newserv.git/commitdiff
JOINFLOOD: add support for glining of ident for trusted users.
authorChris Porter <redacted>
Sat, 7 Mar 2009 13:45:31 +0000 (13:45 +0000)
committerChris Porter <redacted>
Sat, 7 Mar 2009 13:45:31 +0000 (13:45 +0000)
added very very basic gline module.

glines/Makefile.in [new file with mode: 0644]
glines/glines.c [new file with mode: 0644]
glines/glines.h [new file with mode: 0644]
trusts/Makefile.in
trusts/trusts.h
trusts/trusts_api.c [new file with mode: 0644]

diff --git a/glines/Makefile.in b/glines/Makefile.in
new file mode 100644 (file)
index 0000000..89925ac
--- /dev/null
@@ -0,0 +1,6 @@
+@include@ @includel@../build.mk@includel@
+
+.PHONY: all
+all: glines.so
+
+glines.so: glines.o
diff --git a/glines/glines.c b/glines/glines.c
new file mode 100644 (file)
index 0000000..794e612
--- /dev/null
@@ -0,0 +1,20 @@
+#include "../irc/irc.h"
+
+#include "../trusts/trusts.h"
+#include "glines.h"
+
+void glinebynick(nick *np, int duration, char *reason) {
+  irc_send("%s GL * +%s@%s %d %jd :%s", mynumeric->content, istrusted(np)?np->ident:"*", IPtostr(np->p_ipaddr), duration, (intmax_t)getnettime(), reason);
+}
+
+void glinebyhost(char *ident, char *hostname, int duration, char *reason) {
+  /* TODO: resolve trustgroup and trustgline */
+
+  irc_send("%s GL * +%s@%s %d %jd :%s", mynumeric->content, ident, hostname, duration, (intmax_t)getnettime(), reason);
+}
+
+void unglinebyhost(char *ident, char *hostname, int duration, char *reason) {
+  /* TODO: trustungline */
+
+  irc_send("%s GL * -%s@%s %d %jd :%s", mynumeric->content, ident, hostname, duration, (intmax_t)getnettime(), reason);
+}
diff --git a/glines/glines.h b/glines/glines.h
new file mode 100644 (file)
index 0000000..29f554d
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef __GLINES_H
+#define __GLINES_H
+
+void glinebynick(nick *, int, char *);
+void glinebyhost(char *, char *, int, char *);
+void unglinebyhost(char *, char *, int, char *);
+
+#endif
index 893e8540bb4ce34b8952abaafb9f737dce96dd73..3de60c519168c1d66123fda4250254bd91b8abf0 100644 (file)
@@ -4,7 +4,7 @@ TRUSTSDIRS=newsearch
 
 .PHONY: all dirs $(TRUSTSDIRS) clean distclean
 
-all: trusts.so trusts_commands.so trusts_policy.so trusts_migration.so trusts_db.so trusts_management.so trusts_master.so trusts_slave.so dirs
+all: trusts.so trusts_commands.so trusts_policy.so trusts_migration.so trusts_db.so trusts_management.so trusts_master.so trusts_slave.so trusts_api.so dirs
 
 trusts.so: trusts.o data.o formats.o events.o
 
@@ -22,6 +22,8 @@ trusts_master.so: trusts_master.o
 
 trusts_slave.so: trusts_slave.o db-slave.o
 
+trusts_api.so: trusts_api.o
+
 dirs: $(TRUSTSDIRS)
        ln -sf */*.so .
 
index d9685046f44d3dfe4274cecc5f12cbe0172cbbef..fbec7025cb334cc2b59260c6ea9dd0f46c325a63 100644 (file)
@@ -151,4 +151,7 @@ typedef void (*TrustDBMigrationCallback)(int, void *);
 void trusts_newnick(nick *, int);
 void trusts_lostnick(nick *, int);
 
+/* trusts_api.c */
+int istrusted(nick *);
+
 #endif
diff --git a/trusts/trusts_api.c b/trusts/trusts_api.c
new file mode 100644 (file)
index 0000000..23fe063
--- /dev/null
@@ -0,0 +1,6 @@
+#include <../nick/nick.h>
+#include "trusts.h"
+
+int istrusted(nick *np) {
+  return gettrusthost(np) != NULL;
+}