mirror of
https://github.com/znc/znc.git
synced 2026-06-27 05:21:38 +02:00
Make UpdateModule reload the module for every module type
UpdateModule has been moved to CZNC because it doesn't really fit into CUser. The new UpdateModule will reload the module for global modules, user modules and network modules. Fixes #69
This commit is contained in:
@@ -411,33 +411,6 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CUser::UpdateModule(const CString &sModule) {
|
||||
const map<CString,CUser*>& Users = CZNC::Get().GetUserMap();
|
||||
map<CString,CUser*>::const_iterator it;
|
||||
map<CUser*, CString> Affected;
|
||||
map<CUser*, CString>::iterator it2;
|
||||
bool error = false;
|
||||
|
||||
for (it = Users.begin(); it != Users.end(); ++it) {
|
||||
CModule *pMod = it->second->GetModules().FindModule(sModule);
|
||||
if (pMod) {
|
||||
Affected[it->second] = pMod->GetArgs();
|
||||
it->second->GetModules().UnloadModule(pMod->GetModName());
|
||||
}
|
||||
}
|
||||
|
||||
CString sErr;
|
||||
for (it2 = Affected.begin(); it2 != Affected.end(); ++it2) {
|
||||
if (!it2->first->GetModules().LoadModule(sModule, it2->second, CModInfo::UserModule, it2->first, NULL, sErr)) {
|
||||
error = true;
|
||||
DEBUG("Failed to reload [" << sModule << "] for [" << it2->first->GetUserName()
|
||||
<< "]: " << sErr);
|
||||
}
|
||||
}
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
CIRCNetwork* CUser::AddNetwork(const CString &sNetwork) {
|
||||
if (!CIRCNetwork::IsValidNetwork(sNetwork) || FindNetwork(sNetwork)) {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user