mirror of
https://github.com/znc/znc.git
synced 2026-05-06 13:32:36 +02:00
sync from my branch rev 983 and 993:
- module api change, if module fails to load it can give back an useful error message - give a message when client doesnt supply a password when connecting - some minor cleanup git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@803 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
11
Modules.cpp
11
Modules.cpp
@@ -469,7 +469,7 @@ void CModule::ListSockets() {
|
||||
const CString& CModule::GetModName() const { return m_sModName; }
|
||||
CString CModule::GetModNick() const { return ((m_pUser) ? m_pUser->GetStatusPrefix() : "*") + m_sModName; }
|
||||
|
||||
bool CModule::OnLoad(const CString& sArgs) { return true; }
|
||||
bool CModule::OnLoad(const CString& sArgs, CString& sErrorMsg) { sErrorMsg = ""; return true; }
|
||||
bool CModule::OnBoot() { return true; }
|
||||
void CModule::OnIRCDisconnected() {}
|
||||
void CModule::OnIRCConnected() {}
|
||||
@@ -771,9 +771,12 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
|
||||
pModule->SetDescription(GetDesc());
|
||||
push_back(pModule);
|
||||
|
||||
if (!pModule->OnLoad(sArgs)) {
|
||||
UnloadModule(sModule, sRetMsg);
|
||||
sRetMsg = "Module [" + sModule + "] aborted.";
|
||||
if (!pModule->OnLoad(sArgs, sRetMsg)) {
|
||||
UnloadModule(sModule, sModPath);
|
||||
if (!sRetMsg.empty())
|
||||
sRetMsg = "Module [" + sModule + "] aborted: " + sRetMsg;
|
||||
else
|
||||
sRetMsg = "Module [" + sModule + "] aborted.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user