Check in CZNC::AddUser() if the username is still available

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1346 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-01-25 11:12:36 +00:00
parent 74f9f3e864
commit 48ee5c71c5
+11 -5
View File
@@ -1694,13 +1694,19 @@ bool CZNC::DeleteUser(const CString& sUsername) {
}
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
if (pUser->IsValid(sErrorRet)) {
m_msUsers[pUser->GetUserName()] = pUser;
return true;
if (FindUser(pUser->GetUserName()) != NULL) {
DEBUG_ONLY(cout << "User [" << pUser->GetUserName() << "]"
" - already exists" << endl);
return false;
}
if (!pUser->IsValid(sErrorRet)) {
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "]"
" - [" << sErrorRet << "]" << endl);
return false;
}
m_msUsers[pUser->GetUserName()] = pUser;
return true;
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "] - [" << sErrorRet << "]" << endl);
return false;
}
CZNC& CZNC::Get() {