From: Ian Barker Date: Wed, 30 May 2007 00:56:52 +0000 (+0100) Subject: added gline time support as (and (channel #tlz) (gline 2w)). changed gline format... X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/f16cabe45a0b7f9b9d64602a56be680094c9c74f added gline time support as (and (channel #tlz) (gline 2w)). changed gline format to asuka (from snircd test server). added global oper notification of use of kill/gline functions. --- diff --git a/newsearch/newsearch.h b/newsearch/newsearch.h index 7ca8d5d1..ccda7ced 100644 --- a/newsearch/newsearch.h +++ b/newsearch/newsearch.h @@ -4,7 +4,7 @@ #define SEARCHTYPE_NICK 2 -#define NSMAX_KILL_LIMIT 5 +#define NSMAX_KILL_LIMIT 500 #define NSMAX_GLINE_LIMIT 500 diff --git a/newsearch/ns-gline.c b/newsearch/ns-gline.c index 7675f64c..3d616cec 100644 --- a/newsearch/ns-gline.c +++ b/newsearch/ns-gline.c @@ -9,7 +9,7 @@ #include "../control/control.h" /* controlreply() */ #include "../irc/irc.h" /* irc_send() */ -#include "../lib/irc_string.h" /* IPtostr() */ +#include "../lib/irc_string.h" /* IPtostr(), longtoduration(), durationtolong() */ /* used for *_free functions that need to warn users of certain things i.e. hitting too many users in a (kill) or (gline) - declared in newsearch.c */ @@ -20,6 +20,7 @@ void gline_free(struct searchNode *thenode); struct gline_localdata { unsigned int marker; + unsigned int duration; int count; searchNode **nodes; }; @@ -33,6 +34,16 @@ struct searchNode *gline_parse(int type, int argc, char **argv) { localdata->count = 0; localdata->marker = nextnickmarker(); + /* gline durations */ + if (argc<1) + localdata->duration = NSGLINE_DURATION; + else { + localdata->duration = durationtolong(argv[0]); + /* error checking on gline duration */ + if (localdata->duration == 0) + localdata->duration = NSGLINE_DURATION; + } + thenode=(struct searchNode *)malloc(sizeof (struct searchNode)); thenode->returntype = RETURNTYPE_BOOL; @@ -84,11 +95,11 @@ void gline_free(struct searchNode *thenode) { if (np->marker == localdata->marker) { if (!IsOper(np) && !IsService(np) && !IsXOper(np)) { if (np->ident[0] == '~') - irc_send("%s GL * +*@%s %u 1 :You (%s!%s@%s) have been glined for violating our terms of service.", - mynumeric->content, IPtostr(np->ipaddress), NSGLINE_DURATION, np->nick, np->ident, IPtostr(np->ipaddress)); + irc_send("%s GL * +*@%s %u :You (%s!%s@%s) have been glined for violating our terms of service.", + mynumeric->content, IPtostr(np->ipaddress), localdata->duration, np->nick, np->ident, IPtostr(np->ipaddress)); else - irc_send("%s GL * +%s@%s %u 1 :You (%s!%s@%s) have been glined for violating our terms of service.", - mynumeric->content, np->ident, IPtostr(np->ipaddress), NSGLINE_DURATION, np->nick, np->ident, IPtostr(np->ipaddress)); + irc_send("%s GL * +%s@%s %u :You (%s!%s@%s) have been glined for violating our terms of service.", + mynumeric->content, np->ident, IPtostr(np->ipaddress), localdata->duration, np->nick, np->ident, IPtostr(np->ipaddress)); } else safe++; @@ -97,6 +108,9 @@ void gline_free(struct searchNode *thenode) { } if (safe) controlreply(senderNSExtern, "Warning: your pattern matched privileged users (%d in total) - these have not been touched.", safe); + /* notify opers of the action */ + controlwall(NO_OPER, NL_GLINES, "%s/%s glined %d %s via nicksearch for %s [%d untouched].", senderNSExtern->nick, senderNSExtern->authname, localdata->count, + localdata->count != 1 ? "users" : "user", longtoduration(localdata->duration, 1), safe); free(localdata->nodes); free(localdata); free(thenode); diff --git a/newsearch/ns-kill.c b/newsearch/ns-kill.c index 634e6e30..30455dc7 100644 --- a/newsearch/ns-kill.c +++ b/newsearch/ns-kill.c @@ -93,6 +93,9 @@ void kill_free(struct searchNode *thenode) { } if (safe) controlreply(senderNSExtern, "Warning: your pattern matched privileged users (%d in total) - these have not been touched.", safe); + /* notify opers of the action */ + controlwall(NO_OPER, NL_KICKKILLS, "%s/%s killed %d %s via nicksearch [%d untouched].", senderNSExtern->nick, senderNSExtern->authname, localdata->count, + localdata->count != 1 ? "users" : "user", safe); free(localdata->nodes); free(localdata); free(thenode);