diff options
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llcallfloater.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llcallfloater.h | 3 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llimview.h | 1 |
5 files changed, 84 insertions, 17 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index e24e1a8605..5045703233 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -408,6 +408,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>AvalinePhoneSeparator</key> + <map> + <key>Comment</key> + <string>Separator of phone parts to have Avaline numbers human readable in Voice Control Panel</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>-</string> + </map> <key>AvatarAxisDeadZone0</key> <map> <key>Comment</key> diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index a402f59fa1..1468f6d584 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -47,6 +47,7 @@ #include "llfloaterreg.h" #include "llparticipantlist.h" #include "llspeakers.h" +#include "lltextutil.h" #include "lltransientfloatermgr.h" #include "llviewerwindow.h" #include "llvoicechannel.h" @@ -76,6 +77,12 @@ public: return rv; } + void setName(const std::string& name) + { + const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name); + LLAvatarListItem::setName(formatted_phone); + } + void setSpeakerId(const LLUUID& id) { mSpeakingIndicator->setSpeakerId(id); } }; @@ -270,6 +277,11 @@ void LLCallFloater::updateSession() case IM_NOTHING_SPECIAL: case IM_SESSION_P2P_INVITE: mVoiceType = VC_PEER_TO_PEER; + + if (!im_session->mOtherParticipantIsAvatar) + { + mVoiceType = VC_PEER_TO_PEER_AVALINE; + } break; case IM_SESSION_CONFERENCE_START: case IM_SESSION_GROUP_START: @@ -321,16 +333,13 @@ void LLCallFloater::updateSession() void LLCallFloater::refreshParticipantList() { - bool non_avatar_caller = false; - if (VC_PEER_TO_PEER == mVoiceType) + bool non_avatar_caller = VC_PEER_TO_PEER_AVALINE == mVoiceType; + + if (non_avatar_caller) { LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSpeakerManager->getSessionID()); - non_avatar_caller = !session->mOtherParticipantIsAvatar; - if (non_avatar_caller) - { - mNonAvatarCaller->setSpeakerId(session->mOtherParticipantID); - mNonAvatarCaller->setName(session->mName); - } + mNonAvatarCaller->setSpeakerId(session->mOtherParticipantID); + mNonAvatarCaller->setName(session->mName); } mNonAvatarCaller->setVisible(non_avatar_caller); @@ -390,9 +399,17 @@ void LLCallFloater::updateTitle() title = getString("title_nearby"); break; case VC_PEER_TO_PEER: + case VC_PEER_TO_PEER_AVALINE: { + title = voice_channel->getSessionName(); + + if (VC_PEER_TO_PEER_AVALINE == mVoiceType) + { + title = LLTextUtil::formatPhoneNumber(title); + } + LLStringUtil::format_map_t args; - args["[NAME]"] = voice_channel->getSessionName(); + args["[NAME]"] = title; title = getString("title_peer_2_peer", args); } break; diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index 8aba93fc43..2b40225906 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -88,7 +88,8 @@ private: VC_LOCAL_CHAT, VC_GROUP_CHAT, VC_AD_HOC_CHAT, - VC_PEER_TO_PEER + VC_PEER_TO_PEER, + VC_PEER_TO_PEER_AVALINE }EVoiceControls; typedef enum e_speaker_state diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 7c514cf4e6..8664f4ab4a 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -82,6 +82,7 @@ #include "llfirstuse.h" #include "llagentui.h" +#include "lltextutil.h" const static std::string IM_TIME("time"); const static std::string IM_TEXT("message"); @@ -92,6 +93,7 @@ const static std::string NO_SESSION("(IM Session Doesn't Exist)"); const static std::string ADHOC_NAME_SUFFIX(" Conference"); std::string LLCallDialogManager::sPreviousSessionlName = ""; +LLIMModel::LLIMSession::SType LLCallDialogManager::sPreviousSessionType = LLIMModel::LLIMSession::P2P_SESSION; std::string LLCallDialogManager::sCurrentSessionlName = ""; LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL; LLVoiceChannel::EState LLCallDialogManager::sOldState = LLVoiceChannel::STATE_READY; @@ -178,6 +180,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type) { mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id); + mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); // check if it was AVALINE call if (!mOtherParticipantIsAvatar) @@ -227,7 +230,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& { mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID); mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID); - mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID); } if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) @@ -1363,6 +1365,13 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id) sCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution return; } + + if (sSession) + { + // store previous session type to process Avaline calls in dialogs + sPreviousSessionType = sSession->mSessionType; + } + sSession = session; sSession->mVoiceChannel->setStateChangedCallback(LLCallDialogManager::onVoiceChannelStateChanged); if(sCurrentSessionlName != session->mName) @@ -1381,6 +1390,7 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id) mCallDialogPayload["session_name"] = sSession->mName; mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID; mCallDialogPayload["old_channel_name"] = sPreviousSessionlName; + mCallDialogPayload["old_session_type"] = sPreviousSessionType; mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED; mCallDialogPayload["disconnected_channel_name"] = sSession->mName; mCallDialogPayload["session_type"] = sSession->mSessionType; @@ -1410,6 +1420,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat mCallDialogPayload["session_name"] = sSession->mName; mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID; mCallDialogPayload["old_channel_name"] = sPreviousSessionlName; + mCallDialogPayload["old_session_type"] = sPreviousSessionType; mCallDialogPayload["state"] = new_state; mCallDialogPayload["disconnected_channel_name"] = sSession->mName; mCallDialogPayload["session_type"] = sSession->mSessionType; @@ -1424,6 +1435,11 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat } break; + case LLVoiceChannel::STATE_HUNG_UP: + // this state is coming before session is changed, so, put it into payload map + mCallDialogPayload["old_session_type"] = sSession->mSessionType; + break; + case LLVoiceChannel::STATE_CONNECTED : ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY); if (ocd) @@ -1564,7 +1580,15 @@ void LLOutgoingCallDialog::show(const LLSD& key) // tell the user which voice channel they are leaving if (!mPayload["old_channel_name"].asString().empty()) { - childSetTextArg("leaving", "[CURRENT_CHAT]", mPayload["old_channel_name"].asString()); + bool was_avaline_call = LLIMModel::LLIMSession::AVALINE_SESSION == mPayload["old_session_type"].asInteger(); + + std::string old_caller_name = mPayload["old_channel_name"].asString(); + if (was_avaline_call) + { + old_caller_name = LLTextUtil::formatPhoneNumber(old_caller_name); + } + + childSetTextArg("leaving", "[CURRENT_CHAT]", old_caller_name); } else { @@ -1578,10 +1602,18 @@ void LLOutgoingCallDialog::show(const LLSD& key) } std::string callee_name = mPayload["session_name"].asString(); + + LLUUID session_id = mPayload["session_id"].asUUID(); + bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id); + if (callee_name == "anonymous") { callee_name = getString("anonymous"); } + else if (!is_avatar) + { + callee_name = LLTextUtil::formatPhoneNumber(callee_name); + } setTitle(callee_name); @@ -1731,16 +1763,21 @@ BOOL LLIncomingCallDialog::postBuild() call_type = getString(mPayload["notify_box_type"]); } + + // check to see if this is an Avaline call + bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id); + childSetVisible("Start IM", is_avatar); // no IM for avaline + if (caller_name == "anonymous") { caller_name = getString("anonymous"); } - - setTitle(caller_name + " " + call_type); + else if (!is_avatar) + { + caller_name = LLTextUtil::formatPhoneNumber(caller_name); + } - // check to see if this is an Avaline call - bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id); - childSetVisible("Start IM", is_avatar); // no IM for avaline + setTitle(caller_name + " " + call_type); LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name"); caller_name_widget->setValue(caller_name + " " + call_type); diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 11860d0efb..20d8e28392 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -475,6 +475,7 @@ public: protected: static std::string sPreviousSessionlName; + static LLIMModel::LLIMSession::SType sPreviousSessionType; static std::string sCurrentSessionlName; static LLIMModel::LLIMSession* sSession; static LLVoiceChannel::EState sOldState; |