diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 40 |
1 files changed, 16 insertions, 24 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 688dfe4..64931d0 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 | |||
681 | // | 681 | // |
682 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 682 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
683 | 683 | ||
684 | TeleportAgent(agent, regionName, position, lookat); | 684 | TeleportAgent(agent, regionName, position, lookat, false); |
685 | } | 685 | } |
686 | 686 | ||
687 | private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 687 | private void TeleportAgent(string agent, string regionName, |
688 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
688 | { | 689 | { |
689 | m_host.AddScriptLPS(1); | 690 | m_host.AddScriptLPS(1); |
690 | UUID agentId = new UUID(); | 691 | UUID agentId = new UUID(); |
@@ -693,25 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
693 | ScenePresence presence = World.GetScenePresence(agentId); | 694 | ScenePresence presence = World.GetScenePresence(agentId); |
694 | if (presence != null) | 695 | if (presence != null) |
695 | { | 696 | { |
696 | // agent must be over owners land to avoid abuse | 697 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
697 | if (m_host.OwnerID | 698 | // For osTeleportOwner, this restriction isn't necessary |
699 | if (relaxRestrictions || | ||
700 | m_host.OwnerID | ||
698 | == World.LandChannel.GetLandObject( | 701 | == World.LandChannel.GetLandObject( |
699 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 702 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
700 | { | 703 | { |
701 | // Check for hostname, attempt to make a HG link, | ||
702 | // and convert the regionName to the target region | ||
703 | if (regionName.Contains(".") && regionName.Contains(":")) | ||
704 | { | ||
705 | // Even though we use none of the results, we need to perform this call because it appears | ||
706 | // to have some the side effect of setting up hypergrid teleport locations. | ||
707 | World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
708 | // List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); | ||
709 | |||
710 | string[] parts = regionName.Split(new char[] { ':' }); | ||
711 | if (parts.Length > 2) | ||
712 | regionName = parts[0] + ':' + parts[1] + "/ " + parts[2]; | ||
713 | regionName = "http://" + regionName; | ||
714 | } | ||
715 | World.RequestTeleportLocation(presence.ControllingClient, regionName, | 704 | World.RequestTeleportLocation(presence.ControllingClient, regionName, |
716 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 705 | new Vector3((float)position.x, (float)position.y, (float)position.z), |
717 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 706 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); |
@@ -728,10 +717,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
728 | // | 717 | // |
729 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); | 718 | CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); |
730 | 719 | ||
731 | TeleportAgent(agent, regionX, regionY, position, lookat); | 720 | TeleportAgent(agent, regionX, regionY, position, lookat, false); |
732 | } | 721 | } |
733 | 722 | ||
734 | private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 723 | private void TeleportAgent(string agent, int regionX, int regionY, |
724 | LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions) | ||
735 | { | 725 | { |
736 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); | 726 | ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); |
737 | 727 | ||
@@ -742,8 +732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
742 | ScenePresence presence = World.GetScenePresence(agentId); | 732 | ScenePresence presence = World.GetScenePresence(agentId); |
743 | if (presence != null) | 733 | if (presence != null) |
744 | { | 734 | { |
745 | // agent must be over owners land to avoid abuse | 735 | // For osTeleportAgent, agent must be over owners land to avoid abuse |
746 | if (m_host.OwnerID | 736 | // For osTeleportOwner, this restriction isn't necessary |
737 | if (relaxRestrictions || | ||
738 | m_host.OwnerID | ||
747 | == World.LandChannel.GetLandObject( | 739 | == World.LandChannel.GetLandObject( |
748 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 740 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) |
749 | { | 741 | { |
@@ -766,7 +758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
766 | // Threat level None because this is what can already be done with the World Map in the viewer | 758 | // Threat level None because this is what can already be done with the World Map in the viewer |
767 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 759 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
768 | 760 | ||
769 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); | 761 | TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true); |
770 | } | 762 | } |
771 | 763 | ||
772 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) | 764 | public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) |
@@ -778,7 +770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
778 | { | 770 | { |
779 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); | 771 | CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); |
780 | 772 | ||
781 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); | 773 | TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true); |
782 | } | 774 | } |
783 | 775 | ||
784 | // Functions that get information from the agent itself. | 776 | // Functions that get information from the agent itself. |