From dd9bfb6d859c5848b5ff6c8fdebbc34ab65f92e7 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 22 Jan 2010 16:52:53 -0800 Subject: LLCacheName and LLUrlEntryAgent now understand SLIDs - accounts with "Resident" as last name should not display that name. Also added test display names. --- indra/llmessage/llcachename.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 3078d80552..04b8ef9637 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -461,7 +461,7 @@ void LLCacheName::exportFile(std::ostream& ostr) // store it LLUUID id = iter->first; std::string id_str = id.asString(); - if(!entry->mFirstName.empty() && !entry->mLastName.empty()) + if(!entry->mFirstName.empty() /* && !entry->mLastName.empty() */ ) // IDEVO save SLIDs { data[AGENTS][id_str][FIRST] = entry->mFirstName; data[AGENTS][id_str][LAST] = entry->mLastName; @@ -506,6 +506,7 @@ BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& las } } + // static void LLCacheName::LocalizeCacheName(std::string key, std::string value) { @@ -519,7 +520,13 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; BOOL res = getName(id, first_name, last_name); - fullname = first_name + " " + last_name; + fullname = first_name; + if (!last_name.empty()) + { + // IDEVO legacy resident name, not SLID + fullname += " "; + fullname += last_name; + } return res; } @@ -916,6 +923,12 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) { msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); + + // IDEVO HACK - blank out last name + if (entry->mLastName == "Resident") + { + entry->mLastName = ""; + } } else { // is group -- cgit v1.2.3 From 146e9d5e4d9a9a4f33d9ccd47a901980972b7ab9 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 1 Feb 2010 17:06:18 -0800 Subject: Support returning full_name (and SLID) for LLCacheName::get() calls Changed callback signature to full_name instead of first_name,last_name Eliminated all calls to legacy (non-signal/non-boost-bind) lookup mechanism Change Pay dialog names to SLURL links Tweaked layout of Pay Resident and Pay via Object floaters to make SLURLs fit Consolidate name first + " " + last concatenation in LLCacheName::buildFullName() Reviewed with Kelly --- indra/llmessage/llcachename.cpp | 58 +++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 04b8ef9637..e1e5f5bc02 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -75,7 +75,7 @@ public: public: bool mIsGroup; U32 mCreateTime; // unix time_t - std::string mFirstName; + std::string mFirstName; // IDEVO TODO collapse to one field std::string mLastName; std::string mGroupName; }; @@ -520,13 +520,7 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; BOOL res = getName(id, first_name, last_name); - fullname = first_name; - if (!last_name.empty()) - { - // IDEVO legacy resident name, not SLID - fullname += " "; - fullname += last_name; - } + fullname = buildFullname(first_name, last_name); return res; } @@ -566,7 +560,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { - std::string fullname = first + " " + last; + std::string fullname = buildFullname(first, last); return getUUID(fullname, id); } @@ -584,6 +578,19 @@ BOOL LLCacheName::getUUID(const std::string& fullname, LLUUID& id) } } +//static +std::string LLCacheName::buildFullname(const std::string& first, const std::string& last) +{ + std::string fullname = first; + if (!last.empty() + && last != "Resident") + { + fullname += ' '; + fullname += last; + } + return fullname; +} + // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback // and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior @@ -591,7 +598,7 @@ BOOL LLCacheName::getUUID(const std::string& fullname, LLUUID& id) // we call it immediately. -Steve // NOTE: Even though passing first and last name is a bit of extra overhead, it eliminates the // potential need for any parsing should any code need to handle first and last name independently. -boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, const LLCacheNameCallback& callback) +boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback) { boost::signals2::connection res; @@ -599,7 +606,7 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, co { LLCacheNameSignal signal; signal.connect(callback); - signal(id, sCacheName["nobody"], "", is_group); + signal(id, sCacheName["nobody"], is_group); return res; } @@ -611,11 +618,13 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, co // id found in map therefore we can call the callback immediately. if (entry->mIsGroup) { - signal(id, entry->mGroupName, "", entry->mIsGroup); + signal(id, entry->mGroupName, entry->mIsGroup); } else { - signal(id, entry->mFirstName, entry->mLastName, entry->mIsGroup); + std::string fullname = + buildFullname(entry->mFirstName, entry->mLastName); + signal(id, fullname, entry->mIsGroup); } } else @@ -637,9 +646,9 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, co return res; } -boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, old_callback_t callback, void* user_data) +boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data) { - return get(id, is_group, boost::bind(callback, _1, _2, _3, _4, user_data)); + return get(id, is_group, boost::bind(callback, _1, _2, _3, user_data)); } void LLCacheName::processPending() @@ -711,7 +720,7 @@ void LLCacheName::dump() { llinfos << iter->first << " = " - << entry->mFirstName << " " << entry->mLastName + << buildFullname(entry->mFirstName, entry->mLastName) << " @ " << entry->mCreateTime << llendl; } @@ -757,11 +766,13 @@ void LLCacheName::Impl::processPendingReplies() if (!entry->mIsGroup) { - (reply->mSignal)(reply->mID, entry->mFirstName, entry->mLastName, FALSE); + std::string fullname = + LLCacheName::buildFullname(entry->mFirstName, entry->mLastName); + (reply->mSignal)(reply->mID, fullname, false); } else { - (reply->mSignal)(reply->mID, entry->mGroupName, "", TRUE); + (reply->mSignal)(reply->mID, entry->mGroupName, true); } } @@ -924,7 +935,8 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); - // IDEVO HACK - blank out last name + // IDEVO blank out last name for storage to reduce string compares on + // retrieval. Eventually need to convert to single mName field. if (entry->mLastName == "Resident") { entry->mLastName = ""; @@ -938,13 +950,14 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) if (!isGroup) { - mSignal(id, entry->mFirstName, entry->mLastName, FALSE); - std::string fullname = entry->mFirstName + " " + entry->mLastName; + std::string fullname = + LLCacheName::buildFullname(entry->mFirstName, entry->mLastName); + mSignal(id, fullname, false); mReverseCache[fullname] = id; } else { - mSignal(id, entry->mGroupName, "", TRUE); + mSignal(id, entry->mGroupName, true); mReverseCache[entry->mGroupName] = id; } } @@ -973,4 +986,3 @@ void LLCacheName::Impl::handleUUIDGroupNameReply(LLMessageSystem* msg, void** us { ((LLCacheName::Impl*)userData)->processUUIDReply(msg, true); } - -- cgit v1.2.3 From 42176145c9e81dd99b65f88152df50a7b3ccf834 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Feb 2010 14:55:30 -0800 Subject: Converted names build from avatar object LLNameValue pairs to SLID Added temporary getDisplayName() to LLCacheName Moved temporary placeholder display names into LLCacheName Eliminated rarely used LLAgentUI::buildName in favor of buildFullName Standardized buildFullName capitalization --- indra/llmessage/llcachename.cpp | 88 +++++++++++++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 16 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index e6233ecf97..2bdf112448 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -220,7 +220,9 @@ public: Impl(LLMessageSystem* msg); ~Impl(); - + + BOOL getName(const LLUUID& id, std::string& first, std::string& last); + boost::signals2::connection addPending(const LLUUID& id, const LLCacheNameCallback& callback); void addPending(const LLUUID& id, const LLHost& host); @@ -480,7 +482,7 @@ void LLCacheName::exportFile(std::ostream& ostr) } -BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& last) +BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::string& last) { if(id.isNull()) { @@ -489,7 +491,7 @@ BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& las return FALSE; } - LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); + LLCacheNameEntry* entry = get_ptr_in_map(mCache, id ); if (entry) { first = entry->mFirstName; @@ -500,9 +502,9 @@ BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& las { first = sCacheName["waiting"]; last.clear(); - if (!impl.isRequestPending(id)) + if (!isRequestPending(id)) { - impl.mAskNameQueue.insert(id); + mAskNameQueue.insert(id); } return FALSE; } @@ -521,11 +523,65 @@ void LLCacheName::LocalizeCacheName(std::string key, std::string value) BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) { std::string first_name, last_name; - BOOL res = getName(id, first_name, last_name); - fullname = buildFullname(first_name, last_name); + BOOL res = impl.getName(id, first_name, last_name); + fullname = buildFullName(first_name, last_name); return res; } +static std::map sDisplayNames; + +bool LLCacheName::getDisplayName(const LLUUID& id, std::string& display_name) +{ + if (sDisplayNames.empty()) + { + LLUUID id; + const unsigned char miyazaki_hayao_san[] + = { 0xE5, 0xAE, 0xAE, 0xE5, 0xB4, 0x8E, + 0xE9, 0xA7, 0xBF, + 0xE3, 0x81, 0x95, 0xE3, 0x82, 0x93, '\0' }; + id.set("27888d5f-4ddb-4df3-ad36-a1483ce0b3d9"); // miyazaki23 + sDisplayNames[id] = (const char*)miyazaki_hayao_san; + + id.set("3e5bf676-3577-c9ee-9fac-10df430015a1"); // Jim Linden + sDisplayNames[id] = "Jim Jenkins"; + + const unsigned char jose_sanchez[] = + { 'J','o','s',0xC3,0xA9,' ','S','a','n','c','h','e','z', '\0' }; + id.set("a2e76fcd-9360-4f6d-a924-938f923df11a"); // James Linden + sDisplayNames[id] = (const char*)jose_sanchez; + + id.set("3f7ced39-5e38-4fdd-90f2-423560b1e6e2"); // Hamilton Linden + sDisplayNames[id] = "Hamilton Hitchings"; + + id.set("537da1e1-a89f-4f9b-9056-b1f0757ccdd0"); // Rome Linden + sDisplayNames[id] = "Rome Portlock"; + + id.set("244195d6-c9b7-4fd6-9229-c3a8b2e60e81"); // M Linden + sDisplayNames[id] = "Mark Kingdon"; + + id.set("49856302-98d4-4e32-b5e9-035e5b4e83a4"); // T Linden + sDisplayNames[id] = "Tom Hale"; + + id.set("e6ed7825-708f-4c6b-b6a7-f3fe921a9176"); // Callen Linden + sDisplayNames[id] = "Christina Allen"; + + id.set("a7f0ac18-205f-41d2-b5b4-f75f096ae511"); // Crimp Linden + sDisplayNames[id] = "Chris Rimple"; + } + + std::map::iterator it = sDisplayNames.find(id); + if (it != sDisplayNames.end()) + { + display_name = it->second; + return true; + } + else + { + display_name = ""; + return false; + } +} + BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { if(id.isNull()) @@ -562,7 +618,7 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { - std::string fullname = buildFullname(first, last); + std::string fullname = buildFullName(first, last); return getUUID(fullname, id); } @@ -581,7 +637,7 @@ BOOL LLCacheName::getUUID(const std::string& fullname, LLUUID& id) } //static -std::string LLCacheName::buildFullname(const std::string& first, const std::string& last) +std::string LLCacheName::buildFullName(const std::string& first, const std::string& last) { std::string fullname = first; if (!last.empty() @@ -625,7 +681,7 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co else { std::string fullname = - buildFullname(entry->mFirstName, entry->mLastName); + buildFullName(entry->mFirstName, entry->mLastName); signal(id, fullname, entry->mIsGroup); } } @@ -722,7 +778,7 @@ void LLCacheName::dump() { llinfos << iter->first << " = " - << buildFullname(entry->mFirstName, entry->mLastName) + << buildFullName(entry->mFirstName, entry->mLastName) << " @ " << entry->mCreateTime << llendl; } @@ -769,7 +825,7 @@ void LLCacheName::Impl::processPendingReplies() if (!entry->mIsGroup) { std::string fullname = - LLCacheName::buildFullname(entry->mFirstName, entry->mLastName); + LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); (reply->mSignal)(reply->mID, fullname, false); } else @@ -952,10 +1008,10 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) if (!isGroup) { - std::string fullname = - LLCacheName::buildFullname(entry->mFirstName, entry->mLastName); - mSignal(id, fullname, false); - mReverseCache[fullname] = id; + std::string full_name = + LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); + mSignal(id, full_name, false); + mReverseCache[full_name] = id; } else { -- cgit v1.2.3 From f3e4bd08c83714eac6a27cd73c3ac29f36800d37 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 10 Feb 2010 12:03:09 -0800 Subject: Added Jose Sanchez as display name for bobsmith123 --- indra/llmessage/llcachename.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 2bdf112448..4b0cc299c7 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -550,6 +550,9 @@ bool LLCacheName::getDisplayName(const LLUUID& id, std::string& display_name) id.set("a2e76fcd-9360-4f6d-a924-938f923df11a"); // James Linden sDisplayNames[id] = (const char*)jose_sanchez; + id.set("a23fff6c-80ae-4997-9253-48272fd01d3c"); // bobsmith123 + sDisplayNames[id] = (const char*)jose_sanchez; + id.set("3f7ced39-5e38-4fdd-90f2-423560b1e6e2"); // Hamilton Linden sDisplayNames[id] = "Hamilton Hitchings"; -- cgit v1.2.3 From 4c4ba930029c34c6810c7e229b186e89b458053a Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 11 Feb 2010 16:44:42 -0800 Subject: Removed temporary LLCacheName::getDisplayName code --- indra/llmessage/llcachename.cpp | 55 ----------------------------------------- 1 file changed, 55 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 4b0cc299c7..4e3c3630ab 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -528,62 +528,7 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname) return res; } -static std::map sDisplayNames; -bool LLCacheName::getDisplayName(const LLUUID& id, std::string& display_name) -{ - if (sDisplayNames.empty()) - { - LLUUID id; - const unsigned char miyazaki_hayao_san[] - = { 0xE5, 0xAE, 0xAE, 0xE5, 0xB4, 0x8E, - 0xE9, 0xA7, 0xBF, - 0xE3, 0x81, 0x95, 0xE3, 0x82, 0x93, '\0' }; - id.set("27888d5f-4ddb-4df3-ad36-a1483ce0b3d9"); // miyazaki23 - sDisplayNames[id] = (const char*)miyazaki_hayao_san; - - id.set("3e5bf676-3577-c9ee-9fac-10df430015a1"); // Jim Linden - sDisplayNames[id] = "Jim Jenkins"; - - const unsigned char jose_sanchez[] = - { 'J','o','s',0xC3,0xA9,' ','S','a','n','c','h','e','z', '\0' }; - id.set("a2e76fcd-9360-4f6d-a924-938f923df11a"); // James Linden - sDisplayNames[id] = (const char*)jose_sanchez; - - id.set("a23fff6c-80ae-4997-9253-48272fd01d3c"); // bobsmith123 - sDisplayNames[id] = (const char*)jose_sanchez; - - id.set("3f7ced39-5e38-4fdd-90f2-423560b1e6e2"); // Hamilton Linden - sDisplayNames[id] = "Hamilton Hitchings"; - - id.set("537da1e1-a89f-4f9b-9056-b1f0757ccdd0"); // Rome Linden - sDisplayNames[id] = "Rome Portlock"; - - id.set("244195d6-c9b7-4fd6-9229-c3a8b2e60e81"); // M Linden - sDisplayNames[id] = "Mark Kingdon"; - - id.set("49856302-98d4-4e32-b5e9-035e5b4e83a4"); // T Linden - sDisplayNames[id] = "Tom Hale"; - - id.set("e6ed7825-708f-4c6b-b6a7-f3fe921a9176"); // Callen Linden - sDisplayNames[id] = "Christina Allen"; - - id.set("a7f0ac18-205f-41d2-b5b4-f75f096ae511"); // Crimp Linden - sDisplayNames[id] = "Chris Rimple"; - } - - std::map::iterator it = sDisplayNames.find(id); - if (it != sDisplayNames.end()) - { - display_name = it->second; - return true; - } - else - { - display_name = ""; - return false; - } -} BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) { -- cgit v1.2.3 From c16591c046fa76fc5d13387efa3bcaec3422e593 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 12 Feb 2010 16:12:12 -0800 Subject: Per-avatar customizable icons next to name links in text Changed LLUrlEntryAgent callbacks to handle both link label and icon Eliminated legacy LLNameCache file loading Reviewed with Kelly --- indra/llmessage/llcachename.cpp | 83 +---------------------------------------- 1 file changed, 2 insertions(+), 81 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 4e3c3630ab..b94788bd0c 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -308,89 +308,10 @@ boost::signals2::connection LLCacheName::addObserver(const LLCacheNameCallback& return impl.mSignal.connect(callback); } -void LLCacheName::importFile(LLFILE* fp) -{ - S32 count = 0; - - const S32 BUFFER_SIZE = 1024; - char buffer[BUFFER_SIZE]; /*Flawfinder: ignore*/ - - // *NOTE: These buffer sizes are hardcoded into sscanf() below - char id_string[MAX_STRING]; /*Flawfinder: ignore*/ - char firstname[MAX_STRING]; /*Flawfinder: ignore*/ - char lastname[MAX_STRING]; /*Flawfinder: ignore*/ - U32 create_time; - - // This is OK if the first line is actually a name. We just don't load it. - char* valid = fgets(buffer, BUFFER_SIZE, fp); - if (!valid) return; - - // *NOTE: This buffer size is hardcoded into sscanf() below - char version_string[BUFFER_SIZE]; /*Flawfinder: ignore*/ - S32 version = 0; - S32 match = sscanf( /* Flawfinder: ignore */ - buffer, - "%1023s %d", - version_string, &version); - if ( match != 2 - || strcmp(version_string, "version") - || version != CN_FILE_VERSION) - { - llwarns << "Ignoring old cache name file format" << llendl; - return; - } - - // We'll expire entries more than a week old - U32 now = (U32)time(NULL); - const U32 SECS_PER_DAY = 60 * 60 * 24; - U32 delete_before_time = now - (7 * SECS_PER_DAY); - - while(!feof(fp)) - { - valid = fgets(buffer, BUFFER_SIZE, fp); - if (!valid) break; - - match = sscanf( /* Flawfinder: ignore */ - buffer, - "%254s %u %254s %254s", - id_string, - &create_time, - firstname, - lastname); - if (4 != match) continue; - - LLUUID id(id_string); - if (id.isNull()) continue; - - // undo trivial XOR - S32 i; - for (i = 0; i < UUID_BYTES; i++) - { - id.mData[i] ^= 0x33; - } - - // Don't load entries that are more than a week old - if (create_time < delete_before_time) continue; - - LLCacheNameEntry* entry = new LLCacheNameEntry(); - entry->mIsGroup = false; - entry->mCreateTime = create_time; - entry->mFirstName = firstname; - entry->mLastName = lastname; - impl.mCache[id] = entry; - std::string fullname = entry->mFirstName + " " + entry->mLastName; - impl.mReverseCache[fullname] = id; - - count++; - } - - llinfos << "LLCacheName loaded " << count << " names" << llendl; -} - bool LLCacheName::importFile(std::istream& istr) { LLSD data; - if(LLSDSerialize::fromXML(data, istr) < 1) + if(LLSDSerialize::fromXMLDocument(data, istr) < 1) return false; // We'll expire entries more than a week old @@ -512,7 +433,7 @@ BOOL LLCacheName::Impl::getName(const LLUUID& id, std::string& first, std::strin } // static -void LLCacheName::LocalizeCacheName(std::string key, std::string value) +void LLCacheName::localizeCacheName(std::string key, std::string value) { if (key!="" && value!= "" ) sCacheName[key]=value; -- cgit v1.2.3 From b34225a1918026ed8557a19cacf5925d107c134a Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 16 Feb 2010 10:40:53 -0800 Subject: Fix server to use updated LLCacheName API. Fixed callback signatures. Added LLCacheName::getDefaultLastName() to return "Resident" Reviewed with Huseby --- indra/llmessage/llcachename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index b94788bd0c..90c1dedd10 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -672,6 +672,12 @@ std::string LLCacheName::getDefaultName() return sCacheName["waiting"]; } +//static +std::string LLCacheName::getDefaultLastName() +{ + return "Resident"; +} + void LLCacheName::Impl::processPendingAsks() { LLMemType mt_ppa(LLMemType::MTYPE_CACHE_PROCESS_PENDING_ASKS); -- cgit v1.2.3 From 6a69a696d20832973c4d1e9e607e7e3d6f3fce93 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 16 Feb 2010 16:59:34 -0800 Subject: Store last name Resident in cache for now, but don't use for reverse lookups --- indra/llmessage/llcachename.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 90c1dedd10..0e8f9f4828 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -75,7 +75,9 @@ public: public: bool mIsGroup; U32 mCreateTime; // unix time_t - std::string mFirstName; // IDEVO TODO collapse to one field + // IDEVO TODO collapse names to one field, which will eliminate + // many string compares on "Resident" + std::string mFirstName; std::string mLastName; std::string mGroupName; }; @@ -337,7 +339,7 @@ bool LLCacheName::importFile(std::istream& istr) entry->mFirstName = agent[FIRST].asString(); entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; - std::string fullname = entry->mFirstName + " " + entry->mLastName; + std::string fullname = buildFullName(entry->mFirstName, entry->mLastName); impl.mReverseCache[fullname] = id; ++count; @@ -487,13 +489,13 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) { - std::string fullname = buildFullName(first, last); - return getUUID(fullname, id); + std::string full_name = buildFullName(first, last); + return getUUID(full_name, id); } -BOOL LLCacheName::getUUID(const std::string& fullname, LLUUID& id) +BOOL LLCacheName::getUUID(const std::string& full_name, LLUUID& id) { - ReverseCache::iterator iter = impl.mReverseCache.find(fullname); + ReverseCache::iterator iter = impl.mReverseCache.find(full_name); if (iter != impl.mReverseCache.end()) { id = iter->second; @@ -867,13 +869,6 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) { msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_FirstName, entry->mFirstName, i); msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i); - - // IDEVO blank out last name for storage to reduce string compares on - // retrieval. Eventually need to convert to single mName field. - if (entry->mLastName == "Resident") - { - entry->mLastName = ""; - } } else { // is group -- cgit v1.2.3 From 5774acb84e486c1eabad88093e80e3985d36dfcb Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 17 Feb 2010 09:19:06 -0800 Subject: Added function LLCacheName::cleanFullName() to strip " Resident" from strings --- indra/llmessage/llcachename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 0e8f9f4828..9ca0347f83 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -520,6 +520,12 @@ std::string LLCacheName::buildFullName(const std::string& first, const std::stri return fullname; } +//static +std::string LLCacheName::cleanFullName(const std::string& full_name) +{ + return full_name.substr(0, full_name.find(" Resident")); +} + // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback // and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior -- cgit v1.2.3 From c1d7e7d5d961819255f6f2fe4de5ece3b80867db Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 19 Feb 2010 10:53:17 -0800 Subject: Added clear() method for debugging --- indra/llmessage/llcachename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 9ca0347f83..eed2beb859 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -674,6 +674,12 @@ void LLCacheName::dumpStats() << llendl; } +void LLCacheName::clear() +{ + for_each(impl.mCache.begin(), impl.mCache.end(), DeletePairedPointer()); + impl.mCache.clear(); +} + //static std::string LLCacheName::getDefaultName() { -- cgit v1.2.3 From 822d042e0c04dba2cdaced8c81b50840972a7286 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 2 Mar 2010 11:15:28 -0800 Subject: Don't load cached names with blank last names, avoids data corruption --- indra/llmessage/llcachename.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index eed2beb859..8575332392 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -388,7 +388,8 @@ void LLCacheName::exportFile(std::ostream& ostr) // store it LLUUID id = iter->first; std::string id_str = id.asString(); - if(!entry->mFirstName.empty() /* && !entry->mLastName.empty() */ ) // IDEVO save SLIDs + // IDEVO TODO: Should we store SLIDs with last name "Resident" or not? + if(!entry->mFirstName.empty() && !entry->mLastName.empty()) { data[AGENTS][id_str][FIRST] = entry->mFirstName; data[AGENTS][id_str][LAST] = entry->mLastName; -- cgit v1.2.3 From d0632598632465850568789ce2d00dcc325e5ebe Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 3 Mar 2010 16:41:17 -0800 Subject: Work around bad usernames occasionally sent from server. --- indra/llmessage/llcachename.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 8575332392..d7d49eac8d 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -891,8 +891,21 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) if (!isGroup) { - std::string full_name = - LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); + // NOTE: Very occasionally the server sends down a full name + // in the first name field with an empty last name, for example, + // first = "Ladanie1 Resident", last = "". + // I cannot reproduce this, nor can I find a bug in the server code. + // Ensure "Resident" does not appear via cleanFullName, because + // buildFullName only checks last name. JC + std::string full_name; + if (entry->mLastName.empty()) + { + full_name = cleanFullName(entry->mFirstName); + } + else + { + full_name = LLCacheName::buildFullName(entry->mFirstName, entry->mLastName); + } mSignal(id, full_name, false); mReverseCache[full_name] = id; } -- cgit v1.2.3 From 77e6fcd4230f7540c9f4d6f3d503737c6eaf408c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 25 May 2010 11:39:06 -0700 Subject: DEV-50013 WIP gCacheName->getGroup() to distinguish from av lookups Helps with global finds looking for remaining calls to patch. Reviewed with Leyla. --- indra/llmessage/llcachename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 8e87b6f9b9..c6c189c7a1 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -582,6 +582,12 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, co return res; } +boost::signals2::connection LLCacheName::getGroup(const LLUUID& group_id, + const LLCacheNameCallback& callback) +{ + return get(group_id, true, callback); +} + boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, old_callback_t callback, void* user_data) { return get(id, is_group, boost::bind(callback, _1, _2, _3, user_data)); -- cgit v1.2.3 From 6cb420b20bd509e7bf62c8450f12d433c5a81be2 Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Thu, 27 May 2010 15:12:03 -0700 Subject: added function for building a username from a legacy name and fixed group notice panel reviewed by James --- indra/llmessage/llcachename.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index c6c189c7a1..f8c0d05baa 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -527,6 +527,30 @@ std::string LLCacheName::cleanFullName(const std::string& full_name) return full_name.substr(0, full_name.find(" Resident")); } +//static +std::string LLCacheName::buildUsername(const std::string& full_name) +{ + std::string::size_type index = full_name.find(' '); + + if (index != std::string::npos) + { + std::string username; + username = full_name.substr(0, index); + std::string lastname = full_name.substr(index+1); + + if (lastname != "Resident") + { + username = username + "." + lastname; + } + + LLStringUtil::toLower(username); + return username; + } + + // if the input wasn't a correctly formatted legacy name just return it unchanged + return full_name; +} + // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback // and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior -- cgit v1.2.3 From 00e8b3548c931991d784f6f14c80ca29528a206d Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 27 May 2010 18:08:49 -0700 Subject: DEV-50013 Region debug top scripts/colliders display names --- indra/llmessage/llcachename.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index f8c0d05baa..ef60fd5c4e 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -530,6 +530,12 @@ std::string LLCacheName::cleanFullName(const std::string& full_name) //static std::string LLCacheName::buildUsername(const std::string& full_name) { + // rare, but handle hard-coded error names returned from server + if (full_name == "(\?\?\?) (\?\?\?)") + { + return "(\?\?\?)"; + } + std::string::size_type index = full_name.find(' '); if (index != std::string::npos) -- cgit v1.2.3 From cb5d8d1a9295076327f23e5f6d6c91fd0d4580ea Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 22 Oct 2010 17:41:06 -0700 Subject: DN-181 Chat & IM logs saved in unreadable .llsd instead of .txt --- indra/llmessage/llcachename.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 4a66a31c35..522b99bc02 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -38,6 +38,8 @@ #include "message.h" #include "llmemtype.h" +#include + // llsd serialization constants static const std::string AGENTS("agents"); static const std::string GROUPS("groups"); @@ -551,6 +553,31 @@ std::string LLCacheName::buildUsername(const std::string& full_name) return 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; + + std::string legacy_name = name_results[3]; + // 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]; + 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; + } + + return legacy_name; +} + // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback // and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior -- cgit v1.2.3 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 From 739e4ac5414b270247237018c93028052d41e9cd Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 23 Nov 2010 11:25:40 -0800 Subject: DN-212 [crashhunters] LLCacheName::buildLegacyName --- indra/llmessage/llcachename.cpp | 50 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 21 deletions(-) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 4ab6bd2438..caeaaa3be9 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -556,35 +556,43 @@ std::string LLCacheName::buildUsername(const std::string& full_name) //static std::string LLCacheName::buildLegacyName(const std::string& complete_name) { - // regexp doesn't play nice with unicode, chop off the display name + //boost::regexp was showing up in the crashreporter, so doing + //painfully manual parsing using substr. LF S32 open_paren = complete_name.rfind(" ("); + S32 close_paren = complete_name.rfind(')'); - if (open_paren == std::string::npos) + if (open_paren != std::string::npos && + close_paren == complete_name.length()-1) { - return complete_name; - } + S32 length = close_paren - open_paren - 2; + std::string legacy_name = complete_name.substr(open_paren+2, length); + + if (legacy_name.length() > 0) + { + std::string cap_letter = legacy_name.substr(0, 1); + LLStringUtil::toUpper(cap_letter); + legacy_name = cap_letter + legacy_name.substr(1); + + S32 separator = legacy_name.find('.'); - 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; + if (separator != std::string::npos) + { + std::string last_name = legacy_name.substr(separator+1); + legacy_name = legacy_name.substr(0, separator); - 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 (last_name.length() > 0) + { + cap_letter = last_name.substr(0, 1); + LLStringUtil::toUpper(cap_letter); + legacy_name = legacy_name + " " + cap_letter + last_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; + return legacy_name; + } } - return legacy_name; + return complete_name; } // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. -- cgit v1.2.3 From c489f33169bdf88df24c430c278038b2f5a0630a Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Tue, 30 Nov 2010 16:37:31 -0800 Subject: DN-217 Changing between View Display Names on and off during a conference call session put viewer in a state where last name resident was shown in viewer everywhere for user in conference call with last name resident. --- indra/llmessage/llcachename.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llmessage/llcachename.cpp') diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index caeaaa3be9..479efabb5f 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -975,6 +975,10 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) if (entry->mLastName.empty()) { full_name = cleanFullName(entry->mFirstName); + + //fix what we are putting in the cache + entry->mFirstName = full_name; + entry->mLastName = "Resident"; } else { -- cgit v1.2.3