]> jfr.im git - irc/rqf/shadowircd.git/blame - extensions/no_oper_invis.c
Make sure default privset remains available, fixes various crashes
[irc/rqf/shadowircd.git] / extensions / no_oper_invis.c
CommitLineData
212380e3 1/*
2 * Deny opers setting themselves +i unless they are bots (i.e. have
3 * hidden_oper privilege).
4 * -- jilles
5 *
652b8478 6 * $Id: no_oper_invis.c 3219 2007-02-24 19:34:28Z jilles $
212380e3 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
18static void h_noi_umode_changed(hook_data_umode_changed *);
19
20mapi_hfn_list_av1 noi_hfnlist[] = {
21 { "umode_changed", (hookfn) h_noi_umode_changed },
22 { NULL, NULL }
23};
24
652b8478 25DECLARE_MODULE_AV1(no_oper_invis, NULL, NULL, NULL, NULL, noi_hfnlist, "$Revision: 3219 $");
212380e3 26
27static void
28h_noi_umode_changed(hook_data_umode_changed *hdata)
29{
30 struct Client *source_p = hdata->client;
31
32 if (MyClient(source_p) && IsOper(source_p) && !IsOperInvis(source_p) &&
33 IsInvisible(source_p))
34 {
35 ClearInvisible(source_p);
36 /* If they tried /umode +i, complain; do not complain
37 * if they opered up while invisible -- jilles */
38 if (hdata->oldumodes & UMODE_OPER)
39 sendto_one_notice(source_p, ":*** Opers may not set themselves invisible");
40 }
41}