X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/68a88a93c80fe65fafe5a9effaefabcc2b0911b0..7e032dc63479ed3d0b76fe71c05303fbe7dbc53a:/glines/glines.h diff --git a/glines/glines.h b/glines/glines.h index a5c7a724..c7f7e744 100644 --- a/glines/glines.h +++ b/glines/glines.h @@ -4,22 +4,25 @@ #include "../lib/sstring.h" #include "../nick/nick.h" #include "../channel/channel.h" +#include "../whowas/whowas.h" #define SNIRCD_VERSION 134 #define MAXUSERGLINEUSERHITS 100 #define MAXUSERGLINECHANNELHITS 10 -#define MAXUSERGLINEDURATION 90 * 86400 -#define MINUSERGLINEREASON 10 + +#define MAXGLINEDURATION 90 * 86400 +#define MINGLINEREASONLEN 10 #define MAXGLINEUSERHITS 500 #define MAXGLINECHANNELHITS 50 +#define MAXGLINELOG 500 + #define GLINE_IGNORE_TRUST 1 #define GLINE_ALWAYS_NICK 2 #define GLINE_ALWAYS_USER 4 -#define GLINE_NO_LIMIT 8 -#define GLINE_SIMULATE 16 +#define GLINE_SIMULATE 8 #define GLINE_HOSTMASK 1 /* Gline includes a host mask */ #define GLINE_IPMASK 2 /* Gline includes an CIDR mask */ @@ -72,16 +75,29 @@ typedef struct gline { time_t lifetime; unsigned int flags; + int glinebufid; struct gline *next; } gline; typedef struct glinebuf { - gline *head; - int merge; + int id; + sstring *comment; + time_t commit; + time_t amend; + + gline *glines; + + int hitsvalid; + int userhits; + int channelhits; + + array hits; } glinebuf; extern gline *glinelist; +extern glinebuf *glinebuflog[MAXGLINELOG]; +extern int glinebuflogoffset; /* glines.c */ gline *findgline(const char *); @@ -94,6 +110,7 @@ int gline_match_mask(gline *gla, gline *glb); int gline_match_nick(gline *gl, nick *np); int gline_match_channel(gline *gl, channel *cp); int isglinesane(gline *gl, const char **hint); +gline *glinedup(gline *gl); /* glines_formats.c */ gline *makegline(const char *); @@ -102,17 +119,24 @@ char *glinetostring(gline *g); /* glines_util.c */ int glinebyip(const char *user, struct irc_in_addr *ip, unsigned char bits, int duration, const char *reason, int flags, const char *creator); int glinebynick(nick *np, int duration, const char *reason, int flags, const char *creator); +void glineunsetmask(const char *mask); /* glines_buf.c */ -void glinebufinit(glinebuf *gbuf, int merge); +void glinebufinit(glinebuf *gbuf, int id); gline *glinebufadd(glinebuf *gbuf, const char *mask, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime); void glinebufaddbyip(glinebuf *gbuf, const char *user, struct irc_in_addr *ip, unsigned char bits, int flags, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime); void glinebufaddbynick(glinebuf *gbuf, nick *, int flags, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime); +void glinebufaddbywhowas(glinebuf *gbuf, whowas *, int flags, const char *creator, const char *reason, time_t expire, time_t lastmod, time_t lifetime); void glinebufcounthits(glinebuf *gbuf, int *users, int *channels); -int glinebufsanitize(glinebuf *gbuf); -void glinebufspew(glinebuf *gbuf, nick *np); -void glinebufflush(glinebuf *gbuf, int propagate); -void glinebufabandon(glinebuf *gbuf); +int glinebufchecksane(glinebuf *gbuf, nick *spewto, int overridesanity, int overridelimit); +void glinebufspew(glinebuf *gbuf, nick *spewto); +void glinebufmerge(glinebuf *gbuf); +int glinebufcommit(glinebuf *gbuf, int propagate); +void glinebufabort(glinebuf *gbuf); +int glinebufundo(int id); +void glinebufcommentf(glinebuf *gbuf, const char *format, ...); +void glinebufcommentv(glinebuf *gbuf, const char *prefix, int cargc, char **cargv); +int glinebufwritelog(glinebuf *gbuf, int propagating); /* glines_alloc.c */ void freegline(gline *);