]> jfr.im git - irc/quakenet/newserv.git/blob - newsearch/newsearch.h
More safe warning fixes.
[irc/quakenet/newserv.git] / newsearch / newsearch.h
1 #include "../nick/nick.h"
2 #include "../parser/parser.h"
3 #include "../channel/channel.h"
4 #include "../lib/flags.h"
5
6 #define SEARCHTYPE_CHANNEL 1
7 #define SEARCHTYPE_NICK 2
8
9
10 #define NSMAX_KILL_LIMIT 500
11 #define NSMAX_GLINE_LIMIT 500
12
13
14 #define NSMAX_GLINE_CLONES 5
15
16
17 /* gline duration, in seconds */
18 #define NSGLINE_DURATION 3600
19
20 #define NSMAX_REASON_LEN 120
21
22
23 #define RETURNTYPE_BOOL 0x01
24 #define RETURNTYPE_INT 0x02
25 #define RETURNTYPE_STRING 0x03
26 #define RETURNTYPE_TYPE 0xFF
27 #define RETURNTYPE_CONST 0x100
28
29 struct searchNode;
30
31 typedef struct searchNode *(*parseFunc)(int, int, char **);
32 typedef void (*freeFunc)(struct searchNode *);
33 typedef void *(*exeFunc)(struct searchNode *, void *);
34 typedef void (*ChanDisplayFunc)(nick *, chanindex *);
35 typedef void (*NickDisplayFunc)(nick *, nick *);
36
37 /* Core functions */
38 /* Logical (BOOL -> BOOL)*/
39 struct searchNode *and_parse(int type, int argc, char **argv);
40 struct searchNode *not_parse(int type, int argc, char **argv);
41 struct searchNode *or_parse(int type, int argc, char **argv);
42
43 /* Comparison (INT -> BOOL) */
44 struct searchNode *eq_parse(int type, int argc, char **argv);
45 struct searchNode *lt_parse(int type, int argc, char **argv);
46 struct searchNode *gt_parse(int type, int argc, char **argv);
47
48 /* String match (STRING -> BOOL) */
49 struct searchNode *match_parse(int type, int argc, char **argv);
50 struct searchNode *regex_parse(int type, int argc, char **argv);
51
52 /* Length (STRING -> INT) */
53 struct searchNode *length_parse(int type, int argc, char **argv);
54
55 /* kill/gline actions (BOOL) */
56 struct searchNode *kill_parse(int type, int argc, char **argv);
57 struct searchNode *gline_parse(int type, int argc, char **argv);
58
59 /* Nick/Channel functions (various types) */
60 struct searchNode *nick_parse(int type, int argc, char **argv);
61 struct searchNode *modes_parse(int type, int argc, char **argv);
62
63 /* Nick functions (various types) */
64 struct searchNode *hostmask_parse(int type, int argc, char **argv);
65 struct searchNode *realname_parse(int type, int argc, char **argv);
66 struct searchNode *authname_parse(int type, int argc, char **argv);
67 struct searchNode *authts_parse(int type, int argc, char **argv);
68 struct searchNode *ident_parse(int type, int argc, char **argv);
69 struct searchNode *host_parse(int type, int argc, char **argv);
70 struct searchNode *channel_parse(int type, int argc, char **argv);
71 struct searchNode *timestamp_parse(int type, int argc, char **argv);
72 struct searchNode *country_parse(int type, int argc, char **argv);
73 struct searchNode *ip_parse(int type, int argc, char **argv);
74 struct searchNode *channels_parse(int type, int argc, char **argv);
75 struct searchNode *server_parse(int type, int argc, char **argv);
76
77 /* Channel functions (various types) */
78 struct searchNode *exists_parse(int type, int argc, char **argv);
79 struct searchNode *services_parse(int type, int argc, char **argv);
80 struct searchNode *size_parse(int type, int argc, char **argv);
81 struct searchNode *name_parse(int type, int argc, char **argv);
82 struct searchNode *topic_parse(int type, int argc, char **argv);
83 struct searchNode *oppct_parse(int type, int argc, char **argv);
84 struct searchNode *hostpct_parse(int type, int argc, char **argv);
85 struct searchNode *authedpct_parse(int type, int argc, char **argv);
86 struct searchNode *kick_parse(int type, int argc, char **argv);
87
88 /* Interpret a string to give a node */
89 struct searchNode *search_parse(int type, char *input);
90
91 /* Force a node to return the thing you want */
92 struct searchNode *coerceNode(struct searchNode *thenode, int type);
93
94 /* Registration functions */
95 void registersearchterm(char *term, parseFunc parsefunc);
96 void deregistersearchterm(char *term, parseFunc parsefunc);
97 void regchandisp(const char *name, ChanDisplayFunc handler);
98 void unregchandisp(const char *name, ChanDisplayFunc handler);
99 void regnickdisp(const char *name, NickDisplayFunc handler);
100 void unregnickdisp(const char *name, NickDisplayFunc handler);
101
102 /* Special nick* printf */
103 void nssnprintf(char *, size_t, const char *, nick *);
104
105 typedef struct searchNode {
106 int returntype;
107 exeFunc exe;
108 freeFunc free;
109 void *localdata;
110 } searchNode;
111
112 extern const char *parseError;
113
114 void printnick(nick *, nick *);
115