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