mirror of
https://github.com/znc/znc.git
synced 2026-08-06 17:03:14 +02:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user