do not call OnAddUser hook during ZNC startup

This commit is contained in:
Thomas Kriechbaumer
2015-03-21 15:22:43 +00:00
parent 28bb50fa1a
commit a56d4cae6a
2 changed files with 9 additions and 4 deletions
+1 -1
View File
@@ -154,7 +154,7 @@ public:
bool UpdateModule(const CString &sModule);
bool DeleteUser(const CString& sUsername);
bool AddUser(CUser* pUser, CString& sErrorRet);
bool AddUser(CUser* pUser, CString& sErrorRet, bool bStartup = false);
const std::map<CString,CUser*> & GetUserMap() const { return(m_msUsers); }
// Listener yummy
+8 -3
View File
@@ -1168,7 +1168,7 @@ bool CZNC::LoadUsers(CConfig& config, CString& sError) {
}
CString sErr;
if (!AddUser(pUser, sErr)) {
if (!AddUser(pUser, sErr, true)) {
sError = "Invalid user [" + pUser->GetUserName() + "] " + sErr;
}
@@ -1466,7 +1466,7 @@ bool CZNC::DeleteUser(const CString& sUsername) {
return true;
}
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
bool CZNC::AddUser(CUser* pUser, CString& sErrorRet, bool bStartup) {
if (FindUser(pUser->GetUserName()) != nullptr) {
sErrorRet = "User already exists";
DEBUG("User [" << pUser->GetUserName() << "] - already exists");
@@ -1478,7 +1478,12 @@ bool CZNC::AddUser(CUser* pUser, CString& sErrorRet) {
return false;
}
bool bFailed = false;
GLOBALMODULECALL(OnAddUser(*pUser, sErrorRet), &bFailed);
// do not call OnAddUser hook during ZNC startup
if (!bStartup) {
GLOBALMODULECALL(OnAddUser(*pUser, sErrorRet), &bFailed);
}
if (bFailed) {
DEBUG("AddUser [" << pUser->GetUserName() << "] aborted by a module ["
<< sErrorRet << "]");