]> jfr.im git - solanum.git/blame_incremental - include/hook.h
Merge pull request #196 from jevolk/master
[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;
36extern int h_rehash;
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 void *arg1;
48 void *arg2;
49} hook_data;
50
51typedef struct
52{
53 struct Client *client;
54 const void *arg1;
55 const void *arg2;
56} hook_cdata;
57
58typedef struct
59{
60 struct Client *client;
61 const void *arg1;
62 int arg2;
63 int result;
64} hook_data_int;
65
66typedef struct
67{
68 struct Client *client;
69 struct Client *target;
70 struct Channel *chptr;
71 int approved;
72} hook_data_client;
73
74typedef struct
75{
76 struct Client *client;
77 struct Channel *chptr;
78 int approved;
79} hook_data_channel;
80
81typedef struct
82{
83 struct Client *client;
84 struct Channel *chptr;
85 char *key;
86} hook_data_channel_activity;
87
88typedef struct
89{
90 struct Client *client;
91 struct Channel *chptr;
92 struct membership *msptr;
93 struct Client *target;
94 int approved;
95 int dir;
96 const char *modestr;
97} hook_data_channel_approval;
98
99typedef struct
100{
101 struct Client *client;
102 struct Client *target;
103 int approved;
104} hook_data_client_approval;
105
106typedef struct
107{
108 struct Client *local_link; /* local client originating this, or NULL */
109 struct Client *target; /* dying client */
110 struct Client *from; /* causing client (could be &me or target) */
111 const char *comment;
112} hook_data_client_exit;
113
114typedef struct
115{
116 struct Client *client;
117 unsigned int oldumodes;
118 unsigned int oldsnomask;
119} hook_data_umode_changed;
120
121enum message_type {
122 MESSAGE_TYPE_NOTICE,
123 MESSAGE_TYPE_PRIVMSG,
124 MESSAGE_TYPE_PART,
125 MESSAGE_TYPE_COUNT
126};
127
128typedef struct
129{
130 enum message_type msgtype;
131 struct Client *source_p;
132 struct Channel *chptr;
133 const char *text;
134 int approved;
135} hook_data_privmsg_channel;
136
137typedef struct
138{
139 enum message_type msgtype;
140 struct Client *source_p;
141 struct Client *target_p;
142 const char *text;
143 int approved;
144} hook_data_privmsg_user;
145
146typedef struct
147{
148 bool signal;
149} hook_data_rehash;
150
151#endif