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