]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
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; | |
5b96d9a6 | 13 | rb_dlink_list hooks; |
212380e3 AC |
14 | } hook; |
15 | ||
16 | typedef void (*hookfn) (void *data); | |
17 | ||
2e819b6b JT |
18 | extern int h_iosend_id; |
19 | extern int h_iorecv_id; | |
20 | extern int h_iorecvctrl_id; | |
212380e3 | 21 | |
2e819b6b JT |
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; | |
5f8d323c | 32 | extern int h_can_kick; |
ca4c2a86 AC |
33 | extern int h_privmsg_channel; |
34 | extern int h_privmsg_user; | |
212380e3 AC |
35 | |
36 | void init_hook(void); | |
37 | int register_hook(const char *name); | |
38 | void add_hook(const char *name, hookfn fn); | |
39 | void remove_hook(const char *name, hookfn fn); | |
40 | void call_hook(int id, void *arg); | |
41 | ||
42 | typedef struct | |
43 | { | |
44 | struct Client *client; | |
45 | const void *arg1; | |
46 | const void *arg2; | |
47 | } hook_data; | |
48 | ||
49 | typedef struct | |
50 | { | |
51 | struct Client *client; | |
52 | const void *arg1; | |
53 | int arg2; | |
54 | } hook_data_int; | |
55 | ||
56 | typedef struct | |
57 | { | |
58 | struct Client *client; | |
59 | struct Client *target; | |
60 | } hook_data_client; | |
61 | ||
62 | typedef struct | |
63 | { | |
64 | struct Client *client; | |
65 | struct Channel *chptr; | |
66 | int approved; | |
67 | } hook_data_channel; | |
68 | ||
69 | typedef struct | |
70 | { | |
71 | struct Client *client; | |
72 | struct Channel *chptr; | |
73 | char *key; | |
74 | } hook_data_channel_activity; | |
75 | ||
5f8d323c AC |
76 | typedef struct |
77 | { | |
78 | struct Client *client; | |
79 | struct Channel *chptr; | |
6ca4dec9 | 80 | struct membership *msptr; |
5f8d323c AC |
81 | struct Client *target; |
82 | int approved; | |
83 | } hook_data_channel_approval; | |
84 | ||
212380e3 AC |
85 | typedef struct |
86 | { | |
87 | struct Client *client; | |
88 | int approved; | |
89 | } hook_data_client_approval; | |
90 | ||
91 | typedef struct | |
92 | { | |
93 | struct Client *local_link; /* local client originating this, or NULL */ | |
94 | struct Client *target; /* dying client */ | |
95 | struct Client *from; /* causing client (could be &me or target) */ | |
96 | const char *comment; | |
97 | } hook_data_client_exit; | |
98 | ||
99 | typedef struct | |
100 | { | |
101 | struct Client *client; | |
102 | unsigned int oldumodes; | |
103 | unsigned int oldsnomask; | |
104 | } hook_data_umode_changed; | |
105 | ||
ca4c2a86 AC |
106 | enum message_type { |
107 | MESSAGE_TYPE_NOTICE, | |
108 | MESSAGE_TYPE_PRIVMSG, | |
109 | MESSAGE_TYPE_COUNT | |
110 | }; | |
111 | ||
112 | typedef struct | |
113 | { | |
114 | enum message_type msgtype; | |
115 | struct Client *source_p; | |
116 | struct Channel *chptr; | |
117 | const char *text; | |
118 | int approved; | |
119 | } hook_data_privmsg_channel; | |
120 | ||
121 | typedef struct | |
122 | { | |
123 | enum message_type msgtype; | |
124 | struct Client *source_p; | |
125 | struct Client *target_p; | |
126 | const char *text; | |
127 | int approved; | |
128 | } hook_data_privmsg_user; | |
129 | ||
212380e3 | 130 | #endif |