diff options
author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-01 12:57:06 +0200 |
---|---|---|
committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-01 12:57:06 +0200 |
commit | 99a0819d935bbdfb34226e54ff50ed78b1fc6da0 (patch) | |
tree | 60106dfbcff10b425793520ae02a60f159f4a71c /lib/Plugins/Mailx.cpp | |
parent | b3adc1a23a16b5d7a7d341d748bd3e618e5d225f (diff) | |
download | abrt-99a0819d935bbdfb34226e54ff50ed78b1fc6da0.tar.gz abrt-99a0819d935bbdfb34226e54ff50ed78b1fc6da0.tar.xz abrt-99a0819d935bbdfb34226e54ff50ed78b1fc6da0.zip |
rewritten CDebugDump and CrashTypes
Diffstat (limited to 'lib/Plugins/Mailx.cpp')
-rw-r--r-- | lib/Plugins/Mailx.cpp | 112 |
1 files changed, 55 insertions, 57 deletions
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index 1f83cb5..8c0c4a6 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -58,71 +58,69 @@ void CMailx::SendEmail(const std::string& pText) } -void CMailx::Report(const crash_report_t& pReport) +void CMailx::Report(const crash_report_t& pCrashReport) { - std::stringstream ss; - - ss << "Duplicity check" << std::endl; - ss << "==================" << std::endl << std::endl; - ss << "UUID" << std::endl; - ss << "------------" << std::endl; - ss << pReport.m_sUUID << std::endl << std::endl; - ss << "Common information" << std::endl; - ss << "==================" << std::endl << std::endl; - ss << "Architecture" << std::endl; - ss << "------------" << std::endl; - ss << pReport.m_sArchitecture << std::endl << std::endl; - ss << "Kernel version" << std::endl; - ss << "--------------" << std::endl; - ss << pReport.m_sKernel << std::endl << std::endl; - ss << "Package" << std::endl; - ss << "-------" << std::endl; - ss << pReport.m_sPackage << std::endl << std::endl; - ss << "Executable" << std::endl; - ss << "----------" << std::endl; - ss << pReport.m_sExecutable << std::endl << std::endl; - ss << "CmdLine" << std::endl; - ss << "----------" << std::endl; - ss << pReport.m_sCmdLine << std::endl << std::endl; - ss << "Created report" << std::endl; - ss << "==============" << std::endl; - ss << "Text reports" << std::endl; - ss << "==============" << std::endl; - if (pReport.m_sTextData1 != "") - { - ss << "Text Data 1" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sTextData1 << std::endl << std::endl; - } - if (pReport.m_sTextData2 != "") - { - ss << "Text Data 2" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sTextData2 << std::endl << std::endl; - } - if (pReport.m_sComment != "") - { - ss << "User Comments" << std::endl; - ss << "-----------" << std::endl; - ss << pReport.m_sComment << std::endl << std::endl; - } - ss << "Binary reports" << std::endl; - ss << "==============" << std::endl; - ss << "See the attachment[s]" << std::endl; + std::stringstream emailBody; + std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile; - if (m_bSendBinaryData) + crash_report_t::const_iterator it; + for (it = pCrashReport.begin(); it != pCrashReport.end(); it++) { - if (pReport.m_sBinaryData1 != "") + if (it->second.m_sType == TYPE_TXT) { - m_sAttachments = " -a " + pReport.m_sBinaryData1; + if (it->first != FILENAME_UUID && + it->first != FILENAME_ARCHITECTURE && + it->first != FILENAME_KERNEL && + it->first != FILENAME_PACKAGE) + { + additionalFiles << it->first << std::endl; + additionalFiles << "-----" << std::endl; + additionalFiles << it->second.m_sContent << std::endl; + } + else if (it->first == FILENAME_UUID) + { + UUIDFile << it->first << std::endl; + UUIDFile << "-----" << std::endl; + UUIDFile << it->second.m_sContent << std::endl; + } + else + { + commonFiles << it->first << std::endl; + commonFiles << "-----" << std::endl; + commonFiles << it->second.m_sContent << std::endl; + } } - if (pReport.m_sBinaryData2 != "") + if (it->second.m_sType == TYPE_BIN) { - m_sAttachments = " -a " + pReport.m_sBinaryData2; + binaryFiles << " -a " << it->second.m_sContent; } } - SendEmail(ss.str()); + + + emailBody << "Duplicity check" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << UUIDFile.str() << std::endl; + emailBody << "Common information" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << commonFiles.str() << std::endl; + emailBody << "Additional information" << std::endl; + emailBody << "=====" << std::endl << std::endl; + emailBody << additionalFiles.str() << std::endl; + emailBody << "Binary file[s]" << std::endl; + emailBody << "=====" << std::endl; + + if (m_bSendBinaryData) + { + emailBody << "See the attachment[s]" << std::endl; + m_sAttachments = binaryFiles.str(); + } + else + { + emailBody << "Do not send them." << std::endl; + } + + SendEmail(emailBody.str()); } void CMailx::LoadSettings(const std::string& pPath) @@ -144,6 +142,6 @@ void CMailx::LoadSettings(const std::string& pPath) } if (settings.find("SendBinaryData")!= settings.end()) { - m_bSendBinaryData = settings["SendBinaryData"] == "yes"; + m_bSendBinaryData = settings["SendBinaryData"] == "no"; } } |