From 8a2c365e5b47b677da464c277cb713fade8c99d7 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 22 Nov 2010 10:39:46 +0100 Subject: Thank you, thomax, for a patch making changed events CHANGED_REGION_RESTART and CHANGED_REGION work. Fixes Mantix #5214. --- OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 6663aa5..660e9a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -392,13 +392,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance { // m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); PostEvent(new EventParams("changed", - new Object[] { (int)Changed.REGION_RESTART }, new DetectParams[0])); + new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION_RESTART) }, + new DetectParams[0])); } else if (m_stateSource == StateSource.PrimCrossing) { // CHANGED_REGION PostEvent(new EventParams("changed", - new Object[] { (int)Changed.REGION }, new DetectParams[0])); + new Object[] { new LSL_Types.LSLInteger((int)Changed.REGION) }, + new DetectParams[0])); } } else -- cgit v1.1 From 4e0a289a8dfc069201a856d2a67510c5b6b91ccf Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Nov 2010 14:13:27 +0000 Subject: Change FS Voice module to a shared module to avoid gratuitious server handler registrations. Add the missing bits to drive the local connector's HTTP requests. This makes standalones work. --- .../Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 36 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 294d4f0..9a17233 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -58,7 +58,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")] - public class FreeSwitchVoiceModule : INonSharedRegionModule, IVoiceModule + public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -97,8 +97,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private readonly Dictionary m_UUIDName = new Dictionary(); private Dictionary m_ParcelAddress = new Dictionary(); - private Scene m_Scene; - private IConfig m_Config; private IFreeswitchService m_FreeswitchService; @@ -165,6 +163,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); + MainServer.Instance.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler); + // RestStreamHandler h = new // RestStreamHandler("GET", // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); @@ -214,15 +214,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice } } - public void AddRegion(Scene scene) + public void PostInitialise() { - m_Scene = scene; + } + public void AddRegion(Scene scene) + { // We generate these like this: The region's external host name // as defined in Regions.ini is a good address to use. It's a // dotted quad (or should be!) and it can reach this host from // a client. The port is grabbed from the region's HTTP server. - m_openSimWellKnownHTTPAddress = m_Scene.RegionInfo.ExternalHostName; + m_openSimWellKnownHTTPAddress = scene.RegionInfo.ExternalHostName; m_freeSwitchServicePort = MainServer.Instance.Port; if (m_Enabled) @@ -790,6 +792,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { return true; } + + public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request) + { + Hashtable response = new Hashtable(); + response["str_response_string"] = string.Empty; + response["content_type"] = "text/plain"; + response["keepalive"] = false; + response["int_response_code"] = 500; + + Hashtable requestBody = ParseRequestBody((string) request["body"]); + + string section = (string) requestBody["section"]; + + if (section == "directory") + response = m_FreeswitchService.HandleDirectoryRequest(requestBody); + else if (section == "dialplan") + response = m_FreeswitchService.HandleDialplanRequest(requestBody); + else + m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section); + + return response; + } } public class MonoCert : ICertificatePolicy -- cgit v1.1 From d2aebbe0669481c9f416c78dd40ca6007da09f02 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 22 Nov 2010 14:32:51 +0100 Subject: Fox case on a method --- .../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 9a17233..a583cca 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -603,7 +603,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice response["str_response_string"] = string.Empty; response["content-type"] = "text/xml"; - Hashtable requestBody = parseRequestBody((string)request["body"]); + Hashtable requestBody = ParseRequestBody((string)request["body"]); if (!requestBody.ContainsKey("auth_token")) return response; @@ -675,7 +675,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice string uri = (string)request["uri"]; string contenttype = (string)request["content-type"]; - Hashtable requestBody = parseRequestBody((string)request["body"]); + Hashtable requestBody = ParseRequestBody((string)request["body"]); //string pwd = (string) requestBody["pwd"]; string userid = (string) requestBody["userid"]; @@ -719,7 +719,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice return response; } - public Hashtable parseRequestBody(string body) + public Hashtable ParseRequestBody(string body) { Hashtable bodyParams = new Hashtable(); // split string -- cgit v1.1 From d63965cf9480d9385f7b898677c5dc44103b4729 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 22 Nov 2010 13:57:48 +0100 Subject: Let CHANGED_SHAPE trigger. This fixes Mantis #1844. --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2155e26..ba592c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1002,21 +1002,7 @@ namespace OpenSim.Region.Framework.Scenes public PrimitiveBaseShape Shape { get { return m_shape; } - set - { - bool shape_changed = false; - // TODO: this should really be restricted to the right - // set of attributes on shape change. For instance, - // changing the lighting on a shape shouldn't cause - // this. - if (m_shape != null) - shape_changed = true; - - m_shape = value; - - if (shape_changed) - TriggerScriptChangedEvent(Changed.SHAPE); - } + set { m_shape = value; } } public Vector3 Scale @@ -4570,6 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.RootPart.Rezzed = DateTime.UtcNow; ParentGroup.HasGroupChanged = true; + TriggerScriptChangedEvent(Changed.SHAPE); ScheduleFullUpdate(); } -- cgit v1.1 From e1c72cedb3db22c232248ff499644867b8c9e2bc Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 22 Nov 2010 15:47:48 +0100 Subject: Let CHANGED_SCALE also trigger when editing prims and linksets with the viewer's edit tools. This event used to trigger only when the scale was changed with a script. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c2810b2..4ec530e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2607,6 +2607,7 @@ namespace OpenSim.Region.Framework.Scenes //if (part.UUID != m_rootPart.UUID) HasGroupChanged = true; + part.TriggerScriptChangedEvent(Changed.SCALE); ScheduleGroupForFullUpdate(); //if (part.UUID == m_rootPart.UUID) @@ -2758,6 +2759,7 @@ namespace OpenSim.Region.Framework.Scenes part.IgnoreUndoUpdate = false; part.StoreUndoState(); HasGroupChanged = true; + m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); ScheduleGroupForTerseUpdate(); } } -- cgit v1.1 From 34b13a4765cd74a5a09739beb13968da5b9e3e16 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 22 Nov 2010 22:51:26 +0000 Subject: add basic tests to check that under default permissions module owner can delete objects and that non-owners (who are also not administrators, etc.) cannot --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 9 +- .../Region/Framework/Scenes/Scene.Permissions.cs | 62 +++++++++-- .../Framework/Scenes/Tests/SceneObjectUserTests.cs | 124 +++++++++++++++++++++ .../Framework/Scenes/Tests/ScenePresenceTests.cs | 2 + 4 files changed, 186 insertions(+), 11 deletions(-) create mode 100644 OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a29b7f1..06f8ac1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1733,7 +1733,12 @@ namespace OpenSim.Region.Framework.Scenes // Autoreturn has a null client. Nothing else does. So // allow only returns if (action != DeRezAction.Return) + { + m_log.WarnFormat( + "[AGENT INVENTORY]: Ignoring attempt to {0} {1} {2} without a client", + action, grp.Name, grp.UUID); return; + } permissionToTakeCopy = false; } @@ -1741,13 +1746,13 @@ namespace OpenSim.Region.Framework.Scenes { if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) permissionToTakeCopy = false; + if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) permissionToTake = false; - + if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) permissionToDelete = false; } - } // Handle god perms diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index 06890a0..d67638a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -27,13 +27,15 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Text; +using log4net; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes -{ +{ #region Delegates public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); public delegate void SetBypassPermissionsHandler(bool value); @@ -88,6 +90,8 @@ namespace OpenSim.Region.Framework.Scenes public class ScenePermissions { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private Scene m_scene; public ScenePermissions(Scene scene) @@ -242,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes #region DELETE OBJECT public bool CanDeleteObject(UUID objectID, UUID deleter) { + bool result = true; + DeleteObjectHandler handler = OnDeleteObject; if (handler != null) { @@ -249,10 +255,18 @@ namespace OpenSim.Region.Framework.Scenes foreach (DeleteObjectHandler h in list) { if (h(objectID, deleter, m_scene) == false) - return false; + { + result = false; + break; + } } } - return true; + +// m_log.DebugFormat( +// "[SCENE PERMISSIONS]: CanDeleteObject() fired for object {0}, deleter {1}, result {2}", +// objectID, deleter, result); + + return result; } #endregion @@ -260,6 +274,8 @@ namespace OpenSim.Region.Framework.Scenes #region TAKE OBJECT public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) { + bool result = true; + TakeObjectHandler handler = OnTakeObject; if (handler != null) { @@ -267,10 +283,18 @@ namespace OpenSim.Region.Framework.Scenes foreach (TakeObjectHandler h in list) { if (h(objectID, AvatarTakingUUID, m_scene) == false) - return false; + { + result = false; + break; + } } } - return true; + +// m_log.DebugFormat( +// "[SCENE PERMISSIONS]: CanTakeObject() fired for object {0}, taker {1}, result {2}", +// objectID, AvatarTakingUUID, result); + + return result; } #endregion @@ -278,6 +302,8 @@ namespace OpenSim.Region.Framework.Scenes #region TAKE COPY OBJECT public bool CanTakeCopyObject(UUID objectID, UUID userID) { + bool result = true; + TakeCopyObjectHandler handler = OnTakeCopyObject; if (handler != null) { @@ -285,10 +311,18 @@ namespace OpenSim.Region.Framework.Scenes foreach (TakeCopyObjectHandler h in list) { if (h(objectID, userID, m_scene) == false) - return false; + { + result = false; + break; + } } } - return true; + +// m_log.DebugFormat( +// "[SCENE PERMISSIONS]: CanTakeCopyObject() fired for object {0}, user {1}, result {2}", +// objectID, userID, result); + + return result; } #endregion @@ -383,6 +417,8 @@ namespace OpenSim.Region.Framework.Scenes #region RETURN OBJECT public bool CanReturnObjects(ILandObject land, UUID user, List objects) { + bool result = true; + ReturnObjectsHandler handler = OnReturnObjects; if (handler != null) { @@ -390,10 +426,18 @@ namespace OpenSim.Region.Framework.Scenes foreach (ReturnObjectsHandler h in list) { if (h(land, user, objects, m_scene) == false) - return false; + { + result = false; + break; + } } } - return true; + +// m_log.DebugFormat( +// "[SCENE PERMISSIONS]: CanReturnObjects() fired for user {0} for {1} objects on {2}, result {3}", +// user, objects.Count, land.LandData.Name, result); + + return result; } #endregion diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs new file mode 100644 index 0000000..7851f72 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs @@ -0,0 +1,124 @@ +/* + * 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 Nini.Config; +using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using OpenSim.Region.CoreModules.World.Permissions; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; +using OpenSim.Tests.Common.Setup; + +namespace OpenSim.Region.Framework.Scenes.Tests +{ + /// + /// Tests manipulation of scene objects by users. + /// + /// + /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. + /// FIXME: These tests are very incomplete - they only test for a few conditions. + [TestFixture] + public class SceneObjectUserTests + { + /// + /// Test deleting an object from a scene. + /// + [Test] + public void TestDeRezSceneObject() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. + AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; + sogd.Enabled = false; + + SceneObjectPart part + = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); + part.Name = "obj1"; + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + + scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); + sogd.InventoryDeQueueAndDelete(); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + Assert.That(retrievedPart, Is.Null); + } + + /// + /// Test deleting an object from a scene where the deleter is not the owner + /// + /// + /// This test assumes that the deleter is not a god. + [Test] + public void TestDeRezSceneObjectNotOwner() + { + TestHelper.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); + UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); + + TestScene scene = SceneSetupHelpers.SetupScene(); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); + TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); + + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. + AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; + sogd.Enabled = false; + + SceneObjectPart part + = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); + part.Name = "obj1"; + scene.AddNewSceneObject(new SceneObjectGroup(part), false); + + scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); + sogd.InventoryDeQueueAndDelete(); + + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ab5968c..ef52363 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs @@ -65,6 +65,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests [TestFixtureSetUp] public void Init() { + TestHelper.InMethod(); + scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); -- cgit v1.1 From bbc291dfdf9b96d0bdf89d365d0cfd8405ae52e1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 22 Nov 2010 23:07:30 +0000 Subject: adapt tests to use DeRezObjects() since DeRezObject() has recently disappeared --- OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs index 7851f72..b3b99f4 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserTests.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; using System.Reflection; using Nini.Config; using NUnit.Framework; @@ -76,8 +77,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); part.Name = "obj1"; scene.AddNewSceneObject(new SceneObjectGroup(part), false); + List localIds = new List(); + localIds.Add(part.LocalId); - scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); + scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); sogd.InventoryDeQueueAndDelete(); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); @@ -113,8 +116,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); part.Name = "obj1"; scene.AddNewSceneObject(new SceneObjectGroup(part), false); + List localIds = new List(); + localIds.Add(part.LocalId); - scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); + scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); sogd.InventoryDeQueueAndDelete(); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); -- cgit v1.1 From 63170fdea7eb7f6271fdcf048a39824084a83fd1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 23 Nov 2010 04:26:07 +0000 Subject: Only perform the take object permissions check if an object is being attached directly from the scene, not from existing inventory --- .../Avatar/Attachments/AttachmentsModule.cs | 105 ++++++++++----------- 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1744fb3..1f49a01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -111,7 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) + { + remoteClient.SendAgentAlertMessage( + "You don't have sufficient permissions to attach this object", false); + return; + } // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // be removed when that functionality is implemented in opensim @@ -141,76 +146,66 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { Vector3 attachPos = group.AbsolutePosition; - if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) + // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should + // be removed when that functionality is implemented in opensim + AttachmentPt &= 0x7f; + + // If the attachment point isn't the same as the one previously used + // set it's offset position = 0 so that it appears on the attachment point + // and not in a weird location somewhere unknown. + if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) { - // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should - // be removed when that functionality is implemented in opensim - AttachmentPt &= 0x7f; - - // If the attachment point isn't the same as the one previously used - // set it's offset position = 0 so that it appears on the attachment point - // and not in a weird location somewhere unknown. - if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint()) - { - attachPos = Vector3.Zero; - } + attachPos = Vector3.Zero; + } - // AttachmentPt 0 means the client chose to 'wear' the attachment. - if (AttachmentPt == 0) - { - // Check object for stored attachment point - AttachmentPt = (uint)group.GetAttachmentPoint(); - } + // AttachmentPt 0 means the client chose to 'wear' the attachment. + if (AttachmentPt == 0) + { + // Check object for stored attachment point + AttachmentPt = (uint)group.GetAttachmentPoint(); + } - // if we still didn't find a suitable attachment point....... - if (AttachmentPt == 0) - { - // Stick it on left hand with Zero Offset from the attachment point. - AttachmentPt = (uint)AttachmentPoint.LeftHand; - attachPos = Vector3.Zero; - } + // if we still didn't find a suitable attachment point....... + if (AttachmentPt == 0) + { + // Stick it on left hand with Zero Offset from the attachment point. + AttachmentPt = (uint)AttachmentPoint.LeftHand; + attachPos = Vector3.Zero; + } - group.SetAttachmentPoint((byte)AttachmentPt); - group.AbsolutePosition = attachPos; + group.SetAttachmentPoint((byte)AttachmentPt); + group.AbsolutePosition = attachPos; - // Remove any previous attachments - ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); - UUID itemID = UUID.Zero; - if (sp != null) + // Remove any previous attachments + ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); + UUID itemID = UUID.Zero; + if (sp != null) + { + foreach (SceneObjectGroup grp in sp.Attachments) { - foreach (SceneObjectGroup grp in sp.Attachments) + if (grp.GetAttachmentPoint() == (byte)AttachmentPt) { - if (grp.GetAttachmentPoint() == (byte)AttachmentPt) - { - itemID = grp.GetFromItemID(); - break; - } + itemID = grp.GetFromItemID(); + break; } - if (itemID != UUID.Zero) - DetachSingleAttachmentToInv(itemID, remoteClient); } + if (itemID != UUID.Zero) + DetachSingleAttachmentToInv(itemID, remoteClient); + } - if (group.GetFromItemID() == UUID.Zero) - { - m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); - } - else - { - itemID = group.GetFromItemID(); - } - - ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group); - - AttachToAgent(sp, group, AttachmentPt, attachPos, silent); + if (group.GetFromItemID() == UUID.Zero) + { + m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); } else { - remoteClient.SendAgentAlertMessage( - "You don't have sufficient permissions to attach this object", false); - - return false; + itemID = group.GetFromItemID(); } + ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group); + + AttachToAgent(sp, group, AttachmentPt, attachPos, silent); + return true; } -- cgit v1.1 From ba2bf78dcfe57a9e5f3d00a572f7cc82975a4fc0 Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 23 Nov 2010 10:40:31 +0100 Subject: Fix joining land parcels not being stored correctly in SQLite. Thank you to goetz for the initial patch in Mantis #5230. --- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 0bfd73a..8d93354 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -697,6 +697,7 @@ namespace OpenSim.Data.SQLite DataRow landRow = land.Rows.Find(globalID.ToString()); if (landRow != null) { + landRow.Delete(); land.Rows.Remove(landRow); } List rowsToDelete = new List(); @@ -707,6 +708,7 @@ namespace OpenSim.Data.SQLite } for (int iter = 0; iter < rowsToDelete.Count; iter++) { + rowsToDelete[iter].Delete(); landaccesslist.Rows.Remove(rowsToDelete[iter]); } } @@ -755,6 +757,7 @@ namespace OpenSim.Data.SQLite } for (int iter = 0; iter < rowsToDelete.Count; iter++) { + rowsToDelete[iter].Delete(); landaccesslist.Rows.Remove(rowsToDelete[iter]); } rowsToDelete.Clear(); diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs index 1ad1e66..644864a 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs @@ -657,6 +657,7 @@ namespace OpenSim.Data.SQLiteLegacy DataRow landRow = land.Rows.Find(globalID.ToString()); if (landRow != null) { + landRow.Delete(); land.Rows.Remove(landRow); } List rowsToDelete = new List(); @@ -667,6 +668,7 @@ namespace OpenSim.Data.SQLiteLegacy } for (int iter = 0; iter < rowsToDelete.Count; iter++) { + rowsToDelete[iter].Delete(); landaccesslist.Rows.Remove(rowsToDelete[iter]); } @@ -717,6 +719,7 @@ namespace OpenSim.Data.SQLiteLegacy } for (int iter = 0; iter < rowsToDelete.Count; iter++) { + rowsToDelete[iter].Delete(); landaccesslist.Rows.Remove(rowsToDelete[iter]); } rowsToDelete.Clear(); -- cgit v1.1 From c68f03a6ffd030d1ccc9bc5735501496160729ac Mon Sep 17 00:00:00 2001 From: Marck Date: Tue, 23 Nov 2010 11:15:00 +0100 Subject: Fix: Allow use of parameters without specifying a file path with command "save oar" --- OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 358d0a7..2d7244e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver List mainParams = ops.Parse(cmdparams); - if (cmdparams.Length > 2) + if (mainParams.Count > 2) { ArchiveRegion(mainParams[2], options); } -- cgit v1.1 From 7796b90ebb434b4fa32757567b06e595dea4e97d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 23 Nov 2010 14:02:06 +0000 Subject: Fix some crashes caused by the addition of the CreatorData column --- OpenSim/Framework/Capabilities/Caps.cs | 1 + OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 7b0e053..e7f2e13 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -967,6 +967,7 @@ namespace OpenSim.Framework.Capabilities InventoryItemBase item = new InventoryItemBase(); item.Owner = m_agentID; item.CreatorId = m_agentID.ToString(); + item.CreatorData = String.Empty; item.ID = inventoryItem; item.AssetID = asset.FullID; item.Description = assetDescription; diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 88fbda3..b3bfcc2 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -302,6 +302,8 @@ namespace OpenSim.Services.Connectors public bool AddItem(InventoryItemBase item) { + if (item.CreatorData == null) + item.CreatorData = String.Empty; Dictionary ret = MakeRequest("ADDITEM", new Dictionary { { "AssetID", item.AssetID.ToString() }, @@ -335,6 +337,8 @@ namespace OpenSim.Services.Connectors public bool UpdateItem(InventoryItemBase item) { + if (item.CreatorData == null) + item.CreatorData = String.Empty; Dictionary ret = MakeRequest("UPDATEITEM", new Dictionary { { "AssetID", item.AssetID.ToString() }, @@ -558,7 +562,10 @@ namespace OpenSim.Services.Connectors item.InvType = int.Parse(data["InvType"].ToString()); item.Folder = new UUID(data["Folder"].ToString()); item.CreatorId = data["CreatorId"].ToString(); - item.CreatorData = data["CreatorData"].ToString(); + if (data.ContainsKey("CreatorData")) + item.CreatorData = data["CreatorData"].ToString(); + else + item.CreatorData = String.Empty; item.Description = data["Description"].ToString(); item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); -- cgit v1.1 From 45b08a9ce306835dbd9493f4157a3a6e2e0d349c Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 23 Nov 2010 00:31:09 +0100 Subject: Fix more potential nullrefs --- OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 23ae5b4..22a718a 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -600,8 +600,10 @@ namespace OpenSim.Server.Handlers.Asset ret["AssetType"] = item.AssetType.ToString(); ret["BasePermissions"] = item.BasePermissions.ToString(); ret["CreationDate"] = item.CreationDate.ToString(); - ret["CreatorId"] = item.CreatorId.ToString(); - ret["CreatorData"] = item.CreatorData.ToString(); + if (item.CreatorId != null) + ret["CreatorId"] = item.CreatorId.ToString(); + else + ret["CreatorId"] = String.Empty; ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); ret["Description"] = item.Description.ToString(); ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); -- cgit v1.1 From 61a49ec4a8d6e0466d6aa8363b7012dc4e6eab9f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 23 Nov 2010 06:36:57 -0800 Subject: Initialize InventoryItemBase.creatorData properly. Could throw. --- OpenSim/Framework/InventoryItemBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index ce4fc38..a663680 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -117,7 +117,7 @@ namespace OpenSim.Framework } protected UUID m_creatorIdAsUuid = UUID.Zero; - protected string m_creatorData; + protected string m_creatorData = string.Empty; public string CreatorData // = ; { get { return m_creatorData; } -- cgit v1.1 From a4bf6c53437f6527f0ee422eb57898a2b0a65b6a Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 23 Nov 2010 07:44:42 -0800 Subject: Attempt at fixing failing test. --- OpenSim/Data/Tests/InventoryTests.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index 3205bfa..dc03259 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs @@ -323,7 +323,8 @@ namespace OpenSim.Data.Tests .IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.Description) - .IgnoreProperty(x => x.CreatorId)); + .IgnoreProperty(x => x.CreatorId) + .IgnoreProperty(x => x.CreatorData)); inventoryScrambler.Scramble(expected); db.updateInventoryItem(expected); @@ -333,7 +334,8 @@ namespace OpenSim.Data.Tests .IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.Description) - .IgnoreProperty(x => x.CreatorId)); + .IgnoreProperty(x => x.CreatorId) + .IgnoreProperty(x => x.CreatorData)); } [Test] -- cgit v1.1