]> jfr.im git - solanum.git/blame - extensions/force_user_invis.c
m_stats: z: remove unnecessary casting and fix format strings
[solanum.git] / extensions / force_user_invis.c
CommitLineData
30ae6c6f
JT
1/*
2 * Deny user to remove +i flag except they are irc operators
3 *
4 * Based off no_oper_invis.c by jilles
5 *
f9de2f89 6 * Note that +i must be included in default_umodes
30ae6c6f
JT
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
a278a4fc
EM
18static const char noi_desc[] =
19 "Do not allow users to remove user mode +i unless they are operators";
20
82436efb 21static void h_noi_umode_changed(void *);
30ae6c6f
JT
22
23mapi_hfn_list_av1 noi_hfnlist[] = {
82436efb 24 { "umode_changed", h_noi_umode_changed },
30ae6c6f
JT
25 { NULL, NULL }
26};
27
a278a4fc 28DECLARE_MODULE_AV2(force_user_invis, NULL, NULL, NULL, NULL, noi_hfnlist, NULL, NULL, noi_desc);
30ae6c6f
JT
29
30static void
82436efb 31h_noi_umode_changed(void *data)
30ae6c6f 32{
82436efb 33 hook_data_umode_changed *hdata = data;
30ae6c6f
JT
34 struct Client *source_p = hdata->client;
35
d4f7eb4c 36 if (MyClient(source_p) && !IsOperGeneral(source_p) && !IsInvisible(source_p)) {
30ae6c6f
JT
37 SetInvisible(source_p);
38 }
39}