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;