diff --git a/Modules.cpp b/Modules.cpp index 3b94d936..65529cc8 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -124,12 +124,26 @@ CSocket::~CSocket() { } bool CSocket::Connect(const CString& sHostname, unsigned short uPort, bool bSSL, unsigned int uTimeout) { - CString sSockName = "MOD::C::" + m_pModule->GetModName() + "::" + m_pModule->GetUser()->GetUserName(); - return m_pModule->GetManager()->Connect(sHostname, uPort, sSockName, uTimeout, bSSL, m_pModule->GetUser()->GetVHost(), (Csock*) this); + CUser* pUser = m_pModule->GetUser(); + CString sSockName = "MOD::C::" + m_pModule->GetModName(); + CString sVHost; + + if (pUser) { + sSockName += "::" + pUser->GetUserName(); + sVHost = m_pModule->GetUser()->GetVHost(); + } + + return m_pModule->GetManager()->Connect(sHostname, uPort, sSockName, uTimeout, bSSL, sVHost, (Csock*) this); } bool CSocket::Listen(unsigned short uPort, bool bSSL, unsigned int uTimeout) { - CString sSockName = "MOD::L::" + m_pModule->GetModName() + "::" + m_pModule->GetUser()->GetUserName(); + CUser* pUser = m_pModule->GetUser(); + CString sSockName = "MOD::L::" + m_pModule->GetModName(); + + if (pUser) { + sSockName += "::" + pUser->GetUserName(); + } + return m_pModule->GetManager()->ListenAll(uPort, sSockName, bSSL, SOMAXCONN, (Csock*) this); } @@ -191,7 +205,7 @@ CModule::~CModule() { } while (m_vSockets.size()) { - RemSocket(m_vSockets[0]->GetLabel()); + RemSocket(m_vSockets[0]); } SaveRegistry(); @@ -501,6 +515,8 @@ bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CS // CGlobalModule // /////////////////// CModule::EModRet CGlobalModule::OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan) { return CONTINUE; } +CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr Auth) { return CONTINUE; } + CModules::CModules() { m_pUser = NULL; @@ -580,6 +596,10 @@ bool CGlobalModules::OnConfigLine(const CString& sName, const CString& sValue, C GLOBALMODHALTCHK(OnConfigLine(sName, sValue, pUser, pChan)); } +bool CGlobalModules::OnLoginAttempt(CSmartPtr Auth) { + GLOBALMODHALTCHK(OnLoginAttempt(Auth)); +} + CModule* CModules::FindModule(const CString& sModule) const { for (unsigned int a = 0; a < size(); a++) { if (sModule.CaseCmp((*this)[a]->GetModName()) == 0) { diff --git a/Modules.h b/Modules.h index c30753fa..5edf9053 100644 --- a/Modules.h +++ b/Modules.h @@ -390,6 +390,7 @@ public: virtual ~CGlobalModule() {} virtual EModRet OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan); + virtual EModRet OnLoginAttempt(CSmartPtr Auth); private: }; @@ -399,6 +400,7 @@ public: virtual ~CGlobalModules() {} virtual bool OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan); + virtual bool OnLoginAttempt(CSmartPtr Auth); private: };