int CIrcSocket::OnLayerCallback(const CAsyncSocketExLayer* pLayer, int nType, int nCode, WPARAM wParam, LPARAM lParam) { if (nType == LAYERCALLBACK_LAYERSPECIFIC) { ASSERT( pLayer ); if (pLayer == m_pProxyLayer) { switch (nCode) { case PROXYERROR_NOCONN: case PROXYERROR_REQUESTFAILED: { CString strError(GetProxyError(nCode)); if (lParam) { strError += _T(" - "); strError += (LPCSTR)lParam; } if (wParam) { CString strErrInf; if (GetErrorMessage(wParam, strErrInf, 1)) strError += _T(" - ") + strErrInf; } LogWarning(LOG_STATUSBAR, _T("IRC socket: %s"), strError); break; } default: LogWarning(LOG_STATUSBAR, _T("IRC socket: %s"), GetProxyError(nCode)); } } } return 1; }
int CEMSocket::OnLayerCallback(const CAsyncSocketExLayer *pLayer, int nType, int nCode, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); ASSERT( pLayer ); if (nType == LAYERCALLBACK_STATECHANGE) { /*CString logline; if (pLayer==m_pProxyLayer) { //logline.Format(_T("ProxyLayer changed state from %d to %d"), wParam, nCode); //AddLogLine(false,logline); }else //logline.Format(_T("Layer @ %d changed state from %d to %d"), pLayer, wParam, nCode); //AddLogLine(false,logline);*/ return 1; } else if (nType == LAYERCALLBACK_LAYERSPECIFIC) { if (pLayer == m_pProxyLayer) { switch (nCode) { case PROXYERROR_NOCONN: // We failed to connect to the proxy. m_bProxyConnectFailed = true; /* fall through */ case PROXYERROR_REQUESTFAILED: // We are connected to the proxy but it failed to connect to the peer. if (thePrefs.GetVerbose()) { m_strLastProxyError = GetProxyError(nCode); if (lParam && ((LPCSTR)lParam)[0] != '\0') { m_strLastProxyError += _T(" - "); m_strLastProxyError += (LPCSTR)lParam; } // Appending the Winsock error code is actually not needed because that error code // gets reported by to the original caller anyway and will get reported eventually // by calling 'GetFullErrorMessage', /*if (wParam) { CString strErrInf; if (GetErrorMessage(wParam, strErrInf, 1)) m_strLastProxyError += _T(" - ") + strErrInf; }*/ } break; default: m_strLastProxyError = GetProxyError(nCode); LogWarning(false, _T("Proxy-Error: %s"), m_strLastProxyError); } } } return 1; }
int CEMSocket::OnLayerCallback(const CAsyncSocketExLayer *pLayer, int nType, int nCode, WPARAM wParam, LPARAM lParam) { ASSERT(pLayer); /*if (nType == LAYERCALLBACK_STATECHANGE) { CString logline; if (pLayer==m_pProxyLayer) { logline.Format(_T("ProxyLayer changed state from %d to %d"), nParam2, nParam1); AddLogLine(0, logline); } else logline.Format(_T("Layer @ %d changed state from %d to %d"), pLayer, nParam2, nParam1); AddLogLine(0, logline); return 1; } else */if (nType == LAYERCALLBACK_LAYERSPECIFIC) { if (pLayer == m_pProxyLayer) { CString strError(GetProxyError(nCode)); switch (nCode) { case PROXYERROR_NOCONN: // We failed to connect to the proxy m_bProxyConnectFailed = true; case PROXYERROR_REQUESTFAILED: if (lParam && ((LPCSTR)lParam)[0] != '\0') { strError += _T(" - "); strError += (LPCSTR)lParam; } if (wParam) { CString strErrInf; if (GetErrorMessage(wParam, strErrInf, 1)) { strError += _T(" - "); strError += strErrInf; } } default: AddLogLine(0, _T("Proxy error - %s"), strError); } } } return 1; }
int CIrcSocket::OnLayerCallback(const CAsyncSocketExLayer* pLayer, int nType, int nParam1, int nParam2) { if (nType == LAYERCALLBACK_LAYERSPECIFIC) { ASSERT( pLayer ); if (pLayer == m_pProxyLayer) { switch (nParam1) { case PROXYERROR_NOCONN:{ CString strError(_T("IRC socket: Can't connect to proxy server")); CString strErrInf; if (nParam2 && GetErrorMessage(nParam2, strErrInf)) strError += _T(" - ") + strErrInf; LogWarning(LOG_STATUSBAR, _T("%s"), strError); break; } case PROXYERROR_REQUESTFAILED:{ CString strError(_T("IRC socket: Proxy server request failed")); if (nParam2){ strError += _T(" - "); strError += (LPCSTR)nParam2; } LogWarning(LOG_STATUSBAR, _T("%s"), strError); break; } case PROXYERROR_AUTHTYPEUNKNOWN: LogWarning(LOG_STATUSBAR, _T("IRC socket: Required authentification type reported by proxy server is unknown or unsupported")); break; case PROXYERROR_AUTHFAILED: LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server authentification failed")); break; case PROXYERROR_AUTHNOLOGON: LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server requires authentification")); break; case PROXYERROR_CANTRESOLVEHOST: LogWarning(LOG_STATUSBAR, _T("IRC socket: Can't resolve host of proxy server")); break; default:{ LogWarning(LOG_STATUSBAR, _T("IRC socket: Proxy server error - %s"), GetProxyError(nParam1)); } } } } return 1; }