diff options
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r-- | indra/newview/llimview.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 6aa6c3f461..20b9cc1f8b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -854,23 +854,18 @@ public: //in case of race conditions speaker_mgr->updateSpeakers(gIMMgr->getPendingAgentListUpdates(mSessionID)); } - - LLFloaterIMPanel* floaterp = - gIMMgr->findFloaterBySession(mSessionID); - if (floaterp) + if (LLIMMgr::INVITATION_TYPE_VOICE == mInvitiationType) { - if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE ) - { - floaterp->requestAutoConnect(); - LLFloaterIMPanel::onClickStartCall(floaterp); - // always open IM window when connecting to voice - LLFloaterReg::showInstance("communicate", LLSD(), TRUE); - } - else if ( mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE ) - { - LLFloaterReg::showInstance("communicate", LLSD(), TRUE); - } + gIMMgr->startCall(mSessionID); + } + + if ((mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE + || mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE) + && LLIMModel::getInstance()->findIMSession(mSessionID)) + { + // always open IM window when connecting to voice + LLIMFloater::show(mSessionID); } gIMMgr->clearPendingAgentListUpdates(mSessionID); @@ -1041,20 +1036,13 @@ void LLIncomingCallDialog::processCallResponse(S32 response) if (voice) { - LLFloaterIMPanel* im_floater = - gIMMgr->findFloaterBySession( - session_id); - - if (im_floater) + if (gIMMgr->startCall(session_id)) { - im_floater->requestAutoConnect(); - LLFloaterIMPanel::onClickStartCall(im_floater); + // always open IM window when connecting to voice + LLIMFloater::show(session_id); } } - // always open IM window when connecting to voice - LLFloaterReg::showInstance("communicate", session_id); - gIMMgr->clearPendingAgentListUpdates(session_id); gIMMgr->clearPendingInvitation(session_id); } @@ -1159,15 +1147,10 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) payload["session_handle"].asString(), payload["session_uri"].asString()); - LLFloaterIMPanel* im_floater = - gIMMgr->findFloaterBySession( - session_id); - if (im_floater) + if (gIMMgr->startCall(session_id)) { - im_floater->requestAutoConnect(); - LLFloaterIMPanel::onClickStartCall(im_floater); // always open IM window when connecting to voice - LLFloaterReg::showInstance("communicate", session_id, TRUE); + LLIMFloater::show(session_id); } gIMMgr->clearPendingAgentListUpdates(session_id); @@ -1905,6 +1888,24 @@ void LLIMMgr::removeSessionObserver(LLIMSessionObserver *observer) mSessionObservers.remove(observer); } +bool LLIMMgr::startCall(const LLUUID& session_id) +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id); + if (!voice_channel) return false; + + voice_channel->activate(); + return true; +} + +bool LLIMMgr::endCall(const LLUUID& session_id) +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id); + if (!voice_channel) return false; + + voice_channel->deactivate(); + return true; +} + // create a floater and update internal representation for // consistency. Returns the pointer, caller (the class instance since // it is a private method) is not responsible for deleting the |