mirror of
https://github.com/znc/znc.git
synced 2026-05-01 11:02:27 +02:00
Add CChan::SendBuffer(client, buffer) overload
This allows interested parties eg. modules to to send a partial buffer playback without reinventing the wheel.
This commit is contained in:
10
src/Chan.cpp
10
src/Chan.cpp
@@ -526,6 +526,10 @@ CNick* CChan::FindNick(const CString& sNick) {
|
||||
}
|
||||
|
||||
void CChan::SendBuffer(CClient* pClient) {
|
||||
SendBuffer(pClient, m_Buffer);
|
||||
}
|
||||
|
||||
void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) {
|
||||
if (m_pNetwork && m_pNetwork->IsUserAttached()) {
|
||||
// in the event that pClient is NULL, need to send this to all clients for the user
|
||||
// I'm presuming here that pClient is listed inside vClients thus vClients at this
|
||||
@@ -541,7 +545,7 @@ void CChan::SendBuffer(CClient* pClient) {
|
||||
// if pClient is not NULL, the loops break after the first iteration.
|
||||
//
|
||||
// Rework this if you like ...
|
||||
if (!m_Buffer.IsEmpty()) {
|
||||
if (!Buffer.IsEmpty()) {
|
||||
const vector<CClient*> & vClients = m_pNetwork->GetClients();
|
||||
for (size_t uClient = 0; uClient < vClients.size(); ++uClient) {
|
||||
CClient * pUseClient = (pClient ? pClient : vClients[uClient]);
|
||||
@@ -553,9 +557,9 @@ void CChan::SendBuffer(CClient* pClient) {
|
||||
m_pNetwork->PutUser(":***!znc@znc.in PRIVMSG " + GetName() + " :Buffer Playback...", pUseClient);
|
||||
}
|
||||
|
||||
size_t uSize = m_Buffer.Size();
|
||||
size_t uSize = Buffer.Size();
|
||||
for (size_t uIdx = 0; uIdx < uSize; uIdx++) {
|
||||
CString sLine = m_Buffer.GetLine(uIdx, *pUseClient);
|
||||
CString sLine = Buffer.GetLine(uIdx, *pUseClient);
|
||||
bool bNotShowThisLine = false;
|
||||
NETWORKMODULECALL(OnChanBufferPlayLine(*this, *pUseClient, sLine), m_pNetwork->GetUser(), m_pNetwork, NULL, &bNotShowThisLine);
|
||||
if (bNotShowThisLine) continue;
|
||||
|
||||
Reference in New Issue
Block a user