Add new parameter to OnPart module hook: part message.

Sorry for API change :)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2215 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
darthgandalf
2010-12-30 11:28:41 +00:00
parent 644632f915
commit a0c0b73590
9 changed files with 17 additions and 15 deletions

View File

@@ -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;

View File

@@ -424,7 +424,7 @@ void CModule::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CC
void CModule::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& 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<C
bool CModules::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& 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)); }

View File

@@ -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<CChan*>& 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);

View File

@@ -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);
}

View File

@@ -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<CChan*>& vChans) {

View File

@@ -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();

View File

@@ -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<CChan*>& 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<CChan*>& 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<CChan*>& vChans)

View File

@@ -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() + ")");
}

View File

@@ -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<CChan*>& vChans) {