From 9ac2eae1f0d663cb3b2fc05d6d37b07dcfd9025e Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sat, 5 Dec 2015 15:45:20 +0100 Subject: m_cap Learn the supported capability negotiation protocol of a client from CAP LS Let modules implementing caps query this information --- src/modules/m_cap.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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); -- cgit v1.2.3