summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llavatarname.cpp15
-rw-r--r--indra/llcommon/llavatarname.h4
-rw-r--r--indra/newview/llavataractions.cpp65
-rw-r--r--indra/newview/llpanelme.cpp15
-rw-r--r--indra/newview/llviewerdisplayname.cpp1
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
-rw-r--r--indra/newview/skins/default/xui/en/panel_im_control_panel.xml24
7 files changed, 82 insertions, 53 deletions
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index 4eeb6e706d..7415acadd4 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -79,3 +79,18 @@ void LLAvatarName::fromLLSD(const LLSD& sd)
LLDate expires = sd[DISPLAY_NAME_EXPIRES];
mExpires = expires.secondsSinceEpoch();
}
+
+std::string LLAvatarName::getNameAndSLID() const
+{
+ std::string name;
+ if (!mSLID.empty())
+ {
+ name = mDisplayName + " (" + mSLID + ")";
+ }
+ else
+ {
+ // ...display names are off, legacy name is in mDisplayName
+ name = mDisplayName;
+ }
+ return name;
+}
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index d7d91e1c7a..87750210c6 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -49,6 +49,10 @@ public:
void fromLLSD(const LLSD& sd);
+ // For normal names, returns "James Linden (james.linden)"
+ // When display names are disabled returns just "James Linden"
+ std::string getNameAndSLID() const;
+
// "bobsmith123" or "james.linden", US-ASCII only
std::string mSLID;
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 85a087d6f6..fe6ca60d7c 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -187,28 +187,11 @@ void LLAvatarActions::offerTeleport(const uuid_vec_t& ids)
handle_lure(ids);
}
-// static
-void LLAvatarActions::startIM(const LLUUID& id)
+static void on_avatar_name_cache_start_im(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
{
- if (id.isNull())
- return;
-
- std::string name;
- if (!gCacheName->getFullName(id, name))
- {
- gCacheName->get(id, FALSE, boost::bind(&LLAvatarActions::startIM, id));
- return;
- }
-
- // IDEVO
- LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(id, &av_name))
- {
- name = av_name.mDisplayName + " (" + av_name.mSLID + ")";
- }
-
- LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id);
+ std::string name = av_name.getNameAndSLID();
+ LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id);
if (session_id != LLUUID::null)
{
LLIMFloater::show(session_id);
@@ -217,6 +200,16 @@ void LLAvatarActions::startIM(const LLUUID& id)
}
// static
+void LLAvatarActions::startIM(const LLUUID& id)
+{
+ if (id.isNull())
+ return;
+
+ LLAvatarNameCache::get(id,
+ boost::bind(&on_avatar_name_cache_start_im, _1, _2));
+}
+
+// static
void LLAvatarActions::endIM(const LLUUID& id)
{
if (id.isNull())
@@ -229,6 +222,18 @@ void LLAvatarActions::endIM(const LLUUID& id)
}
}
+static void on_avatar_name_cache_start_call(const LLUUID& agent_id,
+ const LLAvatarName& av_name)
+{
+ std::string name = av_name.getNameAndSLID();
+ LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, true);
+ if (session_id != LLUUID::null)
+ {
+ gIMMgr->startCall(session_id);
+ }
+ make_ui_sound("UISndStartIM");
+}
+
// static
void LLAvatarActions::startCall(const LLUUID& id)
{
@@ -236,22 +241,8 @@ void LLAvatarActions::startCall(const LLUUID& id)
{
return;
}
-
- std::string name;
- gCacheName->getFullName(id, name);
- // IDEVO
- LLAvatarName av_name;
- if (LLAvatarNameCache::useDisplayNames()
- && LLAvatarNameCache::get(id, &av_name))
- {
- name = av_name.mDisplayName + " (" + av_name.mSLID + ")";
- }
- LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, id, true);
- if (session_id != LLUUID::null)
- {
- gIMMgr->startCall(session_id);
- }
- make_ui_sound("UISndStartIM");
+ LLAvatarNameCache::get(id,
+ boost::bind(&on_avatar_name_cache_start_call, _1, _2));
}
// static
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 483741e643..f38c8859ef 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -352,8 +352,19 @@ void LLPanelMyProfileEdit::onDialogSetName(const LLSD& notification, const LLSD&
LLUUID agent_id = notification["payload"]["agent_id"];
if (agent_id.isNull()) return;
- std::string display_name = response["display_name"].asString();
- LLViewerDisplayName::set(display_name,
+ std::string display_name_utf8 = response["display_name"].asString();
+
+ const U32 DISPLAY_NAME_MAX_LENGTH = 31; // characters, not bytes
+ LLWString display_name_wstr = utf8string_to_wstring(display_name_utf8);
+ if (display_name_wstr.size() > DISPLAY_NAME_MAX_LENGTH)
+ {
+ LLSD args;
+ args["LENGTH"] = llformat("%d", DISPLAY_NAME_MAX_LENGTH);
+ LLNotificationsUtil::add("SetDisplayNameFailedLength", args);
+ return;
+ }
+
+ LLViewerDisplayName::set(display_name_utf8,
boost::bind(&LLPanelMyProfileEdit::onCacheSetName, this,
_1, _2, _3));
}
diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp
index bec2687cca..ec80129f8a 100644
--- a/indra/newview/llviewerdisplayname.cpp
+++ b/indra/newview/llviewerdisplayname.cpp
@@ -148,7 +148,6 @@ public:
}
};
-#include "llsdserialize.h"
class LLDisplayNameUpdate : public LLHTTPNode
{
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index ffc58746e3..c4ddae1a12 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3098,7 +3098,16 @@ Just like in real life, it takes a while for everyone to learn about a new name.
See http://wiki.secondlife.com/wiki/Display_Names for details.
</notification>
-
+
+ <notification
+ icon="alertmodal.tga"
+ name="SetDisplayNameFailedLength"
+ type="alertmodal">
+Sorry, that name is too long. Display names can have a maximum of [LENGTH] characters.
+
+Please try a shorter name.
+ </notification>
+
<notification
icon="alertmodal.tga"
name="SetDisplayNameFailedGeneric"
diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
index 33a5e01e4c..a36f078f4f 100644
--- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
@@ -24,25 +24,15 @@
top_pad="5"
width="114">
<layout_panel
- mouse_opaque="false"
- auto_resize="true"
- follows="top|left"
- height="0"
- layout="topleft"
- left="2"
- min_height="0"
- width="109"
- top="0"
- name="spacer"
- user_resize="false" />
- <layout_panel
auto_resize="false"
follows="top|left|right"
height="20"
layout="topleft"
+ left="2"
min_height="20"
width="109"
name="view_profile_btn_panel"
+ top="0"
user_resize="false">
<button
follows="left|top|right"
@@ -171,5 +161,15 @@
name="voice_ctrls_btn"
width="109" />
</layout_panel>
+ <layout_panel
+ mouse_opaque="false"
+ auto_resize="true"
+ follows="top|left"
+ height="0"
+ layout="topleft"
+ min_height="0"
+ width="109"
+ name="spacer"
+ user_resize="false" />
</layout_stack>
</panel>