diff options
| author | Zdenek Prikryl <zprikryl@redhat.com> | 2009-06-10 10:06:37 +0200 |
|---|---|---|
| committer | Zdenek Prikryl <zprikryl@redhat.com> | 2009-06-10 10:06:37 +0200 |
| commit | 5b80ac3bd83483cf937b13b222b55a0980ffdc39 (patch) | |
| tree | ec7cb1d37cbf740b41263d4e2c6dd14c78f9a229 /lib/MiddleWare/MiddleWare.cpp | |
| parent | 9eab929557ef4228b3335f4908dd6b4acf9251dc (diff) | |
| download | abrt-5b80ac3bd83483cf937b13b222b55a0980ffdc39.tar.gz abrt-5b80ac3bd83483cf937b13b222b55a0980ffdc39.tar.xz abrt-5b80ac3bd83483cf937b13b222b55a0980ffdc39.zip | |
abrt can take reporter's configuration file from reporting users's $HOME/.abrt/ directory
Diffstat (limited to 'lib/MiddleWare/MiddleWare.cpp')
| -rw-r--r-- | lib/MiddleWare/MiddleWare.cpp | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/lib/MiddleWare/MiddleWare.cpp b/lib/MiddleWare/MiddleWare.cpp index 9b4b088..78fc541 100644 --- a/lib/MiddleWare/MiddleWare.cpp +++ b/lib/MiddleWare/MiddleWare.cpp @@ -27,7 +27,8 @@ CMiddleWare::CMiddleWare(const std::string& pPlugisConfDir, const std::string& pPlugisLibDir) : m_pPluginManager(NULL), - m_bOpenGPGCheck(true) + m_bOpenGPGCheck(true), + m_sPluginsConfDir(pPlugisConfDir) { m_pPluginManager = new CPluginManager(pPlugisConfDir, pPlugisLibDir); m_pPluginManager->LoadPlugins(); @@ -193,14 +194,8 @@ void CMiddleWare::RunAction(const std::string& pActionDir, try { CAction* action = m_pPluginManager->GetAction(pPluginName); - if (action) - { - action->Run(pActionDir, pPluginArgs); - } - else - { - throw CABRTException(EXCEP_ERROR, "Plugin '"+pPluginName+"' is not registered."); - } + + action->Run(pActionDir, pPluginArgs); } catch (CABRTException& e) { @@ -217,33 +212,36 @@ void CMiddleWare::RunActionsAndReporters(const std::string& pDebugDumpDir) { try { - CReporter* reporter = m_pPluginManager->GetReporter((*it_ar).first); - CAction* action = m_pPluginManager->GetAction((*it_ar).first); - if (reporter) + if (m_pPluginManager->GetPluginType((*it_ar).first) == REPORTER) { + CReporter* reporter = m_pPluginManager->GetReporter((*it_ar).first); + map_crash_report_t crashReport; DebugDumpToCrashReport(pDebugDumpDir, crashReport); reporter->Report(crashReport, (*it_ar).second); } - else if (action) + else if (m_pPluginManager->GetPluginType((*it_ar).first) == ACTION) { + CAction* action = m_pPluginManager->GetAction((*it_ar).first); action->Run(pDebugDumpDir, (*it_ar).second); } - else - { - throw CABRTException(EXCEP_ERROR, "Plugin '"+(*it_ar).first+"' is not registered."); - } } catch (CABRTException& e) { comm_layer_inner_warning("CMiddleWare::RunActionsAndReporters(): " + e.what()); - comm_layer_inner_status("Reporting via '"+(*it_ar).first+"' was not successful: " + e.what()); + comm_layer_inner_status("Activation of plugin '"+(*it_ar).first+"' was not successful: " + e.what()); } } } void CMiddleWare::Report(const map_crash_report_t& pCrashReport) { + Report(pCrashReport, m_sPluginsConfDir); +} + +void CMiddleWare::Report(const map_crash_report_t& pCrashReport, + const std::string& pPluginsConfDir) +{ if (pCrashReport.find(CD_MWANALYZER) == pCrashReport.end() || pCrashReport.find(CD_MWUID) == pCrashReport.end() || pCrashReport.find(CD_MWUUID) == pCrashReport.end()) @@ -263,14 +261,20 @@ void CMiddleWare::Report(const map_crash_report_t& pCrashReport) { try { - CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first); - if (reporter) + if (m_pPluginManager->GetPluginType((*it_r).first) == REPORTER) { - reporter->Report(pCrashReport, (*it_r).second); - } - else - { - throw CABRTException(EXCEP_ERROR, "Plugin '"+(*it_r).first+"' is not registered."); + CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first); + + if (pPluginsConfDir == m_sPluginsConfDir) + { + reporter->Report(pCrashReport, (*it_r).second); + } + else + { + reporter->LoadSettings(pPluginsConfDir + "/" + (*it_r).first + "." + PLUGINS_CONF_EXTENSION); + reporter->Report(pCrashReport, (*it_r).second); + reporter->LoadSettings(m_sPluginsConfDir + "/" + (*it_r).first + "." + PLUGINS_CONF_EXTENSION); + } } } catch (CABRTException& e) @@ -403,15 +407,12 @@ void CMiddleWare::RunAnalyzerActions(const std::string& pAnalyzer, const std::st { try { - CAction* action = m_pPluginManager->GetAction((*it_a).first); - if (action) + if (m_pPluginManager->GetPluginType((*it_a).first) == ACTION) { + CAction* action = m_pPluginManager->GetAction((*it_a).first); + action->Run(pDebugDumpDir, (*it_a).second); } - else if (m_pPluginManager->GetReporter((*it_a).first) == NULL) - { - throw CABRTException(EXCEP_ERROR, "Plugin '"+(*it_a).first+"' is not registered."); - } } catch (CABRTException& e) { |
