]> jfr.im git - irc/quakenet/newserv.git/commitdiff
added gline time support as (and (channel #tlz) (gline 2w)). changed gline format...
authorIan Barker <redacted>
Wed, 30 May 2007 00:56:52 +0000 (01:56 +0100)
committerIan Barker <redacted>
Wed, 30 May 2007 00:56:52 +0000 (01:56 +0100)
added global oper notification of use of kill/gline functions.

newsearch/newsearch.h
newsearch/ns-gline.c
newsearch/ns-kill.c

index 7ca8d5d1239548a9e624812013ae2c3adf4c3bce..ccda7ced74efffacd469e32982f1a86e4e3c85d9 100644 (file)
@@ -4,7 +4,7 @@
 #define    SEARCHTYPE_NICK        2
 
 
-#define    NSMAX_KILL_LIMIT       5
+#define    NSMAX_KILL_LIMIT       500
 #define    NSMAX_GLINE_LIMIT      500
 
 
index 7675f64c36dc181a1757383587a9ca0542afb823..3d616ceccfdbe15f0edaf9670072c15e0a896326 100644 (file)
@@ -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 :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 :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);
index 634e6e3044426895d34ab2ceac4a2b5bc135cc12..30455dc7173060ab3cca90c7b1be5131b584ec4c 100644 (file)
@@ -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);