mirror of
https://github.com/znc/znc.git
synced 2026-08-06 08:52:57 +02:00
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:
@@ -720,6 +720,10 @@ public:
|
||||
* @return See CModule::EModRet.
|
||||
*/
|
||||
virtual EModRet OnUserTopicRequest(CString& sChannel);
|
||||
/** This module hook is called when a user requests to quit from network.
|
||||
* @param sMessage The quit message the client sent.
|
||||
*/
|
||||
virtual void OnUserQuit(CString& sMessage);
|
||||
|
||||
/** Called when we receive a CTCP reply <em>from IRC</em>.
|
||||
* @param Nick The nick the CTCP reply is from.
|
||||
@@ -1190,6 +1194,7 @@ public:
|
||||
bool OnUserPart(CString& sChannel, CString& sMessage);
|
||||
bool OnUserTopic(CString& sChannel, CString& sTopic);
|
||||
bool OnUserTopicRequest(CString& sChannel);
|
||||
bool OnUserQuit(CString& sMessage);
|
||||
|
||||
bool OnCTCPReply(CNick& Nick, CString& sMessage);
|
||||
bool OnPrivCTCP(CNick& Nick, CString& sMessage);
|
||||
|
||||
@@ -47,6 +47,7 @@ EModRet OnUserJoin(CString& sChannel, CString& sKey)
|
||||
EModRet OnUserPart(CString& sChannel, CString& sMessage)
|
||||
EModRet OnUserTopic(CString& sChannel, CString& sTopic)
|
||||
EModRet OnUserTopicRequest(CString& sChannel)
|
||||
void OnUserQuit(CString& sMessage)
|
||||
EModRet OnCTCPReply(CNick& Nick, CString& sMessage)
|
||||
EModRet OnPrivCTCP(CNick& Nick, CString& sMessage)
|
||||
EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage)
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
virtual EModRet OnUserJoin(CString& sChannel, CString& sKey) override;
|
||||
virtual EModRet OnUserPart(CString& sChannel, CString& sMessage) override;
|
||||
virtual EModRet OnUserTopic(CString& sChannel, CString& sTopic) override;
|
||||
virtual void OnUserQuit(CString& sMessage) override;
|
||||
virtual EModRet OnUserTopicRequest(CString& sChannel) override;
|
||||
virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage) override;
|
||||
virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage) override;
|
||||
|
||||
@@ -356,6 +356,7 @@ sub OnUserJoin {}
|
||||
sub OnUserPart {}
|
||||
sub OnUserTopic {}
|
||||
sub OnUserTopicRequest {}
|
||||
sub OnUserQuit {}
|
||||
sub OnCTCPReply {}
|
||||
sub OnPrivCTCP {}
|
||||
sub OnChanCTCP {}
|
||||
|
||||
@@ -47,6 +47,7 @@ EModRet OnUserJoin(CString& sChannel, CString& sKey)
|
||||
EModRet OnUserPart(CString& sChannel, CString& sMessage)
|
||||
EModRet OnUserTopic(CString& sChannel, CString& sTopic)
|
||||
EModRet OnUserTopicRequest(CString& sChannel)
|
||||
void OnUserQuit(CString& sMessage)
|
||||
EModRet OnCTCPReply(CNick& Nick, CString& sMessage)
|
||||
EModRet OnPrivCTCP(CNick& Nick, CString& sMessage)
|
||||
EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage)
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
virtual EModRet OnUserPart(CString& sChannel, CString& sMessage) override;
|
||||
virtual EModRet OnUserTopic(CString& sChannel, CString& sTopic) override;
|
||||
virtual EModRet OnUserTopicRequest(CString& sChannel) override;
|
||||
virtual void OnUserQuit(CString& sMessage) override;
|
||||
virtual EModRet OnCTCPReply(CNick& Nick, CString& sMessage) override;
|
||||
virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage) override;
|
||||
virtual EModRet OnChanCTCP(CNick& Nick, CChan& Channel, CString& sMessage) override;
|
||||
|
||||
@@ -339,6 +339,9 @@ class Module:
|
||||
def OnUserTopicRequest(self, sChannel):
|
||||
pass
|
||||
|
||||
def OnUserQuit(self, sMessage):
|
||||
pass
|
||||
|
||||
def OnCTCPReply(self, Nick, sMessage):
|
||||
pass
|
||||
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
@@ -693,6 +693,7 @@ CModule::EModRet CModule::OnUserJoin(CString& sChannel, CString& sKey) { return
|
||||
CModule::EModRet CModule::OnUserPart(CString& sChannel, CString& sMessage) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnUserTopic(CString& sChannel, CString& sTopic) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnUserTopicRequest(CString& sChannel) { return CONTINUE; }
|
||||
void CModule::OnUserQuit(CString& sMessage) {}
|
||||
|
||||
CModule::EModRet CModule::OnCTCPReply(CNick& Nick, CString& sMessage) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnPrivCTCP(CNick& Nick, CString& sMessage) { return CONTINUE; }
|
||||
@@ -854,6 +855,7 @@ bool CModules::OnUserJoin(CString& sChannel, CString& sKey) { MODHALTCHK(OnUserJ
|
||||
bool CModules::OnUserPart(CString& sChannel, CString& sMessage) { MODHALTCHK(OnUserPart(sChannel, sMessage)); }
|
||||
bool CModules::OnUserTopic(CString& sChannel, CString& sTopic) { MODHALTCHK(OnUserTopic(sChannel, sTopic)); }
|
||||
bool CModules::OnUserTopicRequest(CString& sChannel) { MODHALTCHK(OnUserTopicRequest(sChannel)); }
|
||||
bool CModules::OnUserQuit(CString& sMessage) { MODUNLOADCHK(OnUserQuit(sMessage)); return false; }
|
||||
|
||||
bool CModules::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) { MODUNLOADCHK(OnQuit(Nick, sMessage, vChans)); return false; }
|
||||
bool CModules::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) { MODUNLOADCHK(OnNick(Nick, sNewNick, vChans)); return false; }
|
||||
|
||||
Reference in New Issue
Block a user