From 88daf2fa5a6a237da98fbb90753bb6ddb6b7030c Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 3 Aug 2010 17:23:37 +0000 Subject: [PATCH] Add support for CAP CLEAR from clients Thanks to DarthGandalf for the patch. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2097 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Client.cpp b/Client.cpp index acef5e7e..d7b2e374 100644 --- a/Client.cpp +++ b/Client.cpp @@ -846,5 +846,29 @@ void CClient::HandleCap(const CString& sLine) sList += *i + " "; } RespondCap("LIST :" + sList.TrimSuffix_n(" ")); + } else if (sSubCmd.Equals("CLEAR")) { + SCString ssRemoved; + for (SCString::iterator i = m_ssAcceptedCaps.begin(); i != m_ssAcceptedCaps.end(); ++i) { + bool bRemoving = false; + GLOBALMODULECALL(IsClientCapSupported(*i, false), m_pUser, this, bRemoving = true); + if (bRemoving) { + GLOBALMODULECALL(OnClientCapRequest(*i, false), m_pUser, this, ); + ssRemoved.insert(*i); + } + } + if (m_bNamesx) { + m_bNamesx = false; + ssRemoved.insert("multi-prefix"); + } + if (m_bUHNames) { + m_bUHNames = false; + ssRemoved.insert("userhost-in-names"); + } + CString sList = ""; + for (SCString::iterator i = ssRemoved.begin(); i != ssRemoved.end(); ++i) { + m_ssAcceptedCaps.erase(*i); + sList += "-" + *i + " "; + } + RespondCap("ACK :" + sList.TrimSuffix_n(" ")); } }