diff options
author | James Cook <james@lindenlab.com> | 2010-05-12 16:32:54 -0700 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-05-12 16:32:54 -0700 |
commit | 6871747f11f300fcf90edba2224c91a3645617cc (patch) | |
tree | 932f43f6547d1221c889dc2992fc742787883461 /indra/newview/llpanelme.cpp | |
parent | bee1a091469f8d1f2277e8d5b4cc9981e8060bde (diff) |
DEV-50013 Display names limited to 31 chars (not bytes) in viewer UI
Reviewed with Leyla
Diffstat (limited to 'indra/newview/llpanelme.cpp')
-rw-r--r-- | indra/newview/llpanelme.cpp | 15 |
1 files changed, 13 insertions, 2 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)); } |