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