diff --git a/IRCSock.cpp b/IRCSock.cpp index a9312697..3ed0a8cd 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -460,12 +460,13 @@ void CIRCSock::ReadLine(const CString& sData) { if (sChan.Left(1) == ":") { sChan.LeftChomp(); } + CString sMsg = sRest.Token(1, true).TrimPrefix_n(":"); CChan* pChan = m_pUser->FindChan(sChan); bool bDetached = false; if (pChan) { pChan->RemNick(Nick.GetNick()); - MODULECALL(OnPart(Nick.GetNickMask(), *pChan), m_pUser, NULL, NOTHING); + MODULECALL(OnPart(Nick.GetNickMask(), *pChan, sMsg), m_pUser, NULL, NOTHING); if (pChan->IsDetached()) bDetached = true; diff --git a/Modules.cpp b/Modules.cpp index 9a286f19..7022e66d 100644 --- a/Modules.cpp +++ b/Modules.cpp @@ -424,7 +424,7 @@ void CModule::OnQuit(const CNick& Nick, const CString& sMessage, const vector& vChans) {} void CModule::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {} void CModule::OnJoin(const CNick& Nick, CChan& Channel) {} -void CModule::OnPart(const CNick& Nick, CChan& Channel) {} +void CModule::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {} CModule::EModRet CModule::OnChanBufferStarting(CChan& Chan, CClient& Client) { return CONTINUE; } CModule::EModRet CModule::OnChanBufferEnding(CChan& Chan, CClient& Client) { return CONTINUE; } @@ -588,7 +588,7 @@ bool CModules::OnQuit(const CNick& Nick, const CString& sMessage, const vector& vChans) { MODUNLOADCHK(OnNick(Nick, sNewNick, vChans)); return false; } bool CModules::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnKick(Nick, sKickedNick, Channel, sMessage)); return false; } bool CModules::OnJoin(const CNick& Nick, CChan& Channel) { MODUNLOADCHK(OnJoin(Nick, Channel)); return false; } -bool CModules::OnPart(const CNick& Nick, CChan& Channel) { MODUNLOADCHK(OnPart(Nick, Channel)); return false; } +bool CModules::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnPart(Nick, Channel, sMessage)); return false; } bool CModules::OnChanBufferStarting(CChan& Chan, CClient& Client) { MODHALTCHK(OnChanBufferStarting(Chan, Client)); } bool CModules::OnChanBufferEnding(CChan& Chan, CClient& Client) { MODHALTCHK(OnChanBufferEnding(Chan, Client)); } bool CModules::OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) { MODHALTCHK(OnChanBufferPlayLine(Chan, Client, sLine)); } diff --git a/Modules.h b/Modules.h index 3d01237b..472a04b2 100644 --- a/Modules.h +++ b/Modules.h @@ -479,8 +479,9 @@ public: /** Called when a nick parts a channel. * @param Nick The nick who parted. * @param Channel The channel which was parted. + * @param sMessage The part message. */ - virtual void OnPart(const CNick& Nick, CChan& Channel); + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); /** Called before a channel buffer is played back to a client. * @param Chan The channel which will be played back. @@ -859,7 +860,7 @@ public: bool OnNick(const CNick& Nick, const CString& sNewNick, const vector& vChans); bool OnKick(const CNick& Nick, const CString& sOpNick, CChan& Channel, const CString& sMessage); bool OnJoin(const CNick& Nick, CChan& Channel); - bool OnPart(const CNick& Nick, CChan& Channel); + bool OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); bool OnChanBufferStarting(CChan& Chan, CClient& Client); bool OnChanBufferEnding(CChan& Chan, CClient& Client); diff --git a/modules/autocycle.cpp b/modules/autocycle.cpp index b018e704..9114a952 100644 --- a/modules/autocycle.cpp +++ b/modules/autocycle.cpp @@ -101,7 +101,7 @@ public: } } - virtual void OnPart(const CNick& Nick, CChan& Channel) { + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { AutoCycle(Channel); } diff --git a/modules/buffextras.cpp b/modules/buffextras.cpp index 5d7e379b..04a03fc0 100644 --- a/modules/buffextras.cpp +++ b/modules/buffextras.cpp @@ -47,8 +47,8 @@ public: AddBuffer(Channel, Nick.GetNickMask() + " joined"); } - virtual void OnPart(const CNick& Nick, CChan& Channel) { - AddBuffer(Channel, Nick.GetNickMask() + " parted"); + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { + AddBuffer(Channel, Nick.GetNickMask() + " parted with message: [" + sMessage + "]"); } virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector& vChans) { diff --git a/modules/chansaver.cpp b/modules/chansaver.cpp index b13b9b5c..89552aa4 100644 --- a/modules/chansaver.cpp +++ b/modules/chansaver.cpp @@ -61,7 +61,7 @@ public: } } - virtual void OnPart(const CNick& Nick, CChan& Channel) { + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { if (Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) { Channel.SetInConfig(false); CZNC::Get().WriteConfig(); diff --git a/modules/extra/log.cpp b/modules/extra/log.cpp index 204c6ae9..6981111d 100644 --- a/modules/extra/log.cpp +++ b/modules/extra/log.cpp @@ -28,7 +28,7 @@ public: virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage); virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector& vChans); virtual void OnJoin(const CNick& Nick, CChan& Channel); - virtual void OnPart(const CNick& Nick, CChan& Channel); + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage); virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector& vChans); virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic); @@ -137,9 +137,9 @@ void CLogMod::OnJoin(const CNick& Nick, CChan& Channel) PutLog("*** Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ")", Channel); } -void CLogMod::OnPart(const CNick& Nick, CChan& Channel) +void CLogMod::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { - PutLog("*** Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ")", Channel); + PutLog("*** Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") (" + sMessage + ")", Channel); } void CLogMod::OnNick(const CNick& OldNick, const CString& sNewNick, const vector& vChans) diff --git a/modules/sample.cpp b/modules/sample.cpp index 9c2bdaa2..643e23df 100644 --- a/modules/sample.cpp +++ b/modules/sample.cpp @@ -114,7 +114,7 @@ public: PutModule("* Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")"); } - virtual void OnPart(const CNick& Nick, CChan& Channel) { + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" + Nick.GetHost() + ")"); } diff --git a/modules/watch.cpp b/modules/watch.cpp index 9d8e2541..55c73f96 100644 --- a/modules/watch.cpp +++ b/modules/watch.cpp @@ -192,9 +192,9 @@ public: Channel.GetName(), Channel.GetName()); } - virtual void OnPart(const CNick& Nick, CChan& Channel) { + virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { Process(Nick, "* " + Nick.GetNick() + " (" + Nick.GetIdent() + "@" + Nick.GetHost() + ") parts " + - Channel.GetName(), Channel.GetName()); + Channel.GetName() + "(" + sMessage + ")", Channel.GetName()); } virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector& vChans) {