public IUserProfileInfo GetUserProfile(UUID agentID)
{
IUserProfileInfo UserProfile = new IUserProfileInfo();
lock (UserProfilesCache)
{
//Try from the user profile first before getting from the DB
if (UserProfilesCache.TryGetValue(agentID, out UserProfile))
return UserProfile;
}
object remoteValue = DoRemote(agentID);
if (remoteValue != null || m_doRemoteOnly)
{
UserProfile = (IUserProfileInfo)remoteValue;
//Add to the cache
lock (UserProfilesCache)
UserProfilesCache[agentID] = UserProfile;
return UserProfile;
}
QueryFilter filter = new QueryFilter();
filter.andFilters["ID"] = agentID;
filter.andFilters["`Key`"] = "LLProfile";
List<string> query = null;
//Grab it from the almost generic interface
query = GD.Query(new[] { "Value" }, m_userProfileTable, filter, null, null, null);
if (query == null || query.Count == 0)
return null;
//Pull out the OSDmap
OSDMap profile = (OSDMap) OSDParser.DeserializeLLSDXml(query[0]);
UserProfile = new IUserProfileInfo();
UserProfile.FromOSD(profile);
//Add to the cache
lock(UserProfilesCache)
UserProfilesCache[agentID] = UserProfile;
return UserProfile;
}