diff options
author | Diva Canto | 2014-12-25 12:17:07 -0800 |
---|---|---|
committer | Diva Canto | 2014-12-25 12:17:07 -0800 |
commit | bb82076a4d2afd914d325f17443bb409d75bfe0e (patch) | |
tree | 88d90748a922ece49f17838ccf7c10a06f4cf2b1 | |
parent | Updated libomv to grab the latest bug fixes in Collada upload (diff) | |
download | opensim-SC-bb82076a4d2afd914d325f17443bb409d75bfe0e.zip opensim-SC-bb82076a4d2afd914d325f17443bb409d75bfe0e.tar.gz opensim-SC-bb82076a4d2afd914d325f17443bb409d75bfe0e.tar.bz2 opensim-SC-bb82076a4d2afd914d325f17443bb409d75bfe0e.tar.xz |
Allow for richer semantics of object derez. Specifically, allow the existence of region modules that do other kinds of garbage collection. Instead of placing deleted objects in the user's Trash folder, or deleting them immediately (UseTrashOnDelete = false), a module may decide to take garbage collection under its control. For example, it may place derezzed objects in a certain area inworld and delete them later.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 7 |
2 files changed, 54 insertions, 13 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index ba79964..d325240 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -786,8 +786,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
786 | /// <see cref="Scene.doObjectDuplicateOnRay"/> | 786 | /// <see cref="Scene.doObjectDuplicateOnRay"/> |
787 | /// </remarks> | 787 | /// </remarks> |
788 | public event Action<SceneObjectGroup> OnObjectAddedToScene; | 788 | public event Action<SceneObjectGroup> OnObjectAddedToScene; |
789 | |||
790 | /// <summary> | ||
791 | /// When a client sends a derez request for an object inworld | ||
792 | /// but before the object is deleted | ||
793 | /// </summary> | ||
794 | public event DeRezRequested OnDeRezRequested; | ||
795 | /// <summary> | ||
796 | /// Triggered when a client sends a derez request for an object inworld | ||
797 | /// </summary> | ||
798 | /// <param name="remoteClient">The client question (it can be null)</param> | ||
799 | /// <param name="obj">The object in question</param> | ||
800 | /// <param name="action">The exact derez action</param> | ||
801 | /// <returns>Flag indicating whether the object should be deleted from the scene or not</returns> | ||
802 | public delegate bool DeRezRequested(IClientAPI remoteClient, List<SceneObjectGroup> objs, DeRezAction action); | ||
789 | 803 | ||
790 | /// <summary> | 804 | /// <summary> |
805 | /// Triggered when an object is removed from the scene. | ||
806 | /// </summary> | ||
807 | /// <remarks> | ||
808 | /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/> | ||
809 | /// in <see cref="Scene.DeleteSceneObject"/> | ||
810 | /// </remarks> | ||
811 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | ||
812 | /// <summary> | ||
791 | /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> | 813 | /// Delegate for <see cref="OnObjectBeingRemovedFromScene"/> |
792 | /// </summary> | 814 | /// </summary> |
793 | /// <param name="obj">The object being removed from the scene</param> | 815 | /// <param name="obj">The object being removed from the scene</param> |
@@ -806,15 +828,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
806 | /// </remarks> | 828 | /// </remarks> |
807 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | 829 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; |
808 | 830 | ||
809 | /// <summary> | ||
810 | /// Triggered when an object is removed from the scene. | ||
811 | /// </summary> | ||
812 | /// <remarks> | ||
813 | /// Triggered by <see cref="TriggerObjectBeingRemovedFromScene"/> | ||
814 | /// in <see cref="Scene.DeleteSceneObject"/> | ||
815 | /// </remarks> | ||
816 | public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene; | ||
817 | |||
818 | public delegate void NoticeNoLandDataFromStorage(); | 831 | public delegate void NoticeNoLandDataFromStorage(); |
819 | public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage; | 832 | public event NoticeNoLandDataFromStorage OnNoticeNoLandDataFromStorage; |
820 | 833 | ||
@@ -1521,8 +1534,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1521 | } | 1534 | } |
1522 | } | 1535 | } |
1523 | } | 1536 | } |
1524 | } | 1537 | } |
1525 | 1538 | ||
1539 | public bool TriggerDeRezRequested(IClientAPI client, List<SceneObjectGroup> objs, DeRezAction action) | ||
1540 | { | ||
1541 | bool canDeRez = true; | ||
1542 | |||
1543 | DeRezRequested handlerDeRezRequested = OnDeRezRequested; | ||
1544 | if (handlerDeRezRequested != null) | ||
1545 | { | ||
1546 | foreach (DeRezRequested d in handlerDeRezRequested.GetInvocationList()) | ||
1547 | { | ||
1548 | try | ||
1549 | { | ||
1550 | canDeRez &= d(client, objs, action); | ||
1551 | } | ||
1552 | catch (Exception e) | ||
1553 | { | ||
1554 | m_log.ErrorFormat( | ||
1555 | "[EVENT MANAGER]: Delegate for TriggerDeRezRequested failed - continuing. {0} {1}", | ||
1556 | e.Message, e.StackTrace); | ||
1557 | } | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1561 | return canDeRez; | ||
1562 | } | ||
1563 | |||
1526 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 1564 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) |
1527 | { | 1565 | { |
1528 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | 1566 | ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 5cc5606..b14e2f7 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2182,13 +2182,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2182 | } | 2182 | } |
2183 | } | 2183 | } |
2184 | 2184 | ||
2185 | // OK, we're done with permissions. Let's check if any part of the code prevents the objects from being deleted | ||
2186 | bool canDelete = EventManager.TriggerDeRezRequested(remoteClient, deleteGroups, action); | ||
2187 | |||
2185 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) | 2188 | if (permissionToTake && (action != DeRezAction.Delete || this.m_useTrashOnDelete)) |
2186 | { | 2189 | { |
2187 | m_asyncSceneObjectDeleter.DeleteToInventory( | 2190 | m_asyncSceneObjectDeleter.DeleteToInventory( |
2188 | action, destinationID, deleteGroups, remoteClient, | 2191 | action, destinationID, deleteGroups, remoteClient, |
2189 | permissionToDelete); | 2192 | permissionToDelete && canDelete); |
2190 | } | 2193 | } |
2191 | else if (permissionToDelete) | 2194 | else if (permissionToDelete && canDelete) |
2192 | { | 2195 | { |
2193 | foreach (SceneObjectGroup g in deleteGroups) | 2196 | foreach (SceneObjectGroup g in deleteGroups) |
2194 | DeleteSceneObject(g, false); | 2197 | DeleteSceneObject(g, false); |