diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-04-23 14:42:40 +0200 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2009-04-23 14:42:40 +0200 |
commit | bcf4c69ca5fdd6489ca1c09890971fc8f647aa1b (patch) | |
tree | e5fedc350ae9368faf77360ea4fb3c0f6d264210 /lib/CommLayer/CommLayerServerDBus.cpp | |
parent | 99047bce024f1d23c953649cf56ff67e754e44ef (diff) | |
download | abrt-bcf4c69ca5fdd6489ca1c09890971fc8f647aa1b.tar.gz abrt-bcf4c69ca5fdd6489ca1c09890971fc8f647aa1b.tar.xz abrt-bcf4c69ca5fdd6489ca1c09890971fc8f647aa1b.zip |
Added intercomm layer so plugins can send various information to the daemon.
Diffstat (limited to 'lib/CommLayer/CommLayerServerDBus.cpp')
-rw-r--r-- | lib/CommLayer/CommLayerServerDBus.cpp | 71 |
1 files changed, 16 insertions, 55 deletions
diff --git a/lib/CommLayer/CommLayerServerDBus.cpp b/lib/CommLayer/CommLayerServerDBus.cpp index b4df14b..b9024f6 100644 --- a/lib/CommLayer/CommLayerServerDBus.cpp +++ b/lib/CommLayer/CommLayerServerDBus.cpp @@ -11,91 +11,52 @@ DBus::Connection *CCommLayerServerDBus::init_dbus(CCommLayerServerDBus *self) return server->m_pConn; } -CCommLayerServerDBus::CCommLayerServerDBus(CMiddleWare *pMW) -: CCommLayerServer(pMW), +CCommLayerServerDBus::CCommLayerServerDBus() +: CCommLayerServer(), DBus::ObjectAdaptor(*init_dbus(this), CC_DBUS_PATH) { - std::cerr << "CCommLayerDBus init.." << std::endl; - m_pConn->request_name(CC_DBUS_NAME); + try + { + m_pConn->request_name(CC_DBUS_NAME); + } + catch(DBus::Error err) + { + throw std::string("Error while requesting dbus name - have you reloaded the dbus settings?"); + } } CCommLayerServerDBus::~CCommLayerServerDBus() { - std::cout << "Cleaning up dbus" << std::endl; delete m_pDispatcher; } vector_crash_infos_t CCommLayerServerDBus::GetCrashInfos(const std::string &pDBusSender) { - vector_crash_infos_t retval; + vector_crash_infos_t crashInfos; unsigned long unix_uid = m_pConn->sender_unix_uid(pDBusSender.c_str()); - try - { - retval = m_pMW->GetCrashInfos(to_string(unix_uid)); - } - catch(std::string err) - { - std::cerr << err << std::endl; - } - Notify("Sent crash info"); - return retval; + crashInfos = m_pObserver->GetCrashInfos(to_string(unix_uid)); + return crashInfos; } map_crash_report_t CCommLayerServerDBus::CreateReport(const std::string &pUUID,const std::string &pDBusSender) { unsigned long unix_uid = m_pConn->sender_unix_uid(pDBusSender.c_str()); - //std::cerr << pUUID << ":" << unix_uid << std::endl; map_crash_report_t crashReport; - std::cerr << "Creating report" << std::endl; - try - { - m_pMW->CreateCrashReport(pUUID,to_string(unix_uid), crashReport); - //send out the message about completed analyze - CDBusServer_adaptor::AnalyzeComplete(crashReport); - } - catch(std::string err) - { - CDBusServer_adaptor::Error(err); - std::cerr << err << std::endl; - } + crashReport = m_pObserver->CreateReport(pUUID, to_string(unix_uid)); return crashReport; } bool CCommLayerServerDBus::Report(map_crash_report_t pReport) { - //#define FIELD(X) crashReport.m_s##X = pReport[#X]; - //crashReport.m_sUUID = pReport["UUID"]; - //ALL_CRASH_REPORT_FIELDS; - //#undef FIELD - //for (dbus_map_report_info_t::iterator it = pReport.begin(); it!=pReport.end(); ++it) { - // std::cerr << it->second << std::endl; - //} - try - { - m_pMW->Report(pReport); - } - catch(std::string err) - { - std::cerr << err << std::endl; - return false; - } + m_pObserver->Report(pReport); return true; } bool CCommLayerServerDBus::DeleteDebugDump(const std::string& pUUID, const std::string& pDBusSender) { unsigned long unix_uid = m_pConn->sender_unix_uid(pDBusSender.c_str()); - try - { - //std::cerr << "DeleteDebugDump(" << pUUID << "," << unix_uid << ")" << std::endl; - m_pMW->DeleteCrashInfo(pUUID,to_string(unix_uid), true); - } - catch(std::string err) - { - std::cerr << err << std::endl; - return false; - } + m_pObserver->DeleteDebugDump(pUUID,to_string(unix_uid)); return true; } |