Fix '/msg *status disconnect' to *really* disconnect from IRC

Before this commit, if a connection attempt was still going on, that attempt
wasn't aborted. This is now fixed.

This was reported by Kuja, thanks!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1194 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-09-09 15:54:34 +00:00
parent 85845556cd
commit 83ff385000

View File

@@ -266,8 +266,20 @@ void CClient::UserCommand(const CString& sLine) {
}
} else if (sCommand.CaseCmp("DISCONNECT") == 0) {
if (m_pUser) {
if (m_pIRCSock)
// m_pIRCSock is only set after the low level connection
// to the IRC server was established. Before this we can
// only find the IRC socket by its name.
if (m_pIRCSock) {
m_pIRCSock->Quit();
} else {
Csock* pIRCSock;
CString sSockName = "IRC::" + m_pUser->GetUserName();
// This is *slow*, we try to avoid doing this
pIRCSock = CZNC::Get().GetManager().FindSockByName(sSockName);
if (pIRCSock)
pIRCSock->Close();
}
m_pUser->SetIRCConnectEnabled(false);
PutStatus("Disconnected from IRC. Use 'connect' to reconnect.");
return;