diff options
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r-- | indra/newview/llimview.cpp | 87 |
1 files changed, 73 insertions, 14 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9e878f8c75..8917cc11e1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -238,15 +238,17 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction) { - bool is_p2p_session = dynamic_cast<LLVoiceChannelP2P*>(mVoiceChannel); - std::string other_avatar_name; + std::string you = LLTrans::getString("You"); + std::string started_call = LLTrans::getString("started_call"); + std::string joined_call = LLTrans::getString("joined_call"); + std::string other_avatar_name = ""; - if(is_p2p_session) + switch(mSessionType) { + case AVALINE_SESSION: + // *TODO: test avaline calls (EXT-2211) + case P2P_SESSION: gCacheName->getFullName(mOtherParticipantID, other_avatar_name); - std::string you = LLTrans::getString("You"); - std::string started_call = LLTrans::getString("started_call"); - std::string joined_call = LLTrans::getString("joined_call"); if(direction == LLVoiceChannel::INCOMING_CALL) { @@ -280,10 +282,45 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES { mSpeakers->update(true); } - } - else // group || ad-hoc calls - { + break; + + case GROUP_SESSION: + case ADHOC_SESSION: + // *TODO: determine call starter's name "other_avatar_name" (EXT-2211) + // decide how to show notifications for a group/adhoc chat already opened + // for now there is no notification from voice channel for this case + if(direction == LLVoiceChannel::INCOMING_CALL) + { + switch(new_state) + { + case LLVoiceChannel::STATE_CALL_STARTED : + LLIMModel::getInstance()->addMessageSilently(mSessionID, other_avatar_name, mOtherParticipantID, started_call); + break; + case LLVoiceChannel::STATE_CONNECTED : + LLIMModel::getInstance()->addMessageSilently(mSessionID, you, gAgent.getID(), joined_call); + default: + break; + } + } + else // outgoing call + { + switch(new_state) + { + case LLVoiceChannel::STATE_CALL_STARTED : + LLIMModel::getInstance()->addMessageSilently(mSessionID, you, gAgent.getID(), started_call); + break; + default: + break; + } + } + + // Update speakers list when connected + if (LLVoiceChannel::STATE_CONNECTED == new_state) + { + mSpeakers->update(true); + } + break; } } @@ -1190,15 +1227,15 @@ LLIMMgr::showSessionEventError( const std::string& error_string, const LLUUID session_id) { - const LLFloater* floater = getFloaterBySessionID (session_id); - if (!floater) return; - LLSD args; + LLStringUtil::format_map_t event_args; + + event_args["RECIPIENT"] = LLIMModel::getInstance()->getName(session_id); + args["REASON"] = LLTrans::getString(error_string); args["EVENT"] = - LLTrans::getString(event_string); - args["RECIPIENT"] = floater->getTitle(); + LLTrans::getString(event_string, event_args); LLNotificationsUtil::add( "ChatterBoxSessionEventError", @@ -1279,6 +1316,28 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id) sPreviousSessionlName = sCurrentSessionlName; sCurrentSessionlName = session->mName; } + + if (LLVoiceChannel::getCurrentVoiceChannel()->getState() == LLVoiceChannel::STATE_CALL_STARTED && + LLVoiceChannel::getCurrentVoiceChannel()->getCallDirection() == LLVoiceChannel::OUTGOING_CALL) + { + + //*TODO get rid of duplicated code + LLSD mCallDialogPayload; + mCallDialogPayload["session_id"] = sSession->mSessionID; + mCallDialogPayload["session_name"] = sSession->mName; + mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID; + mCallDialogPayload["old_channel_name"] = sPreviousSessionlName; + mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED; + mCallDialogPayload["disconnected_channel_name"] = sSession->mName; + mCallDialogPayload["session_type"] = sSession->mSessionType; + + LLOutgoingCallDialog* ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY); + if(ocd) + { + ocd->show(mCallDialogPayload); + } + } + } void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction) |