mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Remove CSocket::m_sLabel since it isn't really used at all
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
This commit is contained in:
28
Modules.cpp
28
Modules.cpp
@@ -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");
|
||||
|
||||
11
Modules.h
11
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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user