From c2df8d13c93bb4e397b202aa6f9230bec3400301 Mon Sep 17 00:00:00 2001 From: prozacx Date: Mon, 19 Sep 2005 02:23:20 +0000 Subject: [PATCH] Got rid of m_pZNC and started using CZNC::Get() git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@505 726aef4b-f618-498e-8847-2d620e286838 --- UserSock.cpp | 20 ++++++-------------- UserSock.h | 3 --- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/UserSock.cpp b/UserSock.cpp index ef38cc2f..5b73287e 100644 --- a/UserSock.cpp +++ b/UserSock.cpp @@ -285,7 +285,7 @@ void CUserSock::ReadLine(const CString& sData) { PutStatus("DCC -> [" + GetNick() + "][" + sFile + "] Unable to find send to initiate resume."); } } else { - CDCCBounce* pSock = (CDCCBounce*) m_pZNC->GetManager().FindSockByLocalPort(uResumePort); + CDCCBounce* pSock = (CDCCBounce*) CZNC::Get().GetManager().FindSockByLocalPort(uResumePort); if ((pSock) && (strncasecmp(pSock->GetSockName().c_str(), "DCC::", 5) == 0)) { PutIRC("PRIVMSG " + sTarget + " :\001DCC " + sType + " " + sFile + " " + CString::ToString(pSock->GetUserPort()) + " " + sCTCP.Token(4) + "\001"); } @@ -294,7 +294,7 @@ void CUserSock::ReadLine(const CString& sData) { if (strncasecmp(sTarget.c_str(), m_pUser->GetStatusPrefix().c_str(), m_pUser->GetStatusPrefix().length()) == 0) { } else { // Need to lookup the connection by port, filter the port, and forward to the user - TSocketManager& Manager = m_pZNC->GetManager(); + TSocketManager& Manager = CZNC::Get().GetManager(); for (unsigned int a = 0; a < Manager.size(); a++) { CDCCBounce* pSock = (CDCCBounce*) Manager[a]; @@ -668,7 +668,7 @@ void CUserSock::UserCommand(const CString& sLine) { m_pUser->SendFile(GetNick(), sFile); } } else if (sCommand.CaseCmp("LISTDCCS") == 0) { - TSocketManager& Manager = m_pZNC->GetManager(); + TSocketManager& Manager = CZNC::Get().GetManager(); CTable Table; Table.AddColumn("Type"); @@ -935,17 +935,11 @@ void CUserSock::HelpUser() { bool CUserSock::ConnectionFrom(const CString& sHost, unsigned short uPort) { DEBUG_ONLY(cout << GetSockName() << " == ConnectionFrom(" << sHost << ", " << uPort << ")" << endl); - return m_pZNC->IsHostAllowed(sHost); + return CZNC::Get().IsHostAllowed(sHost); } void CUserSock::AuthUser() { - if (!m_pZNC) { - DEBUG_ONLY(cout << "znc not set!" << endl); - Close(); - return; - } - - CUser* pUser = m_pZNC->GetUser(m_sUser); + CUser* pUser = CZNC::Get().GetUser(m_sUser); if ((!pUser) || (!pUser->CheckPass(m_sPass))) { if (pUser) { @@ -967,7 +961,7 @@ void CUserSock::AuthUser() { m_bAuthed = true; SetSockName("USR::" + pUser->GetUserName()); - CIRCSock* pIRCSock = (CIRCSock*) m_pZNC->FindSockByName("IRC::" + pUser->GetUserName()); + CIRCSock* pIRCSock = (CIRCSock*) CZNC::Get().FindSockByName("IRC::" + pUser->GetUserName()); if (pIRCSock) { m_pIRCSock = pIRCSock; @@ -1012,8 +1006,6 @@ void CUserSock::IRCDisconnected() { Csock* CUserSock::GetSockObj(const CString& sHost, unsigned short uPort) { CUserSock* pSock = new CUserSock(sHost, uPort); - pSock->SetZNC(m_pZNC); - return pSock; } diff --git a/UserSock.h b/UserSock.h index bb833f2b..e89895d0 100644 --- a/UserSock.h +++ b/UserSock.h @@ -21,7 +21,6 @@ public: virtual ~CUserSock() {} void Init() { - m_pZNC = NULL; m_pUser = NULL; m_pIRCSock = NULL; m_bAuthed = false; @@ -58,7 +57,6 @@ public: virtual bool ConnectionFrom(const CString& sHost, unsigned short uPort); virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort); - void SetZNC(CZNC* pZNC) { m_pZNC = pZNC; } void SetNick(const CString& s); private: protected: @@ -66,7 +64,6 @@ protected: bool m_bGotPass; bool m_bGotNick; bool m_bGotUser; - CZNC* m_pZNC; CUser* m_pUser; CString m_sNick; CString m_sPass;