]> jfr.im git - irc/rqf/shadowircd.git/blob - include/hook.h
120fe7c26834913672a0b6d2ec48a8d60804a2fd
[irc/rqf/shadowircd.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 * $Id: hook.h 906 2006-02-21 02:25:43Z nenolod $
6 */
7 #ifndef INCLUDED_HOOK_H
8 #define INCLUDED_HOOK_H
9
10 typedef struct
11 {
12 char *name;
13 rb_dlink_list hooks;
14 } hook;
15
16 typedef void (*hookfn) (void *data);
17
18 extern int h_iosend_id;
19 extern int h_iorecv_id;
20 extern int h_iorecvctrl_id;
21
22 extern int h_burst_client;
23 extern int h_burst_channel;
24 extern int h_burst_finished;
25 extern int h_server_introduced;
26 extern int h_server_eob;
27 extern int h_client_exit;
28 extern int h_umode_changed;
29 extern int h_new_local_user;
30 extern int h_new_remote_user;
31 extern int h_introduce_client;
32 extern int h_can_kick;
33
34 void init_hook(void);
35 int register_hook(const char *name);
36 void add_hook(const char *name, hookfn fn);
37 void remove_hook(const char *name, hookfn fn);
38 void call_hook(int id, void *arg);
39
40 typedef struct
41 {
42 struct Client *client;
43 const void *arg1;
44 const void *arg2;
45 } hook_data;
46
47 typedef struct
48 {
49 struct Client *client;
50 const void *arg1;
51 int arg2;
52 } hook_data_int;
53
54 typedef struct
55 {
56 struct Client *client;
57 struct Client *target;
58 } hook_data_client;
59
60 typedef struct
61 {
62 struct Client *client;
63 struct Channel *chptr;
64 int approved;
65 } hook_data_channel;
66
67 typedef struct
68 {
69 struct Client *client;
70 struct Channel *chptr;
71 char *key;
72 } hook_data_channel_activity;
73
74 typedef struct
75 {
76 struct Client *client;
77 struct Channel *chptr;
78 struct Client *target;
79 int approved;
80 } hook_data_channel_approval;
81
82 typedef struct
83 {
84 struct Client *client;
85 int approved;
86 } hook_data_client_approval;
87
88 typedef struct
89 {
90 struct Client *local_link; /* local client originating this, or NULL */
91 struct Client *target; /* dying client */
92 struct Client *from; /* causing client (could be &me or target) */
93 const char *comment;
94 } hook_data_client_exit;
95
96 typedef struct
97 {
98 struct Client *client;
99 unsigned int oldumodes;
100 unsigned int oldsnomask;
101 } hook_data_umode_changed;
102
103 #endif