diff --git a/daemon/src/dbus/dbusmanager.cpp b/daemon/src/dbus/dbusmanager.cpp index bed4b887fa08c87ccfc98939942b6d0ac1133553..37a12ad3b216fb8ef558690360a5545be224f5c9 100644 --- a/daemon/src/dbus/dbusmanager.cpp +++ b/daemon/src/dbus/dbusmanager.cpp @@ -28,6 +28,7 @@ * as that of the covered work. */ +#include <cstdlib> #include <dbusmanager.h> #include "global.h" #include "manager.h" @@ -38,13 +39,6 @@ #include "networkmanager.h" DBusManager::DBusManager() - : _connected(false) - , _callManager(NULL) - , _configurationManager(NULL) - , _instanceManager(NULL) -#ifdef USE_NETWORKMANAGER - , _networkManager(NULL) -#endif { try { DBus::_init_threading(); @@ -62,9 +56,9 @@ DBusManager::DBusManager() _networkManager = new NetworkManager (systemConnection, "/org/freedesktop/NetworkManager", ""); #endif - _connected = true; } catch (const DBus::Error &err) { - _error("%s: %s\n", err.name(), err.what()); + _error("%s: %s, exiting\n", err.name(), err.what()); + ::exit(1); } } diff --git a/daemon/src/dbus/dbusmanager.h b/daemon/src/dbus/dbusmanager.h index a6bc51b8d66548c9f3a1eec71a3c6a926c7ab075..61a6f57144ba390bcd3f448e8ffa069d1553b0a2 100644 --- a/daemon/src/dbus/dbusmanager.h +++ b/daemon/src/dbus/dbusmanager.h @@ -54,15 +54,10 @@ class DBusManager return _configurationManager; }; - bool isConnected() const { - return _connected; - } - void exec(); void exit(); private: - bool _connected; CallManager* _callManager; ConfigurationManager* _configurationManager; Instance* _instanceManager; diff --git a/daemon/src/dbus/instance-introspec.xml b/daemon/src/dbus/instance-introspec.xml index 4b7d075cd87112df83744e3740f892d4f1cb26e5..f564d54cc1ed7bb941af0b35fb063928cd2a9f88 100644 --- a/daemon/src/dbus/instance-introspec.xml +++ b/daemon/src/dbus/instance-introspec.xml @@ -29,18 +29,5 @@ </tp:docstring> </arg> </method> - - <method name="getRegistrationCount" tp:name-for-bindings="getRegistrationCount"> - <tp:docstring> - Get the number of connected clients. - </tp:docstring> - <arg type="i" name="count" direction="out"> - <tp:docstring> - The number of client currently connected to the core - </tp:docstring> - </arg> - </method> - - </interface> </node> diff --git a/daemon/src/dbus/instance.cpp b/daemon/src/dbus/instance.cpp index 6a25a8e30f1f2b01ce8a4ab98a5ec00fbee1b765..266b1b86cf97309032bd2a0ee10e7b4b343cd3ed 100644 --- a/daemon/src/dbus/instance.cpp +++ b/daemon/src/dbus/instance.cpp @@ -31,10 +31,8 @@ #include <instance.h> #include "../manager.h" -const char* Instance::SERVER_PATH = "/org/sflphone/SFLphone/Instance"; - Instance::Instance (DBus::Connection& connection) - : DBus::ObjectAdaptor (connection, SERVER_PATH) + : DBus::ObjectAdaptor (connection, "/org/sflphone/SFLphone/Instance") { count = 0; } @@ -43,7 +41,6 @@ void Instance::Register (const int32_t& pid UNUSED, const std::string& name UNUSED) { - _debug ("Instance::register received"); count++; } @@ -51,7 +48,6 @@ Instance::Register (const int32_t& pid UNUSED, void Instance::Unregister (const int32_t& pid UNUSED) { - _debug ("Instance::unregister received"); count --; if (count <= 0) { @@ -59,10 +55,3 @@ Instance::Unregister (const int32_t& pid UNUSED) Manager::instance().getDbusManager()->exit(); } } - -int32_t -Instance::getRegistrationCount (void) -{ - return count; -} - diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 9007c74d21393fd9b7a815ea568ebd6b8de2d7d5..cf1fd4b41f047847ab147e2ad29a8d5a4259f77b 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -142,6 +142,8 @@ void ManagerImpl::terminate () unloadAccountMap(); + delete SIPVoIPLink::instance(); + delete _dtmfKey; delete _telephoneTone; @@ -209,9 +211,8 @@ bool ManagerImpl::outgoingCall (const std::string& account_id, std::string to_cleaned(NumberCleaner::clean(to, prefix)); - Call::CallConfiguration callConfig; - /* Check what kind of call we are dealing with */ - checkCallConfiguration (call_id, to_cleaned, &callConfig); + Call::CallConfiguration callConfig = checkCallConfiguration (call_id, to_cleaned); + associateConfigToCall(call_id, callConfig); // in any cases we have to detach from current communication if (hasCurrentCall()) { @@ -1684,8 +1685,7 @@ void ManagerImpl::startVoiceMessageNotification (const std::string& accountId, void ManagerImpl::connectionStatusNotification () { - if (_dbus.isConnected()) - _dbus.getConfigurationManager()->accountsChanged(); + _dbus.getConfigurationManager()->accountsChanged(); } /** @@ -2618,8 +2618,7 @@ std::string ManagerImpl::addAccount ( saveConfig(); - if (_dbus.isConnected()) - _dbus.getConfigurationManager()->accountsChanged(); + _dbus.getConfigurationManager()->accountsChanged(); return accountID.str(); } @@ -2640,10 +2639,7 @@ void ManagerImpl::removeAccount (const std::string& accountID) saveConfig(); - _debug ("REMOVE ACCOUNT"); - - if (_dbus.isConnected()) - _dbus.getConfigurationManager()->accountsChanged(); + _dbus.getConfigurationManager()->accountsChanged(); } // ACCOUNT handling @@ -2704,8 +2700,6 @@ std::vector<std::string> ManagerImpl::loadAccountOrder (void) const void ManagerImpl::loadAccountMap(Conf::YamlParser *parser) { - SIPVoIPLink *link = SIPVoIPLink::instance(); - // build a default IP2IP account with default parameters Account *ip2ip = new SIPAccount(IP2IP_PROFILE); _accountMap[IP2IP_PROFILE] = ip2ip; @@ -2727,7 +2721,7 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser *parser) // Initialize default UDP transport according to // IP to IP settings (most likely using port 5060) - link->createDefaultSipUdpTransport(); + SIPVoIPLink::instance()->createDefaultSipUdpTransport(); // Force IP2IP settings to be loaded to be loaded // No registration in the sense of the REGISTER method is performed. @@ -2776,8 +2770,6 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser *parser) void ManagerImpl::unloadAccountMap () { - _debug ("Manager: Unload account map"); - AccountMap::iterator iter; for (iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { // Avoid removing the IP2IP account twice @@ -2786,8 +2778,6 @@ void ManagerImpl::unloadAccountMap () } _accountMap.clear(); - - delete SIPVoIPLink::instance(); } bool ManagerImpl::accountExists (const std::string& accountID) @@ -2861,8 +2851,6 @@ std::map<std::string, int32_t> ManagerImpl::getAddressbookSettings () const void ManagerImpl::setAddressbookSettings ( const std::map<std::string, int32_t>& settings) { - _debug ("Manager: Update addressbook settings"); - addressbookPreference.setEnabled (settings.find ("ADDRESSBOOK_ENABLE")->second == 1); addressbookPreference.setMaxResults (settings.find ("ADDRESSBOOK_MAX_RESULTS")->second); addressbookPreference.setPhoto (settings.find ("ADDRESSBOOK_DISPLAY_CONTACT_PHOTO")->second == 1); @@ -2878,11 +2866,7 @@ void ManagerImpl::setAddressbookSettings ( void ManagerImpl::setAddressbookList (const std::vector<std::string>& list) { - _debug ("Manager: Set addressbook list"); - - std::string s = ManagerImpl::serialize (list); - _debug("Manager: New addressbook list: %s", s.c_str()); - addressbookPreference.setList (s); + addressbookPreference.setList (ManagerImpl::serialize (list)); saveConfig(); } @@ -2921,20 +2905,9 @@ void ManagerImpl::setHookSettings (const std::map<std::string, std::string>& set // saveConfig(); } -void ManagerImpl::checkCallConfiguration (const std::string& id, - const std::string &to, Call::CallConfiguration *callConfig) +Call::CallConfiguration ManagerImpl::checkCallConfiguration (const std::string& id, const std::string &to) { - Call::CallConfiguration config; - - if (to.find (SIP_SCHEME) == 0 or to.find (SIPS_SCHEME) == 0) { - _debug ("Manager: Sip scheme detected (sip: or sips:), sending IP2IP Call"); - config = Call::IPtoIP; - } else - config = Call::Classic; - - associateConfigToCall (id, config); - - *callConfig = config; + return (to.find (SIP_SCHEME) == 0 or to.find (SIPS_SCHEME) == 0) ? Call::IPtoIP : Call::Classic; } bool ManagerImpl::associateConfigToCall (const std::string& callID, @@ -3006,17 +2979,12 @@ std::map<std::string, std::string> ManagerImpl::getCallDetails (const std::strin std::vector<std::string> ManagerImpl::getHistorySerialized(void) const { - _debug("Manager: Get history serialized"); - return _history->get_history_serialized(); } void ManagerImpl::setHistorySerialized(std::vector<std::string> history) { - - _debug("Manager: Set history serialized"); - - _history->set_serialized_history (history, preferences.getHistoryLimit());; + _history->set_serialized_history (history, preferences.getHistoryLimit());; _history->save_history(); } @@ -3056,21 +3024,16 @@ std::vector<std::string> ManagerImpl::getConferenceList (void) const { std::vector<std::string> v; vectorFromMapKeys(_conferencemap, v); - return v; } std::vector<std::string> ManagerImpl::getParticipantList (const std::string& confID) const { - ConferenceMap::const_iterator iter_conf = _conferencemap.find (confID); - Conference *conf = NULL; - - if (iter_conf != _conferencemap.end()) - conf = iter_conf->second; - std::vector<std::string> v; - if (conf) { - const ParticipantSet &participants = conf->getParticipantList(); + + ConferenceMap::const_iterator iter_conf = _conferencemap.find (confID); + if (iter_conf != _conferencemap.end()) { + const ParticipantSet &participants = iter_conf->second->getParticipantList(); std::copy(participants.begin(), participants.end(), std::back_inserter(v));; } else _warn ("Manager: Warning: Did not found conference %s", confID.c_str()); diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index b8551b253b988970a9c43177df9d8f1468b2ae4b..7917303b53d75f3cc9c7b2ff3f1dab1ce627dafe 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -1227,7 +1227,7 @@ class ManagerImpl /** * Check if the call is a classic call or a direct IP-to-IP call */ - void checkCallConfiguration (const std::string& id, const std::string& to, Call::CallConfiguration *callConfig); + Call::CallConfiguration checkCallConfiguration (const std::string& id, const std::string& to); Conf::YamlEmitter *emitter; }; diff --git a/gnome/src/dbus/instance-introspec.xml b/gnome/src/dbus/instance-introspec.xml index 4b7d075cd87112df83744e3740f892d4f1cb26e5..f564d54cc1ed7bb941af0b35fb063928cd2a9f88 100644 --- a/gnome/src/dbus/instance-introspec.xml +++ b/gnome/src/dbus/instance-introspec.xml @@ -29,18 +29,5 @@ </tp:docstring> </arg> </method> - - <method name="getRegistrationCount" tp:name-for-bindings="getRegistrationCount"> - <tp:docstring> - Get the number of connected clients. - </tp:docstring> - <arg type="i" name="count" direction="out"> - <tp:docstring> - The number of client currently connected to the core - </tp:docstring> - </arg> - </method> - - </interface> </node> diff --git a/kde/src/dbus/instance-introspec.xml b/kde/src/dbus/instance-introspec.xml index 4b7d075cd87112df83744e3740f892d4f1cb26e5..f564d54cc1ed7bb941af0b35fb063928cd2a9f88 100755 --- a/kde/src/dbus/instance-introspec.xml +++ b/kde/src/dbus/instance-introspec.xml @@ -29,18 +29,5 @@ </tp:docstring> </arg> </method> - - <method name="getRegistrationCount" tp:name-for-bindings="getRegistrationCount"> - <tp:docstring> - Get the number of connected clients. - </tp:docstring> - <arg type="i" name="count" direction="out"> - <tp:docstring> - The number of client currently connected to the core - </tp:docstring> - </arg> - </method> - - </interface> </node> diff --git a/kde/src/lib/dbus/instance-introspec.xml b/kde/src/lib/dbus/instance-introspec.xml index 4b7d075cd87112df83744e3740f892d4f1cb26e5..f564d54cc1ed7bb941af0b35fb063928cd2a9f88 100644 --- a/kde/src/lib/dbus/instance-introspec.xml +++ b/kde/src/lib/dbus/instance-introspec.xml @@ -29,18 +29,5 @@ </tp:docstring> </arg> </method> - - <method name="getRegistrationCount" tp:name-for-bindings="getRegistrationCount"> - <tp:docstring> - Get the number of connected clients. - </tp:docstring> - <arg type="i" name="count" direction="out"> - <tp:docstring> - The number of client currently connected to the core - </tp:docstring> - </arg> - </method> - - </interface> </node>