aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_hidechans.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-07-17 00:06:50 +0100
committerGravatar Sadie Powell2024-07-17 00:06:50 +0100
commit889d521e05f2e922683d48c74eb00290e7a2f548 (patch)
treeb4c56bd4cdf0881601c7e4d6ff571e491af10bf4 /src/modules/m_hidechans.cpp
parentUse std::endian from C++20 in the sha1 module. (diff)
Shuffle the modules about a bit.
Diffstat (limited to 'src/modules/m_hidechans.cpp')
-rw-r--r--src/modules/m_hidechans.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp
deleted file mode 100644
index 36fbbaac8..000000000
--- a/src/modules/m_hidechans.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2018-2022, 2024 Sadie Powell <sadie@witchery.services>
- * Copyright (C) 2012, 2015 Attila Molnar <attilamolnar@hush.com>
- * Copyright (C) 2012 Robby <robby@chatbelgie.be>
- * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
- * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
- * Copyright (C) 2006, 2008 Robin Burchell <robin+git@viroteck.net>
- *
- * This file is part of InspIRCd. InspIRCd is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "inspircd.h"
-#include "modules/who.h"
-#include "modules/whois.h"
-
-/** Handles user mode +I
- */
-class HideChans final
- : public SimpleUserMode
-{
-public:
- HideChans(Module* Creator)
- : SimpleUserMode(Creator, "hidechans", 'I')
- {
- }
-};
-
-class ModuleHideChans final
- : public Module
- , public Who::VisibleEventListener
- , public Whois::LineEventListener
-{
-private:
- bool AffectsOpers;
- HideChans hm;
-
- ModResult ShouldHideChans(LocalUser* source, User* target)
- {
- if (source == target)
- return MOD_RES_PASSTHRU; // User is targeting themself.
-
- if (!target->IsModeSet(hm))
- return MOD_RES_PASSTHRU; // Mode not set on the target.
-
- if (!AffectsOpers && source->HasPrivPermission("users/auspex"))
- return MOD_RES_PASSTHRU; // Opers aren't exempt or the oper doesn't have the right priv.
-
- return MOD_RES_DENY;
- }
-
-public:
- ModuleHideChans()
- : Module(VF_VENDOR, "Adds user mode I (hidechans) which hides the channels users with it set are in from their /WHOIS response.")
- , Who::VisibleEventListener(this)
- , Whois::LineEventListener(this)
- , hm(this)
- {
- }
-
- void ReadConfig(ConfigStatus& status) override
- {
- AffectsOpers = ServerInstance->Config->ConfValue("hidechans")->getBool("affectsopers");
- }
-
- ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) override
- {
- return ShouldHideChans(source, memb->user);
- }
-
- ModResult OnWhoisLine(Whois::Context& whois, Numeric::Numeric& numeric) override
- {
- if (numeric.GetNumeric() != RPL_WHOISCHANNELS && numeric.GetNumeric() != RPL_CHANNELSMSG)
- return MOD_RES_PASSTHRU;
-
- return ShouldHideChans(whois.GetSource(), whois.GetTarget());
- }
-};
-
-MODULE_INIT(ModuleHideChans)