From: Chris Porter Date: Sat, 7 Mar 2009 13:45:31 +0000 (+0000) Subject: JOINFLOOD: add support for glining of ident for trusted users. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/813c5b73323bff5a7790cdba64bf31e009689c85 JOINFLOOD: add support for glining of ident for trusted users. added very very basic gline module. --- diff --git a/glines/Makefile.in b/glines/Makefile.in new file mode 100644 index 00000000..89925ac9 --- /dev/null +++ b/glines/Makefile.in @@ -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 index 00000000..794e612f --- /dev/null +++ b/glines/glines.c @@ -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 index 00000000..29f554d4 --- /dev/null +++ b/glines/glines.h @@ -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 diff --git a/trusts/Makefile.in b/trusts/Makefile.in index 893e8540..3de60c51 100644 --- a/trusts/Makefile.in +++ b/trusts/Makefile.in @@ -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 . diff --git a/trusts/trusts.h b/trusts/trusts.h index d9685046..fbec7025 100644 --- a/trusts/trusts.h +++ b/trusts/trusts.h @@ -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 index 00000000..23fe0635 --- /dev/null +++ b/trusts/trusts_api.c @@ -0,0 +1,6 @@ +#include <../nick/nick.h> +#include "trusts.h" + +int istrusted(nick *np) { + return gettrusthost(np) != NULL; +}