]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * Copyright (C) 2004-2005 Lee Hardy <lee -at- leeh.co.uk> | |
3 | * Copyright (C) 2004-2005 ircd-ratbox development team | |
212380e3 AC |
4 | */ |
5 | #ifndef INCLUDED_HOOK_H | |
6 | #define INCLUDED_HOOK_H | |
7 | ||
8 | typedef struct | |
9 | { | |
10 | char *name; | |
5b96d9a6 | 11 | rb_dlink_list hooks; |
212380e3 AC |
12 | } hook; |
13 | ||
91b12782 EK |
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 | ||
01fb744c DS |
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 | ||
212380e3 AC |
32 | typedef void (*hookfn) (void *data); |
33 | ||
2e819b6b JT |
34 | extern int h_iosend_id; |
35 | extern int h_iorecv_id; | |
36 | extern int h_iorecvctrl_id; | |
212380e3 | 37 | |
2e819b6b JT |
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; | |
15b05f95 | 44 | extern int h_after_client_exit; |
2e819b6b JT |
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; | |
5f8d323c | 49 | extern int h_can_kick; |
ca4c2a86 AC |
50 | extern int h_privmsg_channel; |
51 | extern int h_privmsg_user; | |
7d603754 KB |
52 | extern int h_conf_read_start; |
53 | extern int h_conf_read_end; | |
4f8ababa | 54 | extern int h_outbound_msgbuf; |
2575a78b | 55 | extern int h_rehash; |
8aadf0ce | 56 | extern int h_priv_change; |
71f10f83 | 57 | extern int h_cap_change; |
212380e3 AC |
58 | |
59 | void init_hook(void); | |
60 | int register_hook(const char *name); | |
61 | void add_hook(const char *name, hookfn fn); | |
91b12782 | 62 | void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority); |
212380e3 AC |
63 | void remove_hook(const char *name, hookfn fn); |
64 | void call_hook(int id, void *arg); | |
65 | ||
48a2b7c1 AC |
66 | typedef struct |
67 | { | |
68 | struct Client *client; | |
69 | void *arg1; | |
70 | void *arg2; | |
71 | } hook_data; | |
72 | ||
212380e3 AC |
73 | typedef struct |
74 | { | |
75 | struct Client *client; | |
76 | const void *arg1; | |
77 | const void *arg2; | |
48a2b7c1 | 78 | } hook_cdata; |
212380e3 AC |
79 | |
80 | typedef struct | |
81 | { | |
82 | struct Client *client; | |
83 | const void *arg1; | |
84 | int arg2; | |
ea2d2700 | 85 | int result; |
212380e3 AC |
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; | |
5bc95eaf | 105 | const char *key; |
212380e3 AC |
106 | } hook_data_channel_activity; |
107 | ||
5f8d323c AC |
108 | typedef struct |
109 | { | |
110 | struct Client *client; | |
111 | struct Channel *chptr; | |
6ca4dec9 | 112 | struct membership *msptr; |
5f8d323c AC |
113 | struct Client *target; |
114 | int approved; | |
202d4966 | 115 | int dir; |
b870a5f8 | 116 | const char *modestr; |
e0622d75 | 117 | const char *error; |
5f8d323c AC |
118 | } hook_data_channel_approval; |
119 | ||
5e413b13 EK |
120 | typedef struct |
121 | { | |
122 | struct Client *client; | |
e8a8d7a4 | 123 | struct Client *target; |
5e413b13 EK |
124 | struct Channel *chptr; |
125 | struct membership *clientms; | |
e8a8d7a4 | 126 | struct membership *targetms; |
5e413b13 EK |
127 | int approved; |
128 | } hook_data_channel_visibility; | |
129 | ||
212380e3 AC |
130 | typedef struct |
131 | { | |
132 | struct Client *client; | |
9d745dbd | 133 | struct Client *target; |
212380e3 AC |
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 | ||
260fc2cc EK |
145 | typedef struct |
146 | { | |
147 | struct Client *client; | |
148 | const char *reason; | |
149 | const char *orig_reason; | |
150 | } hook_data_client_quit; | |
151 | ||
212380e3 AC |
152 | typedef struct |
153 | { | |
154 | struct Client *client; | |
155 | unsigned int oldumodes; | |
156 | unsigned int oldsnomask; | |
157 | } hook_data_umode_changed; | |
158 | ||
71f10f83 EK |
159 | typedef struct |
160 | { | |
161 | struct Client *client; | |
162 | int oldcaps; | |
163 | int add; | |
164 | int del; | |
165 | } hook_data_cap_change; | |
166 | ||
ca4c2a86 AC |
167 | enum message_type { |
168 | MESSAGE_TYPE_NOTICE, | |
169 | MESSAGE_TYPE_PRIVMSG, | |
62cf5b40 | 170 | MESSAGE_TYPE_PART, |
ca4c2a86 AC |
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 | ||
8aadf0ce EK |
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 | ||
2575a78b EM |
202 | typedef struct |
203 | { | |
204 | bool signal; | |
205 | } hook_data_rehash; | |
206 | ||
212380e3 | 207 | #endif |