summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-01-28 14:31:40 +0000
committerSadie Powell <sadie@witchery.services>2020-01-28 14:31:40 +0000
commit0256a41f6fe9d11baa6a894996c3ab4217f1296a (patch)
tree7017517519d360011b6b5435c30dfc53fad57be6
parent868dc21ffbf73921f24ba0c31708feb21556dae6 (diff)
Add a vendor cap which rejects any attempts to enable it.
This is similar to the oragono.io/nope capability only instead of killing the connection it just rejects the request. This should be less intrusive for users.
-rw-r--r--src/modules/m_cap.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index f87b20831..11c93c76a 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -449,13 +449,31 @@ class CommandCap : public SplitCommand
}
};
+class PoisonCap : public Cap::Capability
+{
+ public:
+ PoisonCap(Module* mod)
+ : Cap::Capability(mod, "inspircd.org/poison")
+ {
+ }
+
+ bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE
+ {
+ // Reject the attempt to enable this capability.
+ return false;
+ }
+};
+
class ModuleCap : public Module
{
+ private:
CommandCap cmd;
+ PoisonCap cap;
public:
ModuleCap()
: cmd(this)
+ , cap(this)
{
}