From 3585130ac8b805296323105a5b50c5d416210266 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jan 2011 02:42:22 -0500 Subject: SetTexture_fix --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 30fb252..38a16a4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1750,13 +1750,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { UUID textureID=new UUID(); - if (!UUID.TryParse(texture, out textureID)) - { - textureID=InventoryKey(texture, (int)AssetType.Texture); - } - - if (textureID == UUID.Zero) - return; + textureID=InventoryKey(texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } Primitive.TextureEntry tex = part.Shape.Textures; -- cgit v1.1 From bc2e254b55b65cf267b8027e3e696acbc0f3c60b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 21:55:22 +0000 Subject: minor: fix indentation, spacing on commit 3585130 this previous commit tries to look up the texture by name first before just using the uuid. this allows correct resolution of inventory textures which have uuids as names. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 38a16a4..e8da274 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1748,14 +1748,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SetTexture(SceneObjectPart part, string texture, int face) { - UUID textureID=new UUID(); - - textureID=InventoryKey(texture, (int)AssetType.Texture); - if (textureID == UUID.Zero) - { - if (!UUID.TryParse(texture, out textureID)) - return; - } + UUID textureID = new UUID(); + + textureID = InventoryKey(texture, (int)AssetType.Texture); + if (textureID == UUID.Zero) + { + if (!UUID.TryParse(texture, out textureID)) + return; + } Primitive.TextureEntry tex = part.Shape.Textures; -- cgit v1.1 From 722f0ba18cbea725235f1c31cf3bd3d6a66def29 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 23:06:24 +0000 Subject: Put something in the ImprovedInstantMessage.BinaryBucket for llInstantMessage() to stop this crashing viewer 2.4.0 (1.23.5 was fine with this). We're putting in a string of format " which appears to be the expected value. This resolves http://opensimulator.org/mantis/view.php?id=5356 --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e8da274..73fe160 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3063,12 +3063,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.ParentEstateID = 0; //ParentEstateID; msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; - msg.binaryBucket = new byte[0];// binaryBucket; + msg.binaryBucket + = Util.StringToBytes256( + "{0}/{1}/{2}/{3}", + World.RegionInfo.RegionName, + (int)Math.Floor(m_host.AbsolutePosition.X), + (int)Math.Floor(m_host.AbsolutePosition.Y), + (int)Math.Floor(m_host.AbsolutePosition.Z)); if (m_TransferModule != null) { m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); } + ScriptSleep(2000); } -- cgit v1.1 From 5b7a5a5b8b6221b2fe42f645c757c2e5e9132aa6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 Feb 2011 23:14:21 +0000 Subject: Add position to IM sent from llInstantMessage(), to better fulfill client expectations --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 73fe160..72ee495 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3061,7 +3061,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.fromGroup = false;// fromGroup; msg.offline = (byte)0; //offline; msg.ParentEstateID = 0; //ParentEstateID; - msg.Position = Vector3.Zero;// new Vector3(m_host.AbsolutePosition); + msg.Position = new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; msg.binaryBucket = Util.StringToBytes256( -- cgit v1.1 From cdd64bb8f51df51858b841de4def7808735b02dd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 Feb 2011 00:15:25 +0000 Subject: For now, reinstate the call to World.GridService.GetRegionsByName() commented out in 933f47e Even though we don't use the results, just getting the regions may have side effects in making hypergrid links available for the later World.RequestTeleportLocation() --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c0c790d..3f8735e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -702,7 +702,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) { -// List regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1); + 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]; -- cgit v1.1 From e8ba3d3a101a8b797021a9915b02c1bbfdf33448 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 7 Feb 2011 22:25:43 +0100 Subject: Prevent a nonexistent inventory item from throwing an exception --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 59e905e..cdaaab3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4195,7 +4195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (!found) { llSay(0, String.Format("Could not find object '{0}'", inventory)); - throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); + return; +// throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); } // check if destination is an object -- cgit v1.1 From 6becaf65e15e3fde2d910925b4f7ff09971121f3 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 7 Feb 2011 22:28:59 +0000 Subject: Fix merge issues --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e6ebc6e..673ea46 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1917,14 +1917,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void SetTexture(SceneObjectPart part, string texture, int face) { -<<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) return; - UUID textureID=new UUID(); -======= UUID textureID = new UUID(); ->>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs textureID = InventoryKey(texture, (int)AssetType.Texture); if (textureID == UUID.Zero) @@ -3346,15 +3342,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api msg.dialog = (byte)19; // MessageFromObject msg.fromGroup = false;// fromGroup; msg.offline = (byte)0; //offline; -<<<<<<< HEAD:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs msg.ParentEstateID = World.RegionInfo.EstateSettings.EstateID; msg.Position = new Vector3(m_host.AbsolutePosition); msg.RegionID = World.RegionInfo.RegionID.Guid; - msg.binaryBucket = Util.StringToBytes256(m_host.OwnerID.ToString()); -======= - msg.ParentEstateID = 0; //ParentEstateID; - msg.Position = new Vector3(m_host.AbsolutePosition); - msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; msg.binaryBucket = Util.StringToBytes256( "{0}/{1}/{2}/{3}", @@ -3362,7 +3352,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api (int)Math.Floor(m_host.AbsolutePosition.X), (int)Math.Floor(m_host.AbsolutePosition.Y), (int)Math.Floor(m_host.AbsolutePosition.Z)); ->>>>>>> master:OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs if (m_TransferModule != null) { -- cgit v1.1 From 9801bf03f8ab59e1fe8d439a216ca48a5bd68dc7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 12 Feb 2011 01:14:12 +0000 Subject: minor: add comment explaining that GetRegionsByName needs to stay in TeleportAgent for its side effects. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3f8735e..688dfe4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -702,6 +702,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // 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); -- cgit v1.1 From ba03e2e262191cc37da7cfaba544336aa9e85bd4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 12 Feb 2011 20:59:09 +0100 Subject: Add the country functions in the careminster API --- .../Shared/Api/Implementation/CM_Api.cs | 118 +++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/ICM_Api.cs | 46 ++++++++ .../ScriptEngine/Shared/Api/Runtime/CM_Stub.cs | 71 +++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs create mode 100644 OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs new file mode 100644 index 0000000..489c1c6 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/CM_Api.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Remoting.Lifetime; +using OpenMetaverse; +using Nini.Config; +using OpenSim; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.World.LightShare; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; +using OpenSim.Region.ScriptEngine.Shared.ScriptBase; +using OpenSim.Region.ScriptEngine.Interfaces; +using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; +using OpenSim.Services.Interfaces; + +using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; +using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; +using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; +using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; +using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; + +namespace OpenSim.Region.ScriptEngine.Shared.Api +{ + [Serializable] + public class CM_Api : MarshalByRefObject, ICM_Api, IScriptApi + { + internal IScriptEngine m_ScriptEngine; + internal SceneObjectPart m_host; + internal uint m_localID; + internal UUID m_itemID; + internal bool m_CMFunctionsEnabled = false; + + public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) + { + m_ScriptEngine = ScriptEngine; + m_host = host; + m_localID = localID; + m_itemID = itemID; + + if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) + m_CMFunctionsEnabled = true; + } + + public override Object InitializeLifetimeService() + { + ILease lease = (ILease)base.InitializeLifetimeService(); + + if (lease.CurrentState == LeaseState.Initial) + { + lease.InitialLeaseTime = TimeSpan.FromMinutes(0); + // lease.RenewOnCallTime = TimeSpan.FromSeconds(10.0); + // lease.SponsorshipTimeout = TimeSpan.FromMinutes(1.0); + } + return lease; + } + + public Scene World + { + get { return m_ScriptEngine.World; } + } + + public string cmDetectedCountry(int number) + { + m_host.AddScriptLPS(1); + DetectParams detectedParams = m_ScriptEngine.GetDetectParams(m_itemID, number); + if (detectedParams == null) + return String.Empty; + return detectedParams.Country; + } + + public string cmGetAgentCountry(LSL_Key key) + { + if (!World.Permissions.IsGod(m_host.OwnerID)) + return String.Empty; + + UUID uuid; + + if (!UUID.TryParse(key, out uuid)) + return String.Empty; + + UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, uuid); + return account.UserCountry; + } + } +} diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs new file mode 100644 index 0000000..ab215f3 --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ICM_Api.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections; +using OpenSim.Region.ScriptEngine.Interfaces; + +using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; +using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; +using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; +using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; +using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; + +namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces +{ + public interface ICM_Api + { + string cmDetectedCountry(int num); + string cmGetAgentCountry(key key); + } +} diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs new file mode 100644 index 0000000..4132dfa --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/CM_Stub.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Runtime.Remoting.Lifetime; +using System.Threading; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.ScriptEngine.Interfaces; +using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; +using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; +using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; +using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; +using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list; +using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; +using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; +using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; + +namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase +{ + public partial class ScriptBaseClass : MarshalByRefObject + { + public ICM_Api m_CM_Functions; + + public void ApiTypeCM(IScriptApi api) + { + if (!(api is ICM_Api)) + return; + + m_CM_Functions = (ICM_Api)api; + } + + public string cmDetectedCountry(int num) + { + return m_CM_Functions.cmDetectedCountry(num); + } + + public string cmGetAgentCountry(key key) + { + return m_CM_Functions.cmGetAgentCountry(key); + } + } +} -- cgit v1.1 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') 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') 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 From efd8d03c59296a4179331573016bb2e3fd5cfcc7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 21 Feb 2011 04:02:47 +0100 Subject: Prevent giving copies of no copy scripts or transferring no trans scripts through LSL --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index aa6e505..a62a7b4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6867,6 +6867,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // copy the first script found with this inventory name + TaskInventoryItem scriptItem = null; m_host.TaskInventory.LockItemsForRead(true); foreach (KeyValuePair inv in m_host.TaskInventory) { @@ -6877,6 +6878,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { found = true; srcId = inv.Key; + scriptItem = inv.Value; break; } } @@ -6889,8 +6891,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - // the rest of the permission checks are done in RezScript, so check the pin there as well - World.RezScript(srcId, m_host, destId, pin, running, start_param); + SceneObjectPart dest = World.GetSceneObjectPart(destId); + if (dest != null) + { + if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID) + { + // the rest of the permission checks are done in RezScript, so check the pin there as well + World.RezScript(srcId, m_host, destId, pin, running, start_param); + + if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0) + m_host.Inventory.RemoveInventoryItem(srcId); + } + } // this will cause the delay even if the script pin or permissions were wrong - seems ok ScriptSleep(3000); } -- cgit v1.1 From 0719ffa6fab128352868b65a4ec48e40357ecc5f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 1 Mar 2011 23:34:02 +0100 Subject: Change protection from being teleported home to extend to incognito gods. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a62a7b4..559523b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4486,7 +4486,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (presence != null) { // agent must not be a god - if (presence.GodLevel >= 200) return; + if (presence.UserLevel >= 200) return; // agent must be over the owners land if (m_host.OwnerID == World.LandChannel.GetLandObject( -- cgit v1.1