]> jfr.im git - solanum.git/blob - extensions/force_user_invis.c
Merge pull request #288 from edk0/umode-o-split
[solanum.git] / extensions / force_user_invis.c
1 /*
2 * Deny user to remove +i flag except they are irc operators
3 *
4 * Based off no_oper_invis.c by jilles
5 *
6 * Note that +i must be included in default_umodes
7 */
8
9 #include "stdinc.h"
10 #include "modules.h"
11 #include "client.h"
12 #include "hook.h"
13 #include "ircd.h"
14 #include "send.h"
15 #include "s_conf.h"
16 #include "s_newconf.h"
17
18 static const char noi_desc[] =
19 "Do not allow users to remove user mode +i unless they are operators";
20
21 static void h_noi_umode_changed(hook_data_umode_changed *);
22
23 mapi_hfn_list_av1 noi_hfnlist[] = {
24 { "umode_changed", (hookfn) h_noi_umode_changed },
25 { NULL, NULL }
26 };
27
28 DECLARE_MODULE_AV2(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
29
30 static void
31 h_noi_umode_changed(hook_data_umode_changed *hdata)
32 {
33 struct Client *source_p = hdata->client;
34
35 if (MyClient(source_p) && !IsOperGeneral(source_p) && !IsInvisible(source_p)) {
36 SetInvisible(source_p);
37 }
38 }