summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2010-10-27 15:24:22 -0700
committerLeyla Farazha <leyla@lindenlab.com>2010-10-27 15:24:22 -0700
commit97164f010ce4ec56e5f63cd7ceed882ab12f145b (patch)
treed50d3fd92c06634f18d7a1cbd960972d6b7d3c9b /indra
parent360ce3d667ecd9ac6c6c8b4a91902997ca7de60a (diff)
DN-188 Inspectors and Profile images not available in IM history or local chat history
Diffstat (limited to 'indra')
-rw-r--r--indra/llmessage/llcachename.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 522b99bc02..deaa3e138e 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -556,25 +556,38 @@ std::string LLCacheName::buildUsername(const std::string& full_name)
//static
std::string LLCacheName::buildLegacyName(const std::string& complete_name)
{
- boost::regex complete_name_regex("(.+)( \\()([A-Za-z]+)(.[A-Za-z]+)*(\\))");
- boost::match_results<std::string::const_iterator> name_results;
- if (!boost::regex_match(complete_name, name_results, complete_name_regex)) return complete_name;
+ // regexp doesn't play nice with unicode, chop off the display name
+ S32 open_paren = complete_name.rfind(" (");
- std::string legacy_name = name_results[3];
+ if (open_paren == std::string::npos)
+ {
+ return complete_name;
+ }
+
+ std::string username = complete_name.substr(open_paren);
+ boost::regex complete_name_regex("( \\()([a-z0-9]+)(.[a-z]+)*(\\))");
+ boost::match_results<std::string::const_iterator> name_results;
+ if (!boost::regex_match(username, name_results, complete_name_regex)) return complete_name;
+
+ std::string legacy_name = name_results[2];
// capitalize the first letter
std::string cap_letter = legacy_name.substr(0, 1);
LLStringUtil::toUpper(cap_letter);
- legacy_name = cap_letter + legacy_name.substr(1);
-
- if (name_results[4].matched)
- {
- std::string last_name = name_results[4];
+ legacy_name = cap_letter + legacy_name.substr(1);
+
+ if (name_results[4].matched)
+ {
+ std::string last_name = name_results[3];
std::string cap_letter = last_name.substr(1, 1);
LLStringUtil::toUpper(cap_letter);
- last_name = cap_letter + last_name.substr(2);
- legacy_name = legacy_name + " " + last_name;
- }
-
+ last_name = cap_letter + last_name.substr(2);
+ legacy_name = legacy_name + " " + last_name;
+ }
+ else
+ {
+ legacy_name = legacy_name + " Resident";
+ }
+
return legacy_name;
}