From 6b08c051a33d97d94d9c68d287926939f1a5d6b2 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 22 Dec 2011 15:31:51 -0800 Subject: Enables processing of hypergrid links through simiangrid services. Thanks otakup0pe --- .../SimianGrid/SimianGridServiceConnector.cs | 81 +++++++++++++++------- 1 file changed, 56 insertions(+), 25 deletions(-) (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 918544f..67a65ff 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid public List GetHyperlinks(UUID scopeID) { - // Hypergrid/linked regions are not supported - return new List(); + List foundRegions = new List(); + + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "GetScenes" }, + { "HyperGrid", "true" }, + { "Enabled", "1" } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); + + OSDArray array = response["Scenes"] as OSDArray; + if (array != null) + { + for (int i = 0; i < array.Count; i++) + { + GridRegion region = ResponseToGridRegion(array[i] as OSDMap); + if (region != null) + foundRegions.Add(region); + } + } + } + + return foundRegions; } - + public int GetRegionFlags(UUID scopeID, UUID regionID) { - const int REGION_ONLINE = 4; - NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetScene" }, { "SceneID", regionID.ToString() } }; - // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); + m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { - return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; + OSDMap extraData = response["ExtraData"] as OSDMap; + int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; + int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; + int flags = enabled | hypergrid; + m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); + return flags; } else { @@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = response["MinPosition"].AsVector3d(); region.RegionLocX = (int)minPosition.X; region.RegionLocY = (int)minPosition.Y; - - Uri httpAddress = response["Address"].AsUri(); - region.ExternalHostName = httpAddress.Host; - region.HttpPort = (uint)httpAddress.Port; - - region.ServerURI = extraData["ServerURI"].AsString(); - - IPAddress internalAddress; - IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); - if (internalAddress == null) - internalAddress = IPAddress.Any; - - region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); - region.TerrainImage = extraData["MapTexture"].AsUUID(); - region.Access = (byte)extraData["Access"].AsInteger(); - region.RegionSecret = extraData["RegionSecret"].AsString(); - region.EstateOwner = extraData["EstateOwner"].AsUUID(); - region.Token = extraData["Token"].AsString(); + + if ( ! extraData["HyperGrid"] ) { + Uri httpAddress = response["Address"].AsUri(); + region.ExternalHostName = httpAddress.Host; + region.HttpPort = (uint)httpAddress.Port; + + IPAddress internalAddress; + IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); + if (internalAddress == null) + internalAddress = IPAddress.Any; + + region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); + region.TerrainImage = extraData["MapTexture"].AsUUID(); + region.Access = (byte)extraData["Access"].AsInteger(); + region.RegionSecret = extraData["RegionSecret"].AsString(); + region.EstateOwner = extraData["EstateOwner"].AsUUID(); + region.Token = extraData["Token"].AsString(); + region.ServerURI = extraData["ServerURI"].AsString(); + } else { + region.ServerURI = response["Address"]; + } return region; } -- cgit v1.1