From 9bb838774590bd1ae88f1763b29eaf8f5adca6ba Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sun, 10 Dec 2017 09:50:26 +0000 Subject: [PATCH] Revert "Avoid calling OnWho on every channel in the network WHO was called in. (#1461)" This reverts commit 5132ea987e0e9b2c467ce27f24805ceef056c58c. Add a comment to explain the old behavior, by courtesy of @psychon --- src/IRCSock.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/IRCSock.cpp b/src/IRCSock.cpp index 8b581ea4..203133bc 100644 --- a/src/IRCSock.cpp +++ b/src/IRCSock.cpp @@ -856,13 +856,21 @@ bool CIRCSock::OnNumericMessage(CNumericMessage& Message) { m_pNetwork->SetIRCNick(m_Nick); m_pNetwork->SetIRCServer(sServer); - CChan* pChan = m_pNetwork->FindChan(sChan); + // A nick can only have one ident and hostname. Yes, you can query + // this information per-channel, but it is still global. For + // example, if the client supports UHNAMES, but the IRC server does + // not, then AFAIR "passive snooping of WHO replies" is the only way + // that ZNC can figure out the ident and host for the UHNAMES + // replies. + const vector& vChans = m_pNetwork->GetChans(); - if (pChan) { + for (CChan* pChan : vChans) { pChan->OnWho(sNick, sIdent, sHost); - if (pChan->IsDetached()) { - return true; - } + } + + CChan* pChan = m_pNetwork->FindChan(sChan); + if (pChan && pChan->IsDetached()) { + return true; } break;