diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-05 15:45:20 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-05 15:45:20 +0100 |
commit | 9ac2eae1f0d663cb3b2fc05d6d37b07dcfd9025e (patch) | |
tree | 904eb6cb6ece728486192a69cf48df325e659359 /src | |
parent | 3e08629e8342cfbd17388aa14facf3a3a963233f (diff) |
m_cap Learn the supported capability negotiation protocol of a client from CAP LS
Let modules implementing caps query this information
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cap.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 2b4055e3c..4411306ed 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -115,6 +115,16 @@ class Cap::ManagerImpl : public Cap::Manager return NULL; } + Protocol GetProtocol(LocalUser* user) const + { + return ((capext.get(user) & CAP_302_BIT) ? CAP_302 : CAP_LEGACY); + } + + void Set302Protocol(LocalUser* user) + { + capext.set(user, capext.get(user) | CAP_302_BIT); + } + bool HandleReq(LocalUser* user, const std::string& reqlist) { Ext usercaps = capext.get(user); @@ -211,6 +221,8 @@ class CommandCap : public SplitCommand else if ((subcommand == "LS") || (subcommand == "LIST")) { const bool is_ls = (subcommand.length() == 2); + if ((is_ls) && (parameters.size() > 1) && (parameters[1] == "302")) + manager.Set302Protocol(user); std::string result = subcommand + " :"; manager.HandleList(result, user, is_ls); |