Added code to let CUser know it is being deleted, and added error return to AddUser()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@725 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2006-04-29 19:38:56 +00:00
parent 48c0f4fce4
commit e8d176ea93
2 changed files with 7 additions and 9 deletions

14
znc.cpp
View File

@@ -782,13 +782,13 @@ bool CZNC::ParseConfig(const CString& sConfig) {
} else if (sTag.CaseCmp("User") == 0) {
CString sErr;
if (!pUser->IsValid(sErr)) {
if (!AddUser(pUser, sErr)) {
CUtils::PrintError("Invalid user [" + pUser->GetUserName() + "] " + sErr);
pUser->SetBeingDeleted(true);
delete pUser;
return false;
}
AddUser(pUser);
pUser = NULL;
continue;
}
@@ -1204,15 +1204,13 @@ bool CZNC::DeleteUser(const CString& sUsername) {
return true;
}
bool CZNC::AddUser(CUser* pUser) {
CString sErr;
if (pUser->IsValid(sErr)) {
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
if (pUser->IsValid(sErrorRet)) {
m_msUsers[pUser->GetUserName()] = pUser;
return true;
}
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "] - [" << sErr << "]" << endl);
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "] - [" << sErrorRet << "]" << endl);
return false;
}

2
znc.h
View File

@@ -135,7 +135,7 @@ public:
static CZNC& Get();
CUser* FindUser(const CString& sUsername);
bool DeleteUser(const CString& sUsername);
bool AddUser(CUser* pUser);
bool AddUser(CUser* pUser, CString& sErrorRet);
const map<CString,CUser*> & GetUserMap() const { return( m_msUsers ); }
// Message of the Day