From c55237be0b576da3a1f52c0b07098425a6490a5c Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Fri, 28 Oct 2022 23:18:43 +0100 Subject: [PATCH] Make CUser::Put* send to all clients Instead of only networkless clients, which is a very rare case, because most clients are connected to some network. This resulted in CModule::PutModule to sometimes have no effect. I fixed CUser::PutStatus and PutStatusNotice back in 2011 in 0b6d609014e6795773481b71c3428891a350d609, but missed these 3 functions. Deprecate CUser::PutAllUser() which is now essentially alias to CUser::PutUser(). --- include/znc/User.h | 5 ++++- src/User.cpp | 11 ++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/znc/User.h b/include/znc/User.h index f9f42962..c7ce2fae 100644 --- a/include/znc/User.h +++ b/include/znc/User.h @@ -93,7 +93,10 @@ class CUser : private CCoreTranslationMixin { bool PutUser(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr); bool PutAllUser(const CString& sLine, CClient* pClient = nullptr, - CClient* pSkipClient = nullptr); + CClient* pSkipClient = nullptr) + ZNC_MSG_DEPRECATED("Use PutUser() instead") { + return PutUser(sLine, pClient, pSkipClient); + } bool PutStatus(const CString& sLine, CClient* pClient = nullptr, CClient* pSkipClient = nullptr); bool PutStatusNotice(const CString& sLine, CClient* pClient = nullptr, diff --git a/src/User.cpp b/src/User.cpp index 16624adb..edc109b1 100644 --- a/src/User.cpp +++ b/src/User.cpp @@ -1105,13 +1105,6 @@ bool CUser::PutUser(const CString& sLine, CClient* pClient, } } - return (pClient == nullptr); -} - -bool CUser::PutAllUser(const CString& sLine, CClient* pClient, - CClient* pSkipClient) { - PutUser(sLine, pClient, pSkipClient); - for (CIRCNetwork* pNetwork : m_vIRCNetworks) { if (pNetwork->PutUser(sLine, pClient, pSkipClient)) { return true; @@ -1157,7 +1150,7 @@ bool CUser::PutStatusNotice(const CString& sLine, CClient* pClient, bool CUser::PutModule(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) { - for (CClient* pEachClient : m_vClients) { + for (CClient* pEachClient : GetAllClients()) { if ((!pClient || pClient == pEachClient) && pSkipClient != pEachClient) { pEachClient->PutModule(sModule, sLine); @@ -1173,7 +1166,7 @@ bool CUser::PutModule(const CString& sModule, const CString& sLine, bool CUser::PutModNotice(const CString& sModule, const CString& sLine, CClient* pClient, CClient* pSkipClient) { - for (CClient* pEachClient : m_vClients) { + for (CClient* pEachClient : GetAllClients()) { if ((!pClient || pClient == pEachClient) && pSkipClient != pEachClient) { pEachClient->PutModNotice(sModule, sLine);