]>
Commit | Line | Data |
---|---|---|
2c5db955 CP |
1 | /* hooks.h */ |
2 | ||
3 | #ifndef __HOOKS_H | |
4 | #define __HOOKS_H | |
5 | ||
6 | #define HOOKMAX 5000 | |
7 | ||
8 | /* This is the authoritative registry of all known hook numbers */ | |
9 | ||
f69c0032 | 10 | #define HOOK_CORE_REHASH 0 /* Argument is an int */ |
2c5db955 CP |
11 | #define HOOK_CORE_STATSREQUEST 1 |
12 | #define HOOK_CORE_STATSREPLY 2 | |
526e7c1d | 13 | #define HOOK_CORE_ENDOFHOOKSQUEUE 3 |
d931d0f7 | 14 | #define HOOK_CORE_STOPERROR 4 |
280505a5 | 15 | #define HOOK_CORE_ERROR 5 /* Argument is a struct error_event * */ |
b8e79109 | 16 | #define HOOK_CORE_SIGUSR1 6 |
efa44d15 | 17 | #define HOOK_CORE_SIGINT 7 |
2c5db955 | 18 | |
eb8dffd0 | 19 | #define HOOK_IRC_CONNECTED 100 /* Located in server.c now to fix burst bug */ |
2c5db955 | 20 | #define HOOK_IRC_DISCON 101 |
eb8dffd0 C |
21 | #define HOOK_IRC_SENDBURSTSERVERS 102 /* Located in server.c now to fix burst bug */ |
22 | #define HOOK_IRC_SENDBURSTNICKS 103 /* Located in server.c now to fix burst bug */ | |
23 | #define HOOK_IRC_SENDBURSTBURSTS 104 /* Located in server.c now to fix burst bug */ | |
e609eb1f | 24 | #define HOOK_IRC_PRE_DISCON 105 |
2c5db955 CP |
25 | |
26 | #define HOOK_SERVER_NEWSERVER 200 /* Argument is number of new server */ | |
27 | #define HOOK_SERVER_LOSTSERVER 201 /* Argument is number of lost server */ | |
e609eb1f CP |
28 | #define HOOK_SERVER_END_OF_BURST 202 |
29 | #define HOOK_SERVER_PRE_LOSTSERVER 203 /* Argument is number of lost server */ | |
b6049faf | 30 | #define HOOK_SERVER_LINKED 204 /* Argument is number of server */ |
2c5db955 CP |
31 | |
32 | #define HOOK_NICK_NEWNICK 300 /* Argument is nick* */ | |
33 | #define HOOK_NICK_RENAME 301 /* Argument is nick* */ | |
34 | #define HOOK_NICK_LOSTNICK 302 /* Argument is nick* */ | |
35 | #define HOOK_NICK_WHOISCHANNELS 303 /* Argument is nick*[2] (sender, target) */ | |
36 | #define HOOK_NICK_ACCOUNT 304 /* Argument is nick* */ | |
37 | #define HOOK_NICK_QUIT 305 /* Argument is void*[2] (nick, reason) */ | |
38 | #define HOOK_NICK_SETHOST 306 /* Argument is nick* */ | |
3e3692bf | 39 | #define HOOK_NICK_MODEOPER 307 /* Argument is void*[2] (nick, modes) */ |
acd438c7 | 40 | #define HOOK_NICK_KILL 308 /* Argument is void*[2] (nick, reason) */ |
6885ae9c | 41 | #define HOOK_NICK_MASKPRIVMSG 309 /* Argument is void*[3] (nick, target, message) ** NICK COULD BE NULL ** */ |
2c5db955 CP |
42 | |
43 | #define HOOK_CHANNEL_BURST 400 /* Argument is channel pointer */ | |
44 | #define HOOK_CHANNEL_CREATE 401 /* Argument is void*[2] (channel, nick) */ | |
45 | #define HOOK_CHANNEL_JOIN 402 /* Argument is void*[2] (channel, nick) */ | |
46 | #define HOOK_CHANNEL_PART 403 /* Argument is void*[3] (channel, nick, reason) */ | |
47 | #define HOOK_CHANNEL_KICK 404 /* Argument is void*[4] (channel, kicked, kicker, reason) ** KICKER COULD BE NULL ***/ | |
48 | #define HOOK_CHANNEL_TOPIC 405 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL ** */ | |
49 | #define HOOK_CHANNEL_MODECHANGE 406 /* Argument is void*[3] (channel, nick, flags) ** NICK COULD BE NULL ** */ | |
50 | #define HOOK_CHANNEL_BANSET 407 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL **, ban will be first ban on channel */ | |
51 | #define HOOK_CHANNEL_BANCLEAR 408 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL **, ban will be gone. XXX - could we care what the ban was? */ | |
52 | #define HOOK_CHANNEL_OPPED 409 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
53 | #define HOOK_CHANNEL_DEOPPED 410 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
54 | #define HOOK_CHANNEL_VOICED 411 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
55 | #define HOOK_CHANNEL_DEVOICED 412 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
56 | ||
57 | #define HOOK_CHANNEL_NEWCHANNEL 413 /* Argument is channel pointer */ | |
58 | #define HOOK_CHANNEL_LOSTCHANNEL 414 /* Argument is channel pointer */ | |
59 | ||
60 | #define HOOK_CHANNEL_NEWNICK 415 /* Argument is void*[2] (channel, nick) */ | |
61 | #define HOOK_CHANNEL_LOSTNICK 416 /* Argument is void*[2] (channel, nick) */ | |
62 | ||
8dabf9c9 | 63 | #define HOOK_CHANSERV_DBLOADED 500 /* No arg */ |
6e3ceea8 | 64 | /* 501 spare for now */ |
8dabf9c9 | 65 | #define HOOK_CHANSERV_RUNNING 502 /* No arg */ |
6e3ceea8 | 66 | |
3e3692bf CP |
67 | #define HOOK_CONTROL_REGISTERED 600 /* Argument is nick* */ |
68 | #define HOOK_CONTROL_WHOISREQUEST 601 /* Argument is nick* */ | |
69 | #define HOOK_CONTROL_WHOISREPLY 602 /* Argument is char* */ | |
70 | ||
444d2433 CP |
71 | #define HOOK_SHADOW_SERVER 701 /* Argument is char* */ |
72 | ||
92acf9ae | 73 | #define HOOK_AUTH_FLAGSUPDATED 801 /* Argument is void*[2] (authname*, u_int64_t*) */ |
04b12064 | 74 | #define HOOK_AUTH_LOSTAUTHNAME 802 /* Argument is authname* */ |
c4ffdb9b | 75 | |
2c5db955 CP |
76 | typedef void (*HookCallback)(int, void *); |
77 | ||
a451a113 | 78 | extern unsigned int hookqueuelength; |
526e7c1d | 79 | |
2c5db955 CP |
80 | void inithooks(); |
81 | int registerhook(int hooknum, HookCallback callback); | |
82 | int deregisterhook(int hooknum, HookCallback callback); | |
83 | void triggerhook(int hooknum, void *arg); | |
84 | ||
85 | #endif |