From 0091c37ed3fd3f9ed4edf079a61f986daadca16b Mon Sep 17 00:00:00 2001
From: UbitUmarov
Date: Fri, 27 Jan 2017 20:21:24 +0000
Subject: several changes relative to objects return and parcel prim counts:
avoid null refs, report correct count of returned objects, make obkects
counts by ownership coerent with return rules, etc
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 21 +++++++++++++--------
.../Region/Framework/Scenes/Scene.PacketHandlers.cs | 5 ++++-
.../Region/Framework/Scenes/Scene.Permissions.cs | 13 ++++++++++---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++--
5 files changed, 31 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index dbc7def..2f016fa 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2085,7 +2085,7 @@ namespace OpenSim.Region.Framework.Scenes
/// DeRezAction
/// User folder ID to place derezzed object
public virtual void DeRezObjects(
- IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID)
+ IClientAPI remoteClient, List localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true)
{
// First, see of we can perform the requested action and
// build a list of eligible objects
@@ -2094,7 +2094,11 @@ namespace OpenSim.Region.Framework.Scenes
List takeGroups = new List();
List takeDeleteGroups = new List();
- ScenePresence sp = remoteClient.SceneAgent as ScenePresence;
+ ScenePresence sp = null;
+ if(remoteClient != null)
+ sp = remoteClient.SceneAgent as ScenePresence;
+ else if(action != DeRezAction.Return)
+ return; // only Return can be called without a client
// Start with true for both, then remove the flags if objects
// that we can't derez are part of the selection
@@ -2201,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes
{
if (Permissions.CanReturnObjects(
null,
- remoteClient.AgentId,
+ remoteClient,
new List() {grp}))
{
permissionToTake = true;
permissionToDelete = true;
-
- AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
+ if(AddToReturns)
+ AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition,
+ "parcel owner return");
}
}
else // Auto return passes through here with null agent
@@ -2641,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes
}
public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
- UUID AgentId)
+ IClientAPI client)
{
List localIDs = new List();
@@ -2651,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes
"parcel owner return");
localIDs.Add(grp.RootPart.LocalId);
}
- DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
- UUID.Zero);
+ DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return,
+ UUID.Zero, false);
return true;
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 940f80c..4fef9c3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -185,8 +185,10 @@ namespace OpenSim.Region.Framework.Scenes
// A prim is only tainted if it's allowed to be edited by the person clicking it.
if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
{
+ bool oldsel = part.IsSelected;
part.IsSelected = true;
- EventManager.TriggerParcelPrimCountTainted();
+ if(!oldsel)
+ EventManager.TriggerParcelPrimCountTainted();
}
part.SendPropertiesToClient(remoteClient);
@@ -228,6 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
if (so.OwnerID == remoteClient.AgentId)
{
so.SetGroup(groupID, remoteClient);
+ EventManager.TriggerParcelPrimCountTainted();
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 45d710a..6d3b82f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -54,7 +54,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
- public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List objects);
+ public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List objects);
public delegate bool InstantMessageHandler(UUID user, UUID target);
public delegate bool InventoryTransferHandler(UUID user, UUID target);
public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
@@ -556,17 +556,24 @@ namespace OpenSim.Region.Framework.Scenes
#endregion
#region RETURN OBJECT
- public bool CanReturnObjects(ILandObject land, UUID user, List objects)
+ public bool CanReturnObjects(ILandObject land, IClientAPI client, List objects)
{
bool result = true;
ReturnObjectsHandler handler = OnReturnObjects;
if (handler != null)
{
+ if(objects == null)
+ return false;
+
+ ScenePresence sp = null;
+ if(client != null && client.SceneAgent != null)
+ sp = client.SceneAgent as ScenePresence;
+
Delegate[] list = handler.GetInvocationList();
foreach (ReturnObjectsHandler h in list)
{
- if (h(land, user, objects) == false)
+ if (h(land, sp, objects) == false)
{
result = false;
break;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4fca4ed..5f99b73 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2604,8 +2604,8 @@ namespace OpenSim.Region.Framework.Scenes
{
// Otherwise, use this default creation code;
sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
- AddNewSceneObject(sceneObject, true);
sceneObject.SetGroup(groupID, null);
+ AddNewSceneObject(sceneObject, true);
if (AgentPreferencesService != null) // This will override the brave new full perm world!
{
@@ -2784,7 +2784,7 @@ namespace OpenSim.Region.Framework.Scenes
}
if (toReturn.Count > 0)
{
- returnObjects(toReturn.ToArray(), UUID.Zero);
+ returnObjects(toReturn.ToArray(), null);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index dff242e..45196bb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -645,7 +645,7 @@ namespace OpenSim.Region.Framework.Scenes
localIDs.Add(sog.RootPart.LocalId);
sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
"Returned at region cross");
- sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero);
+ sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
}
catch (Exception)
{
@@ -2254,7 +2254,7 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.UUID);
m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
m_scene.DeRezObjects(null, new List() { RootPart.LocalId }, UUID.Zero,
- DeRezAction.Return, UUID.Zero);
+ DeRezAction.Return, UUID.Zero, false);
return;
}
--
cgit v1.1