diff options
| author | 2020-02-04 12:26:25 +0000 | |
|---|---|---|
| committer | 2020-02-04 12:26:25 +0000 | |
| commit | 6da4987073aad99061360bc54022e342e3a0f555 (patch) | |
| tree | d4e8cca5270013eed9915fe740f346cd6890a7c4 /src/modules/m_cap.cpp | |
| parent | Various CI improvements. (diff) | |
| parent | Include the ABI version with the incompatible module error message. (diff) | |
| download | inspircd++-6da4987073aad99061360bc54022e342e3a0f555.tar.gz inspircd++-6da4987073aad99061360bc54022e342e3a0f555.tar.bz2 inspircd++-6da4987073aad99061360bc54022e342e3a0f555.zip | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_cap.cpp')
| -rw-r--r-- | src/modules/m_cap.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index d9d2ebc5f..e42b93fad 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -1,7 +1,7 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services> + * Copyright (C) 2018-2020 Sadie Powell <sadie@witchery.services> * Copyright (C) 2015-2016, 2018 Attila Molnar <attilamolnar@hush.com> * * This file is part of InspIRCd. InspIRCd is free software: you can @@ -401,10 +401,8 @@ class CommandCap : public SplitCommand if (user->registered != REG_ALL) holdext.set(user, 1); - std::string subcommand(parameters[0].length(), ' '); - std::transform(parameters[0].begin(), parameters[0].end(), subcommand.begin(), ::toupper); - - if (subcommand == "REQ") + const std::string& subcommand = parameters[0]; + if (irc::equals(subcommand, "REQ")) { if (parameters.size() < 2) return CMD_FAILURE; @@ -412,11 +410,11 @@ class CommandCap : public SplitCommand const std::string replysubcmd = (manager.HandleReq(user, parameters[1]) ? "ACK" : "NAK"); DisplayResult2(user, replysubcmd, parameters[1]); } - else if (subcommand == "END") + else if (irc::equals(subcommand, "END")) { holdext.unset(user); } - else if ((subcommand == "LS") || (subcommand == "LIST")) + else if (irc::equals(subcommand, "LS") || irc::equals(subcommand, "LIST")) { Cap::Protocol capversion = Cap::CAP_LEGACY; const bool is_ls = (subcommand.length() == 2); @@ -435,7 +433,7 @@ class CommandCap : public SplitCommand manager.HandleList(result, user, is_ls, ((is_ls) && (capversion != Cap::CAP_LEGACY))); DisplayResult(user, subcommand, result); } - else if ((subcommand == "CLEAR") && (manager.GetProtocol(user) == Cap::CAP_LEGACY)) + else if (irc::equals(subcommand, "CLEAR") && (manager.GetProtocol(user) == Cap::CAP_LEGACY)) { std::string result; manager.HandleClear(user, result); @@ -451,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) 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) { } |
