Move the EModuleType into CModInfo

This also renames the values to shorter and more "well sounding" names.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter
2011-08-21 16:30:36 +02:00
parent 5f53c3509f
commit cce40e9f71
12 changed files with 76 additions and 76 deletions
+21 -21
View File
@@ -517,7 +517,7 @@ void CClient::UserCommand(CString& sLine) {
if (m_pUser->IsAdmin()) {
set<CModInfo> ssGlobalMods;
CZNC::Get().GetModules().GetAvailableMods(ssGlobalMods, ModuleTypeGlobal);
CZNC::Get().GetModules().GetAvailableMods(ssGlobalMods, CModInfo::GlobalModule);
if (ssGlobalMods.empty()) {
PutStatus("No global modules available.");
@@ -562,21 +562,21 @@ void CClient::UserCommand(CString& sLine) {
}
return;
} else if (sCommand.Equals("LOADMOD") || sCommand.Equals("LOADMODULE")) {
EModuleType eType;
CModInfo::EModuleType eType;
CString sType = sLine.Token(1);
CString sMod = sLine.Token(2);
CString sArgs = sLine.Token(3, true);
if (sType.Equals("global")) {
eType = ModuleTypeGlobal;
eType = CModInfo::GlobalModule;
} else if (sType.Equals("user")) {
eType = ModuleTypeUser;
eType = CModInfo::UserModule;
} else {
sMod = sType;
sArgs = sLine.Token(2, true);
sType = "default";
// Will be set correctly later
eType = ModuleTypeUser;
eType = CModInfo::UserModule;
}
if (m_pUser->DenyLoadMod()) {
@@ -600,7 +600,7 @@ void CClient::UserCommand(CString& sLine) {
eType = ModInfo.DefaultType();
}
if (eType == ModuleTypeGlobal && !m_pUser->IsAdmin()) {
if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) {
PutStatus("Unable to load global module [" + sMod + "]: Access Denied.");
return;
}
@@ -609,10 +609,10 @@ void CClient::UserCommand(CString& sLine) {
bool b = false;
switch (eType) {
case ModuleTypeGlobal:
case CModInfo::GlobalModule:
b = CZNC::Get().GetModules().LoadModule(sMod, sArgs, eType, NULL, sModRet);
break;
case ModuleTypeUser:
case CModInfo::UserModule:
b = m_pUser->GetModules().LoadModule(sMod, sArgs, eType, m_pUser, sModRet);
break;
default:
@@ -625,14 +625,14 @@ void CClient::UserCommand(CString& sLine) {
PutStatus(sModRet);
return;
} else if (sCommand.Equals("UNLOADMOD") || sCommand.Equals("UNLOADMODULE")) {
EModuleType eType = ModuleTypeUser;
CModInfo::EModuleType eType = CModInfo::UserModule;
CString sType = sLine.Token(1);
CString sMod = sLine.Token(2);
if (sType.Equals("global")) {
eType = ModuleTypeGlobal;
eType = CModInfo::GlobalModule;
} else if (sType.Equals("user")) {
eType = ModuleTypeUser;
eType = CModInfo::UserModule;
} else {
sMod = sType;
sType = "default";
@@ -659,7 +659,7 @@ void CClient::UserCommand(CString& sLine) {
eType = ModInfo.DefaultType();
}
if (eType == ModuleTypeGlobal && !m_pUser->IsAdmin()) {
if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) {
PutStatus("Unable to unload global module [" + sMod + "]: Access Denied.");
return;
}
@@ -667,10 +667,10 @@ void CClient::UserCommand(CString& sLine) {
CString sModRet;
switch (eType) {
case ModuleTypeGlobal:
case CModInfo::GlobalModule:
CZNC::Get().GetModules().UnloadModule(sMod, sModRet);
break;
case ModuleTypeUser:
case CModInfo::UserModule:
m_pUser->GetModules().UnloadModule(sMod, sModRet);
break;
default:
@@ -680,7 +680,7 @@ void CClient::UserCommand(CString& sLine) {
PutStatus(sModRet);
return;
} else if (sCommand.Equals("RELOADMOD") || sCommand.Equals("RELOADMODULE")) {
EModuleType eType;
CModInfo::EModuleType eType;
CString sType = sLine.Token(1);
CString sMod = sLine.Token(2);
CString sArgs = sLine.Token(3, true);
@@ -691,15 +691,15 @@ void CClient::UserCommand(CString& sLine) {
}
if (sType.Equals("global")) {
eType = ModuleTypeGlobal;
eType = CModInfo::GlobalModule;
} else if (sType.Equals("user")) {
eType = ModuleTypeUser;
eType = CModInfo::UserModule;
} else {
sMod = sType;
sArgs = sLine.Token(2, true);
sType = "default";
// Will be set correctly later
eType = ModuleTypeUser;
eType = CModInfo::UserModule;
}
if (sMod.empty()) {
@@ -718,7 +718,7 @@ void CClient::UserCommand(CString& sLine) {
eType = ModInfo.DefaultType();
}
if (eType == ModuleTypeGlobal && !m_pUser->IsAdmin()) {
if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) {
PutStatus("Unable to reload global module [" + sMod + "]: Access Denied.");
return;
}
@@ -726,10 +726,10 @@ void CClient::UserCommand(CString& sLine) {
CString sModRet;
switch (eType) {
case ModuleTypeGlobal:
case CModInfo::GlobalModule:
CZNC::Get().GetModules().ReloadModule(sMod, sArgs, NULL, sModRet);
break;
case ModuleTypeUser:
case CModInfo::UserModule:
m_pUser->GetModules().ReloadModule(sMod, sArgs, m_pUser, sModRet);
break;
default:
+11 -11
View File
@@ -100,7 +100,7 @@ const CString& CTimer::GetDescription() const { return m_sDescription; }
CModule::CModule(ModHandle pDLL, CUser* pUser, const CString& sModName, const CString& sDataDir) {
m_eType = ModuleTypeUser;
m_eType = CModInfo::UserModule;
m_pDLL = pDLL;
m_pManager = &(CZNC::Get().GetManager());;
m_pUser = pUser;
@@ -577,13 +577,13 @@ 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,
EModuleType eType, bool& bSuccess, CString& sRetMsg) { return CONTINUE; }
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) { return CONTINUE; }
CModule::EModRet CModule::OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) {
return CONTINUE;
}
CModule::EModRet CModule::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
bool& bSuccess, CString& sRetMsg) { return CONTINUE; }
void CModule::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {}
void CModule::OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) {}
CModules::CModules() {
@@ -770,7 +770,7 @@ bool CModules::OnClientCapRequest(const CString& sCap, bool bState) {
}
bool CModules::OnModuleLoading(const CString& sModName, const CString& sArgs,
EModuleType eType, bool& bSuccess, CString& sRetMsg) {
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) {
MODHALTCHK(OnModuleLoading(sModName, sArgs, eType, bSuccess, sRetMsg));
}
@@ -783,7 +783,7 @@ bool CModules::OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
MODHALTCHK(OnGetModInfo(ModInfo, sModule, bSuccess, sRetMsg));
}
bool CModules::OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
bool CModules::OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) {
MODUNLOADCHK(OnGetAvailableMods(ssMods, eType));
return false;
}
@@ -799,7 +799,7 @@ CModule* CModules::FindModule(const CString& sModule) const {
return NULL;
}
bool CModules::LoadModule(const CString& sModule, const CString& sArgs, EModuleType eType, CUser* pUser, CString& sRetMsg) {
bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CModInfo::EModuleType eType, CUser* pUser, CString& sRetMsg) {
sRetMsg = "";
if (FindModule(sModule) != NULL) {
@@ -837,7 +837,7 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, EModuleT
return false;
}
if (!pUser && eType == ModuleTypeUser) {
if (!pUser && eType == CModInfo::UserModule) {
dlclose(p);
sRetMsg = "Module [" + sModule + "] requires a user.";
return false;
@@ -846,10 +846,10 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, EModuleT
CModule* pModule = NULL;
switch (eType) {
case ModuleTypeUser:
case CModInfo::UserModule:
pModule = Info.GetLoader()(p, pUser, sModule, sDataPath);
break;
case ModuleTypeGlobal:
case CModInfo::GlobalModule:
pModule = Info.GetGlobalLoader()(p, sModule, sDataPath);
break;
default:
@@ -937,7 +937,7 @@ bool CModules::ReloadModule(const CString& sModule, const CString& sArgs, CUser*
return false;
}
EModuleType eType = pModule->GetType();
CModInfo::EModuleType eType = pModule->GetType();
pModule = NULL;
sRetMsg = "";
@@ -987,7 +987,7 @@ bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const C
return true;
}
void CModules::GetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
void CModules::GetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) {
ssMods.clear();
unsigned int a = 0;
+18 -18
View File
@@ -39,11 +39,6 @@ class CModInfo;
#endif
#endif
typedef enum {
ModuleTypeGlobal,
ModuleTypeUser
} EModuleType;
typedef void* ModHandle;
template<class M> void TModInfo(CModInfo& Info) {}
@@ -105,7 +100,7 @@ template<class M> CModule* TModLoadGlobal(ModHandle p,
* @see For global modules you need GLOBALMODULEDEFS.
*/
#define MODULEDEFS(CLASS, DESCRIPTION) \
MODCOMMONDEFS(CLASS, DESCRIPTION, ModuleTypeUser, Info.SetLoader(TModLoad<CLASS>))
MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::UserModule, Info.SetLoader(TModLoad<CLASS>))
// !User Module Macros
// Global Module Macros
@@ -116,7 +111,7 @@ template<class M> CModule* TModLoadGlobal(ModHandle p,
/** This works exactly like MODULEDEFS, but for global modules. */
#define GLOBALMODULEDEFS(CLASS, DESCRIPTION) \
MODCOMMONDEFS(CLASS, DESCRIPTION, ModuleTypeGlobal, Info.SetGlobalLoader(TModLoadGlobal<CLASS>))
MODCOMMONDEFS(CLASS, DESCRIPTION, CModInfo::GlobalModule, Info.SetGlobalLoader(TModLoadGlobal<CLASS>))
// !Global Module Macros
// Forward Declarations
@@ -179,6 +174,11 @@ public:
typedef CModule* (*ModLoader)(ModHandle p, CUser* pUser, const CString& sModName, const CString& sModPath);
typedef CModule* (*GlobalModLoader)(ModHandle p, const CString& sModName, const CString& sModPath);
typedef enum {
GlobalModule,
UserModule
} EModuleType;
CModInfo() {
m_fGlobalLoader = NULL;
m_fLoader = NULL;
@@ -209,8 +209,8 @@ public:
static CString ModuleTypeToString(EModuleType eType) {
switch (eType) {
case ModuleTypeGlobal: return "Global";
case ModuleTypeUser: return "User";
case GlobalModule: return "Global";
case UserModule: return "User";
default: return "UNKNOWN";
}
}
@@ -866,14 +866,14 @@ public:
const CString& GetSavePath() const;
// Setters
void SetType(EModuleType eType) { m_eType = eType; }
void SetType(CModInfo::EModuleType eType) { m_eType = eType; }
void SetDescription(const CString& s) { m_sDescription = s; }
void SetModPath(const CString& s) { m_sModPath = s; }
void SetArgs(const CString& s) { m_sArgs = s; }
// !Setters
// Getters
EModuleType GetType() const { return m_eType; }
CModInfo::EModuleType GetType() const { return m_eType; }
const CString& GetDescription() const { return m_sDescription; }
const CString& GetArgs() const { return m_sArgs; }
const CString& GetModPath() const { return m_sModPath; }
@@ -958,7 +958,7 @@ public:
* @return See CModule::EModRet.
*/
virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
EModuleType eType, bool& bSuccess, CString& sRetMsg);
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg);
/** Called when a module is going to be unloaded.
* @param pModule the module.
* @param[out] bSuccess the module was unloaded successfully
@@ -980,11 +980,11 @@ public:
* @param ssMods put new modules here.
* @param bGlobal true if global modules are needed.
*/
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType);
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType);
// !Global Modules
protected:
EModuleType m_eType;
CModInfo::EModuleType m_eType;
CString m_sDescription;
set<CTimer*> m_sTimers;
set<CSocket*> m_sSockets;
@@ -1080,14 +1080,14 @@ public:
bool OnServerCapResult(const CString& sCap, bool bSuccess);
CModule* FindModule(const CString& sModule) const;
bool LoadModule(const CString& sModule, const CString& sArgs, EModuleType eType, CUser* pUser, CString& sRetMsg);
bool LoadModule(const CString& sModule, const CString& sArgs, CModInfo::EModuleType eType, CUser* pUser, CString& sRetMsg);
bool UnloadModule(const CString& sModule);
bool UnloadModule(const CString& sModule, CString& sRetMsg);
bool ReloadModule(const CString& sModule, const CString& sArgs, CUser* pUser, CString& sRetMsg);
static bool GetModInfo(CModInfo& ModInfo, const CString& sModule, CString &sRetMsg);
static bool GetModPathInfo(CModInfo& ModInfo, const CString& sModule, const CString& sModPath, CString &sRetMsg);
static void GetAvailableMods(set<CModInfo>& ssMods, EModuleType eType = ModuleTypeUser);
static void GetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType = CModInfo::UserModule);
// This returns the path to the .so and to the data dir
// which is where static data (webadmin skins) are saved
@@ -1109,11 +1109,11 @@ public:
bool IsClientCapSupported(const CString& sCap, bool bState);
bool OnClientCapRequest(const CString& sCap, bool bState);
bool OnModuleLoading(const CString& sModName, const CString& sArgs,
EModuleType eType, bool& bSuccess, CString& sRetMsg);
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg);
bool OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg);
bool OnGetModInfo(CModInfo& ModInfo, const CString& sModule,
bool& bSuccess, CString& sRetMsg);
bool OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType);
bool OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType);
// !Global Modules
private:
+1 -1
View File
@@ -59,7 +59,7 @@ CSocket::~CSocket() {
m_pModule->UnlinkSocket(this);
}
if (pUser && m_pModule && (m_pModule->GetType() != ModuleTypeGlobal)) {
if (pUser && m_pModule && (m_pModule->GetType() != CModInfo::GlobalModule)) {
pUser->AddBytesWritten(GetBytesWritten());
pUser->AddBytesRead(GetBytesRead());
} else {
+4 -4
View File
@@ -187,7 +187,7 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
if (sValue.ToBool()) {
CUtils::PrintAction("Loading Module [bouncedcc]");
CString sModRet;
bool bModRet = GetModules().LoadModule("bouncedcc", "", ModuleTypeUser, this, sModRet);
bool bModRet = GetModules().LoadModule("bouncedcc", "", CModInfo::UserModule, this, sModRet);
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
@@ -318,7 +318,7 @@ bool CUser::ParseConfig(CConfig* pConfig, CString& sError) {
CString sModRet;
CString sArgs = sValue.Token(1, true);
bool bModRet = GetModules().LoadModule(sModName, sArgs, ModuleTypeUser, this, sModRet);
bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, this, sModRet);
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
@@ -353,7 +353,7 @@ bool CUser::UpdateModule(const CString &sModule) {
CString sErr;
for (it2 = Affected.begin(); it2 != Affected.end(); ++it2) {
if (!it2->first->GetModules().LoadModule(sModule, it2->second, ModuleTypeUser, it2->first, sErr)) {
if (!it2->first->GetModules().LoadModule(sModule, it2->second, CModInfo::UserModule, it2->first, sErr)) {
error = true;
DEBUG("Failed to reload [" << sModule << "] for [" << it2->first->GetUserName()
<< "]: " << sErr);
@@ -696,7 +696,7 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet, bool bCloneChans) {
CModule* pCurMod = vCurMods.FindModule(pNewMod->GetModName());
if (!pCurMod) {
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), ModuleTypeUser, this, sModRet);
vCurMods.LoadModule(pNewMod->GetModName(), pNewMod->GetArgs(), CModInfo::UserModule, this, sModRet);
} else if (pNewMod->GetArgs() != pCurMod->GetArgs()) {
vCurMods.ReloadModule(pNewMod->GetModName(), pNewMod->GetArgs(), this, sModRet);
}
+2 -2
View File
@@ -639,7 +639,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
} else if (pModule->WebRequiresAdmin() && !GetSession()->IsAdmin()) {
PrintErrorPage(403, "Forbidden", "You need to be an admin to access this module");
return PAGE_DONE;
} else if (pModule->GetType() != ModuleTypeGlobal && pModule->GetUser() != GetSession()->GetUser()) {
} else if (pModule->GetType() != CModInfo::GlobalModule && pModule->GetUser() != GetSession()->GetUser()) {
PrintErrorPage(403, "Forbidden", "You must login as " + pModule->GetUser()->GetUserName() + " in order to view this page");
return PAGE_DONE;
} else if (pModule->OnWebPreRequest(*this, m_sPage)) {
@@ -659,7 +659,7 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
}
}
if (pModule && pModule->GetType() != ModuleTypeGlobal && (!IsLoggedIn() || pModule->GetUser() != GetSession()->GetUser())) {
if (pModule && pModule->GetType() != CModInfo::GlobalModule && (!IsLoggedIn() || pModule->GetUser() != GetSession()->GetUser())) {
AddModLoop("UserModLoop", *pModule);
}
+1 -1
View File
@@ -741,7 +741,7 @@ class CAdminMod : public CModule {
CModule *pMod = (pUser)->GetModules().FindModule(sModName);
if (!pMod) {
if (!(pUser)->GetModules().LoadModule(sModName, sArgs, ModuleTypeUser, pUser, sModRet)) {
if (!(pUser)->GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, pUser, sModRet)) {
PutModule("Unable to load module [" + sModName + "] [" + sModRet + "]");
} else {
PutModule("Loaded module [" + sModName + "]");
+6 -6
View File
@@ -75,8 +75,8 @@ public:
}
virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
EModuleType eType, bool& bSuccess, CString& sRetMsg) {
if (!GetUser() || eType != ModuleTypeUser) {
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) {
if (!GetUser() || eType != CModInfo::UserModule) {
return CONTINUE;
}
EModRet result = HALT;
@@ -148,7 +148,7 @@ public:
case Perl_Loaded:
result = HALT;
if (4 == ret) {
ModInfo.AddType(ModuleTypeUser);
ModInfo.AddType(CModInfo::UserModule);
ModInfo.SetDescription(PString(ST(2)));
ModInfo.SetName(sModule);
ModInfo.SetPath(PString(ST(1)));
@@ -178,8 +178,8 @@ public:
return result;
}
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
if (eType != ModuleTypeUser) {
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) {
if (eType != CModInfo::UserModule) {
return;
}
@@ -203,7 +203,7 @@ public:
PUSH_STR(sName);
PCALL("ZNC::Core::ModInfoByPath");
if (!SvTRUE(ERRSV) && ret == 2) {
ModInfo.AddType(ModuleTypeUser);
ModInfo.AddType(CModInfo::UserModule);
ModInfo.SetDescription(PString(ST(0)));
ModInfo.SetName(sName);
ModInfo.SetPath(sPath);
+4 -4
View File
@@ -127,7 +127,7 @@ public:
}
virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
EModuleType eType, bool& bSuccess, CString& sRetMsg) {
CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg) {
PyObject* pyFunc = PyObject_GetAttrString(m_PyZNCModule, "load_module");
if (!pyFunc) {
sRetMsg = GetPyExceptionStr();
@@ -139,7 +139,7 @@ public:
sModName.c_str(),
sArgs.c_str(),
(int)eType,
(eType == ModuleTypeUser ? SWIG_NewInstanceObj(GetUser(), SWIG_TypeQuery("CUser*"), 0) : Py_None),
(eType == CModInfo::UserModule ? SWIG_NewInstanceObj(GetUser(), SWIG_TypeQuery("CUser*"), 0) : Py_None),
CPyRetString::wrap(sRetMsg),
SWIG_NewInstanceObj(reinterpret_cast<CModule*>(this), SWIG_TypeQuery("CModule*"), 0));
if (!pyRes) {
@@ -250,7 +250,7 @@ public:
return HALT;
}
void TryAddModInfo(const CString& sPath, const CString& sName, set<CModInfo>& ssMods, set<CString>& ssAlready, EModuleType eType) {
void TryAddModInfo(const CString& sPath, const CString& sName, set<CModInfo>& ssMods, set<CString>& ssAlready, CModInfo::EModuleType eType) {
if (ssAlready.count(sName)) {
return;
}
@@ -286,7 +286,7 @@ public:
}
}
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, EModuleType eType) {
virtual void OnGetAvailableMods(set<CModInfo>& ssMods, CModInfo::EModuleType eType) {
CDir Dir;
CModules::ModDirList dirs = CModules::GetModDirs();
+1 -1
View File
@@ -115,7 +115,7 @@ public:
virtual void OnServerCapResult(const CString& sCap, bool bSuccess);
virtual EModRet OnTimerAutoJoin(CChan& Channel);
bool OnEmbeddedWebRequest(CWebSock&, const CString&, CTemplate&);
EModRet OnModuleLoading(const CString& sModName, const CString& sArgs, EModuleType eType, bool& bSuccess, CString& sRetMsg);
EModRet OnModuleLoading(const CString& sModName, const CString& sArgs, CModInfo::EModuleType eType, bool& bSuccess, CString& sRetMsg);
};
static inline CPyModule* AsPyModule(CModule* p) {
+4 -4
View File
@@ -272,7 +272,7 @@ public:
CString sArgs = WebSock.GetParam("modargs_" + sModName);
try {
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, ModuleTypeUser, pNewUser, sModRet)) {
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, pNewUser, sModRet)) {
sModLoadError = "Unable to load module [" + sModName + "] [" + sModRet + "]";
}
} catch (...) {
@@ -295,7 +295,7 @@ public:
CString sModLoadError;
try {
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, ModuleTypeUser, pNewUser, sModRet)) {
if (!pNewUser->GetModules().LoadModule(sModName, sArgs, CModInfo::UserModule, pNewUser, sModRet)) {
sModLoadError = "Unable to load module [" + sModName + "] [" + sModRet + "]";
}
} catch (...) {
@@ -1008,7 +1008,7 @@ public:
}
set<CModInfo> ssGlobalMods;
CZNC::Get().GetModules().GetAvailableMods(ssGlobalMods, ModuleTypeGlobal);
CZNC::Get().GetModules().GetAvailableMods(ssGlobalMods, CModInfo::GlobalModule);
for (set<CModInfo>::iterator it = ssGlobalMods.begin(); it != ssGlobalMods.end(); ++it) {
const CModInfo& Info = *it;
@@ -1071,7 +1071,7 @@ public:
CModule *pMod = CZNC::Get().GetModules().FindModule(sModName);
if (!pMod) {
if (!CZNC::Get().GetModules().LoadModule(sModName, sArgs, ModuleTypeGlobal, NULL, sModRet)) {
if (!CZNC::Get().GetModules().LoadModule(sModName, sArgs, CModInfo::GlobalModule, NULL, sModRet)) {
sModLoadError = "Unable to load module [" + sModName + "] [" + sModRet + "]";
}
} else if (pMod->GetArgs() != sArgs) {
+3 -3
View File
@@ -631,7 +631,7 @@ bool CZNC::WriteNewConfig(const CString& sConfigFile) {
// !Listen
set<CModInfo> ssGlobalMods;
GetModules().GetAvailableMods(ssGlobalMods, ModuleTypeGlobal);
GetModules().GetAvailableMods(ssGlobalMods, CModInfo::GlobalModule);
size_t uNrOtherGlobalMods = FilterUncommonModules(ssGlobalMods);
if (!ssGlobalMods.empty()) {
@@ -1057,7 +1057,7 @@ bool CZNC::DoRehash(CString& sError)
if (!pOldMod) {
CUtils::PrintAction("Loading Global Module [" + sModName + "]");
bool bModRet = GetModules().LoadModule(sModName, sArgs, ModuleTypeGlobal, NULL, sModRet);
bool bModRet = GetModules().LoadModule(sModName, sArgs, CModInfo::GlobalModule, NULL, sModRet);
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {
@@ -1089,7 +1089,7 @@ bool CZNC::DoRehash(CString& sError)
CUtils::PrintAction("Loading Global Module [identfile]");
CString sModRet;
bool bModRet = GetModules().LoadModule("identfile", "", ModuleTypeGlobal, NULL, sModRet);
bool bModRet = GetModules().LoadModule("identfile", "", CModInfo::GlobalModule, NULL, sModRet);
CUtils::PrintStatus(bModRet, sModRet);
if (!bModRet) {