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
+6 -8
View File
@@ -782,13 +782,13 @@ bool CZNC::ParseConfig(const CString& sConfig) {
} else if (sTag.CaseCmp("User") == 0) { } else if (sTag.CaseCmp("User") == 0) {
CString sErr; CString sErr;
if (!pUser->IsValid(sErr)) { if (!AddUser(pUser, sErr)) {
CUtils::PrintError("Invalid user [" + pUser->GetUserName() + "] " + sErr); CUtils::PrintError("Invalid user [" + pUser->GetUserName() + "] " + sErr);
pUser->SetBeingDeleted(true);
delete pUser;
return false; return false;
} }
AddUser(pUser);
pUser = NULL; pUser = NULL;
continue; continue;
} }
@@ -1204,15 +1204,13 @@ bool CZNC::DeleteUser(const CString& sUsername) {
return true; return true;
} }
bool CZNC::AddUser(CUser* pUser) { bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
CString sErr; if (pUser->IsValid(sErrorRet)) {
if (pUser->IsValid(sErr)) {
m_msUsers[pUser->GetUserName()] = pUser; m_msUsers[pUser->GetUserName()] = pUser;
return true; return true;
} }
DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "] - [" << sErr << "]" << endl); DEBUG_ONLY(cout << "Invalid user [" << pUser->GetUserName() << "] - [" << sErrorRet << "]" << endl);
return false; return false;
} }
+1 -1
View File
@@ -135,7 +135,7 @@ public:
static CZNC& Get(); static CZNC& Get();
CUser* FindUser(const CString& sUsername); CUser* FindUser(const CString& sUsername);
bool DeleteUser(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 ); } const map<CString,CUser*> & GetUserMap() const { return( m_msUsers ); }
// Message of the Day // Message of the Day