From c20ffc1c87b41154fc4afd62e8c61e4494c0bcc7 Mon Sep 17 00:00:00 2001 From: prozacx Date: Tue, 26 Apr 2005 07:14:18 +0000 Subject: [PATCH] Added IsValid() and Changed behavior of allowed hosts to accept * on no allow defined git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@188 726aef4b-f618-498e-8847-2d620e286838 --- User.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/User.cpp b/User.cpp index f7ea7805..d4c81986 100644 --- a/User.cpp +++ b/User.cpp @@ -57,6 +57,10 @@ bool CUser::AddAllowedHost(const string& sHostMask) { } bool CUser::IsHostAllowed(const string& sHostMask) { + if (m_ssAllowedHosts.empty()) { + return true; + } + for (set::iterator a = m_ssAllowedHosts.begin(); a != m_ssAllowedHosts.end(); a++) { if (CUtils::wildcmp(*a, sHostMask)) { return true; @@ -66,6 +70,27 @@ bool CUser::IsHostAllowed(const string& sHostMask) { return false; } +bool CUser::IsValid(string& sErrMsg) { + sErrMsg.clear(); + + if (m_sPass.empty()) { + sErrMsg = "Pass is empty"; + return false; + } + + if (m_sUserName.empty()) { + sErrMsg = "User is empty"; + return false; + } + + if (m_vServers.empty()) { + sErrMsg = "No servers defined"; + return false; + } + + return true; +} + bool CUser::AddChan(CChan* pChan) { if (!pChan) { return false;