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:
psychon
2007-05-16 22:42:00 +00:00
parent d82eb75d1c
commit a3b405bd07
19 changed files with 31 additions and 34 deletions

View File

@@ -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;
}