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
This commit is contained in:
prozacx
2005-04-26 07:14:18 +00:00
parent b0f2874f8b
commit c20ffc1c87
+25
View File
@@ -57,6 +57,10 @@ bool CUser::AddAllowedHost(const string& sHostMask) {
}
bool CUser::IsHostAllowed(const string& sHostMask) {
if (m_ssAllowedHosts.empty()) {
return true;
}
for (set<string>::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;