]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * Deny opers setting themselves +i unless they are bots (i.e. have | |
3 | * hidden_oper privilege). | |
4 | * -- jilles | |
212380e3 AC |
5 | */ |
6 | ||
7 | #include "stdinc.h" | |
8 | #include "modules.h" | |
9 | #include "client.h" | |
10 | #include "hook.h" | |
11 | #include "ircd.h" | |
12 | #include "send.h" | |
13 | #include "s_conf.h" | |
14 | #include "s_newconf.h" | |
15 | ||
3fd3d7e1 EM |
16 | static const char noi_desc[] = |
17 | "Disallow operators from setting user mode +i on themselves"; | |
18 | ||
82436efb | 19 | static void h_noi_umode_changed(void *); |
212380e3 AC |
20 | |
21 | mapi_hfn_list_av1 noi_hfnlist[] = { | |
82436efb | 22 | { "umode_changed", h_noi_umode_changed }, |
212380e3 AC |
23 | { NULL, NULL } |
24 | }; | |
25 | ||
3fd3d7e1 | 26 | DECLARE_MODULE_AV2(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc); |
212380e3 AC |
27 | |
28 | static void | |
82436efb | 29 | h_noi_umode_changed(void *data) |
212380e3 | 30 | { |
82436efb | 31 | hook_data_umode_changed *hdata = data; |
212380e3 AC |
32 | struct Client *source_p = hdata->client; |
33 | ||
34 | if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) && | |
35 | IsInvisible(source_p)) | |
36 | { | |
37 | ClearInvisible(source_p); | |
38 | /* If they tried /umode +i, complain; do not complain | |
39 | * if they opered up while invisible -- jilles */ | |
40 | if (hdata->oldumodes & UMODE_OPER) | |
41 | sendto_one_notice(source_p, ":*** Opers may not set themselves invisible"); | |
42 | } | |
43 | } |