From d1256536b500a0d72eb643635d10c65980ea2588 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 17 Mar 2012 21:27:28 -0700 Subject: Added GetUUID(first, last) on UserAgentsService so that we can finally make direct user connections. --- .../Hypergrid/UserAgentServiceConnector.cs | 61 +++++++++++++++++++++- .../Services/HypergridService/UserAgentService.cs | 10 ++++ OpenSim/Services/Interfaces/IHypergridServices.cs | 2 + 3 files changed, 72 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 5b27cf6..bf86035 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -789,13 +789,72 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch { - m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on LocateUser response."); + m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetUUI response."); // reason = "Exception: " + e.Message; } return uui; } + public UUID GetUUID(String first, String last) + { + Hashtable hash = new Hashtable(); + hash["first"] = first; + hash["last"] = last; + + IList paramList = new ArrayList(); + paramList.Add(hash); + + XmlRpcRequest request = new XmlRpcRequest("get_uuid", paramList); + // string reason = string.Empty; + + // Send and get reply + UUID uuid = UUID.Zero; + XmlRpcResponse response = null; + try + { + response = request.Send(m_ServerURL, 10000); + } + catch + { + m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUUID", m_ServerURL); + // reason = "Exception: " + e.Message; + return uuid; + } + + if (response.IsFault) + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetUUID returned an error: {1}", m_ServerURL, response.FaultString); + // reason = "XMLRPC Fault"; + return uuid; + } + + hash = (Hashtable)response.Value; + //foreach (Object o in hash) + // m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value); + try + { + if (hash == null) + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUUDI Got null response from {0}! THIS IS BAAAAD", m_ServerURL); + // reason = "Internal error 1"; + return uuid; + } + + // Here's the actual response + if (hash.ContainsKey("UUID")) + UUID.TryParse(hash["UUID"].ToString(), out uuid); + + } + catch + { + m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on UUID response."); + // reason = "Exception: " + e.Message; + } + + return uuid; + } + private bool GetBoolResponse(XmlRpcRequest request, out string reason) { //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL); diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index f681df4..5eca801 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -566,6 +566,16 @@ namespace OpenSim.Services.HypergridService return string.Empty; } + + public UUID GetUUID(String first, String last) + { + // Let's see if it's a local user + UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, first, last); + if (account != null) + return account.PrincipalID; + else + return UUID.Zero; + } } class TravelingAgentInfo diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 5b293ac..0cd44f7 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -62,6 +62,8 @@ namespace OpenSim.Services.Interfaces // on behalf of the userID string GetUUI(UUID userID, UUID targetUserID); + UUID GetUUID(String first, String last); + // Returns the local friends online List StatusNotification(List friends, UUID userID, bool online); //List GetOnlineFriends(UUID userID, List friends); -- cgit v1.1