diff --git a/include/znc/Client.h b/include/znc/Client.h index 855357e5..cecca215 100644 --- a/include/znc/Client.h +++ b/include/znc/Client.h @@ -96,6 +96,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 ;) @@ -128,6 +129,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); @@ -175,6 +179,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 21bf6c8d..b4619065 100644 --- a/src/Chan.cpp +++ b/src/Chan.cpp @@ -580,6 +580,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); @@ -618,6 +621,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 607488b1..e06aa671 100644 --- a/src/IRCNetwork.cpp +++ b/src/IRCNetwork.cpp @@ -569,6 +569,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 { @@ -646,6 +648,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 2432e71f..a69eaef1 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; }