Log user quit messages

Since OnIRCDisconnected() doesn't include the quit message, and OnQuit()
isn't called when the user quits, we need to hook OnSendToIRCMessage().
This commit is contained in:
Eli Young
2017-04-07 19:14:52 -07:00
parent 9146ea6187
commit d32ac7c184

View File

@@ -114,6 +114,8 @@ class CLogMod : public CModule {
const vector<CChan*>& vChans) override;
EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) override;
EModRet OnSendToIRCMessage(CMessage& Message) override;
/* notices */
EModRet OnUserNotice(CString& sTarget, CString& sMessage) override;
EModRet OnPrivNotice(CNick& Nick, CString& sMessage) override;
@@ -399,6 +401,17 @@ void CLogMod::OnQuit(const CNick& Nick, const CString& sMessage,
}
}
CModule::EModRet CLogMod::OnSendToIRCMessage(CMessage& Message) {
if (Message.GetType() != CMessage::Type::Quit) {
return CONTINUE;
}
CIRCNetwork* pNetwork = Message.GetNetwork();
OnQuit(pNetwork->GetIRCNick(),
Message.As<CQuitMessage>().GetReason(),
pNetwork->GetChans());
return CONTINUE;
}
void CLogMod::OnJoin(const CNick& Nick, CChan& Channel) {
if (!HasNV("joins") || GetNV("joins").ToBool())
PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" +