mirror of
https://github.com/znc/znc.git
synced 2026-05-03 03:52:33 +02:00
Changed module load order, bindir/modules -> homedir/.znc/modules -> _MODDIR_
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@76 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
25
Modules.cpp
25
Modules.cpp
@@ -497,27 +497,27 @@ bool CModules::LoadModule(const string& sModule, const string& sArgs, CUser* pUs
|
||||
return false;
|
||||
}
|
||||
|
||||
string sModPath = pUser->GetModPath();
|
||||
string sModPath = pUser->GetBinPath() + "/modules/" + sModule + ".so";
|
||||
|
||||
if (!CFile::Exists(sModPath + "/" + sModule + ".so")) {
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "/" << sModule << ".so] Not found..." << endl);
|
||||
sModPath = _MODDIR_;
|
||||
if (!CFile::Exists(sModPath)) {
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "] Not found..." << endl);
|
||||
sModPath = pUser->GetModPath() + "/" + sModule + ".so";
|
||||
|
||||
if (!CFile::Exists(sModPath + "/" + sModule + ".so"))
|
||||
if (!CFile::Exists(sModPath))
|
||||
{
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "/" << sModule << ".so] Not found..." << endl);
|
||||
sModPath = pUser->GetBinPath() + "/modules";
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "] Not found..." << endl);
|
||||
sModPath = _MODDIR_ + string("/") + sModule + ".so";
|
||||
|
||||
if (!CFile::Exists(sModPath + "/" + sModule + ".so"))
|
||||
if (!CFile::Exists(sModPath))
|
||||
{
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "/" << sModule << ".so] Not found... giving up!" << endl);
|
||||
sRetMsg = "Unable to load module [" + sModule + "] No such module.";
|
||||
DEBUG_ONLY(cout << "[" << sModPath << "] Not found... giving up!" << endl);
|
||||
sRetMsg = "Unable to find module [" + sModule + "]";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void* p = dlopen((sModPath + "/" + sModule + ".so").c_str(), RTLD_LAZY);
|
||||
void* p = dlopen((sModPath).c_str(), RTLD_LAZY);
|
||||
|
||||
if (!p) {
|
||||
sRetMsg = "Unable to load module [" + sModule + "] [" + dlerror() + "]";
|
||||
@@ -526,6 +526,7 @@ bool CModules::LoadModule(const string& sModule, const string& sArgs, CUser* pUs
|
||||
|
||||
typedef double (*fpp)();
|
||||
fpp Version = (fpp) dlsym(p, "GetVersion");
|
||||
|
||||
if (!Version) {
|
||||
dlclose(p);
|
||||
sRetMsg = "Could not find Version() in module [" + sModule + "]";
|
||||
@@ -556,7 +557,7 @@ bool CModules::LoadModule(const string& sModule, const string& sArgs, CUser* pUs
|
||||
return false;
|
||||
}
|
||||
|
||||
sRetMsg = "Loaded module [" + sModule + "]";
|
||||
sRetMsg = "Loaded module [" + sModule + "] [" + sModPath + "]";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user