]> jfr.im git - solanum.git/blame - include/hook.h
Remove missed Winsock2 check
[solanum.git] / include / hook.h
CommitLineData
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
8typedef struct
9{
10 char *name;
5b96d9a6 11 rb_dlink_list hooks;
212380e3
AC
12} hook;
13
91b12782
EK
14enum 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
24typedef void (*hookfn) (void *data);
25
2e819b6b
JT
26extern int h_iosend_id;
27extern int h_iorecv_id;
28extern int h_iorecvctrl_id;
212380e3 29
2e819b6b
JT
30extern int h_burst_client;
31extern int h_burst_channel;
32extern int h_burst_finished;
33extern int h_server_introduced;
34extern int h_server_eob;
35extern int h_client_exit;
15b05f95 36extern int h_after_client_exit;
2e819b6b
JT
37extern int h_umode_changed;
38extern int h_new_local_user;
39extern int h_new_remote_user;
40extern int h_introduce_client;
5f8d323c 41extern int h_can_kick;
ca4c2a86
AC
42extern int h_privmsg_channel;
43extern int h_privmsg_user;
7d603754
KB
44extern int h_conf_read_start;
45extern int h_conf_read_end;
4f8ababa 46extern int h_outbound_msgbuf;
2575a78b 47extern int h_rehash;
8aadf0ce 48extern int h_priv_change;
71f10f83 49extern int h_cap_change;
212380e3
AC
50
51void init_hook(void);
52int register_hook(const char *name);
53void add_hook(const char *name, hookfn fn);
91b12782 54void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority);
212380e3
AC
55void remove_hook(const char *name, hookfn fn);
56void call_hook(int id, void *arg);
57
48a2b7c1
AC
58typedef struct
59{
60 struct Client *client;
61 void *arg1;
62 void *arg2;
63} hook_data;
64
212380e3
AC
65typedef struct
66{
67 struct Client *client;
68 const void *arg1;
69 const void *arg2;
48a2b7c1 70} hook_cdata;
212380e3
AC
71
72typedef struct
73{
74 struct Client *client;
75 const void *arg1;
76 int arg2;
ea2d2700 77 int result;
212380e3
AC
78} hook_data_int;
79
80typedef struct
81{
82 struct Client *client;
83 struct Client *target;
84} hook_data_client;
85
86typedef struct
87{
88 struct Client *client;
89 struct Channel *chptr;
90 int approved;
91} hook_data_channel;
92
93typedef 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
100typedef 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
5e413b13
EK
112typedef struct
113{
114 struct Client *client;
e8a8d7a4 115 struct Client *target;
5e413b13
EK
116 struct Channel *chptr;
117 struct membership *clientms;
e8a8d7a4 118 struct membership *targetms;
5e413b13
EK
119 int approved;
120} hook_data_channel_visibility;
121
212380e3
AC
122typedef struct
123{
124 struct Client *client;
9d745dbd 125 struct Client *target;
212380e3
AC
126 int approved;
127} hook_data_client_approval;
128
129typedef struct
130{
131 struct Client *local_link; /* local client originating this, or NULL */
132 struct Client *target; /* dying client */
133 struct Client *from; /* causing client (could be &me or target) */
134 const char *comment;
135} hook_data_client_exit;
136
260fc2cc
EK
137typedef struct
138{
139 struct Client *client;
140 const char *reason;
141 const char *orig_reason;
142} hook_data_client_quit;
143
212380e3
AC
144typedef struct
145{
146 struct Client *client;
147 unsigned int oldumodes;
148 unsigned int oldsnomask;
149} hook_data_umode_changed;
150
71f10f83
EK
151typedef struct
152{
153 struct Client *client;
154 int oldcaps;
155 int add;
156 int del;
157} hook_data_cap_change;
158
ca4c2a86
AC
159enum message_type {
160 MESSAGE_TYPE_NOTICE,
161 MESSAGE_TYPE_PRIVMSG,
62cf5b40 162 MESSAGE_TYPE_PART,
ca4c2a86
AC
163 MESSAGE_TYPE_COUNT
164};
165
166typedef struct
167{
168 enum message_type msgtype;
169 struct Client *source_p;
170 struct Channel *chptr;
171 const char *text;
172 int approved;
173} hook_data_privmsg_channel;
174
175typedef struct
176{
177 enum message_type msgtype;
178 struct Client *source_p;
179 struct Client *target_p;
180 const char *text;
181 int approved;
182} hook_data_privmsg_user;
183
8aadf0ce
EK
184typedef struct
185{
186 struct Client *client;
187 struct PrivilegeSet *old;
188 struct PrivilegeSet *new;
189 const struct PrivilegeSet *added;
190 const struct PrivilegeSet *removed;
191 const struct PrivilegeSet *unchanged;
192} hook_data_priv_change;
193
2575a78b
EM
194typedef struct
195{
196 bool signal;
197} hook_data_rehash;
198
212380e3 199#endif