]> jfr.im git - solanum.git/blame - include/hook.h
modules: add origin field to V2
[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
212380e3
AC
4 */
5#ifndef INCLUDED_HOOK_H
6#define INCLUDED_HOOK_H
7
8typedef struct
9{
10 char *name;
5b96d9a6 11 rb_dlink_list hooks;
212380e3
AC
12} hook;
13
14typedef void (*hookfn) (void *data);
15
2e819b6b
JT
16extern int h_iosend_id;
17extern int h_iorecv_id;
18extern int h_iorecvctrl_id;
212380e3 19
2e819b6b
JT
20extern int h_burst_client;
21extern int h_burst_channel;
22extern int h_burst_finished;
23extern int h_server_introduced;
24extern int h_server_eob;
25extern int h_client_exit;
26extern int h_umode_changed;
27extern int h_new_local_user;
28extern int h_new_remote_user;
29extern int h_introduce_client;
5f8d323c 30extern int h_can_kick;
ca4c2a86
AC
31extern int h_privmsg_channel;
32extern int h_privmsg_user;
7d603754
KB
33extern int h_conf_read_start;
34extern int h_conf_read_end;
4f8ababa 35extern int h_outbound_msgbuf;
212380e3
AC
36
37void init_hook(void);
38int register_hook(const char *name);
39void add_hook(const char *name, hookfn fn);
40void remove_hook(const char *name, hookfn fn);
41void call_hook(int id, void *arg);
42
48a2b7c1
AC
43typedef struct
44{
45 struct Client *client;
46 void *arg1;
47 void *arg2;
48} hook_data;
49
212380e3
AC
50typedef struct
51{
52 struct Client *client;
53 const void *arg1;
54 const void *arg2;
48a2b7c1 55} hook_cdata;
212380e3
AC
56
57typedef struct
58{
59 struct Client *client;
60 const void *arg1;
61 int arg2;
ea2d2700 62 int result;
212380e3
AC
63} hook_data_int;
64
65typedef struct
66{
67 struct Client *client;
68 struct Client *target;
9e07c8f7
AC
69 struct Channel *chptr;
70 int approved;
212380e3
AC
71} hook_data_client;
72
73typedef struct
74{
75 struct Client *client;
76 struct Channel *chptr;
77 int approved;
78} hook_data_channel;
79
80typedef struct
81{
82 struct Client *client;
83 struct Channel *chptr;
84 char *key;
85} hook_data_channel_activity;
86
5f8d323c
AC
87typedef struct
88{
89 struct Client *client;
90 struct Channel *chptr;
6ca4dec9 91 struct membership *msptr;
5f8d323c
AC
92 struct Client *target;
93 int approved;
202d4966 94 int dir;
b870a5f8 95 const char *modestr;
5f8d323c
AC
96} hook_data_channel_approval;
97
212380e3
AC
98typedef struct
99{
100 struct Client *client;
9d745dbd 101 struct Client *target;
212380e3
AC
102 int approved;
103} hook_data_client_approval;
104
105typedef 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
113typedef struct
114{
115 struct Client *client;
116 unsigned int oldumodes;
117 unsigned int oldsnomask;
118} hook_data_umode_changed;
119
ca4c2a86
AC
120enum message_type {
121 MESSAGE_TYPE_NOTICE,
122 MESSAGE_TYPE_PRIVMSG,
62cf5b40 123 MESSAGE_TYPE_PART,
ca4c2a86
AC
124 MESSAGE_TYPE_COUNT
125};
126
127typedef 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
136typedef 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
212380e3 145#endif