]> jfr.im git - solanum.git/blob - include/hook.h
Resolve shfit/reduce conflict in timespec production (#54)
[solanum.git] / include / hook.h
1 /*
2 * Copyright (C) 2004-2005 Lee Hardy <lee -at- leeh.co.uk>
3 * Copyright (C) 2004-2005 ircd-ratbox development team
4 */
5 #ifndef INCLUDED_HOOK_H
6 #define INCLUDED_HOOK_H
7
8 typedef struct
9 {
10 char *name;
11 rb_dlink_list hooks;
12 } hook;
13
14 enum 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
24 typedef void (*hookfn) (void *data);
25
26 extern int h_iosend_id;
27 extern int h_iorecv_id;
28 extern int h_iorecvctrl_id;
29
30 extern int h_burst_client;
31 extern int h_burst_channel;
32 extern int h_burst_finished;
33 extern int h_server_introduced;
34 extern int h_server_eob;
35 extern int h_client_exit;
36 extern int h_after_client_exit;
37 extern int h_umode_changed;
38 extern int h_new_local_user;
39 extern int h_new_remote_user;
40 extern int h_introduce_client;
41 extern int h_can_kick;
42 extern int h_privmsg_channel;
43 extern int h_privmsg_user;
44 extern int h_conf_read_start;
45 extern int h_conf_read_end;
46 extern int h_outbound_msgbuf;
47 extern int h_rehash;
48 extern int h_cap_change;
49
50 void init_hook(void);
51 int register_hook(const char *name);
52 void add_hook(const char *name, hookfn fn);
53 void add_hook_prio(const char *name, hookfn fn, enum hook_priority priority);
54 void remove_hook(const char *name, hookfn fn);
55 void call_hook(int id, void *arg);
56
57 typedef struct
58 {
59 struct Client *client;
60 void *arg1;
61 void *arg2;
62 } hook_data;
63
64 typedef struct
65 {
66 struct Client *client;
67 const void *arg1;
68 const void *arg2;
69 } hook_cdata;
70
71 typedef struct
72 {
73 struct Client *client;
74 const void *arg1;
75 int arg2;
76 int result;
77 } hook_data_int;
78
79 typedef struct
80 {
81 struct Client *client;
82 struct Client *target;
83 } hook_data_client;
84
85 typedef struct
86 {
87 struct Client *client;
88 struct Channel *chptr;
89 int approved;
90 } hook_data_channel;
91
92 typedef struct
93 {
94 struct Client *client;
95 struct Channel *chptr;
96 const char *key;
97 } hook_data_channel_activity;
98
99 typedef struct
100 {
101 struct Client *client;
102 struct Channel *chptr;
103 struct membership *msptr;
104 struct Client *target;
105 int approved;
106 int dir;
107 const char *modestr;
108 const char *error;
109 } hook_data_channel_approval;
110
111 typedef struct
112 {
113 struct Client *client;
114 struct Client *target;
115 struct Channel *chptr;
116 struct membership *clientms;
117 struct membership *targetms;
118 int approved;
119 } hook_data_channel_visibility;
120
121 typedef struct
122 {
123 struct Client *client;
124 struct Client *target;
125 int approved;
126 } hook_data_client_approval;
127
128 typedef 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
136 typedef struct
137 {
138 struct Client *client;
139 const char *reason;
140 const char *orig_reason;
141 } hook_data_client_quit;
142
143 typedef struct
144 {
145 struct Client *client;
146 unsigned int oldumodes;
147 unsigned int oldsnomask;
148 } hook_data_umode_changed;
149
150 typedef struct
151 {
152 struct Client *client;
153 int oldcaps;
154 int add;
155 int del;
156 } hook_data_cap_change;
157
158 enum message_type {
159 MESSAGE_TYPE_NOTICE,
160 MESSAGE_TYPE_PRIVMSG,
161 MESSAGE_TYPE_PART,
162 MESSAGE_TYPE_COUNT
163 };
164
165 typedef 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
174 typedef 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
183 typedef struct
184 {
185 bool signal;
186 } hook_data_rehash;
187
188 #endif