]> jfr.im git - solanum.git/blame - extensions/no_locops.c
hook_fn casts were hiding UB (#265)
[solanum.git] / extensions / no_locops.c
CommitLineData
6dc16f7e
JT
1/*
2 * Disable LOCOPS (by disallowing any local user setting +l).
3 * -- jilles
4 */
5
6#include "stdinc.h"
7#include "modules.h"
8#include "client.h"
9#include "hook.h"
10#include "ircd.h"
11#include "send.h"
12#include "s_conf.h"
13#include "s_newconf.h"
14
3fd3d7e1
EM
15static const char no_locops_desc[] = "Disables local operators";
16
82436efb 17static void h_nl_umode_changed(void *);
6dc16f7e
JT
18
19mapi_hfn_list_av1 nl_hfnlist[] = {
82436efb 20 { "umode_changed", h_nl_umode_changed },
6dc16f7e
JT
21 { NULL, NULL }
22};
23
3fd3d7e1 24DECLARE_MODULE_AV2(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, NULL, NULL, no_locops_desc);
6dc16f7e
JT
25
26static void
82436efb 27h_nl_umode_changed(void *data)
6dc16f7e 28{
82436efb 29 hook_data_umode_changed *hdata = data;
6dc16f7e
JT
30 struct Client *source_p = hdata->client;
31
32 if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS)
33 {
34 source_p->umodes &= ~UMODE_LOCOPS;
35 }
36}