diff --git a/DCCSock.cpp b/DCCSock.cpp index d4088fe6..a71f2746 100644 --- a/DCCSock.cpp +++ b/DCCSock.cpp @@ -69,17 +69,20 @@ void CDCCSock::Connected() { } void CDCCSock::Disconnected() { + const CString sStart = ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - "; + DEBUG_ONLY(cout << GetSockName() << " == Disconnected()" << endl); + if (m_uBytesSoFar > m_uFileSize) { - m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - TooMuchData!"); + m_pUser->PutModule(m_sModuleName, sStart + "TooMuchData!"); } else if (m_uBytesSoFar == m_uFileSize) { if (m_bSend) { - m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Completed! - Sent [" + m_sLocalFile + "] at [" + CString::ToKBytes(GetAvgWrite() / 1000.0) + "]"); + m_pUser->PutModule(m_sModuleName, sStart + "Completed! - Sent [" + m_sLocalFile + "] at [" + CString::ToKBytes(GetAvgWrite() / 1000.0) + "]"); } else { - m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Completed! - Saved to [" + m_sLocalFile + "] at [" + CString::ToKBytes(GetAvgRead() / 1000.0) + "]"); + m_pUser->PutModule(m_sModuleName, sStart + "Completed! - Saved to [" + m_sLocalFile + "] at [" + CString::ToKBytes(GetAvgRead() / 1000.0) + "]"); } } else { - m_pUser->PutModule(m_sModuleName, ((m_bSend) ? "DCC -> [" : "DCC <- [") + m_sRemoteNick + "][" + m_sFileName + "] - Incomplete!"); + m_pUser->PutModule(m_sModuleName, sStart + "Incomplete!"); } } diff --git a/Utils.h b/Utils.h index 3797761f..2803c0e0 100644 --- a/Utils.h +++ b/Utils.h @@ -422,7 +422,14 @@ private: /** * @class CSafePtr * @author prozac - * @brief This class is intended to be created on the stack and hold a pointer which will be deleted upon destruction. It is useful for functions where you need an allocated pointer and have many return paths. It prevents copying to get around the exclusive ownership situation which makes std::auto_ptr invalidate the first pointer on copy. This is intended to be used in simplistic situations such as local variables. + * @brief Safe deletion of a pointer. + * + * This class is intended to be created on the stack and hold a pointer which + * will be deleted upon destruction. It is useful for functions where you need + * an allocated pointer and have many return paths. It prevents copying to get + * around the exclusive ownership situation which makes std::auto_ptr + * invalidate the first pointer on copy. This is intended to be used in + * simplistic situations such as local variables. */ template class CSafePtr : private CNoCopy {