summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-01-13 00:05:17 +0000
committerSadie Powell <sadie@witchery.services>2021-01-13 00:05:17 +0000
commit56b4dc61e49e4218544f51ac9a25ab3ece60a782 (patch)
tree848614c30892f3205f7d9d4c586ddcedc6be91c9
parent0365daef5eb3b44c17f0320017cebf3af9984386 (diff)
Add a shun option to only apply when users are fully connected.
Closes #1825.
-rw-r--r--docs/conf/modules.conf.example4
-rw-r--r--src/modules/m_shun.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 1faec808c..0a85ef5ca 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -2185,6 +2185,9 @@
# option is deprecated; you should instead give exempt
# server operators the servers/ignore-shun privilege.
#
+# allowconnect: Whether to only apply shuns to users who are fully
+# connected to the server.
+#
# allowtags: Whether to allow client tags to be attached to enabled
# commands.
#
@@ -2201,6 +2204,7 @@
#<shun enabledcommands="ADMIN OPER PING PONG QUIT PART JOIN"
# cleanedcommands="AWAY PART QUIT"
# affectopers="no"
+# allowconnect="no"
# allowtags="no"
# notifyuser="yes">
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 1c64fd76c..d067d1523 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -156,11 +156,16 @@ class ModuleShun : public Module, public Stats::EventListener
insp::flat_set<std::string, irc::insensitive_swo> cleanedcommands;
insp::flat_set<std::string, irc::insensitive_swo> enabledcommands;
bool affectopers;
+ bool allowconnect;
bool allowtags;
bool notifyuser;
bool IsShunned(LocalUser* user)
{
+ // Exempt the user if they are not fully connected and allowconnect is enabled.
+ if (allowconnect && user->registered != REG_ALL)
+ return false;
+
// Exempt the user from shuns if they are an oper and affectopers is disabled.
if (!affectopers && user->IsOper())
return false;
@@ -222,6 +227,7 @@ class ModuleShun : public Module, public Stats::EventListener
affectopers = tag->getBool("affectopers", false);
allowtags = tag->getBool("allowtags");
+ allowconnect = tag->getBool("allowconnect");
notifyuser = tag->getBool("notifyuser", true);
}