From 5f293039b5c9ffeb8327b719c4923e55f1539619 Mon Sep 17 00:00:00 2001 From: psychon Date: Wed, 16 Apr 2008 19:46:26 +0000 Subject: [PATCH] Display better error messages if we can't connect to IRC git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1023 726aef4b-f618-498e-8847-2d620e286838 --- IRCSock.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/IRCSock.cpp b/IRCSock.cpp index 107264b2..f4cb3cd5 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -923,9 +923,27 @@ void CIRCSock::Disconnected() { } void CIRCSock::SockError(int iErrno) { - DEBUG_ONLY(cout << GetSockName() << " == SockError(" << iErrno << ")" << endl); + CString sError; + + if (iErrno == EDOM) { + sError = "Your VHost could not be resolved"; + } else if (iErrno = EADDRNOTAVAIL) { + // Csocket uses this if it can't resolve the dest host name + sError = strerror(iErrno); + sError += " (Is your IRC server's host name valid?)"; + } else { + sError = strerror(iErrno); + } + + DEBUG_ONLY(cout << GetSockName() << " == SockError(" << iErrno << " " + << sError << ")" << endl); if (!m_pUser->IsBeingDeleted()) { - m_pUser->PutStatus("Disconnected from IRC (" + CString(strerror(iErrno)) + "). Reconnecting..."); + if (GetConState() != CST_OK) + m_pUser->PutStatus("Cannot connect to IRC (" + + sError + "). Retrying..."); + else + m_pUser->PutStatus("Disconnected from IRC (" + + sError + "). Reconnecting..."); } m_pUser->ClearRawBuffer(); m_pUser->ClearMotdBuffer();