From ba05f11ea4cf797704eddc8a0d1743526ad48156 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 30 Mar 2010 12:20:31 +0000 Subject: [PATCH] Remove CWebSock::m_bLoggedIn We can just check if m_pUser is NULL for the very same thing. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1859 726aef4b-f618-498e-8847-2d620e286838 --- WebModules.cpp | 5 +---- WebModules.h | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/WebModules.cpp b/WebModules.cpp index a893320a..d0432834 100644 --- a/WebModules.cpp +++ b/WebModules.cpp @@ -28,7 +28,6 @@ bool CZNCTagHandler::HandleTag(CTemplate& Tmpl, const CString& sName, const CStr } CWebSession::CWebSession(const CString& sId) : m_sId(sId) { - m_bLoggedIn = false; m_pUser = NULL; } @@ -83,7 +82,6 @@ void CWebAuth::AcceptedLogin(CUser& User) { CSmartPtr spSession = m_pWebSock->GetSession(); spSession->SetUser(&User); - spSession->SetLoggedIn(true); m_pWebSock->SetLoggedIn(true); m_pWebSock->UnPauseRead(); @@ -99,7 +97,6 @@ void CWebAuth::RefusedLogin(const CString& sReason) { spSession->AddError("Invalid login!"); spSession->SetUser(NULL); - spSession->SetLoggedIn(false); m_pWebSock->SetLoggedIn(false); m_pWebSock->UnPauseRead(); @@ -534,7 +531,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS } else if (sURI == "/robots.txt") { return PrintStaticFile("/pub/robots.txt", sPageRet); } else if (sURI == "/logout") { - GetSession()->SetLoggedIn(false); + GetSession()->SetUser(NULL); SetLoggedIn(false); Redirect("/"); diff --git a/WebModules.h b/WebModules.h index 49d81d59..59f44939 100644 --- a/WebModules.h +++ b/WebModules.h @@ -39,10 +39,9 @@ public: const CString& GetId() const { return m_sId; } CUser* GetUser() const { return m_pUser; } - bool IsLoggedIn() const { return m_pUser && m_bLoggedIn; } + bool IsLoggedIn() const { return m_pUser != NULL; } bool IsAdmin() const; - bool SetLoggedIn(bool b) { m_bLoggedIn = b; return m_bLoggedIn; } CUser* SetUser(CUser* p) { m_pUser = p; return m_pUser; } void ClearMessageLoops(); @@ -52,7 +51,6 @@ public: private: CString m_sId; CUser* m_pUser; - bool m_bLoggedIn; VCString m_vsErrorMsgs; VCString m_vsSuccessMsgs; };