diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 88cb49e89b..e0a97a8b5e 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -20,7 +20,7 @@ * 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 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORTOn * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ @@ -33,7 +33,6 @@ using OpenMetaverse.Packets; namespace OpenSim.Framework { - #region Client API Delegate definitions public delegate void ViewerEffectEventHandler(IClientAPI sender, List args); @@ -98,7 +97,7 @@ namespace OpenSim.Framework public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); public delegate void DeRezObject( - IClientAPI remoteClient, uint localID, UUID groupID, byte destination, UUID destinationID); + IClientAPI remoteClient, uint localID, UUID groupID, DeRezAction action, UUID destinationID); public delegate void GenericCall5(IClientAPI remoteClient, bool status); diff --git a/OpenSim/Framework/IScene.cs b/OpenSim/Framework/IScene.cs index b6bd45a12c..a852eaf9af 100644 --- a/OpenSim/Framework/IScene.cs +++ b/OpenSim/Framework/IScene.cs @@ -40,7 +40,19 @@ namespace OpenSim.Framework Crashed = 2, Starting = 3, SlaveScene = 4 - } ; + }; + + /// + /// Indicate what action to take on an object derez request + /// + public enum DeRezAction : byte + { + TakeCopy = 1, + Take = 4, + GodTakeCopy = 5, + Delete = 6, + Return = 9 + }; public interface IScene { diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 94040ca475..7d31c77150 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -4162,9 +4162,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP foreach (DeRezObjectPacket.ObjectDataBlock data in DeRezPacket.ObjectData) { + // It just so happens that the values on the DeRezAction enumerator match the Destination + // values given by a Second Life client handlerDeRezObject(this, data.ObjectLocalID, DeRezPacket.AgentBlock.GroupID, - DeRezPacket.AgentBlock.Destination, + (DeRezAction)DeRezPacket.AgentBlock.Destination, DeRezPacket.AgentBlock.DestinationID); } } diff --git a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs index 20cf3183f2..03b3977b75 100644 --- a/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs +++ b/OpenSim/Region/Environment/Scenes/AsyncSceneObjectGroupDeleter.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Environment.Scenes { class DeleteToInventoryHolder { - public int destination; + public DeRezAction action; public IClientAPI remoteClient; public SceneObjectGroup objectGroup; public UUID folderID; @@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// Delete the given object from the scene /// - public void DeleteToInventory(int destination, UUID folderID, + public void DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient, bool permissionToDelete) { @@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Scenes lock (m_inventoryDeletes) { DeleteToInventoryHolder dtis = new DeleteToInventoryHolder(); - dtis.destination = destination; + dtis.action = action; dtis.folderID = folderID; dtis.objectGroup = objectGroup; dtis.remoteClient = remoteClient; @@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes try { - m_scene.DeleteToInventory(x.destination, x.folderID, x.objectGroup, x.remoteClient); + m_scene.DeleteToInventory(x.action, x.folderID, x.objectGroup, x.remoteClient); if (x.permissionToDelete) m_scene.DeleteSceneObject(x.objectGroup, false); } @@ -149,7 +149,7 @@ namespace OpenSim.Region.Environment.Scenes } } } - catch(Exception e) + catch (Exception e) { // We can't put the object group details in here since the root part may have disappeared (which is where these sit). // FIXME: This needs to be fixed. diff --git a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs index 92627d1d47..f44ba301aa 100644 --- a/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Hypergrid/HGScene.Inventory.cs @@ -102,9 +102,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid /// /// DeleteToInventory /// - public override UUID DeleteToInventory(int destination, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) + public override UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { - UUID assetID = base.DeleteToInventory(destination, folderID, objectGroup, remoteClient); + UUID assetID = base.DeleteToInventory(action, folderID, objectGroup, remoteClient); if (!assetID.Equals(UUID.Zero)) { diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 77ac1218e9..113b16c653 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.Environment.Scenes public partial class Scene { private static readonly ILog m_log - = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// /// Allows asynchronous derezzing of objects from the scene into a client's inventory. @@ -1543,10 +1543,13 @@ namespace OpenSim.Region.Environment.Scenes /// /// Called when an object is removed from the environment into inventory. /// - /// /// + /// + /// + /// + /// public virtual void DeRezObject(IClientAPI remoteClient, uint localID, - UUID groupID, byte destination, UUID destinationID) + UUID groupID, DeRezAction action, UUID destinationID) { SceneObjectPart part = GetSceneObjectPart(localID); if (part == null) @@ -1564,20 +1567,20 @@ namespace OpenSim.Region.Environment.Scenes bool permissionToTake = false; bool permissionToDelete = false; - if (destination == 1) // Take Copy + if (action == DeRezAction.TakeCopy) { permissionToTake = Permissions.CanTakeCopyObject( grp.UUID, remoteClient.AgentId); } - else if (destination == 5) // God take copy + else if (action == DeRezAction.GodTakeCopy) { permissionToTake = Permissions.IsGod( remoteClient.AgentId); } - else if (destination == 4) // Take + else if (action == DeRezAction.Take) { permissionToTake = Permissions.CanTakeObject( @@ -1587,7 +1590,7 @@ namespace OpenSim.Region.Environment.Scenes //If they can take, they can delete! permissionToDelete = permissionToTake; } - else if (destination == 6) //Delete + else if (action == DeRezAction.Delete) { permissionToTake = Permissions.CanDeleteObject( @@ -1598,7 +1601,7 @@ namespace OpenSim.Region.Environment.Scenes grp.UUID, remoteClient.AgentId); } - else if (destination == 9) //Return + else if (action == DeRezAction.Return) { if (remoteClient != null) { @@ -1625,7 +1628,7 @@ namespace OpenSim.Region.Environment.Scenes if (permissionToTake) { m_asyncSceneObjectDeleter.DeleteToInventory( - destination, destinationID, grp, remoteClient, + action, destinationID, grp, remoteClient, permissionToDelete); } else if (permissionToDelete) @@ -1638,13 +1641,11 @@ namespace OpenSim.Region.Environment.Scenes /// Delete a scene object from a scene and place in the given avatar's inventory. /// Returns the UUID of the newly created asset. /// - /// - /// - /// - /// + /// /// - /// - public virtual UUID DeleteToInventory(int destination, UUID folderID, + /// + /// + public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, SceneObjectGroup objectGroup, IClientAPI remoteClient) { UUID assetID = UUID.Zero; @@ -1671,7 +1672,7 @@ namespace OpenSim.Region.Environment.Scenes // If we're returning someone's item, it goes back to the // owner's Lost And Found folder. - if (folderID == UUID.Zero || (destination == 6 && + if (folderID == UUID.Zero || (action == DeRezAction.Delete && objectGroup.OwnerID != remoteClient.AgentId)) { InventoryFolderBase folder = @@ -1708,8 +1709,7 @@ namespace OpenSim.Region.Environment.Scenes InventoryItemBase item = new InventoryItemBase(); item.Creator = objectGroup.RootPart.CreatorID; - if (destination == 1 || - destination == 4)// Take / Copy + if (action == DeRezAction.TakeCopy || action == DeRezAction.Take) item.Owner = remoteClient.AgentId; else // Delete / Return item.Owner = objectGroup.OwnerID; @@ -2215,7 +2215,7 @@ namespace OpenSim.Region.Environment.Scenes { AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); DeRezObject(null, grp.RootPart.LocalId, - grp.RootPart.GroupID, 9, UUID.Zero); + grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); } return true; } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 7bdcb5c637..8a6f06c0d6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1223,10 +1223,10 @@ namespace OpenSim.Region.Environment.Scenes parcel.landData.OtherCleanTime) { DetachFromBackup(); - m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); + m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); m_scene.DeRezObject(null, RootPart.LocalId, - RootPart.GroupID, 9, UUID.Zero); + RootPart.GroupID, DeRezAction.Return, UUID.Zero); return; } diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index 73916963cc..babdee6c6d 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests Is.EqualTo(agentId)); IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); - scene.DeRezObject(client, part.LocalId, UUID.Zero, 9, UUID.Zero); + scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Return, UUID.Zero); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart, Is.Not.Null);