]> jfr.im git - solanum.git/blame_incremental - include/hook.h
ircd: fix up some iwarn() calls which referred to L_MAIN
[solanum.git] / include / hook.h
... / ...
CommitLineData
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
8typedef struct
9{
10 char *name;
11 rb_dlink_list hooks;
12} hook;
13
14typedef void (*hookfn) (void *data);
15
16extern int h_iosend_id;
17extern int h_iorecv_id;
18extern int h_iorecvctrl_id;
19
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;
30extern int h_can_kick;
31extern int h_privmsg_channel;
32extern int h_privmsg_user;
33extern int h_conf_read_start;
34extern int h_conf_read_end;
35extern int h_outbound_msgbuf;
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
43typedef struct
44{
45 struct Client *client;
46 void *arg1;
47 void *arg2;
48} hook_data;
49
50typedef struct
51{
52 struct Client *client;
53 const void *arg1;
54 const void *arg2;
55} hook_cdata;
56
57typedef struct
58{
59 struct Client *client;
60 const void *arg1;
61 int arg2;
62 int result;
63} hook_data_int;
64
65typedef struct
66{
67 struct Client *client;
68 struct Client *target;
69 struct Channel *chptr;
70 int approved;
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
87typedef 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
98typedef struct
99{
100 struct Client *client;
101 struct Client *target;
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
120enum message_type {
121 MESSAGE_TYPE_NOTICE,
122 MESSAGE_TYPE_PRIVMSG,
123 MESSAGE_TYPE_PART,
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
145#endif