From 09d9c2ca196f43396f9adf1d0f98a6ee41b6834f Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Mon, 3 Jun 2013 16:36:51 -0400 Subject: [PATCH] * #23661: daemon: use getAccountID directly --- daemon/src/managerimpl.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index a57d170673..39f7760ded 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -1646,16 +1646,19 @@ void ManagerImpl::peerHungupCall(const std::string& call_id) /* Direct IP to IP call */ if (isIPToIP(call_id)) { Call * call = SIPVoIPLink::instance()->getSipCall(call_id); - history_.addCall(call, preferences.getHistoryLimit()); - SIPVoIPLink::instance()->hangup(call_id, 0); - saveHistory(); + if (call) { + history_.addCall(call, preferences.getHistoryLimit()); + SIPVoIPLink::instance()->hangup(call_id, 0); + saveHistory(); + } } else { - const std::string account_id(getAccountFromCall(call_id)); - VoIPLink *link = getAccountLink(account_id); Call * call = getCallFromCallID(call_id); - history_.addCall(call, preferences.getHistoryLimit()); - link->peerHungup(call_id); - saveHistory(); + if (call) { + VoIPLink *link = getAccountLink(call->getAccountId()); + history_.addCall(call, preferences.getHistoryLimit()); + link->peerHungup(call_id); + saveHistory(); + } } /* Broadcast a signal over DBus */ @@ -1900,16 +1903,16 @@ std::string ManagerImpl::createConfigFile() const std::string ManagerImpl::getCurrentAudioCodecName(const std::string& id) { - std::string accountid = getAccountFromCall(id); - VoIPLink* link = getAccountLink(accountid); Call* call = getCallFromCallID(id); std::string codecName; if (call) { Call::CallState state = call->getState(); - if (state == Call::ACTIVE or state == Call::CONFERENCING) + if (state == Call::ACTIVE or state == Call::CONFERENCING) { + VoIPLink* link = getAccountLink(call->getAccountId()); codecName = link->getCurrentAudioCodecNames(call); + } } return codecName; @@ -1918,13 +1921,13 @@ std::string ManagerImpl::getCurrentAudioCodecName(const std::string& id) std::string ManagerImpl::getCurrentVideoCodecName(const std::string& ID) { - std::string accountID = getAccountFromCall(ID); - VoIPLink* link = getAccountLink(accountID); Call *call(getCallFromCallID(ID)); - if (call) + if (call) { + VoIPLink* link = getAccountLink(call->getAccountId()); return link->getCurrentVideoCodecName(call); - else + } else { return ""; + } } /** @@ -2049,7 +2052,6 @@ void ManagerImpl::setRecordingCall(const std::string& id) ConferenceMap::const_iterator it(conferenceMap_.find(id)); if (it == conferenceMap_.end()) { DEBUG("Set recording for call %s", id.c_str()); - std::string accountid(getAccountFromCall(id)); rec = getCallFromCallID(id); } else { DEBUG("Set recording for conference %s", id.c_str()); -- GitLab