diff options
author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-02-12 09:59:31 +0100 |
---|---|---|
committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-02-12 09:59:31 +0100 |
commit | 8b9c51fff870ef59066878ae818bb3aaf4c04682 (patch) | |
tree | 7558d07f6894da4538bafec513d8ce5c126f1d50 | |
parent | 8602cc221f7a23943f3b2854661c004f39cc9fc7 (diff) | |
download | abrt-8b9c51fff870ef59066878ae818bb3aaf4c04682.tar.gz abrt-8b9c51fff870ef59066878ae818bb3aaf4c04682.tar.xz abrt-8b9c51fff870ef59066878ae818bb3aaf4c04682.zip |
changed interface of reporter plugins, so user have posibility ti change reported data
-rw-r--r-- | lib/MiddleWare/Reporter.h | 14 | ||||
-rw-r--r-- | lib/Plugins/Mailx.cpp | 35 | ||||
-rw-r--r-- | lib/Plugins/Mailx.h | 2 |
3 files changed, 27 insertions, 24 deletions
diff --git a/lib/MiddleWare/Reporter.h b/lib/MiddleWare/Reporter.h index f1493f5b..5419bdcb 100644 --- a/lib/MiddleWare/Reporter.h +++ b/lib/MiddleWare/Reporter.h @@ -28,8 +28,20 @@ class CReporter : public CPlugin { public: + typedef struct SReport + { + std::string m_sArchitecture; + std::string m_sKernel; + std::string m_sExecutable; + std::string m_sPackage; + std::string m_sTextData1; + std::string m_sTextData2; + std::string m_bBinaryData1; + std::string m_bBinaryData2; + } report_t; + virtual ~CReporter() {} - virtual void Report(const std::string& pDebugDumpPath) = 0; + virtual void Report(const report_t& pReport) = 0; }; #endif /* REPORTER_H_ */ diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp index a81ffbe8..eb731842 100644 --- a/lib/Plugins/Mailx.cpp +++ b/lib/Plugins/Mailx.cpp @@ -56,60 +56,51 @@ void CMailx::SendEmail(const std::string& pText) } -void CMailx::Report(const std::string& pDebugDumpDir) +void CMailx::Report(const report_t& pReport) { std::stringstream ss; - std::string data; - CDebugDump dd; - dd.Open(pDebugDumpDir); ss << "Common information" << std::endl; ss << "==================" << std::endl << std::endl; - dd.LoadText(FILENAME_ARCHITECTURE, data); ss << "Architecture" << std::endl; ss << "------------" << std::endl; - ss << data << std::endl << std::endl; - dd.LoadText(FILENAME_KERNEL, data); + ss << pReport.m_sArchitecture << std::endl << std::endl; ss << "Kernel version" << std::endl; ss << "--------------" << std::endl; - ss << data << std::endl << std::endl; - dd.LoadText(FILENAME_PACKAGE, data); + ss << pReport.m_sKernel << std::endl << std::endl; ss << "Package" << std::endl; ss << "-------" << std::endl; - ss << data << std::endl << std::endl; - dd.LoadText(FILENAME_EXECUTABLE, data); + ss << pReport.m_sPackage << std::endl << std::endl; ss << "Executable" << std::endl; ss << "----------" << std::endl; - ss << data << std::endl << std::endl; + ss << pReport.m_sExecutable << std::endl << std::endl; ss << "Created report" << std::endl; ss << "==============" << std::endl; ss << "Text reports" << std::endl; ss << "==============" << std::endl; - if (dd.Exist(FILENAME_TEXTDATA1)) + if (pReport.m_sTextData1 != "") { - dd.LoadText(FILENAME_TEXTDATA1, data); ss << "Text Data 1" << std::endl; ss << "-----------" << std::endl; - ss << data << std::endl << std::endl; + ss << pReport.m_sTextData1 << std::endl << std::endl; } - if (dd.Exist(FILENAME_TEXTDATA2)) + if (pReport.m_sTextData2 != "") { - dd.LoadText(FILENAME_TEXTDATA2, data); ss << "Text Data 2" << std::endl; ss << "-----------" << std::endl; - ss << data << std::endl << std::endl; + ss << pReport.m_sTextData2 << std::endl << std::endl; } ss << "Binary reports" << std::endl; ss << "==============" << std::endl; ss << "See the attachment[s]" << std::endl; - if (dd.Exist(FILENAME_BINARYDATA1)) + if (pReport.m_bBinaryData1 != "") { - m_sAttachments = " -a " + pDebugDumpDir + "/" + FILENAME_BINARYDATA1; + m_sAttachments = " -a " + pReport.m_bBinaryData1; } - if (dd.Exist(FILENAME_BINARYDATA2)) + if (pReport.m_bBinaryData2 != "") { - m_sAttachments = " -a " + pDebugDumpDir + "/" + FILENAME_BINARYDATA2; + m_sAttachments = " -a " + pReport.m_bBinaryData2; } SendEmail(ss.str()); diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h index 789af614..3c54feb6 100644 --- a/lib/Plugins/Mailx.h +++ b/lib/Plugins/Mailx.h @@ -44,7 +44,7 @@ class CMailx : public CReporter void DeInit() {} void SetSettings(const map_settings_t& pSettings); - void Report(const std::string& pDebugDumpDir); + void Report(const report_t& pReport); }; |