diff options
| author | Richard Linden <none@none> | 2011-05-02 17:57:52 -0700 |
|---|---|---|
| committer | Richard Linden <none@none> | 2011-05-02 17:57:52 -0700 |
| commit | d5faa4f38d338777463b7ad6eb3239041d43fe28 (patch) | |
| tree | d57efbda59c9f677b2245bebc97fec129f3f9fad /indra/newview/llpanellogin.cpp | |
| parent | 9a6f06687e5b467f0c049bfbf88c2131eee11ef3 (diff) | |
| parent | 78d76eb4b01e0bd6db41a67d1573a1b841cbe993 (diff) | |
Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience
Diffstat (limited to 'indra/newview/llpanellogin.cpp')
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index a5385b0b1c..4ac3a248d3 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -81,6 +81,10 @@ const S32 MAX_PASSWORD = 16; LLPanelLogin *LLPanelLogin::sInstance = NULL; BOOL LLPanelLogin::sCapslockDidNotification = FALSE; +// Helper for converting a user name into the canonical "Firstname Lastname" form. +// For new accounts without a last name "Resident" is added as a last name. +static std::string canonicalize_username(const std::string& name); + class LLLoginRefreshHandler : public LLCommandHandler { public: @@ -232,7 +236,14 @@ void LLPanelLogin::addFavoritesToStartLocation() for (LLSD::map_const_iterator iter = fav_llsd.beginMap(); iter != fav_llsd.endMap(); ++iter) { - if(iter->first != getChild<LLComboBox>("username_combo")->getSimple()) continue; + std::string user_defined_name = getChild<LLComboBox>("username_combo")->getSimple(); + + // The account name in stored_favorites.xml has Resident last name even if user has + // a single word account name, so it can be compared case-insensitive with the + // user defined "firstname lastname". + S32 res = LLStringUtil::compareInsensitive(canonicalize_username(user_defined_name), iter->first); + if (res != 0) continue; + combo->addSeparator(); LLSD user_llsd = iter->second; for (LLSD::array_const_iterator iter1 = user_llsd.beginArray(); @@ -1036,3 +1047,28 @@ void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& n break; } } + +std::string canonicalize_username(const std::string& name) +{ + std::string cname = name; + LLStringUtil::trim(cname); + + // determine if the username is a first/last form or not. + size_t separator_index = cname.find_first_of(" ._"); + std::string first = cname.substr(0, separator_index); + std::string last; + if (separator_index != cname.npos) + { + last = cname.substr(separator_index+1, cname.npos); + LLStringUtil::trim(last); + } + else + { + // ...on Linden grids, single username users as considered to have + // last name "Resident" + last = "Resident"; + } + + // Username in traditional "firstname lastname" form. + return first + ' ' + last; +} |
