]> jfr.im git - solanum.git/blob - include/hook.h
ircd: rework sendq limits a bit.
[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 * $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 extern int h_privmsg_channel;
34 extern int h_privmsg_user;
35 extern int h_conf_read_start;
36 extern int h_conf_read_end;
37
38 void init_hook(void);
39 int register_hook(const char *name);
40 void add_hook(const char *name, hookfn fn);
41 void remove_hook(const char *name, hookfn fn);
42 void call_hook(int id, void *arg);
43
44 typedef struct
45 {
46 struct Client *client;
47 const void *arg1;
48 const void *arg2;
49 } hook_data;
50
51 typedef struct
52 {
53 struct Client *client;
54 const void *arg1;
55 int arg2;
56 } hook_data_int;
57
58 typedef struct
59 {
60 struct Client *client;
61 struct Client *target;
62 struct Channel *chptr;
63 int approved;
64 } hook_data_client;
65
66 typedef struct
67 {
68 struct Client *client;
69 struct Channel *chptr;
70 int approved;
71 } hook_data_channel;
72
73 typedef struct
74 {
75 struct Client *client;
76 struct Channel *chptr;
77 char *key;
78 } hook_data_channel_activity;
79
80 typedef struct
81 {
82 struct Client *client;
83 struct Channel *chptr;
84 struct membership *msptr;
85 struct Client *target;
86 int approved;
87 int dir;
88 } hook_data_channel_approval;
89
90 typedef struct
91 {
92 struct Client *client;
93 struct Client *target;
94 int approved;
95 } hook_data_client_approval;
96
97 typedef struct
98 {
99 struct Client *local_link; /* local client originating this, or NULL */
100 struct Client *target; /* dying client */
101 struct Client *from; /* causing client (could be &me or target) */
102 const char *comment;
103 } hook_data_client_exit;
104
105 typedef struct
106 {
107 struct Client *client;
108 unsigned int oldumodes;
109 unsigned int oldsnomask;
110 } hook_data_umode_changed;
111
112 enum message_type {
113 MESSAGE_TYPE_NOTICE,
114 MESSAGE_TYPE_PRIVMSG,
115 MESSAGE_TYPE_PART,
116 MESSAGE_TYPE_COUNT
117 };
118
119 typedef struct
120 {
121 enum message_type msgtype;
122 struct Client *source_p;
123 struct Channel *chptr;
124 const char *text;
125 int approved;
126 } hook_data_privmsg_channel;
127
128 typedef struct
129 {
130 enum message_type msgtype;
131 struct Client *source_p;
132 struct Client *target_p;
133 const char *text;
134 int approved;
135 } hook_data_privmsg_user;
136
137 #endif