From 47a5ab375112e4b319102353e6f4b8308cbf0394 Mon Sep 17 00:00:00 2001 From: psychon Date: Fri, 9 Jul 2010 18:02:04 +0000 Subject: [PATCH] Remove the CClient* argument to all module calls OnUnknownUserRaw() and OnClientCapRequest() were both getting a CClient* as their first argument, but the proper way to pass a CClient* argument to a module is via GetClient(). Since recently, all the places where this module hooks are called do this properly, so we can remove this bogus argument. No module that is part of znc is affected by this change. Let's see how many external ones break. ;) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2077 726aef4b-f618-498e-8847-2d620e286838 --- Client.cpp | 4 ++-- Modules.cpp | 12 ++++++------ Modules.h | 10 ++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Client.cpp b/Client.cpp index 6e586413..13918e91 100644 --- a/Client.cpp +++ b/Client.cpp @@ -67,7 +67,7 @@ void CClient::ReadLine(const CString& sData) { if (IsAttached()) { MODULECALL(OnUserRaw(sLine), m_pUser, this, return); } else { - GLOBALMODULECALL(OnUnknownUserRaw(this, sLine), m_pUser, this, return); + GLOBALMODULECALL(OnUnknownUserRaw(sLine), m_pUser, this, return); } CString sCommand = sLine.Token(0); @@ -826,7 +826,7 @@ void CClient::HandleCap(const CString& sLine) } else if ("userhost-in-names" == *it) { m_bUHNames = bVal; } else { - GLOBALMODULECALL(OnClientCapRequest(this, *it, bVal), m_pUser, this, ); + GLOBALMODULECALL(OnClientCapRequest(*it, bVal), m_pUser, this, ); } if (bVal) { diff --git a/Modules.cpp b/Modules.cpp index 73d0df93..a45a2537 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -502,10 +502,10 @@ CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; } void CGlobalModule::OnClientConnect(CZNCSock* 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; } +CModule::EModRet CGlobalModule::OnUnknownUserRaw(CString& sLine) { return CONTINUE; } void CGlobalModule::OnClientCapLs(SCString& ssCaps) {} bool CGlobalModule::IsClientCapSupported(const CString& sCap, bool bState) { return false; } -void CGlobalModule::OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState) {} +void CGlobalModule::OnClientCapRequest(const CString& sCap, bool bState) {} CModules::CModules() { @@ -628,8 +628,8 @@ bool CGlobalModules::OnFailedLogin(const CString& sUsername, const CString& sRem return false; } -bool CGlobalModules::OnUnknownUserRaw(CClient* pClient, CString& sLine) { - GLOBALMODHALTCHK(OnUnknownUserRaw(pClient, sLine)); +bool CGlobalModules::OnUnknownUserRaw(CString& sLine) { + GLOBALMODHALTCHK(OnUnknownUserRaw(sLine)); } bool CGlobalModules::OnClientCapLs(SCString& ssCaps) { @@ -664,8 +664,8 @@ bool CGlobalModules::IsClientCapSupported(const CString& sCap, bool bState) { return bResult; } -bool CGlobalModules::OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState) { - GLOBALMODCALL(OnClientCapRequest(pClient, sCap, bState)); +bool CGlobalModules::OnClientCapRequest(const CString& sCap, bool bState) { + GLOBALMODCALL(OnClientCapRequest(sCap, bState)); return false; } diff --git a/Modules.h b/Modules.h index 07e164a7..e261c80e 100644 --- a/Modules.h +++ b/Modules.h @@ -953,12 +953,11 @@ public: /** This function behaves like CModule::OnRaw(), but is also called * before the client successfully logged in to ZNC. You should always * prefer to use CModule::OnRaw() if possible. - * @param pClient The client. * @param sLine The raw traffic line which the client sent. * @todo Why doesn't this use m_pUser and m_pClient? * (Well, ok, m_pUser isn't known yet...) */ - virtual EModRet OnUnknownUserRaw(CClient* pClient, CString& sLine); + virtual EModRet OnUnknownUserRaw(CString& sLine); /** Called when a client told us CAP LS. Use ssCaps.insert("cap-name") * for announcing capabilities which your module supports. @@ -972,11 +971,10 @@ public: */ virtual bool IsClientCapSupported(const CString& sCap, bool bState); /** Called when we actually need to turn a capability on or off for a client. - * @param pClient client which requested this. * @param sCap name of wanted capability. * @param bState On or off, depending on which case client needs. */ - virtual void OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState); + virtual void OnClientCapRequest(const CString& sCap, bool bState); private: }; @@ -991,10 +989,10 @@ public: bool OnClientConnect(CZNCSock* pSock, const CString& sHost, unsigned short uPort); bool OnLoginAttempt(CSmartPtr Auth); bool OnFailedLogin(const CString& sUsername, const CString& sRemoteIP); - bool OnUnknownUserRaw(CClient* pClient, CString& sLine); + bool OnUnknownUserRaw(CString& sLine); bool OnClientCapLs(SCString& ssCaps); bool IsClientCapSupported(const CString& sCap, bool bState); - bool OnClientCapRequest(CClient* pClient, const CString& sCap, bool bState); + bool OnClientCapRequest(const CString& sCap, bool bState); private: };