From e00fa2176eba429d7bda1699209f434f76bfb1dc Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 16 Jun 2010 18:48:30 +0000 Subject: [PATCH] Support disabling CAPabilities This commits adds support for cap commands like this one: CAP REQ :-multi-prefix git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2027 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Client.cpp b/Client.cpp index 536cf132..3641d830 100644 --- a/Client.cpp +++ b/Client.cpp @@ -796,16 +796,24 @@ void CClient::HandleCap(const CString& sLine) } else if (sSubCmd.Equals("REQ")) { bool bReqUHNames = false; bool bReqNamesx = false; + bool bValueUHNames = false; + bool bValueNamesx = false; VCString vsTokens; VCString::iterator it; sLine.Token(2).TrimPrefix_n(":").Split(" ", vsTokens, false); for (it = vsTokens.begin(); it != vsTokens.end(); ++it) { + bool bVal = true; + if (it->TrimPrefix("-")) + bVal = false; + if (*it == "multi-prefix") { bReqNamesx = true; + bValueNamesx = bVal; } else if (*it == "userhost-in-names") { bReqUHNames = true; + bValueUHNames = bVal; } else { // Some unsupported capability is requested RespondCap("NAK :" + sLine.Token(2, true).TrimPrefix_n(":")); @@ -816,9 +824,9 @@ void CClient::HandleCap(const CString& sLine) // All is fine, we support what was requested RespondCap("ACK :" + sLine.Token(2, true).TrimPrefix_n(":")); if (bReqUHNames) - m_bUHNames = true; + m_bUHNames = bValueUHNames; if (bReqNamesx) - m_bNamesx = true; + m_bNamesx = bValueNamesx; } else if (sSubCmd.Equals("LIST")) { CString sList = ""; if (m_bNamesx)