From dfaa0c34fc04bc973f6927d24245b23c0684c0cb Mon Sep 17 00:00:00 2001 From: psychon Date: Mon, 27 Oct 2008 19:34:03 +0000 Subject: [PATCH] Fix the behaviour change of the last commit git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1264 726aef4b-f618-498e-8847-2d620e286838 --- modules/partyline.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/modules/partyline.cpp b/modules/partyline.cpp index 0a8fe4c8..495b7426 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -122,8 +122,9 @@ public: } virtual EModRet OnDeleteUser(CUser& User) { - for (set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) { // Loop through each chan - PartUser(&User, *it, true, "User deleted"); + // Loop through each chan + for (set::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) { + RemoveUser(&User, *it, "KICK", true, "User deleted"); } return CONTINUE; @@ -263,10 +264,16 @@ public: void PartUser(CUser* pUser, CPartylineChannel* pChannel, bool bForce = false, const CString& sMessage = "") { + RemoveUser(pUser, pChannel, "PART", bForce, sMessage); + } + + void RemoveUser(CUser* pUser, CPartylineChannel* pChannel, const CString& sCommand, + bool bForce = false, const CString& sMessage = "") { if (!pChannel || !pChannel->IsInChannel(pUser->GetUserName())) { return; } + CString sCmd = " " + sCommand + " "; CString sMsg = sMessage; if (!sMsg.empty()) sMsg = " :" + sMsg; @@ -282,10 +289,10 @@ public: sHost = pUser->GetIRCNick().GetHost(); } - pUser->PutUser(":" + pUser->GetIRCNick().GetNickMask() + " PART " + pUser->PutUser(":" + pUser->GetIRCNick().GetNickMask() + sCmd + pChannel->GetName() + sMsg); - PutChan(ssNicks, ":?" + pUser->GetUserName() + "!" + pUser->GetIdent() + "@" + sHost + " PART " - + pChannel->GetName() + sMsg, false); + PutChan(ssNicks, ":?" + pUser->GetUserName() + "!" + pUser->GetIdent() + "@" + sHost + + sCmd + pChannel->GetName() + sMsg, false); if (ssNicks.empty()) { delete pChannel;