summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-12-07 18:58:52 -0800
committerMerov Linden <merov@lindenlab.com>2012-12-07 18:58:52 -0800
commita6f1690128b510977cfe86071f80f81967b9d0c7 (patch)
treef856510c10ab175959fd4f9ad7f9ae6f84438467
parentbb322a1cccd3fab28951ad4e11b5edcfc4e48140 (diff)
CHUI-580, CHUI-406 : Fixed : Finished avatar name caching, also fixed the display of (waiting) when names don't come (mostly in legacy mode).
-rw-r--r--indra/llmessage/llavatarnamecache.cpp39
-rw-r--r--indra/newview/llconversationmodel.cpp1
2 files changed, 28 insertions, 12 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 15c4f2a207..9d6aa15ed1 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -100,11 +100,14 @@ namespace LLAvatarNameCache
void requestNamesViaCapability();
- // Legacy name system callback
+ // Legacy name system callbacks
void legacyNameCallback(const LLUUID& agent_id,
const std::string& full_name,
bool is_group);
-
+ void legacyNameFetch(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group);
+
void requestNamesViaLegacy();
// Do a single callback to a given slot
@@ -262,8 +265,7 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
<< agent_id << LL_ENDL;
gCacheName->get(agent_id, false, // legacy compatibility
- boost::bind(&LLAvatarNameCache::legacyNameCallback,
- _1, _2, _3));
+ boost::bind(&LLAvatarNameCache::legacyNameFetch, _1, _2, _3));
}
else
{
@@ -367,19 +369,32 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id,
const std::string& full_name,
bool is_group)
{
- LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameCallback "
- << "agent " << agent_id << " "
+ // Put the received data in the cache
+ legacyNameFetch(agent_id, full_name, is_group);
+
+ // Retrieve the name and set it to never (or almost never...) expire: when we are using the legacy
+ // protocol, we do not get an expiration date for each name and there's no reason to ask the
+ // data again and again so we set the expiration time to the largest value admissible.
+ std::map<LLUUID,LLAvatarName>::iterator av_record = sCache.find(agent_id);
+ LLAvatarName& av_name = av_record->second;
+ av_name.setExpires(MAX_UNREFRESHED_TIME);
+}
+
+void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id,
+ const std::string& full_name,
+ bool is_group)
+{
+ LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch "
+ << "agent " << agent_id << " "
<< "full name '" << full_name << "'"
- << ( is_group ? " [group]" : "" )
- << LL_ENDL;
+ << ( is_group ? " [group]" : "" )
+ << LL_ENDL;
// Construct an av_name record from this name.
LLAvatarName av_name;
av_name.fromString(full_name);
- av_name.dump();
-
- // Add to cache, because if we don't we'll keep rerequesting the
- // same record forever.
+
+ // Add to cache: we're still using the new cache even if we're using the old (legacy) protocol.
processName(agent_id, av_name);
}
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp
index 1f6022decb..99dd35a9e8 100644
--- a/indra/newview/llconversationmodel.cpp
+++ b/indra/newview/llconversationmodel.cpp
@@ -393,6 +393,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display
mDistToAgent(-1.0),
mAvatarNameCacheConnection()
{
+ mDisplayName = display_name;
mConvType = CONV_PARTICIPANT;
}