]> jfr.im git - irc/quakenet/newserv.git/commitdiff
added LISP style kill/gline functionality
authorIan Barker <redacted>
Wed, 30 May 2007 00:04:42 +0000 (01:04 +0100)
committerIan Barker <redacted>
Wed, 30 May 2007 00:04:42 +0000 (01:04 +0100)
14 files changed:
newsearch/Makefile
newsearch/newsearch.c
newsearch/newsearch.h
newsearch/ns-authname.c
newsearch/ns-channel.c
newsearch/ns-country.c
newsearch/ns-host.c
newsearch/ns-hostmask.c
newsearch/ns-ident.c
newsearch/ns-ip.c
newsearch/ns-modes.c
newsearch/ns-nick.c
newsearch/ns-realname.c
newsearch/ns-timestamp.c

index 4e5fad9a6d1aea0df0486c9f9a2a97c34d79173f..d764b2c1d366e6b3f2409fcb5f67920f135d8a7a 100644 (file)
@@ -2,5 +2,5 @@
 .PHONY: all
 all: newsearch.so
 
-newsearch.so: newsearch.o ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o
+newsearch.so: newsearch.o ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o ns-kill.o ns-gline.o
        ld -shared -Bdynamic $(LIBPCRE) -o $@ $^
index 0d993f39fd1018a6c7e4ac3482d2c8c0a8f5cd52..0b96fbd70550b59a80cb871a9f2473a698ddf0d7 100644 (file)
@@ -3,7 +3,6 @@
 #include "newsearch.h"
 
 #include "../irc/irc_config.h"
-#include "../nick/nick.h"
 #include "../lib/irc_string.h"
 #include "../parser/parser.h"
 #include "../control/control.h"
@@ -24,6 +23,9 @@ void *trueval(int type);
 void *falseval(int type);
 
 const char *parseError;
+/* used for *_free functions that need to warn users of certain things
+   i.e. hitting too many users in a (kill) or (gline) */
+const struct nick *senderNSExtern;
 
 void _init() {
   searchTree=newcommandtree();
@@ -57,6 +59,10 @@ void _init() {
   /* Nickname / channel operations */
   registersearchterm("modes",modes_parse);
 
+  /* Kill / gline parameters */
+  registersearchterm("kill",kill_parse);
+  registersearchterm("gline",gline_parse);
+
   registercontrolhelpcmd("nicksearch",NO_OPER,4,do_nicksearch, "Usage: nicksearch <criteria>\nSearches for nicknames with the given criteria.");
 }
 
@@ -81,13 +87,13 @@ void printnick(nick *sender, nick *np) {
 }
 
 int do_nicksearch(void *source, int cargc, char **cargv) {
-  nick *sender=source, *np;
+  nick *sender = senderNSExtern = source, *np;
   int i;
   struct searchNode *search;
   int limit=500,matches=0;
   char *ch;
   int arg=0;
-  
+
   if (cargc<1)
     return CMD_USAGE;
   
index 108716d4a1d8c52286b403353f190892c0bcbd74..7ca8d5d1239548a9e624812013ae2c3adf4c3bce 100644 (file)
@@ -1,8 +1,17 @@
+#include "../nick/nick.h"
 
 #define    SEARCHTYPE_CHANNEL     1
 #define    SEARCHTYPE_NICK        2
 
 
+#define    NSMAX_KILL_LIMIT       5
+#define    NSMAX_GLINE_LIMIT      500
+
+
+/* gline duration, in seconds */
+#define    NSGLINE_DURATION       3600
+
+
 #define    RETURNTYPE_BOOL        0x01
 #define    RETURNTYPE_INT         0x02
 #define    RETURNTYPE_STRING      0x03
@@ -35,6 +44,8 @@ struct searchNode *channel_parse(int type, int argc, char **argv);
 struct searchNode *timestamp_parse(int type, int argc, char **argv);
 struct searchNode *country_parse(int type, int argc, char **argv);
 struct searchNode *ip_parse(int type, int argc, char **argv);
+struct searchNode *kill_parse(int type, int argc, char **argv);
+struct searchNode *gline_parse(int type, int argc, char **argv);
 
 
 struct searchNode *search_parse(int type, char *input);
@@ -46,7 +57,6 @@ void deregistersearchterm(char *term, parseFunc parsefunc);
 void *trueval(int type);
 void *falseval(int type);
 
-
 typedef struct searchNode {
   int returntype;
   exeFunc  exe;
index 8c11c3b6cc680224e3af568074b0850fa60a5d0f..3c602abeeed8f0a003cd9010abeb17e5eb7e4519 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
-
 void *authname_exe(struct searchNode *thenode, int type, void *theinput);
 void authname_free(struct searchNode *thenode);
 
index e1a90ac9bbddd222e0896a11b4017cea4e5b3108..01a6808099b3d2d8b76bbe4958ae8f10a713f6ba 100644 (file)
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
 #include "../channel/channel.h"
 
 void *channel_exe(struct searchNode *thenode, int type, void *theinput);
index eeba0f31fbfbac614c762fb50b3d6ccbebb76389..fe7bb6f6cbb9f6d14070f301566fb1cbfb143e3c 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 
 #include "../irc/irc_config.h"
-#include "../nick/nick.h"
 #include "../lib/irc_string.h"
 
 void *country_exe(struct searchNode *thenode, int type, void *theinput);
index 2810009df8a0f47caee5d5dfdf2de33b94bb4258..6bf89ba76dfc69ada5c62ac9c4c28a6d630d8fab 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 
 #include "../irc/irc_config.h"
-#include "../nick/nick.h"
 #include "../lib/irc_string.h"
 
 void *host_exe(struct searchNode *thenode, int type, void *theinput);
index 83edc2cdb9f2a169a3db50e256141ae3edc315d8..1bf7dd7abc09259e827debf024392c44829855bd 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 
 #include "../irc/irc_config.h"
-#include "../nick/nick.h"
 #include "../lib/irc_string.h"
 
 void *hostmask_exe(struct searchNode *thenode, int type, void *theinput);
index 3d568a13671526f2316573196f953e75ec477860..817e86e67ddb0ebb8aa13f8010b33dd9a16c8013 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
-
 void *ident_exe(struct searchNode *thenode, int type, void *theinput);
 void ident_free(struct searchNode *thenode);
 
index e78fb67a981600e00ac881ab89a2c125deb89b41..e81c9f5b4de058051951dbb57dc6da069aa23299 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
-
 void *ip_exe(struct searchNode *thenode, int type, void *theinput);
 void ip_free(struct searchNode *thenode);
 
index 03db9c58c9d143d33fb7210c0f18afa0d7654459..f92292d9bbdc312c4439542ec0a60453b4a7f13a 100644 (file)
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
 #include "../channel/channel.h"
 #include "../lib/flags.h"
 
index dcbb2b083e8fde270a777702110b3f1e6a45e41b..7cfb2ce88e042f3594be8ad48e910f321b46ebb7 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
-
 void *nick_exe(struct searchNode *thenode, int type, void *theinput);
 void nick_free(struct searchNode *thenode);
 
index 93358728269fbac7b8ba3f0978cfef860c4679d6..e047b121fbc028ea0b58a275a16c1d728255f0b5 100644 (file)
@@ -7,8 +7,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../nick/nick.h"
-
 void *realname_exe(struct searchNode *thenode, int type, void *theinput);
 void realname_free(struct searchNode *thenode);
 
index 97cdd79bd964150ae0b2f7ce0c254d6d1b715e29..7ad4d70fdcdb87f1fedc5bc6a85cdd652915622f 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 
 #include "../irc/irc_config.h"
-#include "../nick/nick.h"
 #include "../lib/irc_string.h"
 
 void *timestamp_exe(struct searchNode *thenode, int type, void *theinput);