]>
Commit | Line | Data |
---|---|---|
68022745 LM |
1 | /************************************************************************ |
2 | * IRC - Internet Relay Chat, include/hooks.h | |
3 | * Copyright (C) 2003 Lucas Madar | |
4 | * | |
5 | */ | |
6 | ||
7 | enum c_hooktype { | |
35755cff AW |
8 | CHOOK_10SEC, /* Called every 10 seconds or so -- |
9 | * not guaranteed to be 10 seconds * | |
10 | * Params: None | |
11 | * Returns void | |
12 | */ | |
13 | CHOOK_PREACCESS, /* Called before any access checks (dns, ident) | |
14 | * are done, acptr->ip is valid, | |
15 | * acptr->hostip is not "*" | |
16 | * Params: 1: (aClient *) | |
17 | * Returns int | |
18 | */ | |
19 | CHOOK_POSTACCESS, /* called after access checks are done | |
20 | * (right before client is put on network) | |
21 | * Params: 1: (aClient *) | |
22 | * Returns int | |
23 | */ | |
24 | CHOOK_POSTMOTD, /* called after MOTD is shown to the client | |
25 | * Params: 1: (aClient *) | |
26 | * Returns int | |
27 | */ | |
4fcf5df0 | 28 | |
35755cff AW |
29 | CHOOK_MSG, /* called for every privmsg or notice |
30 | * Params: 3: (aClient *, int isnotice, char *msgtext), | |
31 | * Returns int | |
32 | */ | |
33 | CHOOK_CHANMSG, /* called for every privmsg or notice to a channel | |
34 | * Params: 4: (aClient *source, aChannel *destination, | |
62832563 | 35 | * int isnotice, char *msgtxt) |
35755cff AW |
36 | * Returns int |
37 | */ | |
38 | CHOOK_USERMSG, /* called for every privmsg or notice to a user | |
39 | * Params: 4: (aClient *source, aClient *destination, | |
40 | * int isnotice, char *msgtxt) | |
41 | * Returns int | |
42 | */ | |
43 | CHOOK_MYMSG, /* called for every privmsg or notice to 'me.name' | |
44 | * Params: 3: (aClient *, int isnotice, char *msgtext) | |
45 | * Returns int | |
46 | */ | |
62832563 | 47 | CHOOK_JOIN, /* called for local JOINs |
48 | * Params: 1: (aClient *, aChannel *) | |
49 | * Returns int | |
50 | */ | |
51 | CHOOK_SENDBURST, /* called from m_server.c during netbursts | |
52 | * Params: 1: (aClient *) | |
53 | * Returns void | |
54 | */ | |
55 | CHOOK_THROTTLE, /* called from channel.c during throttle warnings | |
56 | * Params: 3: (aClient *source, aChannel *channel, | |
57 | * int type, int jnum, int jtime) | |
58 | * Returns void | |
59 | */ | |
60 | CHOOK_FORBID, /* called from m_nick.c and channel.c when a user is | |
61 | * attempting to use a forbidden nick or join a forbidden | |
62 | * channel | |
63 | * Params: 3: (aClient *source, char *name, | |
64 | * struct simBan *ban) | |
65 | * Returns void | |
66 | */ | |
0d79931d KS |
67 | CHOOK_WHOIS, /* called from s_user.c when a user is |
68 | * doing a /whois | |
69 | * Params: 2: (aClient *source, aClient *target) | |
70 | * Returns int | |
71 | */ | |
72 | CHOOK_MASKHOST, /* called from s_user.c when in order to | |
73 | * mask a user host/IP | |
74 | * Params: 3: (char *orghost, char **newhost, int type) | |
75 | * Returns int | |
76 | */ | |
35755cff AW |
77 | CHOOK_SIGNOFF, /* called on client exit (exit_client) |
78 | * Params: 1: (aClient *) | |
79 | * Returns void */ | |
4fcf5df0 LM |
80 | MHOOK_LOAD, /* Called for modules loading and unloading */ |
81 | MHOOK_UNLOAD /* Params: 2: (char *modulename, void *moduleopaque) */ | |
68022745 LM |
82 | }; |
83 | ||
84 | extern int call_hooks(enum c_hooktype hooktype, ...); | |
4e3a6506 LM |
85 | extern int init_modules(); |
86 | ||
868e1a2a | 87 | #define MODULE_INTERFACE_VERSION 1009 /* the interface version (hooks, modules.c commands, etc) */ |
68022745 LM |
88 | |
89 | #ifdef BIRCMODULE | |
90 | extern void *bircmodule_add_hook(enum c_hooktype, void *, void *); | |
91 | extern void bircmodule_del_hook(); | |
92 | extern int bircmodule_malloc(int); | |
2c7a708c | 93 | extern void bircmodule_free(void *); |
68022745 | 94 | #endif |
0d79931d KS |
95 | |
96 | #define UHM_SUCCESS 1 | |
97 | #define UHM_SOFT_FAILURE 0 | |
98 | #define UHM_HARD_FAILURE FLUSH_BUFFER |