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