Merge branch 'master-core' into mantis5110

viewer-2-initial-appearance
Jonathan Freedman 2010-11-23 22:27:54 -08:00
commit bc51dfc45e
17 changed files with 307 additions and 99 deletions

View File

@ -697,6 +697,7 @@ namespace OpenSim.Data.SQLite
DataRow landRow = land.Rows.Find(globalID.ToString()); DataRow landRow = land.Rows.Find(globalID.ToString());
if (landRow != null) if (landRow != null)
{ {
landRow.Delete();
land.Rows.Remove(landRow); land.Rows.Remove(landRow);
} }
List<DataRow> rowsToDelete = new List<DataRow>(); List<DataRow> rowsToDelete = new List<DataRow>();
@ -707,6 +708,7 @@ namespace OpenSim.Data.SQLite
} }
for (int iter = 0; iter < rowsToDelete.Count; iter++) for (int iter = 0; iter < rowsToDelete.Count; iter++)
{ {
rowsToDelete[iter].Delete();
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
} }
@ -755,6 +757,7 @@ namespace OpenSim.Data.SQLite
} }
for (int iter = 0; iter < rowsToDelete.Count; iter++) for (int iter = 0; iter < rowsToDelete.Count; iter++)
{ {
rowsToDelete[iter].Delete();
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
rowsToDelete.Clear(); rowsToDelete.Clear();

View File

@ -657,6 +657,7 @@ namespace OpenSim.Data.SQLiteLegacy
DataRow landRow = land.Rows.Find(globalID.ToString()); DataRow landRow = land.Rows.Find(globalID.ToString());
if (landRow != null) if (landRow != null)
{ {
landRow.Delete();
land.Rows.Remove(landRow); land.Rows.Remove(landRow);
} }
List<DataRow> rowsToDelete = new List<DataRow>(); List<DataRow> rowsToDelete = new List<DataRow>();
@ -667,6 +668,7 @@ namespace OpenSim.Data.SQLiteLegacy
} }
for (int iter = 0; iter < rowsToDelete.Count; iter++) for (int iter = 0; iter < rowsToDelete.Count; iter++)
{ {
rowsToDelete[iter].Delete();
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
@ -717,6 +719,7 @@ namespace OpenSim.Data.SQLiteLegacy
} }
for (int iter = 0; iter < rowsToDelete.Count; iter++) for (int iter = 0; iter < rowsToDelete.Count; iter++)
{ {
rowsToDelete[iter].Delete();
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
rowsToDelete.Clear(); rowsToDelete.Clear();

View File

@ -323,7 +323,8 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description) .IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId)); .IgnoreProperty(x => x.CreatorId)
.IgnoreProperty(x => x.CreatorData));
inventoryScrambler.Scramble(expected); inventoryScrambler.Scramble(expected);
db.updateInventoryItem(expected); db.updateInventoryItem(expected);
@ -333,7 +334,8 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x => x.InvType) .IgnoreProperty(x => x.InvType)
.IgnoreProperty(x => x.CreatorIdAsUuid) .IgnoreProperty(x => x.CreatorIdAsUuid)
.IgnoreProperty(x => x.Description) .IgnoreProperty(x => x.Description)
.IgnoreProperty(x => x.CreatorId)); .IgnoreProperty(x => x.CreatorId)
.IgnoreProperty(x => x.CreatorData));
} }
[Test] [Test]

View File

@ -967,6 +967,7 @@ namespace OpenSim.Framework.Capabilities
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
item.Owner = m_agentID; item.Owner = m_agentID;
item.CreatorId = m_agentID.ToString(); item.CreatorId = m_agentID.ToString();
item.CreatorData = String.Empty;
item.ID = inventoryItem; item.ID = inventoryItem;
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = assetDescription; item.Description = assetDescription;

View File

@ -117,7 +117,7 @@ namespace OpenSim.Framework
} }
protected UUID m_creatorIdAsUuid = UUID.Zero; protected UUID m_creatorIdAsUuid = UUID.Zero;
protected string m_creatorData; protected string m_creatorData = string.Empty;
public string CreatorData // = <profile url>;<name> public string CreatorData // = <profile url>;<name>
{ {
get { return m_creatorData; } get { return m_creatorData; }

View File

@ -111,7 +111,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return; return;
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
{
remoteClient.SendAgentAlertMessage(
"You don't have sufficient permissions to attach this object", false);
return; return;
}
// TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should
// be removed when that functionality is implemented in opensim // be removed when that functionality is implemented in opensim
@ -141,76 +146,66 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
Vector3 attachPos = group.AbsolutePosition; 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 attachPos = Vector3.Zero;
// 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;
}
// AttachmentPt 0 means the client chose to 'wear' the attachment. // AttachmentPt 0 means the client chose to 'wear' the attachment.
if (AttachmentPt == 0) if (AttachmentPt == 0)
{ {
// Check object for stored attachment point // Check object for stored attachment point
AttachmentPt = (uint)group.GetAttachmentPoint(); AttachmentPt = (uint)group.GetAttachmentPoint();
} }
// if we still didn't find a suitable attachment point....... // if we still didn't find a suitable attachment point.......
if (AttachmentPt == 0) if (AttachmentPt == 0)
{ {
// Stick it on left hand with Zero Offset from the attachment point. // Stick it on left hand with Zero Offset from the attachment point.
AttachmentPt = (uint)AttachmentPoint.LeftHand; AttachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = Vector3.Zero; attachPos = Vector3.Zero;
} }
group.SetAttachmentPoint((byte)AttachmentPt); group.SetAttachmentPoint((byte)AttachmentPt);
group.AbsolutePosition = attachPos; group.AbsolutePosition = attachPos;
// Remove any previous attachments // Remove any previous attachments
ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
UUID itemID = UUID.Zero; UUID itemID = UUID.Zero;
if (sp != null) 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) if (group.GetFromItemID() == UUID.Zero)
{ {
m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID); m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
}
else
{
itemID = group.GetFromItemID();
}
ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
} }
else else
{ {
remoteClient.SendAgentAlertMessage( itemID = group.GetFromItemID();
"You don't have sufficient permissions to attach this object", false);
return false;
} }
ShowAttachInUserInventory(remoteClient, AttachmentPt, itemID, group);
AttachToAgent(sp, group, AttachmentPt, attachPos, silent);
return true; return true;
} }

View File

@ -130,7 +130,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
List<string> mainParams = ops.Parse(cmdparams); List<string> mainParams = ops.Parse(cmdparams);
if (cmdparams.Length > 2) if (mainParams.Count > 2)
{ {
ArchiveRegion(mainParams[2], options); ArchiveRegion(mainParams[2], options);
} }

View File

@ -1733,7 +1733,12 @@ namespace OpenSim.Region.Framework.Scenes
// Autoreturn has a null client. Nothing else does. So // Autoreturn has a null client. Nothing else does. So
// allow only returns // allow only returns
if (action != DeRezAction.Return) if (action != DeRezAction.Return)
{
m_log.WarnFormat(
"[AGENT INVENTORY]: Ignoring attempt to {0} {1} {2} without a client",
action, grp.Name, grp.UUID);
return; return;
}
permissionToTakeCopy = false; permissionToTakeCopy = false;
} }
@ -1741,13 +1746,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId)) if (!Permissions.CanTakeCopyObject(grp.UUID, remoteClient.AgentId))
permissionToTakeCopy = false; permissionToTakeCopy = false;
if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId)) if (!Permissions.CanTakeObject(grp.UUID, remoteClient.AgentId))
permissionToTake = false; permissionToTake = false;
if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId)) if (!Permissions.CanDeleteObject(grp.UUID, remoteClient.AgentId))
permissionToDelete = false; permissionToDelete = false;
} }
} }
// Handle god perms // Handle god perms

View File

@ -27,13 +27,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using System.Text; using System.Text;
using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework.Scenes namespace OpenSim.Region.Framework.Scenes
{ {
#region Delegates #region Delegates
public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID); public delegate uint GenerateClientFlagsHandler(UUID userID, UUID objectID);
public delegate void SetBypassPermissionsHandler(bool value); public delegate void SetBypassPermissionsHandler(bool value);
@ -88,6 +90,8 @@ namespace OpenSim.Region.Framework.Scenes
public class ScenePermissions public class ScenePermissions
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_scene; private Scene m_scene;
public ScenePermissions(Scene scene) public ScenePermissions(Scene scene)
@ -242,6 +246,8 @@ namespace OpenSim.Region.Framework.Scenes
#region DELETE OBJECT #region DELETE OBJECT
public bool CanDeleteObject(UUID objectID, UUID deleter) public bool CanDeleteObject(UUID objectID, UUID deleter)
{ {
bool result = true;
DeleteObjectHandler handler = OnDeleteObject; DeleteObjectHandler handler = OnDeleteObject;
if (handler != null) if (handler != null)
{ {
@ -249,10 +255,18 @@ namespace OpenSim.Region.Framework.Scenes
foreach (DeleteObjectHandler h in list) foreach (DeleteObjectHandler h in list)
{ {
if (h(objectID, deleter, m_scene) == false) 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 #endregion
@ -260,6 +274,8 @@ namespace OpenSim.Region.Framework.Scenes
#region TAKE OBJECT #region TAKE OBJECT
public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID) public bool CanTakeObject(UUID objectID, UUID AvatarTakingUUID)
{ {
bool result = true;
TakeObjectHandler handler = OnTakeObject; TakeObjectHandler handler = OnTakeObject;
if (handler != null) if (handler != null)
{ {
@ -267,10 +283,18 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TakeObjectHandler h in list) foreach (TakeObjectHandler h in list)
{ {
if (h(objectID, AvatarTakingUUID, m_scene) == false) 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 #endregion
@ -278,6 +302,8 @@ namespace OpenSim.Region.Framework.Scenes
#region TAKE COPY OBJECT #region TAKE COPY OBJECT
public bool CanTakeCopyObject(UUID objectID, UUID userID) public bool CanTakeCopyObject(UUID objectID, UUID userID)
{ {
bool result = true;
TakeCopyObjectHandler handler = OnTakeCopyObject; TakeCopyObjectHandler handler = OnTakeCopyObject;
if (handler != null) if (handler != null)
{ {
@ -285,10 +311,18 @@ namespace OpenSim.Region.Framework.Scenes
foreach (TakeCopyObjectHandler h in list) foreach (TakeCopyObjectHandler h in list)
{ {
if (h(objectID, userID, m_scene) == false) 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 #endregion
@ -383,6 +417,8 @@ namespace OpenSim.Region.Framework.Scenes
#region RETURN OBJECT #region RETURN OBJECT
public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects)
{ {
bool result = true;
ReturnObjectsHandler handler = OnReturnObjects; ReturnObjectsHandler handler = OnReturnObjects;
if (handler != null) if (handler != null)
{ {
@ -390,10 +426,18 @@ namespace OpenSim.Region.Framework.Scenes
foreach (ReturnObjectsHandler h in list) foreach (ReturnObjectsHandler h in list)
{ {
if (h(land, user, objects, m_scene) == false) 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 #endregion

View File

@ -2607,6 +2607,7 @@ namespace OpenSim.Region.Framework.Scenes
//if (part.UUID != m_rootPart.UUID) //if (part.UUID != m_rootPart.UUID)
HasGroupChanged = true; HasGroupChanged = true;
part.TriggerScriptChangedEvent(Changed.SCALE);
ScheduleGroupForFullUpdate(); ScheduleGroupForFullUpdate();
//if (part.UUID == m_rootPart.UUID) //if (part.UUID == m_rootPart.UUID)
@ -2758,6 +2759,7 @@ namespace OpenSim.Region.Framework.Scenes
part.IgnoreUndoUpdate = false; part.IgnoreUndoUpdate = false;
part.StoreUndoState(); part.StoreUndoState();
HasGroupChanged = true; HasGroupChanged = true;
m_rootPart.TriggerScriptChangedEvent(Changed.SCALE);
ScheduleGroupForTerseUpdate(); ScheduleGroupForTerseUpdate();
} }
} }

View File

@ -1002,21 +1002,7 @@ namespace OpenSim.Region.Framework.Scenes
public PrimitiveBaseShape Shape public PrimitiveBaseShape Shape
{ {
get { return m_shape; } get { return m_shape; }
set set { m_shape = value; }
{
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);
}
} }
public Vector3 Scale public Vector3 Scale
@ -4570,6 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes
ParentGroup.RootPart.Rezzed = DateTime.UtcNow; ParentGroup.RootPart.Rezzed = DateTime.UtcNow;
ParentGroup.HasGroupChanged = true; ParentGroup.HasGroupChanged = true;
TriggerScriptChangedEvent(Changed.SHAPE);
ScheduleFullUpdate(); ScheduleFullUpdate();
} }

View File

@ -0,0 +1,129 @@
/*
* 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.Collections.Generic;
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
{
/// <summary>
/// Tests manipulation of scene objects by users.
/// </summary>
///
/// 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
{
/// <summary>
/// Test deleting an object from a scene.
/// </summary>
[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);
List<uint> localIds = new List<uint>();
localIds.Add(part.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null);
}
/// <summary>
/// Test deleting an object from a scene where the deleter is not the owner
/// </summary>
///
/// 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);
List<uint> localIds = new List<uint>();
localIds.Add(part.LocalId);
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
}
}
}

View File

@ -65,6 +65,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
TestHelper.InMethod();
scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000);

View File

@ -58,7 +58,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "FreeSwitchVoiceModule")] [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); 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<string, string> m_UUIDName = new Dictionary<string, string>(); private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
private Scene m_Scene;
private IConfig m_Config; private IConfig m_Config;
private IFreeswitchService m_FreeswitchService; 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), MainServer.Instance.AddHTTPHandler(String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix),
FreeSwitchSLVoiceGetPreloginHTTPHandler); FreeSwitchSLVoiceGetPreloginHTTPHandler);
MainServer.Instance.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
// RestStreamHandler h = new // RestStreamHandler h = new
// RestStreamHandler("GET", // RestStreamHandler("GET",
// String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler); // String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix), FreeSwitchSLVoiceGetPreloginHTTPHandler);
@ -214,15 +214,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
} }
} }
public void PostInitialise()
{
}
public void AddRegion(Scene scene) public void AddRegion(Scene scene)
{ {
m_Scene = scene;
// We generate these like this: The region's external host name // 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 // 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 // dotted quad (or should be!) and it can reach this host from
// a client. The port is grabbed from the region's HTTP server. // 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; m_freeSwitchServicePort = MainServer.Instance.Port;
if (m_Enabled) if (m_Enabled)
@ -601,7 +603,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
response["str_response_string"] = string.Empty; response["str_response_string"] = string.Empty;
response["content-type"] = "text/xml"; response["content-type"] = "text/xml";
Hashtable requestBody = parseRequestBody((string)request["body"]); Hashtable requestBody = ParseRequestBody((string)request["body"]);
if (!requestBody.ContainsKey("auth_token")) if (!requestBody.ContainsKey("auth_token"))
return response; return response;
@ -673,7 +675,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
string uri = (string)request["uri"]; string uri = (string)request["uri"];
string contenttype = (string)request["content-type"]; string contenttype = (string)request["content-type"];
Hashtable requestBody = parseRequestBody((string)request["body"]); Hashtable requestBody = ParseRequestBody((string)request["body"]);
//string pwd = (string) requestBody["pwd"]; //string pwd = (string) requestBody["pwd"];
string userid = (string) requestBody["userid"]; string userid = (string) requestBody["userid"];
@ -717,7 +719,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
return response; return response;
} }
public Hashtable parseRequestBody(string body) public Hashtable ParseRequestBody(string body)
{ {
Hashtable bodyParams = new Hashtable(); Hashtable bodyParams = new Hashtable();
// split string // split string
@ -790,6 +792,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
{ {
return true; 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 public class MonoCert : ICertificatePolicy

View File

@ -392,13 +392,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
// m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script"); // m_log.Debug("[Script] Posted changed(CHANGED_REGION_RESTART) to script");
PostEvent(new EventParams("changed", 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) else if (m_stateSource == StateSource.PrimCrossing)
{ {
// CHANGED_REGION // CHANGED_REGION
PostEvent(new EventParams("changed", 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 else

View File

@ -600,8 +600,10 @@ namespace OpenSim.Server.Handlers.Asset
ret["AssetType"] = item.AssetType.ToString(); ret["AssetType"] = item.AssetType.ToString();
ret["BasePermissions"] = item.BasePermissions.ToString(); ret["BasePermissions"] = item.BasePermissions.ToString();
ret["CreationDate"] = item.CreationDate.ToString(); ret["CreationDate"] = item.CreationDate.ToString();
ret["CreatorId"] = item.CreatorId.ToString(); if (item.CreatorId != null)
ret["CreatorData"] = item.CreatorData.ToString(); ret["CreatorId"] = item.CreatorId.ToString();
else
ret["CreatorId"] = String.Empty;
ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
ret["Description"] = item.Description.ToString(); ret["Description"] = item.Description.ToString();
ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();

View File

@ -302,6 +302,8 @@ namespace OpenSim.Services.Connectors
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
if (item.CreatorData == null)
item.CreatorData = String.Empty;
Dictionary<string,object> ret = MakeRequest("ADDITEM", Dictionary<string,object> ret = MakeRequest("ADDITEM",
new Dictionary<string,object> { new Dictionary<string,object> {
{ "AssetID", item.AssetID.ToString() }, { "AssetID", item.AssetID.ToString() },
@ -335,6 +337,8 @@ namespace OpenSim.Services.Connectors
public bool UpdateItem(InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)
{ {
if (item.CreatorData == null)
item.CreatorData = String.Empty;
Dictionary<string,object> ret = MakeRequest("UPDATEITEM", Dictionary<string,object> ret = MakeRequest("UPDATEITEM",
new Dictionary<string,object> { new Dictionary<string,object> {
{ "AssetID", item.AssetID.ToString() }, { "AssetID", item.AssetID.ToString() },
@ -558,7 +562,10 @@ namespace OpenSim.Services.Connectors
item.InvType = int.Parse(data["InvType"].ToString()); item.InvType = int.Parse(data["InvType"].ToString());
item.Folder = new UUID(data["Folder"].ToString()); item.Folder = new UUID(data["Folder"].ToString());
item.CreatorId = data["CreatorId"].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.Description = data["Description"].ToString();
item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());