]> jfr.im git - irc/quakenet/newserv.git/blob - core/hooks.h
merge
[irc/quakenet/newserv.git] / core / hooks.h
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
10 #define HOOK_CORE_REHASH 0
11 #define HOOK_CORE_STATSREQUEST 1
12 #define HOOK_CORE_STATSREPLY 2
13 #define HOOK_CORE_ENDOFHOOKSQUEUE 3
14
15 #define HOOK_IRC_CONNECTED 100
16 #define HOOK_IRC_DISCON 101
17 #define HOOK_IRC_SENDBURSTSERVERS 102
18 #define HOOK_IRC_SENDBURSTNICKS 103
19 #define HOOK_IRC_SENDBURSTBURSTS 104
20 #define HOOK_IRC_PRE_DISCON 105
21
22 #define HOOK_SERVER_NEWSERVER 200 /* Argument is number of new server */
23 #define HOOK_SERVER_LOSTSERVER 201 /* Argument is number of lost server */
24 #define HOOK_SERVER_END_OF_BURST 202
25 #define HOOK_SERVER_PRE_LOSTSERVER 203 /* Argument is number of lost server */
26
27 #define HOOK_NICK_NEWNICK 300 /* Argument is nick* */
28 #define HOOK_NICK_RENAME 301 /* Argument is nick* */
29 #define HOOK_NICK_LOSTNICK 302 /* Argument is nick* */
30 #define HOOK_NICK_WHOISCHANNELS 303 /* Argument is nick*[2] (sender, target) */
31 #define HOOK_NICK_ACCOUNT 304 /* Argument is nick* */
32 #define HOOK_NICK_QUIT 305 /* Argument is void*[2] (nick, reason) */
33 #define HOOK_NICK_SETHOST 306 /* Argument is nick* */
34 #define HOOK_NICK_MODEOPER 307 /* Argument is void*[2] (nick, modes) */
35
36 #define HOOK_CHANNEL_BURST 400 /* Argument is channel pointer */
37 #define HOOK_CHANNEL_CREATE 401 /* Argument is void*[2] (channel, nick) */
38 #define HOOK_CHANNEL_JOIN 402 /* Argument is void*[2] (channel, nick) */
39 #define HOOK_CHANNEL_PART 403 /* Argument is void*[3] (channel, nick, reason) */
40 #define HOOK_CHANNEL_KICK 404 /* Argument is void*[4] (channel, kicked, kicker, reason) ** KICKER COULD BE NULL ***/
41 #define HOOK_CHANNEL_TOPIC 405 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL ** */
42 #define HOOK_CHANNEL_MODECHANGE 406 /* Argument is void*[3] (channel, nick, flags) ** NICK COULD BE NULL ** */
43 #define HOOK_CHANNEL_BANSET 407 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL **, ban will be first ban on channel */
44 #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? */
45 #define HOOK_CHANNEL_OPPED 409 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */
46 #define HOOK_CHANNEL_DEOPPED 410 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */
47 #define HOOK_CHANNEL_VOICED 411 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */
48 #define HOOK_CHANNEL_DEVOICED 412 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */
49
50 #define HOOK_CHANNEL_NEWCHANNEL 413 /* Argument is channel pointer */
51 #define HOOK_CHANNEL_LOSTCHANNEL 414 /* Argument is channel pointer */
52
53 #define HOOK_CHANNEL_NEWNICK 415 /* Argument is void*[2] (channel, nick) */
54 #define HOOK_CHANNEL_LOSTNICK 416 /* Argument is void*[2] (channel, nick) */
55
56 #define HOOK_CHANSERV_DBLOADED 500 /* No arg */
57
58 #define HOOK_CONTROL_REGISTERED 600 /* Argument is nick* */
59 #define HOOK_CONTROL_WHOISREQUEST 601 /* Argument is nick* */
60 #define HOOK_CONTROL_WHOISREPLY 602 /* Argument is char* */
61
62 typedef void (*HookCallback)(int, void *);
63
64 unsigned int hookqueuelength;
65
66 void inithooks();
67 int registerhook(int hooknum, HookCallback callback);
68 int deregisterhook(int hooknum, HookCallback callback);
69 void triggerhook(int hooknum, void *arg);
70
71 #endif