diff options
author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-08-14 20:59:43 +0200 |
---|---|---|
committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-08-14 20:59:43 +0200 |
commit | 3c226c987f5015e8184bfc4293ee9f9b2f7b8f67 (patch) | |
tree | b2ec9e8f5ec3140008a15cccea4030c438dbe72e /src/Daemon | |
parent | 15e44fefb8e0ce093e91bc0fd96302c6b77bf92a (diff) | |
download | abrt-3c226c987f5015e8184bfc4293ee9f9b2f7b8f67.tar.gz abrt-3c226c987f5015e8184bfc4293ee9f9b2f7b8f67.tar.xz abrt-3c226c987f5015e8184bfc4293ee9f9b2f7b8f67.zip |
added support for storing results from reporters (used from gui)
Diffstat (limited to 'src/Daemon')
-rw-r--r-- | src/Daemon/CrashWatcher.cpp | 2 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.cpp | 21 | ||||
-rw-r--r-- | src/Daemon/MiddleWare.h | 11 |
3 files changed, 27 insertions, 7 deletions
diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 44ac253d..5fb4a366 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -820,7 +820,7 @@ bool CCrashWatcher::Report(map_crash_report_t pReport, const std::string& pUID) //} try { - m_pMW->Report(pReport, pUID); + CMiddleWare::report_status_t rs = m_pMW->Report(pReport, pUID); } catch (CABRTException& e) { diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index 80380555..5591203b 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -247,9 +247,11 @@ void CMiddleWare::RunActionsAndReporters(const std::string& pDebugDumpDir) } } -void CMiddleWare::Report(const map_crash_report_t& pCrashReport, - const std::string& pUID) +CMiddleWare::report_status_t CMiddleWare::Report(const map_crash_report_t& pCrashReport, + const std::string& pUID) { + report_status_t ret; + std::string message; if (pCrashReport.find(CD_MWANALYZER) == pCrashReport.end() || pCrashReport.find(CD_MWUID) == pCrashReport.end() || pCrashReport.find(CD_MWUUID) == pCrashReport.end()) @@ -269,6 +271,8 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport, { try { + std::string res; + if (m_pPluginManager->GetPluginType((*it_r).first) == REPORTER) { CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first); @@ -290,26 +294,34 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport, } } - reporter->Report(pCrashReport, (*it_r).second); + res = reporter->Report(pCrashReport, (*it_r).second); if (home != "") { reporter->SetSettings(oldSettings); } } + ret[(*it_r).first].push_back("1"); + ret[(*it_r).first].push_back(res); + message += res + "\n"; } catch (CABRTException& e) { + ret[(*it_r).first].push_back("0"); + ret[(*it_r).first].push_back(e.what()); comm_layer_inner_warning("CMiddleWare::Report(): " + e.what()); comm_layer_inner_status("Reporting via '"+(*it_r).first+"' was not successful: " + e.what()); } + } } CDatabase* database = m_pPluginManager->GetDatabase(m_sDatabase); database->Connect(); - database->SetReported(UUID, UID); + database->SetReported(UUID, UID, message); database->DisConnect(); + + return ret; } void CMiddleWare::DeleteDebugDumpDir(const std::string& pDebugDumpDir) @@ -564,6 +576,7 @@ CMiddleWare::mw_result_t CMiddleWare::GetCrashInfo(const std::string& pUUID, add_crash_data_to_crash_info(pCrashInfo, CD_COUNT, row.m_sCount); add_crash_data_to_crash_info(pCrashInfo, CD_TIME, row.m_sTime); add_crash_data_to_crash_info(pCrashInfo, CD_REPORTED, row.m_sReported); + add_crash_data_to_crash_info(pCrashInfo, CD_MESSAGE, row.m_sMessage); add_crash_data_to_crash_info(pCrashInfo, CD_MWDDD, row.m_sDebugDumpDir); return MW_OK; diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h index bb845435..a996a85b 100644 --- a/src/Daemon/MiddleWare.h +++ b/src/Daemon/MiddleWare.h @@ -54,6 +54,12 @@ class CMiddleWare when trying open file in debug dump directory..*/ } mw_result_t; + typedef std::map<std::string, vector_strings_t> report_status_t; + typedef enum { + RS_CODE, + RS_MESSAGE + } report_status_items_t; + private: typedef set_strings_t set_blacklist_t; typedef set_strings_t set_enabled_plugins_t; @@ -259,9 +265,10 @@ class CMiddleWare * ...). * @param pCrashReport A crash report. * @param pUID An user uid + * @return A report status, which reporters ends sucessfuly with messages. */ - void Report(const map_crash_report_t& pCrashReport, - const std::string& pUID); + report_status_t Report(const map_crash_report_t& pCrashReport, + const std::string& pUID); /** * A method, which deletes particular debugdump directory. * @param pDebugDumpDir A debugdump directory. |