diff --git a/User.cpp b/User.cpp index fb70d267..76e4830a 100644 --- a/User.cpp +++ b/User.cpp @@ -473,6 +473,27 @@ const CString& CUser::GetRealName() const { return m_sRealName; } const CString& CUser::GetVHost() const { return m_sVHost; } const CString& CUser::GetPass() const { return m_sPass; } +CString CUser::FindModPath(const CString& sModule) const { + CString sModPath = GetCurPath() + "/modules/" + sModule + ".so"; + + if (!CFile::Exists(sModPath)) { + DEBUG_ONLY(cout << "[" << sModPath << "] Not found..." << endl); + sModPath = 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); + return ""; + } + } + } + + return sModPath; +} + const CString& CUser::GetCurPath() const { return m_pZNC->GetCurPath(); } const CString& CUser::GetDLPath() const { return m_pZNC->GetDLPath(); } const CString& CUser::GetModPath() const { return m_pZNC->GetModPath(); } diff --git a/User.h b/User.h index f5fb5b8d..00efd96c 100644 --- a/User.h +++ b/User.h @@ -95,6 +95,7 @@ public: const CString& GetVHost() const; const CString& GetPass() const; + CString FindModPath(const CString& sModule) const; const CString& GetCurPath() const; const CString& GetDLPath() const; const CString& GetModPath() const;