diff --git a/Client.cpp b/Client.cpp index f5401f4f..7bf5b73f 100644 --- a/Client.cpp +++ b/Client.cpp @@ -72,6 +72,9 @@ void CClient::ReadLine(const CString& sData) { #ifdef _MODULES if (IsAttached()) { MODULECALL(OnUserRaw(sLine), m_pUser, this, return); + } else { + if (CZNC::Get().GetModules().OnUnknownUserRaw(this, sLine)) + return; } #endif diff --git a/Modules.cpp b/Modules.cpp index da927bab..b8f835b8 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -564,6 +564,7 @@ CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; } void CGlobalModule::OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort) {} CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr Auth) { return CONTINUE; } void CGlobalModule::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {} +CModule::EModRet CGlobalModule::OnUnknownUserRaw(CClient* pClient, CString& sLine) { return CONTINUE; } CModules::CModules() { @@ -672,6 +673,10 @@ void CGlobalModules::OnFailedLogin(const CString& sUsername, const CString& sRem GLOBALMODCALL(OnFailedLogin(sUsername, sRemoteIP)); } +bool CGlobalModules::OnUnknownUserRaw(CClient* pClient, CString& sLine) { + GLOBALMODHALTCHK(OnUnknownUserRaw(pClient, sLine)); +} + CModule* CModules::FindModule(const CString& sModule) const { for (unsigned int a = 0; a < size(); a++) { if (sModule.Equals((*this)[a]->GetModName())) { diff --git a/Modules.h b/Modules.h index bbf7f8b8..e0829200 100644 --- a/Modules.h +++ b/Modules.h @@ -458,6 +458,7 @@ public: virtual void OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort); virtual EModRet OnLoginAttempt(CSmartPtr Auth); virtual void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP); + virtual EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine); private: }; @@ -471,6 +472,7 @@ public: void OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort); bool OnLoginAttempt(CSmartPtr Auth); void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP); + bool OnUnknownUserRaw(CClient* pClient, CString& sLine); private: };