]>
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 | typedef void (*hookfn) (void *data); | |
25 | ||
26 | extern int h_iosend_id; | |
27 | extern int h_iorecv_id; | |
28 | extern int h_iorecvctrl_id; | |
29 | ||
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; | |
36 | extern int h_after_client_exit; | |
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; | |
41 | extern int h_can_kick; | |
42 | extern int h_privmsg_channel; | |
43 | extern int h_privmsg_user; | |
44 | extern int h_conf_read_start; | |
45 | extern int h_conf_read_end; | |
46 | extern int h_outbound_msgbuf; | |
47 | extern int h_rehash; | |
48 | ||
49 | void init_hook(void); | |
50 | int register_hook(const char *name); | |
51 | void add_hook(const char *name, hookfn fn); | |
52 | void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority); | |
53 | void remove_hook(const char *name, hookfn fn); | |
54 | void call_hook(int id, void *arg); | |
55 | ||
56 | typedef struct | |
57 | { | |
58 | struct Client *client; | |
59 | void *arg1; | |
60 | void *arg2; | |
61 | } hook_data; | |
62 | ||
63 | typedef struct | |
64 | { | |
65 | struct Client *client; | |
66 | const void *arg1; | |
67 | const void *arg2; | |
68 | } hook_cdata; | |
69 | ||
70 | typedef struct | |
71 | { | |
72 | struct Client *client; | |
73 | const void *arg1; | |
74 | int arg2; | |
75 | int result; | |
76 | } hook_data_int; | |
77 | ||
78 | typedef struct | |
79 | { | |
80 | struct Client *client; | |
81 | struct Client *target; | |
82 | } hook_data_client; | |
83 | ||
84 | typedef struct | |
85 | { | |
86 | struct Client *client; | |
87 | struct Channel *chptr; | |
88 | int approved; | |
89 | } hook_data_channel; | |
90 | ||
91 | typedef struct | |
92 | { | |
93 | struct Client *client; | |
94 | struct Channel *chptr; | |
95 | const char *key; | |
96 | } hook_data_channel_activity; | |
97 | ||
98 | typedef struct | |
99 | { | |
100 | struct Client *client; | |
101 | struct Channel *chptr; | |
102 | struct membership *msptr; | |
103 | struct Client *target; | |
104 | int approved; | |
105 | int dir; | |
106 | const char *modestr; | |
107 | const char *error; | |
108 | } hook_data_channel_approval; | |
109 | ||
110 | typedef struct | |
111 | { | |
112 | struct Client *client; | |
113 | struct Channel *chptr; | |
114 | struct membership *clientms; | |
115 | struct membership *targms; | |
116 | int approved; | |
117 | } hook_data_channel_visibility; | |
118 | ||
119 | typedef struct | |
120 | { | |
121 | struct Client *client; | |
122 | struct Client *target; | |
123 | int approved; | |
124 | } hook_data_client_approval; | |
125 | ||
126 | typedef struct | |
127 | { | |
128 | struct Client *local_link; /* local client originating this, or NULL */ | |
129 | struct Client *target; /* dying client */ | |
130 | struct Client *from; /* causing client (could be &me or target) */ | |
131 | const char *comment; | |
132 | } hook_data_client_exit; | |
133 | ||
134 | typedef struct | |
135 | { | |
136 | struct Client *client; | |
137 | const char *reason; | |
138 | const char *orig_reason; | |
139 | } hook_data_client_quit; | |
140 | ||
141 | typedef struct | |
142 | { | |
143 | struct Client *client; | |
144 | unsigned int oldumodes; | |
145 | unsigned int oldsnomask; | |
146 | } hook_data_umode_changed; | |
147 | ||
148 | enum message_type { | |
149 | MESSAGE_TYPE_NOTICE, | |
150 | MESSAGE_TYPE_PRIVMSG, | |
151 | MESSAGE_TYPE_PART, | |
152 | MESSAGE_TYPE_COUNT | |
153 | }; | |
154 | ||
155 | typedef struct | |
156 | { | |
157 | enum message_type msgtype; | |
158 | struct Client *source_p; | |
159 | struct Channel *chptr; | |
160 | const char *text; | |
161 | int approved; | |
162 | } hook_data_privmsg_channel; | |
163 | ||
164 | typedef struct | |
165 | { | |
166 | enum message_type msgtype; | |
167 | struct Client *source_p; | |
168 | struct Client *target_p; | |
169 | const char *text; | |
170 | int approved; | |
171 | } hook_data_privmsg_user; | |
172 | ||
173 | typedef struct | |
174 | { | |
175 | bool signal; | |
176 | } hook_data_rehash; | |
177 | ||
178 | #endif |