From 55cc8044cbb5f723831ddc5070407be8d0cc1255 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 6 Apr 2014 19:38:19 +0300 Subject: Refactored: use Scene.GetAgentHomeURI() to get the Home URI of a user --- OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | 6 +----- .../Framework/EntityTransfer/EntityTransferModule.cs | 5 +---- .../Framework/EntityTransfer/HGEntityTransferModule.cs | 6 +----- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 68fef29..24286a4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs @@ -239,11 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GridRegion gatekeeper = new GridRegion(); gatekeeper.ServerURI = url; - - string homeURI = null; - AgentCircuitData acd = scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId); - if (acd != null && acd.ServiceURLs != null && acd.ServiceURLs.ContainsKey("HomeURI")) - homeURI = (string)acd.ServiceURLs["HomeURI"]; + string homeURI = scene.GetAgentHomeURI(client.AgentId); string message; GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(im.RegionID), client.AgentId, homeURI, out message); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 4ecb8e6..3d9c93f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -529,10 +529,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (reg != null) { - string homeURI = null; - AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.AgentId); - if (acd != null && acd.ServiceURLs != null && acd.ServiceURLs.ContainsKey("HomeURI")) - homeURI = (string)acd.ServiceURLs["HomeURI"]; + string homeURI = Scene.GetAgentHomeURI(sp.ControllingClient.AgentId); string message; finalDestination = GetFinalDestination(reg, sp.ControllingClient.AgentId, homeURI, out message); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 5b7dfe3..52e0d5a 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -532,11 +532,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer GatekeeperServiceConnector gConn = new GatekeeperServiceConnector(); GridRegion gatekeeper = new GridRegion(); gatekeeper.ServerURI = lm.Gatekeeper; - - string homeURI = null; - AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(remoteClient.AgentId); - if (acd != null && acd.ServiceURLs != null && acd.ServiceURLs.ContainsKey("HomeURI")) - homeURI = (string)acd.ServiceURLs["HomeURI"]; + string homeURI = Scene.GetAgentHomeURI(remoteClient.AgentId); string message; GridRegion finalDestination = gConn.GetHyperlinkRegion(gatekeeper, new UUID(lm.RegionID), remoteClient.AgentId, homeURI, out message); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 19d4e84..3ff21ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2676,6 +2676,18 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Returns the Home URI of the agent, or null if unknown. + /// + public string GetAgentHomeURI(UUID agentID) + { + AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID); + if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI")) + return circuit.ServiceURLs["HomeURI"].ToString(); + else + return null; + } + + /// /// Cache the user name for later use. /// /// -- cgit v1.1