From 6dc16f7e8286c73c9961f503e74838e15d67a4db Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 25 Dec 2007 13:27:41 +0100 Subject: [PATCH] Add no_locops extension to disable LOCOPS (force everyone -l). --- extensions/Makefile.in | 1 + extensions/no_locops.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 extensions/no_locops.c diff --git a/extensions/Makefile.in b/extensions/Makefile.in index 4f97fb90..f9e75aa5 100644 --- a/extensions/Makefile.in +++ b/extensions/Makefile.in @@ -54,6 +54,7 @@ SRCS = \ m_omode.c \ m_opme.c \ m_webirc.c \ + no_locops.c \ no_oper_invis.c \ spy_admin_notice.c \ spy_info_notice.c \ diff --git a/extensions/no_locops.c b/extensions/no_locops.c new file mode 100644 index 00000000..e71b9249 --- /dev/null +++ b/extensions/no_locops.c @@ -0,0 +1,33 @@ +/* + * Disable LOCOPS (by disallowing any local user setting +l). + * -- jilles + */ + +#include "stdinc.h" +#include "modules.h" +#include "client.h" +#include "hook.h" +#include "ircd.h" +#include "send.h" +#include "s_conf.h" +#include "s_newconf.h" + +static void h_nl_umode_changed(hook_data_umode_changed *); + +mapi_hfn_list_av1 nl_hfnlist[] = { + { "umode_changed", (hookfn) h_nl_umode_changed }, + { NULL, NULL } +}; + +DECLARE_MODULE_AV1(no_locops, NULL, NULL, NULL, NULL, nl_hfnlist, "$Revision: 3219 $"); + +static void +h_nl_umode_changed(hook_data_umode_changed *hdata) +{ + struct Client *source_p = hdata->client; + + if (MyClient(source_p) && source_p->umodes & UMODE_LOCOPS) + { + source_p->umodes &= ~UMODE_LOCOPS; + } +}