From b0f37a817b2e920f3a2ec1e8792e75bb33147b2b Mon Sep 17 00:00:00 2001 From: prozacx Date: Mon, 16 May 2005 05:39:34 +0000 Subject: [PATCH] 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 --- Modules.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/Modules.cpp b/Modules.cpp index 6ef52c82..baee7ef0 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -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);