Added OnFailedLogin() global module hook

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@720 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2006-04-06 09:10:04 +00:00
parent bb7094e149
commit d91109d777
2 changed files with 25 additions and 0 deletions
+23
View File
@@ -24,6 +24,24 @@
} \
} \
#define GLOBALMODCALL(func) \
for (unsigned int a = 0; a < size(); a++) { \
try { \
CGlobalModule* pMod = (CGlobalModule*) (*this)[a]; \
if (m_pUser) { \
pMod->SetUser(m_pUser); \
pMod->func; \
pMod->SetUser(NULL); \
} else { \
pMod->func; \
} \
} catch (CModule::EModException e) { \
if (e == CModule::UNLOAD) { \
UnloadModule((*this)[a]->GetModName()); \
} \
} \
} \
#define GLOBALMODHALTCHK(func) \
bool bHaltCore = false; \
for (unsigned int a = 0; a < size(); a++) { \
@@ -517,6 +535,7 @@ bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CS
CModule::EModRet CGlobalModule::OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan) { return CONTINUE; }
CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; }
CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { return CONTINUE; }
void CGlobalModule::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {}
CModules::CModules() {
@@ -605,6 +624,10 @@ bool CGlobalModules::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
GLOBALMODHALTCHK(OnLoginAttempt(Auth));
}
void CGlobalModules::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {
GLOBALMODCALL(OnFailedLogin(sUsername, sRemoteIP));
}
CModule* CModules::FindModule(const CString& sModule) const {
for (unsigned int a = 0; a < size(); a++) {
if (sModule.CaseCmp((*this)[a]->GetModName()) == 0) {