mirror of
https://github.com/znc/znc.git
synced 2026-07-31 22:13:20 +02:00
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:
+10
-7
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user