From 47a5d8d7420f86088d75e4b578e7e997ba2d11c8 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 21 Jan 2011 19:55:35 +0100 Subject: Make osTeleportOwner work in foreign regions by relaxing the restrictions on teleporting an agent. --- .../Shared/Api/Implementation/OSSL_Api.cs | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 688dfe4..402d3a5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionName, position, lookat); + TeleportAgent(agent, regionName, position, lookat, false); } - private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, string regionName, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { m_host.AddScriptLPS(1); UUID agentId = new UUID(); @@ -694,7 +695,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must be over owners land to avoid abuse - if (m_host.OwnerID + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -728,10 +730,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - TeleportAgent(agent, regionX, regionY, position, lookat); + TeleportAgent(agent, regionX, regionY, position, lookat, false); } - private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + private void TeleportAgent(string agent, int regionX, int regionY, + LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) { ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); @@ -742,8 +745,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over owners land to avoid abuse - if (m_host.OwnerID + // For osTeleportAgent, agent must be over owners land to avoid abuse + // For osTeleportOwner, this restriction isn't necessary + if (relaxRestrictions || + m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { @@ -766,7 +771,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Threat level None because this is what can already be done with the World Map in the viewer CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); } public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) @@ -778,7 +783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); - TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); + TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); } // Functions that get information from the agent itself. -- cgit v1.1 From 4f9c3c73ad8cc2178e44c724c72a4bb292e5ea93 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 21 Jan 2011 20:00:04 +0100 Subject: Add support for new naming syntax of linked regions to osTeleportAgent and osTeleportOwner. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 402d3a5..64931d0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -694,26 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentId); if (presence != null) { - // agent must be over owners land to avoid abuse + // For osTeleportAgent, agent must be over owners land to avoid abuse + // For osTeleportOwner, this restriction isn't necessary if (relaxRestrictions || m_host.OwnerID == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { - // Check for hostname, attempt to make a HG link, - // and convert the regionName to the target region - if (regionName.Contains(".") && regionName.Contains(":")) - { - // Even though we use none of the results, we need to perform this call because it appears - // to have some the side effect of setting up hypergrid teleport locations. - World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); -// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); - - string[] parts = regionName.Split(new char[] { ':' }); - if (parts.Length > 2) - regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; - regionName = "http://" + regionName; - } World.RequestTeleportLocation(presence.ControllingClient, regionName, new Vector3((float)position.x, (float)position.y, (float)position.z), new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); -- cgit v1.1