]>
Commit | Line | Data |
---|---|---|
2c5db955 CP |
1 | /* hooks.h */ |
2 | ||
3 | #ifndef __HOOKS_H | |
4 | #define __HOOKS_H | |
5 | ||
5c86c36f CP |
6 | #include <limits.h> |
7 | ||
2c5db955 CP |
8 | #define HOOKMAX 5000 |
9 | ||
10 | /* This is the authoritative registry of all known hook numbers */ | |
11 | ||
f69c0032 | 12 | #define HOOK_CORE_REHASH 0 /* Argument is an int */ |
2c5db955 CP |
13 | #define HOOK_CORE_STATSREQUEST 1 |
14 | #define HOOK_CORE_STATSREPLY 2 | |
526e7c1d | 15 | #define HOOK_CORE_ENDOFHOOKSQUEUE 3 |
d931d0f7 | 16 | #define HOOK_CORE_STOPERROR 4 |
280505a5 | 17 | #define HOOK_CORE_ERROR 5 /* Argument is a struct error_event * */ |
b8e79109 | 18 | #define HOOK_CORE_SIGUSR1 6 |
efa44d15 | 19 | #define HOOK_CORE_SIGINT 7 |
2c5db955 | 20 | |
eb8dffd0 | 21 | #define HOOK_IRC_CONNECTED 100 /* Located in server.c now to fix burst bug */ |
2c5db955 | 22 | #define HOOK_IRC_DISCON 101 |
eb8dffd0 C |
23 | #define HOOK_IRC_SENDBURSTSERVERS 102 /* Located in server.c now to fix burst bug */ |
24 | #define HOOK_IRC_SENDBURSTNICKS 103 /* Located in server.c now to fix burst bug */ | |
25 | #define HOOK_IRC_SENDBURSTBURSTS 104 /* Located in server.c now to fix burst bug */ | |
e609eb1f | 26 | #define HOOK_IRC_PRE_DISCON 105 |
2c5db955 CP |
27 | |
28 | #define HOOK_SERVER_NEWSERVER 200 /* Argument is number of new server */ | |
29 | #define HOOK_SERVER_LOSTSERVER 201 /* Argument is number of lost server */ | |
e609eb1f CP |
30 | #define HOOK_SERVER_END_OF_BURST 202 |
31 | #define HOOK_SERVER_PRE_LOSTSERVER 203 /* Argument is number of lost server */ | |
b6049faf | 32 | #define HOOK_SERVER_LINKED 204 /* Argument is number of server */ |
2c5db955 CP |
33 | |
34 | #define HOOK_NICK_NEWNICK 300 /* Argument is nick* */ | |
2fdef282 | 35 | #define HOOK_NICK_RENAME 301 /* Argument is void*[2] (nick *, oldnick) */ |
2c5db955 | 36 | #define HOOK_NICK_LOSTNICK 302 /* Argument is nick* */ |
a7697869 | 37 | #define HOOK_NICK_WHOISCHANNELS 303 /* Argument is void*[3] (sender, target, sourcenum) */ |
2c5db955 CP |
38 | #define HOOK_NICK_ACCOUNT 304 /* Argument is nick* */ |
39 | #define HOOK_NICK_QUIT 305 /* Argument is void*[2] (nick, reason) */ | |
40 | #define HOOK_NICK_SETHOST 306 /* Argument is nick* */ | |
3e3692bf | 41 | #define HOOK_NICK_MODEOPER 307 /* Argument is void*[2] (nick, modes) */ |
acd438c7 | 42 | #define HOOK_NICK_KILL 308 /* Argument is void*[2] (nick, reason) */ |
6885ae9c | 43 | #define HOOK_NICK_MASKPRIVMSG 309 /* Argument is void*[3] (nick, target, message) ** NICK COULD BE NULL ** */ |
2c5db955 CP |
44 | |
45 | #define HOOK_CHANNEL_BURST 400 /* Argument is channel pointer */ | |
46 | #define HOOK_CHANNEL_CREATE 401 /* Argument is void*[2] (channel, nick) */ | |
47 | #define HOOK_CHANNEL_JOIN 402 /* Argument is void*[2] (channel, nick) */ | |
48 | #define HOOK_CHANNEL_PART 403 /* Argument is void*[3] (channel, nick, reason) */ | |
49 | #define HOOK_CHANNEL_KICK 404 /* Argument is void*[4] (channel, kicked, kicker, reason) ** KICKER COULD BE NULL ***/ | |
50 | #define HOOK_CHANNEL_TOPIC 405 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL ** */ | |
d968d1fe | 51 | #define HOOK_CHANNEL_MODECHANGE 406 /* Argument is void*[3] (channel, nick, flags, oldchanmodes) ** NICK COULD BE NULL ** */ |
2c5db955 CP |
52 | #define HOOK_CHANNEL_BANSET 407 /* Argument is void*[2] (channel, nick) ** NICK COULD BE NULL **, ban will be first ban on channel */ |
53 | #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? */ | |
54 | #define HOOK_CHANNEL_OPPED 409 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
55 | #define HOOK_CHANNEL_DEOPPED 410 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
56 | #define HOOK_CHANNEL_VOICED 411 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
57 | #define HOOK_CHANNEL_DEVOICED 412 /* Argument is void*[3] (channel, nick, target) ** NICK COULD BE NULL ** */ | |
58 | ||
59 | #define HOOK_CHANNEL_NEWCHANNEL 413 /* Argument is channel pointer */ | |
60 | #define HOOK_CHANNEL_LOSTCHANNEL 414 /* Argument is channel pointer */ | |
61 | ||
62 | #define HOOK_CHANNEL_NEWNICK 415 /* Argument is void*[2] (channel, nick) */ | |
63 | #define HOOK_CHANNEL_LOSTNICK 416 /* Argument is void*[2] (channel, nick) */ | |
64 | ||
8dabf9c9 | 65 | #define HOOK_CHANSERV_DBLOADED 500 /* No arg */ |
6e3ceea8 | 66 | /* 501 spare for now */ |
8dabf9c9 | 67 | #define HOOK_CHANSERV_RUNNING 502 /* No arg */ |
6e3ceea8 | 68 | |
d72584f9 | 69 | #define HOOK_CHANSERV_AUTH 503 /* Argument is void*[2] (nick *, lastauth) */ |
70 | #define HOOK_CHANSERV_PWCHANGE 504 /* Argument is nick * */ | |
71 | #define HOOK_CHANSERV_CHANLEVMOD 505 /* Argument is void*[3] (nick *, regchanuser *, oldflags) */ | |
72 | #define HOOK_CHANSERV_CHANLEVDUMP 506 /* Argument is nick * */ | |
73 | #define HOOK_CHANSERV_WHOIS 507 /* Argument is nick * */ | |
74 | #define HOOK_CHANSERV_WHOAMI 508 /* Argument is nick * */ | |
75 | #define HOOK_CHANSERV_CMD 509 /* Argument is nick * */ | |
76 | ||
3e3692bf CP |
77 | #define HOOK_CONTROL_REGISTERED 600 /* Argument is nick* */ |
78 | #define HOOK_CONTROL_WHOISREQUEST 601 /* Argument is nick* */ | |
79 | #define HOOK_CONTROL_WHOISREPLY 602 /* Argument is char* */ | |
80 | ||
444d2433 CP |
81 | #define HOOK_SHADOW_SERVER 701 /* Argument is char* */ |
82 | ||
92acf9ae | 83 | #define HOOK_AUTH_FLAGSUPDATED 801 /* Argument is void*[2] (authname*, u_int64_t*) */ |
04b12064 | 84 | #define HOOK_AUTH_LOSTAUTHNAME 802 /* Argument is authname* */ |
c4ffdb9b | 85 | |
83bccee3 | 86 | #define HOOK_TRUSTS_DB_CLOSED 900 /* No arg */ |
be2823bc | 87 | #define HOOK_TRUSTS_DB_LOADED 901 /* No arg */ |
9097ab05 CP |
88 | #define HOOK_TRUSTS_NEWNICK 902 /* Argument is void*[2] (nick*, long) */ |
89 | #define HOOK_TRUSTS_LOSTNICK 903 /* Argument is void*[2] (nick*, long) */ | |
2129448c CP |
90 | #define HOOK_TRUSTS_NEWGROUP 904 /* Argument is trustgroup* */ |
91 | #define HOOK_TRUSTS_LOSTGROUP 905 /* Argument is trustgroup* */ | |
82a316e7 CP |
92 | #define HOOK_TRUSTS_ADDGROUP 906 /* Argument is trustgroup* */ |
93 | #define HOOK_TRUSTS_DELGROUP 907 /* Argument is trustgroup* */ | |
94 | #define HOOK_TRUSTS_ADDHOST 908 /* Argument is trusthost* */ | |
95 | #define HOOK_TRUSTS_DELHOST 909 /* Argument is trusthost* */ | |
2ab0a1e7 CP |
96 | #define HOOK_TRUSTS_MODIFYGROUP 910 /* Argument is trustgroup* */ |
97 | #define HOOK_TRUSTS_LOSTHOST 911 /* Argument is trusthost* */ | |
be2823bc | 98 | |
39e9e93e CP |
99 | #define HOOK_SIGNONTRACKER_HAVETIME 1100 /* Argument is nick* */ |
100 | ||
5c86c36f CP |
101 | #define PRIORITY_DEFAULT 0 |
102 | ||
103 | #define PRIORITY_MAX LONG_MIN | |
104 | #define PRIORITY_MIN LONG_MAX | |
105 | ||
2c5db955 CP |
106 | typedef void (*HookCallback)(int, void *); |
107 | ||
a451a113 | 108 | extern unsigned int hookqueuelength; |
526e7c1d | 109 | |
2c5db955 CP |
110 | void inithooks(); |
111 | int registerhook(int hooknum, HookCallback callback); | |
112 | int deregisterhook(int hooknum, HookCallback callback); | |
113 | void triggerhook(int hooknum, void *arg); | |
5c86c36f | 114 | int registerpriorityhook(int hooknum, HookCallback callback, long priority); |
2c5db955 CP |
115 | |
116 | #endif |