diff options
author | Peter Powell <petpow@saberuk.com> | 2019-04-19 14:31:43 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-04-19 14:37:32 +0100 |
commit | b6935108cac7395565034db58d21b7a861133083 (patch) | |
tree | e6b7c4877d4a6d30c8054cfc177a955f86195344 /src | |
parent | 329cb421904698a020a7dd6df9fadbad88b6d411 (diff) |
Fall back to the most recent version supported on "CAP LS".
This ensures compliance with the behaviour specified in ircv3/ircv3-specifications#371.
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cap.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 922061757..6e3033bf2 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -407,13 +407,21 @@ class CommandCap : public SplitCommand } else if ((subcommand == "LS") || (subcommand == "LIST")) { + Cap::Protocol capversion = Cap::CAP_LEGACY; const bool is_ls = (subcommand.length() == 2); - if ((is_ls) && (parameters.size() > 1) && (parameters[1] == "302")) - manager.Set302Protocol(user); + if ((is_ls) && (parameters.size() > 1)) + { + unsigned int version = ConvToNum<unsigned int>(parameters[1]); + if (version >= 302) + { + capversion = Cap::CAP_302; + manager.Set302Protocol(user); + } + } std::string result; // Show values only if supports v3.2 and doing LS - manager.HandleList(result, user, is_ls, ((is_ls) && (manager.GetProtocol(user) != Cap::CAP_LEGACY))); + 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)) |