]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 2004-2005 Lee Hardy <lee -at- leeh.co.uk> | |
3 | * Copyright (C) 2004-2005 ircd-ratbox development team | |
4 | */ | |
5 | #ifndef INCLUDED_HOOK_H | |
6 | #define INCLUDED_HOOK_H | |
7 | ||
8 | typedef struct | |
9 | { | |
10 | char *name; | |
11 | rb_dlink_list hooks; | |
12 | } hook; | |
13 | ||
14 | enum hook_priority | |
15 | { | |
16 | HOOK_LOWEST = 10, | |
17 | HOOK_LOW = 20, | |
18 | HOOK_NORMAL = 30, | |
19 | HOOK_HIGH = 40, | |
20 | HOOK_HIGHEST = 50, | |
21 | HOOK_MONITOR = 100 | |
22 | }; | |
23 | ||
24 | /* for idle time privacy features */ | |
25 | enum whois_idle_approval | |
26 | { | |
27 | WHOIS_IDLE_HIDE = 0, | |
28 | WHOIS_IDLE_SHOW = 1, | |
29 | WHOIS_IDLE_AUSPEX = 2 | |
30 | }; | |
31 | ||
32 | typedef void (*hookfn) (void *data); | |
33 | ||
34 | extern int h_iosend_id; | |
35 | extern int h_iorecv_id; | |
36 | extern int h_iorecvctrl_id; | |
37 | ||
38 | extern int h_burst_client; | |
39 | extern int h_burst_channel; | |
40 | extern int h_burst_finished; | |
41 | extern int h_server_introduced; | |
42 | extern int h_server_eob; | |
43 | extern int h_client_exit; | |
44 | extern int h_after_client_exit; | |
45 | extern int h_umode_changed; | |
46 | extern int h_new_local_user; | |
47 | extern int h_new_remote_user; | |
48 | extern int h_introduce_client; | |
49 | extern int h_can_kick; | |
50 | extern int h_privmsg_channel; | |
51 | extern int h_privmsg_user; | |
52 | extern int h_conf_read_start; | |
53 | extern int h_conf_read_end; | |
54 | extern int h_outbound_msgbuf; | |
55 | extern int h_rehash; | |
56 | extern int h_priv_change; | |
57 | extern int h_cap_change; | |
58 | ||
59 | void init_hook(void); | |
60 | int register_hook(const char *name); | |
61 | void add_hook(const char *name, hookfn fn); | |
62 | void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority); | |
63 | void remove_hook(const char *name, hookfn fn); | |
64 | void call_hook(int id, void *arg); | |
65 | ||
66 | typedef struct | |
67 | { | |
68 | struct Client *client; | |
69 | void *arg1; | |
70 | void *arg2; | |
71 | } hook_data; | |
72 | ||
73 | typedef struct | |
74 | { | |
75 | struct Client *client; | |
76 | const void *arg1; | |
77 | const void *arg2; | |
78 | } hook_cdata; | |
79 | ||
80 | typedef struct | |
81 | { | |
82 | struct Client *client; | |
83 | const void *arg1; | |
84 | int arg2; | |
85 | int result; | |
86 | } hook_data_int; | |
87 | ||
88 | typedef struct | |
89 | { | |
90 | struct Client *client; | |
91 | struct Client *target; | |
92 | } hook_data_client; | |
93 | ||
94 | typedef struct | |
95 | { | |
96 | struct Client *client; | |
97 | struct Channel *chptr; | |
98 | int approved; | |
99 | } hook_data_channel; | |
100 | ||
101 | typedef struct | |
102 | { | |
103 | struct Client *client; | |
104 | struct Channel *chptr; | |
105 | const char *key; | |
106 | } hook_data_channel_activity; | |
107 | ||
108 | typedef struct | |
109 | { | |
110 | struct Client *client; | |
111 | struct Channel *chptr; | |
112 | struct membership *msptr; | |
113 | struct Client *target; | |
114 | int approved; | |
115 | int dir; | |
116 | const char *modestr; | |
117 | const char *error; | |
118 | } hook_data_channel_approval; | |
119 | ||
120 | typedef struct | |
121 | { | |
122 | struct Client *client; | |
123 | struct Client *target; | |
124 | struct Channel *chptr; | |
125 | struct membership *clientms; | |
126 | struct membership *targetms; | |
127 | int approved; | |
128 | } hook_data_channel_visibility; | |
129 | ||
130 | typedef struct | |
131 | { | |
132 | struct Client *client; | |
133 | struct Client *target; | |
134 | int approved; | |
135 | } hook_data_client_approval; | |
136 | ||
137 | typedef struct | |
138 | { | |
139 | struct Client *local_link; /* local client originating this, or NULL */ | |
140 | struct Client *target; /* dying client */ | |
141 | struct Client *from; /* causing client (could be &me or target) */ | |
142 | const char *comment; | |
143 | } hook_data_client_exit; | |
144 | ||
145 | typedef struct | |
146 | { | |
147 | struct Client *client; | |
148 | const char *reason; | |
149 | const char *orig_reason; | |
150 | } hook_data_client_quit; | |
151 | ||
152 | typedef struct | |
153 | { | |
154 | struct Client *client; | |
155 | unsigned int oldumodes; | |
156 | unsigned int oldsnomask; | |
157 | } hook_data_umode_changed; | |
158 | ||
159 | typedef struct | |
160 | { | |
161 | struct Client *client; | |
162 | int oldcaps; | |
163 | int add; | |
164 | int del; | |
165 | } hook_data_cap_change; | |
166 | ||
167 | enum message_type { | |
168 | MESSAGE_TYPE_NOTICE, | |
169 | MESSAGE_TYPE_PRIVMSG, | |
170 | MESSAGE_TYPE_PART, | |
171 | MESSAGE_TYPE_COUNT | |
172 | }; | |
173 | ||
174 | typedef struct | |
175 | { | |
176 | enum message_type msgtype; | |
177 | struct Client *source_p; | |
178 | struct Channel *chptr; | |
179 | const char *text; | |
180 | int approved; | |
181 | } hook_data_privmsg_channel; | |
182 | ||
183 | typedef struct | |
184 | { | |
185 | enum message_type msgtype; | |
186 | struct Client *source_p; | |
187 | struct Client *target_p; | |
188 | const char *text; | |
189 | int approved; | |
190 | } hook_data_privmsg_user; | |
191 | ||
192 | typedef struct | |
193 | { | |
194 | struct Client *client; | |
195 | struct PrivilegeSet *old; | |
196 | struct PrivilegeSet *new; | |
197 | const struct PrivilegeSet *added; | |
198 | const struct PrivilegeSet *removed; | |
199 | const struct PrivilegeSet *unchanged; | |
200 | } hook_data_priv_change; | |
201 | ||
202 | typedef struct | |
203 | { | |
204 | bool signal; | |
205 | } hook_data_rehash; | |
206 | ||
207 | #endif |