]>
Commit | Line | Data |
---|---|---|
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 "numeric.h" | |
8 | #include "s_user.h" | |
9 | #include "s_conf.h" | |
10 | ||
11 | static const char override_kick_immunity_desc[] = | |
12 | "Prevents +p users (oper override) from being kicked from any channel"; | |
13 | ||
14 | static void can_kick(void *data); | |
15 | ||
16 | mapi_hfn_list_av1 override_kick_immunity_hfnlist[] = { | |
17 | { "can_kick", can_kick, HOOK_HIGHEST }, | |
18 | { NULL, NULL } | |
19 | }; | |
20 | ||
21 | static void | |
22 | can_kick(void *vdata) | |
23 | { | |
24 | hook_data_channel_approval *data = vdata; | |
25 | ||
26 | if (data->target->umodes & user_modes['p']) | |
27 | { | |
28 | if (data->client->umodes & user_modes['p']) | |
29 | { | |
30 | /* Using oper-override to kick an oper | |
31 | * who's also using oper-override, better | |
32 | * report what happened. | |
33 | */ | |
34 | sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (KICK %s)", | |
35 | get_oper_name(data->client), data->chptr->chname, data->target->name); | |
36 | } | |
37 | else | |
38 | { | |
39 | /* Like cmode +M, let's report any attempt | |
40 | * to kick the immune oper. | |
41 | */ | |
42 | sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s attempted to kick %s from %s (who is +p)", | |
43 | data->client->name, data->target->name, data->chptr->chname); | |
44 | sendto_one_numeric(data->client, ERR_ISCHANSERVICE, "%s %s :Cannot kick immune IRC operators.", | |
45 | data->target->name, data->chptr->chname); | |
46 | data->approved = 0; | |
47 | } | |
48 | return; | |
49 | } | |
50 | } | |
51 | ||
52 | DECLARE_MODULE_AV2(override_kick_immunity, NULL, NULL, NULL, NULL, | |
53 | override_kick_immunity_hfnlist, NULL, NULL, override_kick_immunity_desc); |