bool CNetMsgBaseBuffered::DataForSend(QByteArray** pData) { if (m_pArrData != NULL) { Q_ASSERT(NULL); delete m_pArrData; } m_pArrData = new QByteArray(); *pData = m_pArrData; QDataStream outStream(m_pArrData, QIODevice::WriteOnly); outStream.setByteOrder(QDataStream::LittleEndian); if (m_header.Save(outStream) && SaveMsg(outStream)) { quint32 nMsgLen = m_pArrData->size(); memcpy(m_pArrData->data(),(char*)&nMsgLen, sizeof(nMsgLen)); return true; } Q_ASSERT(NULL); return false; }
/******************************** SaveMsg() Retrives (RETR) and Saves the specified message to disk storage NOTE Message index is 1 based NOT zero based PARAM index - Index of the message to be saved fileName - name and path of the destination file to save the message to RETURN UTE_SUCCESS - Success UTE_NOCONNECTION - NOT connected UTE_SVR_NO_RESPONSE - no response from Server UTE_FILE_OPEN_ERROR - Not able to open file for writing UTE_RETR_FAILED - RETR command has timed out without a response from the server UTE_SOCK_TIMEOUT - Timed out while receiving parts of the message UTE_ABORTED - User canceled the Save to file process *********************************/ int CUT_POP3Client::SaveMsg(int index, LPCTSTR fileName) { CUT_FileDataSource dsFile(fileName); return SaveMsg(index, dsFile); }