]>
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; |
212380e3 AC |
36 | |
37 | void init_hook(void); | |
38 | int register_hook(const char *name); | |
39 | void add_hook(const char *name, hookfn fn); | |
40 | void remove_hook(const char *name, hookfn fn); | |
41 | void call_hook(int id, void *arg); | |
42 | ||
48a2b7c1 AC |
43 | typedef struct |
44 | { | |
45 | struct Client *client; | |
46 | void *arg1; | |
47 | void *arg2; | |
48 | } hook_data; | |
49 | ||
212380e3 AC |
50 | typedef struct |
51 | { | |
52 | struct Client *client; | |
53 | const void *arg1; | |
54 | const void *arg2; | |
48a2b7c1 | 55 | } hook_cdata; |
212380e3 AC |
56 | |
57 | typedef struct | |
58 | { | |
59 | struct Client *client; | |
60 | const void *arg1; | |
61 | int arg2; | |
ea2d2700 | 62 | int result; |
212380e3 AC |
63 | } hook_data_int; |
64 | ||
65 | typedef struct | |
66 | { | |
67 | struct Client *client; | |
68 | struct Client *target; | |
9e07c8f7 AC |
69 | struct Channel *chptr; |
70 | int approved; | |
212380e3 AC |
71 | } hook_data_client; |
72 | ||
73 | typedef struct | |
74 | { | |
75 | struct Client *client; | |
76 | struct Channel *chptr; | |
77 | int approved; | |
78 | } hook_data_channel; | |
79 | ||
80 | typedef struct | |
81 | { | |
82 | struct Client *client; | |
83 | struct Channel *chptr; | |
84 | char *key; | |
85 | } hook_data_channel_activity; | |
86 | ||
5f8d323c AC |
87 | typedef struct |
88 | { | |
89 | struct Client *client; | |
90 | struct Channel *chptr; | |
6ca4dec9 | 91 | struct membership *msptr; |
5f8d323c AC |
92 | struct Client *target; |
93 | int approved; | |
202d4966 | 94 | int dir; |
b870a5f8 | 95 | const char *modestr; |
5f8d323c AC |
96 | } hook_data_channel_approval; |
97 | ||
212380e3 AC |
98 | typedef struct |
99 | { | |
100 | struct Client *client; | |
9d745dbd | 101 | struct Client *target; |
212380e3 AC |
102 | int approved; |
103 | } hook_data_client_approval; | |
104 | ||
105 | typedef struct | |
106 | { | |
107 | struct Client *local_link; /* local client originating this, or NULL */ | |
108 | struct Client *target; /* dying client */ | |
109 | struct Client *from; /* causing client (could be &me or target) */ | |
110 | const char *comment; | |
111 | } hook_data_client_exit; | |
112 | ||
113 | typedef struct | |
114 | { | |
115 | struct Client *client; | |
116 | unsigned int oldumodes; | |
117 | unsigned int oldsnomask; | |
118 | } hook_data_umode_changed; | |
119 | ||
ca4c2a86 AC |
120 | enum message_type { |
121 | MESSAGE_TYPE_NOTICE, | |
122 | MESSAGE_TYPE_PRIVMSG, | |
62cf5b40 | 123 | MESSAGE_TYPE_PART, |
ca4c2a86 AC |
124 | MESSAGE_TYPE_COUNT |
125 | }; | |
126 | ||
127 | typedef struct | |
128 | { | |
129 | enum message_type msgtype; | |
130 | struct Client *source_p; | |
131 | struct Channel *chptr; | |
132 | const char *text; | |
133 | int approved; | |
134 | } hook_data_privmsg_channel; | |
135 | ||
136 | typedef struct | |
137 | { | |
138 | enum message_type msgtype; | |
139 | struct Client *source_p; | |
140 | struct Client *target_p; | |
141 | const char *text; | |
142 | int approved; | |
143 | } hook_data_privmsg_user; | |
144 | ||
212380e3 | 145 | #endif |