Add CClient::IsPlaybackActive()

To let modules know whether a client is currently in playback mode.
The clientbuffer module (#343) wants to update "last seen message"
timestamps in OnSendToClient() but it must avoid doing that while
in playback mode.
This commit is contained in:
J-P Nurmi
2014-11-14 00:14:49 +01:00
parent 1b7c637dbd
commit efe1e1ee91
4 changed files with 19 additions and 0 deletions
+5
View File
@@ -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;
}
+4
View File
@@ -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. "
+5
View File
@@ -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;
}