public IUserProfileInfo GetUserProfile(UUID PrincipalID) { try { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(PrincipalID.ToString(), "RemoteServerURI"); foreach (string url in serverURIs) { OSDMap map = new OSDMap(); map["Method"] = "getprofile"; map["PrincipalID"] = PrincipalID; OSDMap response = WebUtils.PostToService(url + "osd", map, true, true); if (response["_Result"].Type == OSDType.Map) { OSDMap responsemap = (OSDMap)response["_Result"]; if (responsemap.Count == 0) { continue; } IUserProfileInfo info = new IUserProfileInfo(); info.FromOSD(responsemap); return(info); } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e); } return(null); }
/// <summary> /// Get a user's profile /// </summary> /// <param name="agentID"></param> /// <returns></returns> public IUserProfileInfo GetUserProfile(UUID agentID) { IUserProfileInfo UserProfile = new IUserProfileInfo(); //Try from the user profile first before getting from the DB if (UserProfilesCache.TryGetValue(agentID, out UserProfile)) { return(UserProfile); } else { UserProfile = new IUserProfileInfo(); List <string> query = null; //Grab it from the almost generic interface query = GD.Query(new string[] { "ID", "`Key`" }, new object[] { agentID, "LLProfile" }, "userdata", "Value"); if (query == null || query.Count == 0) { return(null); } //Pull out the OSDmap OSDMap profile = (OSDMap)OSDParser.DeserializeLLSDXml(query[0]); UserProfile.FromOSD(profile); //Add to the cache UserProfilesCache[agentID] = UserProfile; return(UserProfile); } }
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); }
public byte[] UpdateProfile(OSDMap request) { IUserProfileInfo UserProfile = new IUserProfileInfo(); UserProfile.FromOSD((OSDMap)request["Profile"]); ProfileConnector.UpdateUserProfile(UserProfile); OSDMap result = new OSDMap(); result["result"] = "Successful"; string xmlString = OSDParser.SerializeJsonString(result); //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
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"}, "userdata", 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; }