]>
jfr.im git - irc/quakenet/newserv.git/blob - newsearch/newsearch.h
28714aa52424f1ad68259691320c0eba54828fd3
1 #include "../nick/nick.h"
2 #include "../parser/parser.h"
3 #include "../channel/channel.h"
4 #include "../lib/flags.h"
6 #define SEARCHTYPE_CHANNEL 1
7 #define SEARCHTYPE_NICK 2
10 #define NSMAX_KILL_LIMIT 500
11 #define NSMAX_GLINE_LIMIT 500
14 #define NSMAX_GLINE_CLONES 5
17 /* gline duration, in seconds */
18 #define NSGLINE_DURATION 3600
21 #define RETURNTYPE_BOOL 0x01
22 #define RETURNTYPE_INT 0x02
23 #define RETURNTYPE_STRING 0x03
24 #define RETURNTYPE_TYPE 0xFF
25 #define RETURNTYPE_CONST 0x100
29 typedef struct searchNode
*(*parseFunc
)(int, int, char **);
30 typedef void (*freeFunc
)(struct searchNode
*);
31 typedef void *(*exeFunc
)(struct searchNode
*, void *);
34 /* Logical (BOOL -> BOOL)*/
35 struct searchNode
*and_parse(int type
, int argc
, char **argv
);
36 struct searchNode
*not_parse(int type
, int argc
, char **argv
);
37 struct searchNode
*or_parse(int type
, int argc
, char **argv
);
39 /* Comparison (INT -> BOOL) */
40 struct searchNode
*eq_parse(int type
, int argc
, char **argv
);
41 struct searchNode
*lt_parse(int type
, int argc
, char **argv
);
42 struct searchNode
*gt_parse(int type
, int argc
, char **argv
);
44 /* String match (STRING -> BOOL) */
45 struct searchNode
*match_parse(int type
, int argc
, char **argv
);
46 struct searchNode
*regex_parse(int type
, int argc
, char **argv
);
48 /* Length (STRING -> INT) */
49 struct searchNode
*length_parse(int type
, int argc
, char **argv
);
51 /* kill/gline actions (BOOL) */
52 struct searchNode
*kill_parse(int type
, int argc
, char **argv
);
53 struct searchNode
*gline_parse(int type
, int argc
, char **argv
);
55 /* Nick/Channel functions (various types) */
56 struct searchNode
*nick_parse(int type
, int argc
, char **argv
);
57 struct searchNode
*modes_parse(int type
, int argc
, char **argv
);
59 /* Nick functions (various types) */
60 struct searchNode
*hostmask_parse(int type
, int argc
, char **argv
);
61 struct searchNode
*realname_parse(int type
, int argc
, char **argv
);
62 struct searchNode
*authname_parse(int type
, int argc
, char **argv
);
63 struct searchNode
*ident_parse(int type
, int argc
, char **argv
);
64 struct searchNode
*host_parse(int type
, int argc
, char **argv
);
65 struct searchNode
*channel_parse(int type
, int argc
, char **argv
);
66 struct searchNode
*timestamp_parse(int type
, int argc
, char **argv
);
67 struct searchNode
*country_parse(int type
, int argc
, char **argv
);
68 struct searchNode
*ip_parse(int type
, int argc
, char **argv
);
70 /* Channel functions (various types) */
71 struct searchNode
*exists_parse(int type
, int argc
, char **argv
);
72 struct searchNode
*services_parse(int type
, int argc
, char **argv
);
73 struct searchNode
*size_parse(int type
, int argc
, char **argv
);
74 struct searchNode
*name_parse(int type
, int argc
, char **argv
);
75 struct searchNode
*topic_parse(int type
, int argc
, char **argv
);
76 struct searchNode
*oppct_parse(int type
, int argc
, char **argv
);
77 struct searchNode
*hostpct_parse(int type
, int argc
, char **argv
);
78 struct searchNode
*authedpct_parse(int type
, int argc
, char **argv
);
80 /* Interpret a string to give a node */
81 struct searchNode
*search_parse(int type
, char *input
);
83 /* Force a node to return the thing you want */
84 struct searchNode
*coerceNode(struct searchNode
*thenode
, int type
);
86 /* Registration functions */
87 void registersearchterm(char *term
, parseFunc parsefunc
);
88 void deregistersearchterm(char *term
, parseFunc parsefunc
);
90 void *trueval(int type
);
91 void *falseval(int type
);
93 typedef struct searchNode
{
100 extern const char *parseError
;