summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-01-05 14:20:07 +0200
committerMike Antipov <mantipov@productengine.com>2010-01-05 14:20:07 +0200
commitb499fabab8915bd135bc2cbdc105627a458e97c8 (patch)
treec20b7d3827013f354b6b2142c7dfdbd31ea77d03 /indra/newview
parent5043fcce370fd21e9709f94787191a060919cc2b (diff)
Completed low task EXT-3759 (NOTFORBETA0: Phone numbers for AvaLine calls should be human readable)
-- for now phone number is split on parts by two digits from right to left. The first left part can have 2 or 3 digits, i.e. +44-33-33-44-55-66 or 12-34-56-78-90. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llcallfloater.cpp35
-rw-r--r--indra/newview/llcallfloater.h3
-rw-r--r--indra/newview/llimview.cpp51
-rw-r--r--indra/newview/llimview.h1
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 b9af49a50d..51b88cc267 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)
@@ -224,7 +227,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") )
@@ -1360,6 +1362,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)
@@ -1378,6 +1387,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;
@@ -1407,6 +1417,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;
@@ -1421,6 +1432,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)
@@ -1561,7 +1577,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
{
@@ -1575,10 +1599,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);
@@ -1728,16 +1760,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;