]>
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 | ||
212380e3 AC |
24 | typedef void (*hookfn) (void *data); |
25 | ||
2e819b6b JT |
26 | extern int h_iosend_id; |
27 | extern int h_iorecv_id; | |
28 | extern int h_iorecvctrl_id; | |
212380e3 | 29 | |
2e819b6b JT |
30 | extern int h_burst_client; |
31 | extern int h_burst_channel; | |
32 | extern int h_burst_finished; | |
33 | extern int h_server_introduced; | |
34 | extern int h_server_eob; | |
35 | extern int h_client_exit; | |
15b05f95 | 36 | extern int h_after_client_exit; |
2e819b6b JT |
37 | extern int h_umode_changed; |
38 | extern int h_new_local_user; | |
39 | extern int h_new_remote_user; | |
40 | extern int h_introduce_client; | |
5f8d323c | 41 | extern int h_can_kick; |
ca4c2a86 AC |
42 | extern int h_privmsg_channel; |
43 | extern int h_privmsg_user; | |
7d603754 KB |
44 | extern int h_conf_read_start; |
45 | extern int h_conf_read_end; | |
4f8ababa | 46 | extern int h_outbound_msgbuf; |
2575a78b | 47 | extern int h_rehash; |
212380e3 AC |
48 | |
49 | void init_hook(void); | |
50 | int register_hook(const char *name); | |
51 | void add_hook(const char *name, hookfn fn); | |
91b12782 | 52 | void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority); |
212380e3 AC |
53 | void remove_hook(const char *name, hookfn fn); |
54 | void call_hook(int id, void *arg); | |
55 | ||
48a2b7c1 AC |
56 | typedef struct |
57 | { | |
58 | struct Client *client; | |
59 | void *arg1; | |
60 | void *arg2; | |
61 | } hook_data; | |
62 | ||
212380e3 AC |
63 | typedef struct |
64 | { | |
65 | struct Client *client; | |
66 | const void *arg1; | |
67 | const void *arg2; | |
48a2b7c1 | 68 | } hook_cdata; |
212380e3 AC |
69 | |
70 | typedef struct | |
71 | { | |
72 | struct Client *client; | |
73 | const void *arg1; | |
74 | int arg2; | |
ea2d2700 | 75 | int result; |
212380e3 AC |
76 | } hook_data_int; |
77 | ||
78 | typedef struct | |
79 | { | |
80 | struct Client *client; | |
81 | struct Client *target; | |
9e07c8f7 AC |
82 | struct Channel *chptr; |
83 | int approved; | |
212380e3 AC |
84 | } hook_data_client; |
85 | ||
86 | typedef struct | |
87 | { | |
88 | struct Client *client; | |
89 | struct Channel *chptr; | |
90 | int approved; | |
91 | } hook_data_channel; | |
92 | ||
93 | typedef struct | |
94 | { | |
95 | struct Client *client; | |
96 | struct Channel *chptr; | |
5bc95eaf | 97 | const char *key; |
212380e3 AC |
98 | } hook_data_channel_activity; |
99 | ||
5f8d323c AC |
100 | typedef struct |
101 | { | |
102 | struct Client *client; | |
103 | struct Channel *chptr; | |
6ca4dec9 | 104 | struct membership *msptr; |
5f8d323c AC |
105 | struct Client *target; |
106 | int approved; | |
202d4966 | 107 | int dir; |
b870a5f8 | 108 | const char *modestr; |
e0622d75 | 109 | const char *error; |
5f8d323c AC |
110 | } hook_data_channel_approval; |
111 | ||
212380e3 AC |
112 | typedef struct |
113 | { | |
114 | struct Client *client; | |
9d745dbd | 115 | struct Client *target; |
212380e3 AC |
116 | int approved; |
117 | } hook_data_client_approval; | |
118 | ||
119 | typedef struct | |
120 | { | |
121 | struct Client *local_link; /* local client originating this, or NULL */ | |
122 | struct Client *target; /* dying client */ | |
123 | struct Client *from; /* causing client (could be &me or target) */ | |
124 | const char *comment; | |
125 | } hook_data_client_exit; | |
126 | ||
260fc2cc EK |
127 | typedef struct |
128 | { | |
129 | struct Client *client; | |
130 | const char *reason; | |
131 | const char *orig_reason; | |
132 | } hook_data_client_quit; | |
133 | ||
212380e3 AC |
134 | typedef struct |
135 | { | |
136 | struct Client *client; | |
137 | unsigned int oldumodes; | |
138 | unsigned int oldsnomask; | |
139 | } hook_data_umode_changed; | |
140 | ||
ca4c2a86 AC |
141 | enum message_type { |
142 | MESSAGE_TYPE_NOTICE, | |
143 | MESSAGE_TYPE_PRIVMSG, | |
62cf5b40 | 144 | MESSAGE_TYPE_PART, |
ca4c2a86 AC |
145 | MESSAGE_TYPE_COUNT |
146 | }; | |
147 | ||
148 | typedef struct | |
149 | { | |
150 | enum message_type msgtype; | |
151 | struct Client *source_p; | |
152 | struct Channel *chptr; | |
153 | const char *text; | |
154 | int approved; | |
155 | } hook_data_privmsg_channel; | |
156 | ||
157 | typedef struct | |
158 | { | |
159 | enum message_type msgtype; | |
160 | struct Client *source_p; | |
161 | struct Client *target_p; | |
162 | const char *text; | |
163 | int approved; | |
164 | } hook_data_privmsg_user; | |
165 | ||
2575a78b EM |
166 | typedef struct |
167 | { | |
168 | bool signal; | |
169 | } hook_data_rehash; | |
170 | ||
212380e3 | 171 | #endif |