]>
Commit | Line | Data |
---|---|---|
6538a4cb VY |
1 | #include "stdinc.h" |
2 | #include "modules.h" | |
3 | #include "hook.h" | |
4 | #include "client.h" | |
5 | #include "ircd.h" | |
6 | #include "send.h" | |
7 | #include "s_conf.h" | |
8 | #include "s_user.h" | |
9 | #include "s_serv.h" | |
10 | #include "numeric.h" | |
11 | #include "chmode.h" | |
12 | ||
13 | static void h_can_join(hook_data_channel *); | |
14 | ||
15 | mapi_hfn_list_av1 adminonly_hfnlist[] = { | |
16 | { "can_join", (hookfn) h_can_join }, | |
17 | { NULL, NULL } | |
18 | }; | |
19 | ||
20 | static int | |
21 | _modinit(void) | |
22 | { | |
23 | chmode_table['A'].mode_type = find_cflag_slot(); | |
24 | chmode_table['A'].set_func = chm_staff; | |
25 | ||
26 | construct_noparam_modes(); | |
27 | ||
28 | return 0; | |
29 | } | |
30 | ||
31 | static void | |
32 | _moddeinit(void) | |
33 | { | |
34 | chmode_table['A'].mode_type = 0; | |
35 | ||
36 | construct_noparam_modes(); | |
37 | } | |
38 | ||
39 | DECLARE_MODULE_AV1(chm_adminonly, _modinit, _moddeinit, NULL, NULL, adminonly_hfnlist, "$Revision$"); | |
40 | ||
41 | static void | |
42 | h_can_join(hook_data_channel *data) | |
43 | { | |
44 | struct Client *source_p = data->client; | |
45 | struct Channel *chptr = data->chptr; | |
46 | ||
f1651c90 | 47 | if((chptr->mode.mode & chmode_flags['A']) && !IsAdmin(source_p)) { |
6538a4cb VY |
48 | sendto_one_numeric(source_p, 519, "%s :Cannot join channel (+A) - you are not an IRC server administrator", chptr->chname); |
49 | data->approved = ERR_CUSTOM; | |
50 | } | |
51 | } | |
52 |