summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-03-29 12:06:06 +0100
committerSadie Powell <sadie@witchery.services>2020-03-29 12:08:19 +0100
commit3f3da905b9bce3b180208ed3e6547f8579779b28 (patch)
treec0689339ca65c1114f8433d6ce4eda2e28444de5
parent92732be632831cbb0751a5f2ad3d89e9bf87b2dd (diff)
Add support for the servers/ignore-shun privilege.
-rw-r--r--docs/conf/opers.conf.example1
-rw-r--r--src/modules/m_shun.cpp18
2 files changed, 7 insertions, 12 deletions
diff --git a/docs/conf/opers.conf.example b/docs/conf/opers.conf.example
index 7cad2589c..67801ce31 100644
--- a/docs/conf/opers.conf.example
+++ b/docs/conf/opers.conf.example
@@ -38,6 +38,7 @@
# - users/ignore-noctcp: allows opers with this priv to send a CTCP to a +T user.
# - users/ignore-privdeaf: allows opers with this priv to message users with +D set.
# - users/sajoin-others: allows opers with this priv to /SAJOIN users other than themselves.
+ # - servers/ignore-shun: allows opers with this priv to ignore shuns.
# - servers/use-disabled-commands: allows opers with this priv to use disabled commands.
# - servers/use-disabled-modes: allows opers with this priv to use disabled modes.
#
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 6eaa6b47c..e75f18770 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -212,19 +212,13 @@ class ModuleShun : public Module, public Stats::EventListener
if (validated)
return MOD_RES_PASSTHRU;
- if (!ServerInstance->XLines->MatchesLine("SHUN", user))
- {
- /* Not shunned, don't touch. */
- return MOD_RES_PASSTHRU;
- }
-
- if (!affectopers && user->IsOper())
- {
- /* Don't do anything if the user is an operator and affectopers isn't set */
- return MOD_RES_PASSTHRU;
- }
+ // Exempt the user from shuns if:
+ // (1) They are an oper and affectopers is disabled.
+ // (2) They have the servers/ignore-shun privilege.
+ if ((!affectopers && user->IsOper()) || user->HasPrivPermission("servers/ignore-shun"))
+ return MOD_RES_PASSTHRU;
- if (!ShunEnabledCommands.count(command))
+ if (ServerInstance->XLines->MatchesLine("SHUN", user) && !ShunEnabledCommands.count(command))
{
if (NotifyOfShun)
user->WriteNotice("*** Command " + command + " not processed, as you have been blocked from issuing commands (SHUN)");