]> jfr.im git - solanum.git/blame - include/hook.h
libratbox: implement rb_linebuf_putprefix() which joins a format string to a static...
[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;
ea2d2700 56 int result;
212380e3
AC
57} hook_data_int;
58
59typedef struct
60{
61 struct Client *client;
62 struct Client *target;
9e07c8f7
AC
63 struct Channel *chptr;
64 int approved;
212380e3
AC
65} hook_data_client;
66
67typedef struct
68{
69 struct Client *client;
70 struct Channel *chptr;
71 int approved;
72} hook_data_channel;
73
74typedef struct
75{
76 struct Client *client;
77 struct Channel *chptr;
78 char *key;
79} hook_data_channel_activity;
80
5f8d323c
AC
81typedef struct
82{
83 struct Client *client;
84 struct Channel *chptr;
6ca4dec9 85 struct membership *msptr;
5f8d323c
AC
86 struct Client *target;
87 int approved;
202d4966 88 int dir;
b870a5f8 89 const char *modestr;
5f8d323c
AC
90} hook_data_channel_approval;
91
212380e3
AC
92typedef struct
93{
94 struct Client *client;
9d745dbd 95 struct Client *target;
212380e3
AC
96 int approved;
97} hook_data_client_approval;
98
99typedef struct
100{
101 struct Client *local_link; /* local client originating this, or NULL */
102 struct Client *target; /* dying client */
103 struct Client *from; /* causing client (could be &me or target) */
104 const char *comment;
105} hook_data_client_exit;
106
107typedef struct
108{
109 struct Client *client;
110 unsigned int oldumodes;
111 unsigned int oldsnomask;
112} hook_data_umode_changed;
113
ca4c2a86
AC
114enum message_type {
115 MESSAGE_TYPE_NOTICE,
116 MESSAGE_TYPE_PRIVMSG,
62cf5b40 117 MESSAGE_TYPE_PART,
ca4c2a86
AC
118 MESSAGE_TYPE_COUNT
119};
120
121typedef struct
122{
123 enum message_type msgtype;
124 struct Client *source_p;
125 struct Channel *chptr;
126 const char *text;
127 int approved;
128} hook_data_privmsg_channel;
129
130typedef struct
131{
132 enum message_type msgtype;
133 struct Client *source_p;
134 struct Client *target_p;
135 const char *text;
136 int approved;
137} hook_data_privmsg_user;
138
212380e3 139#endif