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