.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 $@ $^
#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"
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();
/* 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.");
}
}
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;
+#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
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);
void *trueval(int type);
void *falseval(int type);
-
typedef struct searchNode {
int returntype;
exeFunc exe;
#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);
#include <stdio.h>
#include <stdlib.h>
-#include "../nick/nick.h"
#include "../channel/channel.h"
void *channel_exe(struct searchNode *thenode, int type, void *theinput);
#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);
#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);
#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);
#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);
#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);
#include <stdio.h>
#include <stdlib.h>
-#include "../nick/nick.h"
#include "../channel/channel.h"
#include "../lib/flags.h"
#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);
#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);
#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);