From a773c13f69e34d1e987e765e5148aea43d4da4fd Mon Sep 17 00:00:00 2001 From: psychon Date: Sat, 24 May 2008 21:12:53 +0000 Subject: [PATCH] Add bAdminOnly and pSkipClient arguments to CZNC::Broadcast git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1070 726aef4b-f618-498e-8847-2d620e286838 --- znc.cpp | 11 ++++++++--- znc.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/znc.cpp b/znc.cpp index 936cb27f..46d1c3f6 100644 --- a/znc.cpp +++ b/znc.cpp @@ -1573,12 +1573,17 @@ bool CZNC::RemVHost(const CString& sHost) { return true; } -void CZNC::Broadcast(const CString& sMessage, CUser* pUser) { +void CZNC::Broadcast(const CString& sMessage, bool bAdminOnly, + CUser* pSkipUser, CClient *pSkipClient) { for (map::iterator a = m_msUsers.begin(); a != m_msUsers.end(); a++) { - if (a->second != pUser) { + if (bAdminOnly && !a->second->IsAdmin()) + continue; + + if (a->second != pSkipUser) { CString sMsg = sMessage; + MODULECALL(OnBroadcast(sMsg), a->second, NULL, continue); - a->second->PutStatusNotice("*** " + sMsg); + a->second->PutStatusNotice("*** " + sMsg, NULL, pSkipClient); } } } diff --git a/znc.h b/znc.h index 9850f787..2974ccc6 100644 --- a/znc.h +++ b/znc.h @@ -116,7 +116,8 @@ public: void ClearVHosts(); bool AddVHost(const CString& sHost); bool RemVHost(const CString& sHost); - void Broadcast(const CString& sMessage, CUser* pUser = NULL); + void Broadcast(const CString& sMessage, bool bAdminOnly = false, + CUser* pSkipUser = NULL, CClient* pSkipClient = NULL); void AddBytesRead(unsigned long long u) { m_uBytesRead += u; } void AddBytesWritten(unsigned long long u) { m_uBytesWritten += u; } unsigned long long BytesRead() const { return m_uBytesRead; }