diff options
author | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-08 15:26:05 +0200 |
---|---|---|
committer | Zdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com> | 2009-04-08 15:26:05 +0200 |
commit | 70ccc1877c0d729b8c4aff450f6c4a3209e57c9b (patch) | |
tree | 091757654735c31f3784f7c4840a105bcea14b96 /lib | |
parent | 477fa5323fad21b978cf8025a80041f979b2c27b (diff) | |
download | abrt-70ccc1877c0d729b8c4aff450f6c4a3209e57c9b.tar.gz abrt-70ccc1877c0d729b8c4aff450f6c4a3209e57c9b.tar.xz abrt-70ccc1877c0d729b8c4aff450f6c4a3209e57c9b.zip |
added new CD_ATT type
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MiddleWare/CrashTypes.h | 6 | ||||
-rw-r--r-- | lib/MiddleWare/MiddleWare.cpp | 16 | ||||
-rw-r--r-- | lib/Plugins/Logger.cpp | 11 | ||||
-rw-r--r-- | lib/Plugins/Mailx.cpp | 22 |
4 files changed, 39 insertions, 16 deletions
diff --git a/lib/MiddleWare/CrashTypes.h b/lib/MiddleWare/CrashTypes.h index 3dc3f4e8..4c2a2e45 100644 --- a/lib/MiddleWare/CrashTypes.h +++ b/lib/MiddleWare/CrashTypes.h @@ -7,10 +7,14 @@ // SYS - system value, should not be displayed // BIN - binary value, should be displayed -// TXT = text value, should be displayed +// TXT - text value, should be displayed +// ATT - text value which can be sent as attachment via reporters #define CD_SYS "s" #define CD_BIN "b" #define CD_TXT "t" +#define CD_ATT "a" + +#define CD_ATT_SIZE (256) #define CD_ISEDITABLE "y" #define CD_ISNOTEDITABLE "n" diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp index 8d69e321..51369295 100644 --- a/lib/MiddleWare/MiddleWare.cpp +++ b/lib/MiddleWare/MiddleWare.cpp @@ -48,6 +48,7 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_c !dd.Exist(FILENAME_ARCHITECTURE) || !dd.Exist(FILENAME_KERNEL) || !dd.Exist(FILENAME_PACKAGE) || + !dd.Exist(FILENAME_RELEASE) || !dd.Exist(FILENAME_EXECUTABLE)) { dd.Close(); @@ -71,13 +72,24 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_c fileName == FILENAME_ARCHITECTURE || fileName == FILENAME_KERNEL || fileName == FILENAME_PACKAGE || + fileName == FILENAME_RELEASE || fileName == FILENAME_EXECUTABLE) { add_crash_data_to_crash_report(pCrashReport, fileName, CD_TXT, CD_ISNOTEDITABLE, content); } - else if (fileName != FILENAME_UID) + else if (fileName != FILENAME_UID && + fileName != FILENAME_ANALYZER && + fileName != FILENAME_TIME && + fileName != FILENAME_DESCRIPTION ) { - add_crash_data_to_crash_report(pCrashReport, fileName, CD_TXT, CD_ISEDITABLE, content); + if (content.length() < CD_ATT_SIZE) + { + add_crash_data_to_crash_report(pCrashReport, fileName, CD_TXT, CD_ISEDITABLE, content); + } + else + { + add_crash_data_to_crash_report(pCrashReport, fileName, CD_ATT, CD_ISEDITABLE, content); + } } } } diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp index de9e68f4..8f89838f 100644 --- a/lib/Plugins/Logger.cpp +++ b/lib/Plugins/Logger.cpp @@ -47,7 +47,7 @@ void CLogger::LoadSettings(const std::string& pPath) void CLogger::Report(const map_crash_report_t& pCrashReport) { - std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile; + std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile; std::ofstream fOut; map_crash_report_t::const_iterator it; @@ -77,6 +77,12 @@ void CLogger::Report(const map_crash_report_t& pCrashReport) commonFiles << it->second[CD_CONTENT] << std::endl << std::endl; } } + if (it->second[CD_TYPE] == CD_ATT) + { + bigTextFiles << it->first << std::endl; + bigTextFiles << "-----" << std::endl; + bigTextFiles << it->second[CD_CONTENT] << std::endl << std::endl; + } if (it->second[CD_TYPE] == CD_BIN) { binaryFiles << it->first << std::endl; @@ -106,6 +112,9 @@ void CLogger::Report(const map_crash_report_t& pCrashReport) fOut << "Additional information" << std::endl; fOut << "======" << std::endl << std::endl; fOut << additionalFiles.str() << std::endl; + fOut << "Big Text Files" << std::endl; + fOut << "======" << std::endl; + fOut << bigTextFiles.str() << std::endl; fOut << "Binary files" << std::endl; fOut << "======" << std::endl; fOut << binaryFiles.str() << std::endl; diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index dbadb1e6..72d5cb7a 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -61,7 +61,7 @@ void CMailx::SendEmail(const std::string& pText) void CMailx::Report(const map_crash_report_t& pCrashReport) { std::stringstream emailBody; - std::stringstream binaryFiles, commonFiles, additionalFiles, UUIDFile; + std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile; map_crash_report_t::const_iterator it; for (it = pCrashReport.begin(); it != pCrashReport.end(); it++) @@ -75,21 +75,25 @@ void CMailx::Report(const map_crash_report_t& pCrashReport) { additionalFiles << it->first << std::endl; additionalFiles << "-----" << std::endl; - additionalFiles << it->second[CD_CONTENT] << std::endl; + additionalFiles << it->second[CD_CONTENT] << std::endl << std::endl; } else if (it->first == FILENAME_UUID) { UUIDFile << it->first << std::endl; UUIDFile << "-----" << std::endl; - UUIDFile << it->second[CD_CONTENT] << std::endl; + UUIDFile << it->second[CD_CONTENT] << std::endl << std::endl; } else { commonFiles << it->first << std::endl; commonFiles << "-----" << std::endl; - commonFiles << it->second[CD_CONTENT] << std::endl; + commonFiles << it->second[CD_CONTENT] << std::endl << std::endl; } } + if (it->second[CD_TYPE] == CD_ATT) + { + bigTextFiles << " -a " << it->second[CD_CONTENT]; + } if (it->second[CD_TYPE] == CD_BIN) { binaryFiles << " -a " << it->second[CD_CONTENT]; @@ -107,17 +111,11 @@ void CMailx::Report(const map_crash_report_t& pCrashReport) emailBody << "Additional information" << std::endl; emailBody << "=====" << std::endl << std::endl; emailBody << additionalFiles.str() << std::endl; - emailBody << "Binary file[s]" << std::endl; - emailBody << "=====" << std::endl; + m_sAttachments = bigTextFiles.str(); if (m_bSendBinaryData) { - emailBody << "See the attachment[s]" << std::endl; - m_sAttachments = binaryFiles.str(); - } - else - { - emailBody << "Do not send them." << std::endl; + m_sAttachments += binaryFiles.str(); } SendEmail(emailBody.str()); |