Add "Loaded" flag to the user page.

This commit is contained in:
Vasily Fomin
2014-05-29 17:49:41 +02:00
parent 78f7897dfc
commit 3ad285243d
2 changed files with 38 additions and 0 deletions

View File

@@ -1225,6 +1225,26 @@ public:
}
}
// Check if module is loaded globally
l["LoadedGlobally"] = CString(CZNC::Get().GetModules().FindModule(Info.GetName()) != NULL);
// Check if module is loaded by all or some networks
const vector<CIRCNetwork*>& userNetworks = pUser->GetNetworks();
unsigned int networksWithRenderedModuleCount = 0;
for (unsigned int networkIndex = 0; networkIndex < userNetworks.size(); ++networkIndex) {
const CIRCNetwork* pCurrentNetwork = userNetworks[networkIndex];
const CModules& networkModules = pCurrentNetwork->GetModules();
for (unsigned int networkModuleIndex = 0; networkModuleIndex < networkModules.size(); ++networkModuleIndex) {
const CModule* pCurModule = networkModules[networkModuleIndex];
if (Info.GetName() == pCurModule->GetModName()) {
networksWithRenderedModuleCount++;
}
}
}
l["LoadedByAllNetworks"] = CString(networksWithRenderedModuleCount == userNetworks.size());
const bool isLoadedBySomeNetworks = (networksWithRenderedModuleCount != 0) && (networksWithRenderedModuleCount < userNetworks.size());
l["LoadedBySomeNetworks"] = CString(isLoadedBySomeNetworks);
if (!spSession->IsAdmin() && pUser && pUser->DenyLoadMod()) {
l["Disabled"] = "true";
}