From f81177b102c65ad9d575e48fff18da91ff5a0dd4 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 3 Oct 2008 12:53:39 +0000 Subject: [PATCH] Fix stickychan to work with disabled channels (e.g. after a kick) This kinda turns stickychan into kickrejoin... well, so what? Thanks to Julian for reporting this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1238 726aef4b-f618-498e-8847-2d620e286838 --- modules/stickychan.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/stickychan.cpp b/modules/stickychan.cpp index 754bd7fe..f076dc49 100644 --- a/modules/stickychan.cpp +++ b/modules/stickychan.cpp @@ -78,14 +78,17 @@ public: { for (MCString::iterator it = BeginNV(); it != EndNV(); it++) { - if (!m_pUser->FindChan(it->first)) - { - CChan *pChan = new CChan(it->first, m_pUser, true); + CChan *pChan = m_pUser->FindChan(it->first); + if (!pChan) { + pChan = new CChan(it->first, m_pUser, true); if (!it->second.empty()) pChan->SetKey(it->second); m_pUser->AddChan(pChan); - PutModule("Joining [" + it->first + "]"); - PutIRC("JOIN " + it->first + (it->second.empty() ? "" : it->second)); + } + if (!pChan->IsOn()) { + PutModule("Joining [" + pChan->GetName() + "]"); + PutIRC("JOIN " + pChan->GetName() + (pChan->GetKey().empty() + ? "" : " " + pChan->GetKey())); } } }