]> jfr.im git - solanum.git/blob - include/hook.h
Revert "Implement the netsplit batch type."
[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 typedef void (*hookfn) (void *data);
15
16 extern int h_iosend_id;
17 extern int h_iorecv_id;
18 extern int h_iorecvctrl_id;
19
20 extern int h_burst_client;
21 extern int h_burst_channel;
22 extern int h_burst_finished;
23 extern int h_server_introduced;
24 extern int h_server_eob;
25 extern int h_client_exit;
26 extern int h_umode_changed;
27 extern int h_new_local_user;
28 extern int h_new_remote_user;
29 extern int h_introduce_client;
30 extern int h_can_kick;
31 extern int h_privmsg_channel;
32 extern int h_privmsg_user;
33 extern int h_conf_read_start;
34 extern int h_conf_read_end;
35 extern int h_outbound_msgbuf;
36 extern int h_rehash;
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 void *arg1;
48 void *arg2;
49 } hook_data;
50
51 typedef struct
52 {
53 struct Client *client;
54 const void *arg1;
55 const void *arg2;
56 } hook_cdata;
57
58 typedef struct
59 {
60 struct Client *client;
61 const void *arg1;
62 int arg2;
63 int result;
64 } hook_data_int;
65
66 typedef struct
67 {
68 struct Client *client;
69 struct Client *target;
70 struct Channel *chptr;
71 int approved;
72 } hook_data_client;
73
74 typedef struct
75 {
76 struct Client *client;
77 struct Channel *chptr;
78 int approved;
79 } hook_data_channel;
80
81 typedef struct
82 {
83 struct Client *client;
84 struct Channel *chptr;
85 char *key;
86 } hook_data_channel_activity;
87
88 typedef struct
89 {
90 struct Client *client;
91 struct Channel *chptr;
92 struct membership *msptr;
93 struct Client *target;
94 int approved;
95 int dir;
96 const char *modestr;
97 } hook_data_channel_approval;
98
99 typedef struct
100 {
101 struct Client *client;
102 struct Client *target;
103 int approved;
104 } hook_data_client_approval;
105
106 typedef struct
107 {
108 struct Client *local_link; /* local client originating this, or NULL */
109 struct Client *target; /* dying client */
110 struct Client *from; /* causing client (could be &me or target) */
111 const char *comment;
112 } hook_data_client_exit;
113
114 typedef struct
115 {
116 struct Client *client;
117 unsigned int oldumodes;
118 unsigned int oldsnomask;
119 } hook_data_umode_changed;
120
121 enum message_type {
122 MESSAGE_TYPE_NOTICE,
123 MESSAGE_TYPE_PRIVMSG,
124 MESSAGE_TYPE_PART,
125 MESSAGE_TYPE_COUNT
126 };
127
128 typedef struct
129 {
130 enum message_type msgtype;
131 struct Client *source_p;
132 struct Channel *chptr;
133 const char *text;
134 int approved;
135 } hook_data_privmsg_channel;
136
137 typedef struct
138 {
139 enum message_type msgtype;
140 struct Client *source_p;
141 struct Client *target_p;
142 const char *text;
143 int approved;
144 } hook_data_privmsg_user;
145
146 typedef struct
147 {
148 bool signal;
149 } hook_data_rehash;
150
151 #endif