mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
Merge CGlobalModule(s) into CModule(s)
This commit is contained in:
+45
-50
@@ -19,10 +19,10 @@
|
||||
# warning "your crap box doesnt define RTLD_LOCAL !?"
|
||||
#endif
|
||||
|
||||
#define _MODUNLOADCHK(func, type) \
|
||||
#define MODUNLOADCHK(func) \
|
||||
for (unsigned int a = 0; a < size(); a++) { \
|
||||
try { \
|
||||
type* pMod = (type *) (*this)[a]; \
|
||||
CModule* pMod = (CModule *) (*this)[a]; \
|
||||
CClient* pOldClient = pMod->GetClient(); \
|
||||
pMod->SetClient(m_pClient); \
|
||||
if (m_pUser) { \
|
||||
@@ -41,14 +41,12 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define MODUNLOADCHK(func) _MODUNLOADCHK(func, CModule)
|
||||
#define GLOBALMODCALL(func) _MODUNLOADCHK(func, CGlobalModule)
|
||||
|
||||
#define _MODHALTCHK(func, type) \
|
||||
#define MODHALTCHK(func) \
|
||||
bool bHaltCore = false; \
|
||||
for (unsigned int a = 0; a < size(); a++) { \
|
||||
try { \
|
||||
type* pMod = (type*) (*this)[a]; \
|
||||
CModule* pMod = (CModule*) (*this)[a]; \
|
||||
CModule::EModRet e = CModule::CONTINUE; \
|
||||
CClient* pOldClient = pMod->GetClient(); \
|
||||
pMod->SetClient(m_pClient); \
|
||||
@@ -77,9 +75,6 @@
|
||||
} \
|
||||
return bHaltCore;
|
||||
|
||||
#define MODHALTCHK(func) _MODHALTCHK(func, CModule)
|
||||
#define GLOBALMODHALTCHK(func) _MODHALTCHK(func, CGlobalModule)
|
||||
|
||||
/////////////////// Timer ///////////////////
|
||||
CTimer::CTimer(CModule* pModule, unsigned int uInterval, unsigned int uCycles, const CString& sLabel, const CString& sDescription) : CCron() {
|
||||
SetName(sLabel);
|
||||
@@ -570,25 +565,25 @@ bool CModule::PutModNotice(const CString& sLine) {
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// CGlobalModule //
|
||||
// Global Module //
|
||||
///////////////////
|
||||
CModule::EModRet CGlobalModule::OnAddUser(CUser& User, CString& sErrorRet) { return CONTINUE; }
|
||||
CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; }
|
||||
void CGlobalModule::OnClientConnect(CZNCSock* pClient, const CString& sHost, unsigned short uPort) {}
|
||||
CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { return CONTINUE; }
|
||||
void CGlobalModule::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {}
|
||||
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(const CString& sCap, bool bState) {}
|
||||
CModule::EModRet CGlobalModule::OnModuleLoading(const CString& sModName, const CString& sArgs,
|
||||
CModule::EModRet CModule::OnAddUser(CUser& User, CString& sErrorRet) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnDeleteUser(CUser& User) { return CONTINUE; }
|
||||
void CModule::OnClientConnect(CZNCSock* pClient, const CString& sHost, unsigned short uPort) {}
|
||||
CModule::EModRet CModule::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { return CONTINUE; }
|
||||
void CModule::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {}
|
||||
CModule::EModRet CModule::OnUnknownUserRaw(CString& sLine) { return CONTINUE; }
|
||||
void CModule::OnClientCapLs(SCString& ssCaps) {}
|
||||
bool CModule::IsClientCapSupported(const CString& sCap, bool bState) { return false; }
|
||||
void CModule::OnClientCapRequest(const CString& sCap, bool bState) {}
|
||||
CModule::EModRet CModule::OnModuleLoading(const CString& sModName, const CString& sArgs,
|
||||
bool& bSuccess, CString& sRetMsg) { return CONTINUE; }
|
||||
CModule::EModRet CGlobalModule::OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) {
|
||||
CModule::EModRet CModule::OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) {
|
||||
return CONTINUE;
|
||||
}
|
||||
CModule::EModRet CGlobalModule::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
|
||||
CModule::EModRet CModule::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
|
||||
bool& bSuccess, CString& sRetMsg) { return CONTINUE; }
|
||||
void CGlobalModule::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {}
|
||||
void CModule::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {}
|
||||
|
||||
|
||||
CModules::CModules() {
|
||||
@@ -709,45 +704,45 @@ bool CModules::OnServerCapAvailable(const CString& sCap) {
|
||||
bool CModules::OnServerCapResult(const CString& sCap, bool bSuccess) { MODUNLOADCHK(OnServerCapResult(sCap, bSuccess)); return false; }
|
||||
|
||||
////////////////////
|
||||
// CGlobalModules //
|
||||
// Global Modules //
|
||||
////////////////////
|
||||
bool CGlobalModules::OnAddUser(CUser& User, CString& sErrorRet) {
|
||||
GLOBALMODHALTCHK(OnAddUser(User, sErrorRet));
|
||||
bool CModules::OnAddUser(CUser& User, CString& sErrorRet) {
|
||||
MODHALTCHK(OnAddUser(User, sErrorRet));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnDeleteUser(CUser& User) {
|
||||
GLOBALMODHALTCHK(OnDeleteUser(User));
|
||||
bool CModules::OnDeleteUser(CUser& User) {
|
||||
MODHALTCHK(OnDeleteUser(User));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnClientConnect(CZNCSock* pClient, const CString& sHost, unsigned short uPort) {
|
||||
GLOBALMODCALL(OnClientConnect(pClient, sHost, uPort));
|
||||
bool CModules::OnClientConnect(CZNCSock* pClient, const CString& sHost, unsigned short uPort) {
|
||||
MODUNLOADCHK(OnClientConnect(pClient, sHost, uPort));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
GLOBALMODHALTCHK(OnLoginAttempt(Auth));
|
||||
bool CModules::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
MODHALTCHK(OnLoginAttempt(Auth));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {
|
||||
GLOBALMODCALL(OnFailedLogin(sUsername, sRemoteIP));
|
||||
bool CModules::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {
|
||||
MODUNLOADCHK(OnFailedLogin(sUsername, sRemoteIP));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnUnknownUserRaw(CString& sLine) {
|
||||
GLOBALMODHALTCHK(OnUnknownUserRaw(sLine));
|
||||
bool CModules::OnUnknownUserRaw(CString& sLine) {
|
||||
MODHALTCHK(OnUnknownUserRaw(sLine));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnClientCapLs(SCString& ssCaps) {
|
||||
GLOBALMODCALL(OnClientCapLs(ssCaps));
|
||||
bool CModules::OnClientCapLs(SCString& ssCaps) {
|
||||
MODUNLOADCHK(OnClientCapLs(ssCaps));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Maybe create new macro for this?
|
||||
bool CGlobalModules::IsClientCapSupported(const CString& sCap, bool bState) {
|
||||
bool CModules::IsClientCapSupported(const CString& sCap, bool bState) {
|
||||
bool bResult = false;
|
||||
for (unsigned int a = 0; a < size(); ++a) {
|
||||
try {
|
||||
CGlobalModule* pMod = (CGlobalModule*) (*this)[a];
|
||||
CModule* pMod = (CModule*) (*this)[a];
|
||||
CClient* pOldClient = pMod->GetClient();
|
||||
pMod->SetClient(m_pClient);
|
||||
if (m_pUser) {
|
||||
@@ -769,27 +764,27 @@ bool CGlobalModules::IsClientCapSupported(const CString& sCap, bool bState) {
|
||||
return bResult;
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnClientCapRequest(const CString& sCap, bool bState) {
|
||||
GLOBALMODCALL(OnClientCapRequest(sCap, bState));
|
||||
bool CModules::OnClientCapRequest(const CString& sCap, bool bState) {
|
||||
MODUNLOADCHK(OnClientCapRequest(sCap, bState));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnModuleLoading(const CString& sModName, const CString& sArgs,
|
||||
bool CModules::OnModuleLoading(const CString& sModName, const CString& sArgs,
|
||||
bool& bSuccess, CString& sRetMsg) {
|
||||
GLOBALMODHALTCHK(OnModuleLoading(sModName, sArgs, bSuccess, sRetMsg));
|
||||
MODHALTCHK(OnModuleLoading(sModName, sArgs, bSuccess, sRetMsg));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) {
|
||||
GLOBALMODHALTCHK(OnModuleUnloading(pModule, bSuccess, sRetMsg));
|
||||
bool CModules::OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) {
|
||||
MODHALTCHK(OnModuleUnloading(pModule, bSuccess, sRetMsg));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
|
||||
bool CModules::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
|
||||
bool& bSuccess, CString& sRetMsg) {
|
||||
GLOBALMODHALTCHK(OnGetModInfo(ModInfo, sModule, bSuccess, sRetMsg));
|
||||
MODHALTCHK(OnGetModInfo(ModInfo, sModule, bSuccess, sRetMsg));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
|
||||
GLOBALMODCALL(OnGetAvailableMods(ssMods, eType));
|
||||
bool CModules::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
|
||||
MODUNLOADCHK(OnGetAvailableMods(ssMods, eType));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user