From 0256a41f6fe9d11baa6a894996c3ab4217f1296a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 28 Jan 2020 14:31:40 +0000 Subject: 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. --- src/modules/m_cap.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/modules') 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) { } -- cgit v1.2.3