From 52ee8a11efcbc972ea4b752d1a9aece5f0b35510 Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 14 Nov 2009 11:36:19 +0000 Subject: [PATCH] Some small cleanup to CUser::Clone() This shouldn't change anything except the readers ability to understand this snippet (hopefully). git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1658 726aef4b-f618-498e-8847-2d620e286838 --- User.cpp | 18 +++++++++--------- User.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/User.cpp b/User.cpp index 58870dc2..7af817bd 100644 --- a/User.cpp +++ b/User.cpp @@ -379,20 +379,20 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) { AddServer(pServer->GetName(), pServer->GetPort(), pServer->GetPass(), pServer->IsSSL()); } + m_uServerIdx = 0; for (a = 0; a < m_vServers.size(); a++) { if (sServer.Equals(m_vServers[a]->GetName())) { - m_uServerIdx = a +1; + m_uServerIdx = a + 1; break; } + } + if (m_uServerIdx == 0) { + m_uServerIdx = m_vServers.size(); + CIRCSock* pSock = GetIRCSock(); - if (a == m_vServers.size() -1) { - m_uServerIdx = m_vServers.size(); - CIRCSock* pSock = GetIRCSock(); - - if (pSock) { - PutStatus("Jumping servers because this server is no longer in the list"); - pSock->Quit(); - } + if (pSock) { + PutStatus("Jumping servers because this server is no longer in the list"); + pSock->Quit(); } } // !Servers diff --git a/User.h b/User.h index 59a4310e..39caa156 100644 --- a/User.h +++ b/User.h @@ -278,7 +278,7 @@ protected: set m_sDCCBounces; set m_sDCCSocks; set m_ssAllowedHosts; - unsigned int m_uServerIdx; + unsigned int m_uServerIdx; ///< Index in m_vServers of our current server + 1 unsigned int m_uBufferCount; unsigned long long m_uBytesRead; unsigned long long m_uBytesWritten;