]>
Commit | Line | Data |
---|---|---|
e118f2d4 AC |
1 | /* |
2 | * Do not allow operators to be kicked from +M channels. | |
3 | * -- kaniini | |
4 | */ | |
5 | ||
6 | #include "stdinc.h" | |
7 | #include "modules.h" | |
8 | #include "hook.h" | |
9 | #include "client.h" | |
10 | #include "ircd.h" | |
11 | #include "send.h" | |
12 | #include "hash.h" | |
13 | #include "s_conf.h" | |
14 | #include "s_user.h" | |
15 | #include "s_serv.h" | |
16 | #include "numeric.h" | |
17 | #include "privilege.h" | |
18 | #include "s_newconf.h" | |
19 | #include "chmode.h" | |
20 | ||
21 | static void hdl_can_kick(hook_data_channel_approval *); | |
22 | ||
23 | mapi_hfn_list_av1 chm_operpeace_hfnlist[] = { | |
24 | { "can_kick", (hookfn) hdl_can_kick }, | |
25 | { NULL, NULL } | |
26 | }; | |
27 | ||
28 | static unsigned int mymode; | |
29 | ||
30 | static int | |
31 | _modinit(void) | |
32 | { | |
33 | mymode = cflag_add('M', chm_hidden); | |
34 | if (mymode == 0) | |
35 | return -1; | |
36 | ||
37 | return 0; | |
38 | } | |
39 | ||
40 | static void | |
41 | _moddeinit(void) | |
42 | { | |
43 | cflag_orphan('M'); | |
44 | } | |
45 | ||
46 | DECLARE_MODULE_AV1(chm_operpeace, _modinit, _moddeinit, NULL, NULL, chm_operpeace_hfnlist, "$Revision$"); | |
47 | ||
48 | static void | |
49 | hdl_can_kick(hook_data_channel_approval *data) | |
50 | { | |
51 | struct Client *source_p = data->client; | |
52 | struct Client *who = data->target; | |
53 | struct Channel *chptr = data->chptr; | |
54 | ||
55 | if(IsOper(source_p)) | |
56 | return; | |
57 | ||
58 | if((chptr->mode.mode & mymode) && IsOper(who)) | |
59 | { | |
60 | sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s attempted to kick %s from %s (which is +M)", | |
61 | source_p->name, who->name, chptr->chname); | |
62 | sendto_one_numeric(source_p, ERR_ISCHANSERVICE, "%s %s :Cannot kick IRC operators from that channel.", | |
63 | who->name, chptr->chname); | |
64 | data->approved = 0; | |
65 | } | |
66 | } |