From d84b9c6e9ee96029f3400dbce67aa28458544aa6 Mon Sep 17 00:00:00 2001 From: silverleo Date: Wed, 31 Dec 2008 12:22:38 +0000 Subject: [PATCH] Add OnUnknownUserRaw() global module call. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1314 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 3 +++ Modules.cpp | 5 +++++ Modules.h | 2 ++ 3 files changed, 10 insertions(+) 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: };