Do all module calls through the macros

This commit should make sure that all module calls are done through either
MODULECALL, GLOBALMODULECALL or ALLMODULECALL. Also, in the process some module
calls where ("accidentally" ;) ) fixed to set correct values for a global
module's m_pUser during a module call.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2076 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-07-08 16:43:23 +00:00
parent 94ea2c6c42
commit 9ae959b800
5 changed files with 34 additions and 47 deletions
+10 -7
View File
@@ -67,9 +67,7 @@ void CClient::ReadLine(const CString& sData) {
if (IsAttached()) {
MODULECALL(OnUserRaw(sLine), m_pUser, this, return);
} else {
if (CZNC::Get().GetModules().OnUnknownUserRaw(this, sLine)) {
return;
}
GLOBALMODULECALL(OnUnknownUserRaw(this, sLine), m_pUser, this, return);
}
CString sCommand = sLine.Token(0);
@@ -639,7 +637,7 @@ void CAuthBase::RefuseLogin(const CString& sReason) {
"to login as you, but was rejected [" + sReason + "].");
}
CZNC::Get().GetModules().OnFailedLogin(GetUsername(), GetRemoteIP());
GLOBALMODULECALL(OnFailedLogin(GetUsername(), GetRemoteIP()), NULL, NULL, );
RefusedLogin(sReason);
Invalidate();
}
@@ -784,7 +782,7 @@ void CClient::HandleCap(const CString& sLine)
if (sSubCmd.Equals("LS")) {
SCString ssOfferCaps;
CZNC::Get().GetModules().OnClientCapLs(ssOfferCaps);
GLOBALMODULECALL(OnClientCapLs(ssOfferCaps), m_pUser, this, );
CString sRes;
for (SCString::iterator i = ssOfferCaps.begin(); i != ssOfferCaps.end(); ++i) {
sRes += *i + " ";
@@ -805,7 +803,12 @@ void CClient::HandleCap(const CString& sLine)
if (sCap.TrimPrefix("-"))
bVal = false;
if ("multi-prefix" != sCap && "userhost-in-names" != sCap && !CZNC::Get().GetModules().IsClientCapSupported(sCap, bVal)) {
bool bAccepted = ("multi-prefix" == sCap) || ("userhost-in-names" == sCap);
if (!bAccepted) {
GLOBALMODULECALL(IsClientCapSupported(sCap, bVal), m_pUser, this, bAccepted = true);
}
if (!bAccepted) {
// Some unsupported capability is requested
RespondCap("NAK :" + sLine.Token(2, true).TrimPrefix_n(":"));
return;
@@ -823,7 +826,7 @@ void CClient::HandleCap(const CString& sLine)
} else if ("userhost-in-names" == *it) {
m_bUHNames = bVal;
} else {
CZNC::Get().GetModules().OnClientCapRequest(this, *it, bVal);
GLOBALMODULECALL(OnClientCapRequest(this, *it, bVal), m_pUser, this, );
}
if (bVal) {