From 0ca689f2eb8c185af31cd0c5ebe11188ac238677 Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 1 Jan 2011 22:57:54 +0000 Subject: [PATCH] webmods: Fix One of my recent commits made webmods only find user modules instead of global modules. This worked before because m_sForcedUser was an empty string which made the code look for global modules. This commit adds an explicit check for global modules which hopefully fixes all problems. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2238 726aef4b-f618-498e-8847-2d620e286838 --- WebModules.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/WebModules.cpp b/WebModules.cpp index 1a0d53fb..db95646d 100644 --- a/WebModules.cpp +++ b/WebModules.cpp @@ -558,11 +558,15 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS return PrintTemplate("modlist", sPageRet); } - if (!ForceLogin()) { - return PAGE_DONE; - } + CModule *pModule = CZNC::Get().GetModules().FindModule(m_sModName); + if (!pModule) { + // Check if GetSession()->GetUser() is NULL and display + // an error in that case + if (!ForceLogin()) + return PAGE_DONE; - CModule* pModule = CZNC::Get().FindModule(m_sModName, GetSession()->GetUser()); + pModule = GetSession()->GetUser()->GetModules().FindModule(m_sModName); + } if (!pModule) { return PAGE_NOTFOUND;