From 9c92d93ac49160b036338e51e99e502d037021db Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 29 Jun 2010 18:58:14 +0000 Subject: [PATCH] Remove CZNC::GetUser() CZNC::FindUser() does the same thing and we don't need two of these. GetUser() was removed because FindUser() is used more than GetUser(). Thanks to Sthebig for noticing this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2046 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 2 +- modules/modperl.cpp | 2 +- znc.cpp | 8 +------- znc.h | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Client.cpp b/Client.cpp index 4c27ed7b..3ee3bebf 100644 --- a/Client.cpp +++ b/Client.cpp @@ -629,7 +629,7 @@ void CAuthBase::RefuseLogin(const CString& sReason) { if (!m_pSock) return; - CUser* pUser = CZNC::Get().GetUser(GetUsername()); + CUser* pUser = CZNC::Get().FindUser(GetUsername()); // If the username is valid, notify that user that someone tried to // login. Use sReason because there are other reasons than "wrong diff --git a/modules/modperl.cpp b/modules/modperl.cpp index dcfce759..1f015a0b 100644 --- a/modules/modperl.cpp +++ b/modules/modperl.cpp @@ -293,7 +293,7 @@ public: if (sUsername.empty()) return(m_pUser); - CUser *pUser = CZNC::Get().GetUser(sUsername); + CUser *pUser = CZNC::Get().FindUser(sUsername); if (bSetUserContext) m_pUser = pUser; diff --git a/znc.cpp b/znc.cpp index eb95d2fc..6d76d5b0 100644 --- a/znc.cpp +++ b/znc.cpp @@ -409,12 +409,6 @@ void CZNC::DeleteUsers() { DisableConnectUser(); } -CUser* CZNC::GetUser(const CString& sUser) { - // Todo: make this case insensitive - map::iterator it = m_msUsers.find(sUser); - return (it == m_msUsers.end()) ? NULL : it->second; -} - Csock* CZNC::FindSockByName(const CString& sSockName) { return m_Manager.FindSockByName(sSockName); } @@ -1959,7 +1953,7 @@ void CZNC::AuthUser(CSmartPtr AuthClass) { return; } - CUser* pUser = GetUser(AuthClass->GetUsername()); + CUser* pUser = FindUser(AuthClass->GetUsername()); if (!pUser || !pUser->CheckPass(AuthClass->GetPassword())) { AuthClass->RefuseLogin("Invalid Password"); diff --git a/znc.h b/znc.h index 4bf00d89..38545975 100644 --- a/znc.h +++ b/znc.h @@ -38,7 +38,6 @@ public: void ReleaseISpoof(); bool WritePidFile(int iPid); bool DeletePidFile(); - CUser* GetUser(const CString& sUser); Csock* FindSockByName(const CString& sSockName); bool IsHostAllowed(const CString& sHostMask) const; // This returns false if there are too many anonymous connections from this ip