From d73933156a99ac512f38e5cb203b8735d6e9eec8 Mon Sep 17 00:00:00 2001 From: psychon Date: Sun, 13 Jun 2010 07:46:57 +0000 Subject: [PATCH] Add support for some capabilities multi-prefix is just NAMESX' CAP name and userhost-in-names is just UHNAMES for CAP. This makes it pretty easy to make them work. :) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2024 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/Client.cpp b/Client.cpp index 3423f170..536cf132 100644 --- a/Client.cpp +++ b/Client.cpp @@ -788,15 +788,43 @@ void CClient::HandleCap(const CString& sLine) CString sSubCmd = sLine.Token(1); if (sSubCmd.Equals("LS")) { - RespondCap("LS :"); + RespondCap("LS :userhost-in-names multi-prefix"); m_bInCap = true; } else if (sSubCmd.Equals("END")) { m_bInCap = false; AuthUser(); } else if (sSubCmd.Equals("REQ")) { - // No capabilities supported for now - RespondCap("NAK :" + sLine.Token(2, true).TrimPrefix_n(":")); + bool bReqUHNames = false; + bool bReqNamesx = false; + + VCString vsTokens; + VCString::iterator it; + sLine.Token(2).TrimPrefix_n(":").Split(" ", vsTokens, false); + + for (it = vsTokens.begin(); it != vsTokens.end(); ++it) { + if (*it == "multi-prefix") { + bReqNamesx = true; + } else if (*it == "userhost-in-names") { + bReqUHNames = true; + } else { + // Some unsupported capability is requested + RespondCap("NAK :" + sLine.Token(2, true).TrimPrefix_n(":")); + return; + } + } + + // All is fine, we support what was requested + RespondCap("ACK :" + sLine.Token(2, true).TrimPrefix_n(":")); + if (bReqUHNames) + m_bUHNames = true; + if (bReqNamesx) + m_bNamesx = true; } else if (sSubCmd.Equals("LIST")) { - RespondCap("LIST :"); + CString sList = ""; + if (m_bNamesx) + sList += "multi-prefix "; + if (m_bUHNames) + sList += "userhost-in-names "; + RespondCap("LIST :" + sList.TrimSuffix_n(" ")); } }