Add OnUserQuit() for extending clearbufferonmsg

Add OnUserQuit() callback. On smartphone, user doesn't want to see
same lines repeatedly. But, meanwhile, user doesn't want to miss lines
when connection was lost.

To do it, this uses OnUserQuit() callback. With this callback,
clearbufferonmsg can clear buffer if user quited client explicitly.
And when connection was lost, buffer is still not cleared.
This commit is contained in:
OGAWA Hirofumi
2015-02-22 04:02:39 +09:00
parent c0abef2c00
commit feec20b013
9 changed files with 17 additions and 0 deletions

View File

@@ -198,6 +198,8 @@ void CClient::ReadLine(const CString& sData) {
// Block PONGs, we already responded to the pings
return;
} else if (sCommand.Equals("QUIT")) {
CString sMsg = sLine.Token(1, true).TrimPrefix_n();
NETWORKMODULECALL(OnUserQuit(sMsg), m_pUser, m_pNetwork, this, NOTHING);
Close(Csock::CLT_AFTERWRITE); // Treat a client quit as a detach
return; // Don't forward this msg. We don't want the client getting us disconnected.
} else if (sCommand.Equals("PROTOCTL")) {