diff options
author | Andrew Meadows <andrew@lindenlab.com> | 2010-12-22 09:54:45 -0800 |
---|---|---|
committer | Andrew Meadows <andrew@lindenlab.com> | 2010-12-22 09:54:45 -0800 |
commit | 740bd8dbfd791bdd548064912abad8c0bf230f4c (patch) | |
tree | bd237c8141a0b5643038640f4bc24d1fb6d5fd65 /indra/llmessage | |
parent | 049b00a6f10d50609055810b0800f49476b351d2 (diff) | |
parent | ab100825bd0064dc64b9ef8bea1c70bc04090716 (diff) |
merge
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llassetstorage.cpp | 4 | ||||
-rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 28 | ||||
-rw-r--r-- | indra/llmessage/llcachename.cpp | 54 |
3 files changed, 48 insertions, 38 deletions
diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp index b26d412e9f..27a368df3d 100644 --- a/indra/llmessage/llassetstorage.cpp +++ b/indra/llmessage/llassetstorage.cpp @@ -513,6 +513,10 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, LL } +// +// *NOTE: Logic here is replicated in LLViewerAssetStorage::_queueDataRequest. +// Changes here may need to be replicated in the viewer's derived class. +// void LLAssetStorage::_queueDataRequest(const LLUUID& uuid, LLAssetType::EType atype, LLGetAssetCallback callback, void *user_data, BOOL duplicate, diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 7396117d84..03c28eb2a5 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -235,27 +235,21 @@ public: /*virtual*/ void error(U32 status, const std::string& reason) { - // We're going to construct a dummy record and cache it for a while, - // either briefly for a 503 Service Unavailable, or longer for other - // errors. - F64 retry_timestamp = errorRetryTimestamp(status); - - // *NOTE: "??" starts trigraphs in C/C++, escape the question marks. - const std::string DUMMY_NAME("\?\?\?"); - LLAvatarName av_name; - av_name.mUsername = DUMMY_NAME; - av_name.mDisplayName = DUMMY_NAME; - av_name.mIsDisplayNameDefault = false; - av_name.mIsDummy = true; - av_name.mExpires = retry_timestamp; + // If there's an error, it might be caused by PeopleApi, + // or when loading textures on startup and using a very slow + // network, this query may time out. Fallback to the legacy + // cache. + + llwarns << "LLAvatarNameResponder error " << status << " " << reason << llendl; // Add dummy records for all agent IDs in this request std::vector<LLUUID>::const_iterator it = mAgentIDs.begin(); for ( ; it != mAgentIDs.end(); ++it) { const LLUUID& agent_id = *it; - // cache it and fire signals - LLAvatarNameCache::processName(agent_id, av_name, true); + gCacheName->get(agent_id, false, // legacy compatibility + boost::bind(&LLAvatarNameCache::legacyNameCallback, + _1, _2, _3)); } } @@ -357,7 +351,7 @@ void LLAvatarNameCache::requestNamesViaCapability() if (url.size() > NAME_URL_SEND_THRESHOLD) { //llinfos << "requestNames " << url << llendl; - LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); + LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f); url.clear(); agent_ids.clear(); } @@ -366,7 +360,7 @@ void LLAvatarNameCache::requestNamesViaCapability() if (!url.empty()) { //llinfos << "requestNames " << url << llendl; - LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); + LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f); url.clear(); agent_ids.clear(); } diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 4ab6bd2438..479efabb5f 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<std::string::const_iterator> 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. @@ -967,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 { |