From bb73c600e44c8d3295f2dec81878f1c8001ae85f Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Thu, 28 Jun 2012 21:00:37 +0100 Subject: [PATCH 1/2] bNoChange in On{,De}{Op,Voice} wast incorrect Fixes #128 --- src/Chan.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Chan.cpp b/src/Chan.cpp index 1f901802..f3112afa 100644 --- a/src/Chan.cpp +++ b/src/Chan.cpp @@ -271,6 +271,8 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) { unsigned char uPerm = m_pNetwork->GetIRCSock()->GetPermFromMode(uMode); if (uPerm) { + bool bNoChange = (pNick->HasPerm(uPerm) == bAdd); + if (bAdd) { pNick->AddPerm(uPerm); @@ -284,7 +286,6 @@ void CChan::ModeChange(const CString& sModes, const CNick* pOpNick) { RemPerm(uPerm); } } - bool bNoChange = (pNick->HasPerm(uPerm) == bAdd); if (uMode && pOpNick) { NETWORKMODULECALL(OnChanPermission(*pOpNick, *pNick, *this, uMode, bAdd, bNoChange), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING); From 981963a41e8b47f8a4f4ed16b5d8d90ae0626f54 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Thu, 28 Jun 2012 21:15:12 +0100 Subject: [PATCH 2/2] Don't send our password required notice until after CAP negotiation --- include/znc/Client.h | 1 + src/Client.cpp | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/znc/Client.h b/include/znc/Client.h index 7cc34a81..1653352b 100644 --- a/include/znc/Client.h +++ b/include/znc/Client.h @@ -96,6 +96,7 @@ public: virtual ~CClient(); + void SendRequiredPasswordNotice(); void AcceptLogin(CUser& User); void RefuseLogin(const CString& sReason); diff --git a/src/Client.cpp b/src/Client.cpp index 3c778731..0660fc85 100644 --- a/src/Client.cpp +++ b/src/Client.cpp @@ -69,6 +69,13 @@ CClient::~CClient() { } } +void CClient::SendRequiredPasswordNotice() { + PutClient(":irc.znc.in 464 " + GetNick() + " :Password required"); + PutClient(":irc.znc.in NOTICE AUTH :*** " + "You need to send your password. " + "Try /quote PASS :"); +} + void CClient::ReadLine(const CString& sData) { CString sLine = sData; @@ -132,11 +139,8 @@ void CClient::ReadLine(const CString& sData) { m_bGotUser = true; if (m_bGotPass) { AuthUser(); - } else { - PutClient(":irc.znc.in 464 " + GetNick() + " :Password required"); - PutClient(":irc.znc.in NOTICE AUTH :*** " - "You need to send your password. " - "Try /quote PASS :"); + } else if (!m_bInCap) { + SendRequiredPasswordNotice(); } return; // Don't forward this msg. ZNC has already registered us. @@ -808,7 +812,13 @@ void CClient::HandleCap(const CString& sLine) m_bInCap = true; } else if (sSubCmd.Equals("END")) { m_bInCap = false; - AuthUser(); + if (!IsAttached()) { + if (!m_pUser && m_bGotUser && !m_bGotPass) { + SendRequiredPasswordNotice(); + } else { + AuthUser(); + } + } } else if (sSubCmd.Equals("REQ")) { VCString vsTokens; VCString::iterator it;