diff --git a/include/znc/Client.h b/include/znc/Client.h index 16998214..072cd570 100644 --- a/include/znc/Client.h +++ b/include/znc/Client.h @@ -97,6 +97,7 @@ public: m_bServerTime = false; m_bBatch = false; m_bSelfMessage = false; + m_bPlaybackActive = false; EnableReadLine(); // RFC says a line can have 512 chars max, but we are // a little more gentle ;) @@ -129,6 +130,9 @@ public: void BouncedOff(); bool IsAttached() const { return m_pUser != NULL; } + bool IsPlaybackActive() const { return m_bPlaybackActive; } + void SetPlaybackActive(bool bActive) { m_bPlaybackActive = bActive; } + void PutIRC(const CString& sLine); void PutClient(const CString& sLine); unsigned int PutStatus(const CTable& table); @@ -176,6 +180,7 @@ protected: bool m_bServerTime; bool m_bBatch; bool m_bSelfMessage; + bool m_bPlaybackActive; CUser* m_pUser; CIRCNetwork* m_pNetwork; CString m_sNick; diff --git a/src/Chan.cpp b/src/Chan.cpp index 6f0534c4..4b409668 100644 --- a/src/Chan.cpp +++ b/src/Chan.cpp @@ -578,6 +578,9 @@ void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) { for (size_t uClient = 0; uClient < vClients.size(); ++uClient) { CClient * pUseClient = (pClient ? pClient : vClients[uClient]); + bool bWasPlaybackActive = pUseClient->IsPlaybackActive(); + pUseClient->SetPlaybackActive(true); + bool bSkipStatusMsg = pUseClient->HasServerTime(); NETWORKMODULECALL(OnChanBufferStarting(*this, *pUseClient), m_pNetwork->GetUser(), m_pNetwork, NULL, &bSkipStatusMsg); @@ -617,6 +620,8 @@ void CChan::SendBuffer(CClient* pClient, const CBuffer& Buffer) { m_pNetwork->PutUser(":znc.in BATCH -" + sBatchName, pUseClient); } + pUseClient->SetPlaybackActive(bWasPlaybackActive); + if (pClient) break; } diff --git a/src/IRCNetwork.cpp b/src/IRCNetwork.cpp index 646331de..28dd3a6d 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -579,6 +579,8 @@ void CIRCNetwork::ClientConnected(CClient *pClient) { size_t uIdx, uSize; + pClient->SetPlaybackActive(true); + if (m_RawBuffer.IsEmpty()) { pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() + " :- Welcome to ZNC -"); } else { @@ -657,6 +659,8 @@ void CIRCNetwork::ClientConnected(CClient *pClient) { } m_NoticeBuffer.Clear(); + pClient->SetPlaybackActive(false); + // Tell them why they won't connect if (!GetIRCConnectEnabled()) pClient->PutStatus("You are currently disconnected from IRC. " diff --git a/src/Query.cpp b/src/Query.cpp index 45dc6faf..d6e3f534 100644 --- a/src/Query.cpp +++ b/src/Query.cpp @@ -44,6 +44,9 @@ void CQuery::SendBuffer(CClient* pClient, const CBuffer& Buffer) { for (size_t uClient = 0; uClient < vClients.size(); ++uClient) { CClient * pUseClient = (pClient ? pClient : vClients[uClient]); + bool bWasPlaybackActive = pUseClient->IsPlaybackActive(); + pUseClient->SetPlaybackActive(true); + bool bBatch = pUseClient->HasBatch(); CString sBatchName = m_sName.MD5(); @@ -78,6 +81,8 @@ void CQuery::SendBuffer(CClient* pClient, const CBuffer& Buffer) { m_pNetwork->PutUser(":znc.in BATCH -" + sBatchName, pUseClient); } + pUseClient->SetPlaybackActive(bWasPlaybackActive); + if (pClient) break; }