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