mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01: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:
14
znc.cpp
14
znc.cpp
@@ -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
2
znc.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user