]> jfr.im git - solanum.git/blame - include/hook.h
wsproc: call rb_clear_cloexec on child fds
[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;
71f10f83 48extern int h_cap_change;
212380e3
AC
49
50void init_hook(void);
51int register_hook(const char *name);
52void add_hook(const char *name, hookfn fn);
91b12782 53void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority);
212380e3
AC
54void remove_hook(const char *name, hookfn fn);
55void call_hook(int id, void *arg);
56
48a2b7c1
AC
57typedef struct
58{
59 struct Client *client;
60 void *arg1;
61 void *arg2;
62} hook_data;
63
212380e3
AC
64typedef struct
65{
66 struct Client *client;
67 const void *arg1;
68 const void *arg2;
48a2b7c1 69} hook_cdata;
212380e3
AC
70
71typedef struct
72{
73 struct Client *client;
74 const void *arg1;
75 int arg2;
ea2d2700 76 int result;
212380e3
AC
77} hook_data_int;
78
79typedef struct
80{
81 struct Client *client;
82 struct Client *target;
83} hook_data_client;
84
85typedef struct
86{
87 struct Client *client;
88 struct Channel *chptr;
89 int approved;
90} hook_data_channel;
91
92typedef struct
93{
94 struct Client *client;
95 struct Channel *chptr;
5bc95eaf 96 const char *key;
212380e3
AC
97} hook_data_channel_activity;
98
5f8d323c
AC
99typedef struct
100{
101 struct Client *client;
102 struct Channel *chptr;
6ca4dec9 103 struct membership *msptr;
5f8d323c
AC
104 struct Client *target;
105 int approved;
202d4966 106 int dir;
b870a5f8 107 const char *modestr;
e0622d75 108 const char *error;
5f8d323c
AC
109} hook_data_channel_approval;
110
5e413b13
EK
111typedef struct
112{
113 struct Client *client;
e8a8d7a4 114 struct Client *target;
5e413b13
EK
115 struct Channel *chptr;
116 struct membership *clientms;
e8a8d7a4 117 struct membership *targetms;
5e413b13
EK
118 int approved;
119} hook_data_channel_visibility;
120
212380e3
AC
121typedef struct
122{
123 struct Client *client;
9d745dbd 124 struct Client *target;
212380e3
AC
125 int approved;
126} hook_data_client_approval;
127
128typedef struct
129{
130 struct Client *local_link; /* local client originating this, or NULL */
131 struct Client *target; /* dying client */
132 struct Client *from; /* causing client (could be &me or target) */
133 const char *comment;
134} hook_data_client_exit;
135
260fc2cc
EK
136typedef struct
137{
138 struct Client *client;
139 const char *reason;
140 const char *orig_reason;
141} hook_data_client_quit;
142
212380e3
AC
143typedef struct
144{
145 struct Client *client;
146 unsigned int oldumodes;
147 unsigned int oldsnomask;
148} hook_data_umode_changed;
149
71f10f83
EK
150typedef struct
151{
152 struct Client *client;
153 int oldcaps;
154 int add;
155 int del;
156} hook_data_cap_change;
157
ca4c2a86
AC
158enum message_type {
159 MESSAGE_TYPE_NOTICE,
160 MESSAGE_TYPE_PRIVMSG,
62cf5b40 161 MESSAGE_TYPE_PART,
ca4c2a86
AC
162 MESSAGE_TYPE_COUNT
163};
164
165typedef struct
166{
167 enum message_type msgtype;
168 struct Client *source_p;
169 struct Channel *chptr;
170 const char *text;
171 int approved;
172} hook_data_privmsg_channel;
173
174typedef struct
175{
176 enum message_type msgtype;
177 struct Client *source_p;
178 struct Client *target_p;
179 const char *text;
180 int approved;
181} hook_data_privmsg_user;
182
2575a78b
EM
183typedef struct
184{
185 bool signal;
186} hook_data_rehash;
187
212380e3 188#endif