]>
Commit | Line | Data |
---|---|---|
acdf71d9 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 | ||
acdf71d9 VY |
13 | static void h_can_join(hook_data_channel *); |
14 | ||
15 | mapi_hfn_list_av1 operonly_hfnlist[] = { | |
16 | { "can_join", (hookfn) h_can_join }, | |
17 | { NULL, NULL } | |
18 | }; | |
19 | ||
19716b9f | 20 | static unsigned int mymode; |
acdf71d9 VY |
21 | |
22 | /* This is a simple example of how to use dynamic channel modes. | |
23 | * Not tested enough yet, use at own risk. | |
24 | * -- dwr | |
25 | */ | |
26 | static int | |
27 | _modinit(void) | |
28 | { | |
19716b9f JT |
29 | mymode = cflag_add('O', chm_staff); |
30 | if (mymode == 0) | |
31 | return -1; | |
acdf71d9 VY |
32 | |
33 | return 0; | |
34 | } | |
35 | ||
36 | ||
acdf71d9 VY |
37 | static void |
38 | _moddeinit(void) | |
39 | { | |
19716b9f | 40 | cflag_orphan('O'); |
acdf71d9 VY |
41 | } |
42 | ||
43 | DECLARE_MODULE_AV1(chm_operonly, _modinit, _moddeinit, NULL, NULL, operonly_hfnlist, "$Revision$"); | |
44 | ||
45 | static void | |
46 | h_can_join(hook_data_channel *data) | |
47 | { | |
48 | struct Client *source_p = data->client; | |
49 | struct Channel *chptr = data->chptr; | |
50 | ||
19716b9f | 51 | if((chptr->mode.mode & mymode) && !IsOper(source_p)) { |
eb463ef3 | 52 | sendto_one_numeric(source_p, 520, "%s :Cannot join channel (+O) - you are not an IRC operator", chptr->chname); |
acdf71d9 VY |
53 | data->approved = ERR_CUSTOM; |
54 | } | |
55 | } | |
56 |