From 97164f010ce4ec56e5f63cd7ceed882ab12f145b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Wed, 27 Oct 2010 15:24:22 -0700 Subject: DN-188 Inspectors and Profile images not available in IM history or local chat history --- indra/llmessage/llcachename.cpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') 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 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 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; } -- cgit v1.2.3 From ebc8cdd6cbd8207a54314c71fd6abc6e8a49893b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 29 Oct 2010 13:15:16 -0700 Subject: DN-154 Display Names only shown in Nearby Chat History when a user logs back in even if Usernames were shown in Chat during previous session --- indra/llmessage/llcachename.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index deaa3e138e..a8f53a38c3 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -575,7 +575,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) LLStringUtil::toUpper(cap_letter); legacy_name = cap_letter + legacy_name.substr(1); - if (name_results[4].matched) + if (name_results[3].matched) { std::string last_name = name_results[3]; std::string cap_letter = last_name.substr(1, 1); -- cgit v1.2.3 From dfdd1abe513facad78f8169405879a05d6e8d56b Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 4 Nov 2010 11:51:45 -0700 Subject: DN-188 Fixed users with lastname residents not having inspectors in chat history --- indra/llmessage/llcachename.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index a8f53a38c3..4ab6bd2438 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -565,29 +565,25 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) } std::string username = complete_name.substr(open_paren); - boost::regex complete_name_regex("( \\()([a-z0-9]+)(.[a-z]+)*(\\))"); - boost::match_results name_results; - if (!boost::regex_match(username, name_results, complete_name_regex)) return complete_name; - + boost::regex complete_name_regex("( \\()([a-z0-9]+)(.[a-z]+)*(\\))"); + boost::match_results 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[3].matched) - { + legacy_name = cap_letter + legacy_name.substr(1); + + if (name_results[3].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; - } - else - { - legacy_name = legacy_name + " Resident"; - } - + last_name = cap_letter + last_name.substr(2); + legacy_name = legacy_name + " " + last_name; + } + return legacy_name; } -- cgit v1.2.3