mirror of
https://github.com/znc/znc.git
synced 2026-08-10 19:02:51 +02:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user