]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add a vendor cap which rejects any attempts to enable it.
authorSadie Powell <sadie@witchery.services>
Tue, 28 Jan 2020 14:31:40 +0000 (14:31 +0000)
committerSadie Powell <sadie@witchery.services>
Tue, 28 Jan 2020 14:31:40 +0000 (14:31 +0000)
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

index f87b2083124d354f67efbc0b6d0b65ffed769e11..11c93c76a5fda27149cf754585f7d5d7a133eb30 100644 (file)
@@ -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)
        {
        }