From 6941058824e418bcdc2932c35f226bbcc5cea2ad Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 1 Jan 2012 14:57:13 -0500 Subject: Profile Updates Update basic profile to use the replaceable interface, making configuration less error-prone. Add support to query avatar's home user account and profile service for regions usng the updated OpenProfileModule with Hypergrid. --- .../Hypergrid/UserAgentServiceConnector.cs | 54 ++++++++++++++++++++++ .../Services/HypergridService/UserAgentService.cs | 25 ++++++++++ OpenSim/Services/Interfaces/IHypergridServices.cs | 1 + 3 files changed, 80 insertions(+) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 57b6d16..5b27cf6 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -561,6 +561,60 @@ namespace OpenSim.Services.Connectors.Hypergrid return online; } + public Dictionary GetUserInfo (UUID userID) + { + Hashtable hash = new Hashtable(); + hash["userID"] = userID.ToString(); + + IList paramList = new ArrayList(); + paramList.Add(hash); + + XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList); + + Dictionary info = new Dictionary(); + XmlRpcResponse response = null; + try + { + response = request.Send(m_ServerURL, 10000); + } + catch + { + m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL); + return info; + } + + if (response.IsFault) + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString); + return info; + } + + hash = (Hashtable)response.Value; + try + { + if (hash == null) + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL); + return info; + } + + // Here is the actual response + foreach (object key in hash.Keys) + { + if (hash[key] != null) + { + info.Add(key.ToString(), hash[key]); + } + } + } + catch + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response."); + } + + return info; + } + public Dictionary GetServerURLs(UUID userID) { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 8538660..f681df4 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -488,6 +488,31 @@ namespace OpenSim.Services.HypergridService return online; } + public Dictionary GetUserInfo(UUID userID) + { + Dictionary info = new Dictionary(); + + if (m_UserAccountService == null) + { + m_log.WarnFormat("[USER AGENT SERVICE]: Unable to get user flags because user account service is missing"); + info["result"] = "fail"; + info["message"] = "UserAccountService is missing!"; + return info; + } + + UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero /*!!!*/, userID); + + if (account != null) + { + info.Add("user_flags", (object)account.UserFlags); + info.Add("user_created", (object)account.Created); + info.Add("user_title", (object)account.UserTitle); + info.Add("result", "success"); + } + + return info; + } + public Dictionary GetServerURLs(UUID userID) { if (m_UserAccountService == null) diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index e86ec51..5b293ac 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -55,6 +55,7 @@ namespace OpenSim.Services.Interfaces void LogoutAgent(UUID userID, UUID sessionID); GridRegion GetHomeRegion(UUID userID, out Vector3 position, out Vector3 lookAt); Dictionary GetServerURLs(UUID userID); + Dictionary GetUserInfo(UUID userID); string LocateUser(UUID userID); // Tries to get the universal user identifier for the targetUserId -- cgit v1.1