Moved code for finding module path to CUser::FindModPath()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@319 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-05-16 05:39:34 +00:00
parent af02c09235
commit b0f37a817b

View File

@@ -6,10 +6,6 @@
#include "Nick.h"
#include "Chan.h"
#ifndef _MODDIR_
#define _MODDIR_ "/usr/share/znc"
#endif
#define MODUNLOADCHK(func) \
for (unsigned int a = 0; a < size(); a++) { \
try { \
@@ -478,22 +474,11 @@ bool CModules::LoadModule(const CString& sModule, const CString& sArgs, CUser* p
return false;
}
CString sModPath = pUser->GetCurPath() + "/modules/" + sModule + ".so";
CString sModPath = pUser->FindModPath(sModule);
if (!CFile::Exists(sModPath)) {
DEBUG_ONLY(cout << "[" << sModPath << "] Not found..." << endl);
sModPath = pUser->GetModPath() + "/" + sModule + ".so";
if (!CFile::Exists(sModPath)) {
DEBUG_ONLY(cout << "[" << sModPath << "] Not found..." << endl);
sModPath = _MODDIR_ + CString("/") + sModule + ".so";
if (!CFile::Exists(sModPath)) {
DEBUG_ONLY(cout << "[" << sModPath << "] Not found... giving up!" << endl);
sRetMsg = "Unable to find module [" + sModule + "]";
return false;
}
}
if (sModPath.empty()) {
sRetMsg = "Unable to find module [" + sModule + "]";
return false;
}
void* p = dlopen((sModPath).c_str(), RTLD_LAZY);