]> jfr.im git - irc/rizon/znc.git/commitdiff
Remove CSocket::m_sLabel since it isn't really used at all
authorpsychon <redacted>
Mon, 29 Sep 2008 13:34:42 +0000 (13:34 +0000)
committerpsychon <redacted>
Mon, 29 Sep 2008 13:34:42 +0000 (13:34 +0000)
It doesn't really make much sense either, because Csock already has contains
a socket name member which can be used for this. This is exactly what this
patch does.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1229 726aef4b-f618-498e-8847-2d620e286838

Modules.cpp
Modules.h
modules/imapauth.cpp

index 6469b48c0bbb0daea6e841db13bf95146b71a07c..e1b3d70fb40cd5dea9ba25e7d9c1bdabd4d59327 100644 (file)
@@ -99,16 +99,14 @@ const CString& CTimer::GetDescription() const { return m_sDescription; }
 /////////////////// !Timer ///////////////////
 
 /////////////////// Socket ///////////////////
-CSocket::CSocket(CModule* pModule, const CString& sLabel) : Csock() {
+CSocket::CSocket(CModule* pModule) : Csock() {
        m_pModule = pModule;
-       m_sLabel = sLabel;
        m_pModule->AddSocket(this);
        EnableReadLine();
 }
 
-CSocket::CSocket(CModule* pModule, const CString& sLabel, const CString& sHostname, unsigned short uPort, int iTimeout) : Csock(sHostname, uPort, iTimeout) {
+CSocket::CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout) : Csock(sHostname, uPort, iTimeout) {
        m_pModule = pModule;
-       m_sLabel = sLabel;
        m_pModule->AddSocket(this);
        EnableReadLine();
 }
@@ -127,6 +125,11 @@ bool CSocket::Connect(const CString& sHostname, unsigned short uPort, bool bSSL,
                sVHost = m_pModule->GetUser()->GetVHost();
        }
 
+       // Don't overwrite the socket name if one is already set
+       if (!GetSockName().empty()) {
+               sSockName = GetSockName();
+       }
+
        return m_pModule->GetManager()->Connect(sHostname, uPort, sSockName, uTimeout, bSSL, sVHost, (Csock*) this);
 }
 
@@ -137,6 +140,10 @@ bool CSocket::Listen(unsigned short uPort, bool bSSL, unsigned int uTimeout) {
        if (pUser) {
                sSockName += "::" + pUser->GetUserName();
        }
+       // Don't overwrite the socket name if one is already set
+       if (!GetSockName().empty()) {
+               sSockName = GetSockName();
+       }
 
        return m_pModule->GetManager()->ListenAll(uPort, sSockName, bSSL, SOMAXCONN, (Csock*) this);
 }
@@ -161,10 +168,7 @@ bool CSocket::PutModNotice(const CString& sLine, const CString& sIdent, const CS
 }
 
 void CSocket::SetModule(CModule* p) { m_pModule = p; }
-void CSocket::SetLabel(const CString& s) { m_sLabel = s; }
-
 CModule* CSocket::GetModule() const { return m_pModule; }
-const CString& CSocket::GetLabel() const { return m_sLabel; }
 /////////////////// !Socket ///////////////////
 
 CModule::CModule(void* pDLL, CUser* pUser, const CString& sModName, const CString& sDataDir) {
@@ -357,11 +361,11 @@ bool CModule::RemSocket(CSocket* pSocket) {
        return false;
 }
 
-bool CModule::RemSocket(const CString& sLabel) {
+bool CModule::RemSocket(const CString& sSockName) {
        for (unsigned int a = 0; a < m_vSockets.size(); a++) {
                CSocket* pSocket = m_vSockets[a];
 
-               if (pSocket->GetLabel().CaseCmp(sLabel) == 0) {
+               if (pSocket->GetSockName().CaseCmp(sSockName) == 0) {
                        m_vSockets.erase(m_vSockets.begin() +a);
                        m_pManager->DelSockByAddr(pSocket);
                        return true;
@@ -382,10 +386,10 @@ bool CModule::UnlinkSocket(CSocket* pSocket) {
        return false;
 }
 
-CSocket* CModule::FindSocket(const CString& sLabel) {
+CSocket* CModule::FindSocket(const CString& sSockName) {
        for (unsigned int a = 0; a < m_vSockets.size(); a++) {
                CSocket* pSocket = m_vSockets[a];
-               if (pSocket->GetLabel().CaseCmp(sLabel) == 0) {
+               if (pSocket->GetSockName().CaseCmp(sSockName) == 0) {
                        return pSocket;
                }
        }
@@ -411,7 +415,7 @@ void CModule::ListSockets() {
                CSocket* pSocket = (CSocket*) m_vSockets[a];
 
                Table.AddRow();
-               Table.SetCell("Name", pSocket->GetLabel());
+               Table.SetCell("Name", pSocket->GetSockName());
 
                if (pSocket->GetType() == CSocket::LISTENER) {
                        Table.SetCell("State", "Listening");
index 4bcefa29013f180a85484a56ba3b4bcffed0972d..ffa4e987ddc828bc18fc84cdfe64967c8fa53079 100644 (file)
--- a/Modules.h
+++ b/Modules.h
@@ -132,8 +132,8 @@ private:
 
 class CSocket : public Csock {
 public:
-       CSocket(CModule* pModule, const CString& sLabel);
-       CSocket(CModule* pModule, const CString& sLabel, const CString& sHostname, unsigned short uPort, int iTimeout = 60);
+       CSocket(CModule* pModule);
+       CSocket(CModule* pModule, const CString& sHostname, unsigned short uPort, int iTimeout = 60);
        virtual ~CSocket();
 
        using Csock::Connect;
@@ -149,17 +149,14 @@ public:
 
        // Setters
        void SetModule(CModule* p);
-       void SetLabel(const CString& s);
        // !Setters
 
        // Getters
        CModule* GetModule() const;
-       const CString& GetLabel() const;
        // !Getters
 private:
 protected:
        CModule*        m_pModule;
-       CString         m_sLabel;
 };
 
 class CModInfo {
@@ -305,9 +302,9 @@ public:
        // Socket stuff
        bool AddSocket(CSocket* pSocket);
        bool RemSocket(CSocket* pSocket);
-       bool RemSocket(const CString& sLabel);
+       bool RemSocket(const CString& sSockName);
        bool UnlinkSocket(CSocket* pSocket);
-       CSocket* FindSocket(const CString& sLabel);
+       CSocket* FindSocket(const CString& sSockName);
        virtual void ListSockets();
        // !Socket stuff
 
index 6d1bd395c6ea503d7b884fc8216c6b0c516c30c0..06aba5ab2cd252fbee5f1a18ba1de8455a85f16a 100644 (file)
@@ -16,7 +16,7 @@ class CIMAPAuthMod;
 class CIMAPSock : public CSocket {
 public:
        CIMAPSock(CIMAPAuthMod* pModule, CSmartPtr<CAuthBase> Auth)
-               : CSocket((CModule*) pModule, "IMAPMod"), m_spAuth(Auth) {
+               : CSocket((CModule*) pModule), m_spAuth(Auth) {
                        m_pIMAPMod = pModule;
                        m_bSentReply = false;
                        m_bSentLogin = false;