summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llpanelme.cpp15
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
2 files changed, 23 insertions, 3 deletions
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/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"