summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2017-02-15 20:40:03 +0200
committerandreykproductengine <akleshchev@productengine.com>2017-02-15 20:40:03 +0200
commit605160d501158362ced3e62425bdcd8d28895fd5 (patch)
tree0bd0338860645e47902b9f761d6309bc46688116 /indra/llmessage
parent9c015df3fab0b5cc229ad1a0393e5da50ee29883 (diff)
MAINT-7118 Swapping legacy people API with new cache
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llavatarnamecache.cpp22
-rw-r--r--indra/llmessage/llavatarnamecache.h10
2 files changed, 31 insertions, 1 deletions
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 004db546b7..5a112b5432 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -755,6 +755,28 @@ void LLAvatarNameCache::insert(const LLUUID& agent_id, const LLAvatarName& av_na
sCache[agent_id] = av_name;
}
+LLUUID LLAvatarNameCache::findIdByName(const std::string& name)
+{
+ std::map<LLUUID, LLAvatarName>::iterator it;
+ std::map<LLUUID, LLAvatarName>::iterator end = sCache.end();
+ for (it = sCache.begin(); it != end; ++it)
+ {
+ if (it->second.getUserName() == name)
+ {
+ return it->first;
+ }
+ }
+
+ // Legacy method
+ LLUUID id;
+ if (gCacheName->getUUID(name, id))
+ {
+ return id;
+ }
+
+ return LLUUID::null;
+}
+
#if 0
F64 LLAvatarNameCache::nameExpirationFromHeaders(LLCore::HttpHeaders *headers)
{
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index bd2715e956..63e067c939 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -84,7 +84,15 @@ namespace LLAvatarNameCache
void insert(const LLUUID& agent_id, const LLAvatarName& av_name);
void erase(const LLUUID& agent_id);
- /// Provide some fallback for agents that return errors.
+ // A way to find agent id by UUID, very slow, also unreliable
+ // since it doesn't request names, just serch exsisting ones
+ // that are likely not in cache.
+ //
+ // Todo: Find a way to remove this.
+ // Curently this method is used for chat history and in some cases notices.
+ LLUUID findIdByName(const std::string& name);
+
+ /// Provide some fallback for agents that return errors.
void handleAgentError(const LLUUID& agent_id);
// Compute name expiration time from HTTP Cache-Control header,