aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-01-27 20:21:24 +0000
committerUbitUmarov2017-01-27 20:21:24 +0000
commit0091c37ed3fd3f9ed4edf079a61f986daadca16b (patch)
tree6e5ca5cb7fa6ae6325d5222b37f39a794a48d345 /OpenSim
parentparcels must be loaded before objects, so they can be added to them (diff)
downloadopensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.zip
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.gz
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.bz2
opensim-SC_OLD-0091c37ed3fd3f9ed4edf079a61f986daadca16b.tar.xz
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
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs15
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs13
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs2
12 files changed, 75 insertions, 69 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index eedba9d..ab6d58f 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Framework
107 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient); 107 public delegate void GenericCall4(Packet packet, IClientAPI remoteClient);
108 108
109 public delegate void DeRezObject( 109 public delegate void DeRezObject(
110 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID); 110 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true);
111 111
112 public delegate void GenericCall5(IClientAPI remoteClient, bool status); 112 public delegate void GenericCall5(IClientAPI remoteClient, bool status);
113 113
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 66be5e5..dfa7095 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -149,9 +149,11 @@ namespace OpenSim.Region.CoreModules.World.Land
149 parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache 149 parcelInfoCache.Size = 30; // the number of different parcel requests in this region to cache
150 parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0); 150 parcelInfoCache.DefaultTTL = new TimeSpan(0, 5, 0);
151 151
152 m_scene.EventManager.OnObjectAddedToScene += EventManagerOnParcelPrimCountAdd;
152 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; 153 m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
153 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; 154
154 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; 155 m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
156 m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
155 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; 157 m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
156 158
157 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; 159 m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
@@ -815,6 +817,9 @@ namespace OpenSim.Region.CoreModules.World.Land
815 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 817 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
816 } 818 }
817 819
820 if(m_landList.Count == 0 || m_landIDList == null)
821 return null;
822
818 lock (m_landIDList) 823 lock (m_landIDList)
819 { 824 {
820 try 825 try
@@ -826,8 +831,6 @@ namespace OpenSim.Region.CoreModules.World.Land
826 return null; 831 return null;
827 } 832 }
828 } 833 }
829
830 return m_landList[m_landIDList[x / 4, y / 4]];
831 } 834 }
832 835
833 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID 836 // Create a 'parcel is here' bitmap for the parcel identified by the passed landID
@@ -1642,9 +1645,9 @@ namespace OpenSim.Region.CoreModules.World.Land
1642 foreach (HashSet<SceneObjectGroup> objs in returns.Values) 1645 foreach (HashSet<SceneObjectGroup> objs in returns.Values)
1643 { 1646 {
1644 List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs); 1647 List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
1645 if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2)) 1648 if (m_scene.Permissions.CanReturnObjects(null, remoteClient, objs2))
1646 { 1649 {
1647 m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId); 1650 m_scene.returnObjects(objs2.ToArray(), remoteClient);
1648 } 1651 }
1649 else 1652 else
1650 { 1653 {
@@ -2037,7 +2040,7 @@ namespace OpenSim.Region.CoreModules.World.Land
2037 { 2040 {
2038 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 2041 SceneObjectGroup[] objs = new SceneObjectGroup[1];
2039 objs[0] = obj; 2042 objs[0] = obj;
2040 ((Scene)client.Scene).returnObjects(objs, client.AgentId); 2043 ((Scene)client.Scene).returnObjects(objs, client);
2041 } 2044 }
2042 2045
2043 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); 2046 Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>();
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 8c0edc8..9d84e66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1664,7 +1664,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1664 { 1664 {
1665 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 1665 SceneObjectGroup[] objs = new SceneObjectGroup[1];
1666 objs[0] = obj; 1666 objs[0] = obj;
1667 m_scene.returnObjects(objs, obj.OwnerID); 1667 m_scene.returnObjects(objs, null);
1668 } 1668 }
1669 1669
1670 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 1670 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
@@ -1695,6 +1695,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1695 { 1695 {
1696 if (obj.GroupID == LandData.GroupID) 1696 if (obj.GroupID == LandData.GroupID)
1697 { 1697 {
1698 if (obj.OwnerID == LandData.OwnerID)
1699 continue;
1698 if (!returns.ContainsKey(obj.OwnerID)) 1700 if (!returns.ContainsKey(obj.OwnerID))
1699 returns[obj.OwnerID] = 1701 returns[obj.OwnerID] =
1700 new List<SceneObjectGroup>(); 1702 new List<SceneObjectGroup>();
@@ -1736,8 +1738,8 @@ namespace OpenSim.Region.CoreModules.World.Land
1736 1738
1737 foreach (List<SceneObjectGroup> ol in returns.Values) 1739 foreach (List<SceneObjectGroup> ol in returns.Values)
1738 { 1740 {
1739 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) 1741 if (m_scene.Permissions.CanReturnObjects(this, remote_client, ol))
1740 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); 1742 m_scene.returnObjects(ol.ToArray(), remote_client);
1741 } 1743 }
1742 } 1744 }
1743 1745
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 857f919..2a720db 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -92,10 +92,8 @@ namespace OpenSim.Region.CoreModules.World.Land
92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this); 92 m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
93 93
94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; 94 m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
95 m_Scene.EventManager.OnObjectBeingRemovedFromScene += 95 m_Scene.EventManager.OnObjectBeingRemovedFromScene += OnObjectBeingRemovedFromScene;
96 OnObjectBeingRemovedFromScene; 96 m_Scene.EventManager.OnParcelPrimCountTainted += OnParcelPrimCountTainted;
97 m_Scene.EventManager.OnParcelPrimCountTainted +=
98 OnParcelPrimCountTainted;
99 m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; 97 m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
100 } 98 }
101 99
@@ -215,29 +213,15 @@ namespace OpenSim.Region.CoreModules.World.Land
215 else 213 else
216 parcelCounts.Users[obj.OwnerID] = partCount; 214 parcelCounts.Users[obj.OwnerID] = partCount;
217 215
218 if (obj.IsSelected) 216 if (obj.IsSelected || obj.GetSittingAvatarsCount() > 0)
219 {
220 parcelCounts.Selected += partCount; 217 parcelCounts.Selected += partCount;
221 } 218
219 if (obj.OwnerID == landData.OwnerID)
220 parcelCounts.Owner += partCount;
221 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
222 parcelCounts.Group += partCount;
222 else 223 else
223 { 224 parcelCounts.Others += partCount;
224 if (landData.IsGroupOwned)
225 {
226 if (obj.OwnerID == landData.GroupID)
227 parcelCounts.Owner += partCount;
228 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
229 parcelCounts.Group += partCount;
230 else
231 parcelCounts.Others += partCount;
232 }
233 else
234 {
235 if (obj.OwnerID == landData.OwnerID)
236 parcelCounts.Owner += partCount;
237 else
238 parcelCounts.Others += partCount;
239 }
240 }
241 } 225 }
242 } 226 }
243 227
@@ -393,7 +377,6 @@ namespace OpenSim.Region.CoreModules.World.Land
393 count = counts.Owner; 377 count = counts.Owner;
394 count += counts.Group; 378 count += counts.Group;
395 count += counts.Others; 379 count += counts.Others;
396 count += counts.Selected;
397 } 380 }
398 } 381 }
399 382
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index c00112b..279b966 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -282,9 +282,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
282 scenePermissions.OnTerraformLand += CanTerraformLand; 282 scenePermissions.OnTerraformLand += CanTerraformLand;
283 scenePermissions.OnBuyLand += CanBuyLand; 283 scenePermissions.OnBuyLand += CanBuyLand;
284 284
285 scenePermissions.OnReturnObjects += CanReturnObjects;
286
285 scenePermissions.OnRezObject += CanRezObject; 287 scenePermissions.OnRezObject += CanRezObject;
286 scenePermissions.OnObjectEntry += CanObjectEntry; 288 scenePermissions.OnObjectEntry += CanObjectEntry;
287 scenePermissions.OnReturnObjects += CanReturnObjects;
288 289
289 scenePermissions.OnDuplicateObject += CanDuplicateObject; 290 scenePermissions.OnDuplicateObject += CanDuplicateObject;
290 scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs; 291 scenePermissions.OnDeleteObjectByIDs += CanDeleteObjectByIDs;
@@ -1621,19 +1622,20 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1621 return false; 1622 return false;
1622 } 1623 }
1623 1624
1624 private bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) 1625 private bool CanReturnObjects(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects)
1625 { 1626 {
1626 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 1627 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1627 if (m_bypassPermissions) return m_bypassPermissionsValue; 1628 if (m_bypassPermissions) return m_bypassPermissionsValue;
1628 1629
1629 ScenePresence sp = m_scene.GetScenePresence(user); 1630 if(sp == null)
1630 if (sp == null) 1631 return true; // assuming that in this case rights are as owner
1631 return false;
1632 1632
1633 bool isPrivUser = sp.IsGod || IsEstateManager(user); 1633 UUID userID = sp.UUID;
1634 bool isPrivUser = sp.IsGod || IsEstateManager(userID);
1634 1635
1635 IClientAPI client = sp.ControllingClient; 1636 IClientAPI client = sp.ControllingClient;
1636 GroupPowers powers; 1637
1638 ulong powers = 0;
1637 ILandObject l; 1639 ILandObject l;
1638 1640
1639 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects)) 1641 foreach (SceneObjectGroup g in new List<SceneObjectGroup>(objects))
@@ -1644,7 +1646,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1644 continue; 1646 continue;
1645 } 1647 }
1646 1648
1647 if (isPrivUser || g.OwnerID == user) 1649 if (isPrivUser || g.OwnerID == userID)
1648 continue; 1650 continue;
1649 1651
1650 // This is a short cut for efficiency. If land is non-null, 1652 // This is a short cut for efficiency. If land is non-null,
@@ -1671,7 +1673,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1671 LandData ldata = l.LandData; 1673 LandData ldata = l.LandData;
1672 // If we own the land outright, then allow 1674 // If we own the land outright, then allow
1673 // 1675 //
1674 if (ldata.OwnerID == user) 1676 if (ldata.OwnerID == userID)
1675 continue; 1677 continue;
1676 1678
1677 // Group voodoo 1679 // Group voodoo
@@ -1679,19 +1681,19 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1679 if (ldata.IsGroupOwned) 1681 if (ldata.IsGroupOwned)
1680 { 1682 {
1681 UUID lGroupID = ldata.GroupID; 1683 UUID lGroupID = ldata.GroupID;
1682 powers = (GroupPowers)client.GetGroupPowers(lGroupID);
1683 // Not a group member, or no rights at all 1684 // Not a group member, or no rights at all
1684 // 1685 //
1685 if (powers == (GroupPowers)0) 1686 powers = client.GetGroupPowers(lGroupID);
1687 if(powers == 0)
1686 { 1688 {
1687 objects.Remove(g); 1689 objects.Remove(g);
1688 continue; 1690 continue;
1689 } 1691 }
1690 1692
1691 // Group deeded object? 1693 // Group deeded object?
1692 // 1694 //
1693 if (g.OwnerID == lGroupID && 1695 if (g.OwnerID == lGroupID &&
1694 (powers & GroupPowers.ReturnGroupOwned) == (GroupPowers)0) 1696 (powers & (ulong)GroupPowers.ReturnGroupOwned) == 0)
1695 { 1697 {
1696 objects.Remove(g); 1698 objects.Remove(g);
1697 continue; 1699 continue;
@@ -1700,13 +1702,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1700 // Group set object? 1702 // Group set object?
1701 // 1703 //
1702 if (g.GroupID == lGroupID && 1704 if (g.GroupID == lGroupID &&
1703 (powers & GroupPowers.ReturnGroupSet) == (GroupPowers)0) 1705 (powers & (ulong)GroupPowers.ReturnGroupSet) == 0)
1704 { 1706 {
1705 objects.Remove(g); 1707 objects.Remove(g);
1706 continue; 1708 continue;
1707 } 1709 }
1708 1710
1709 if ((powers & GroupPowers.ReturnNonGroup) == (GroupPowers)0) 1711 if ((powers & (ulong)GroupPowers.ReturnNonGroup) == 0)
1710 { 1712 {
1711 objects.Remove(g); 1713 objects.Remove(g);
1712 continue; 1714 continue;
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index 04b6f00..167f6b5 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -105,8 +105,9 @@ namespace OpenSim.Region.CoreModules.World.Vegetation
105 if (rootPart.Shape.PCode != (byte)PCode.Grass) 105 if (rootPart.Shape.PCode != (byte)PCode.Grass)
106 AdaptTree(ref shape); 106 AdaptTree(ref shape);
107 107
108 m_scene.AddNewSceneObject(sceneObject, true);
109 sceneObject.SetGroup(groupID, null); 108 sceneObject.SetGroup(groupID, null);
109 m_scene.AddNewSceneObject(sceneObject, true);
110 sceneObject.AggregatePerms();
110 111
111 return sceneObject; 112 return sceneObject;
112 } 113 }
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
2085 /// <param name='action'>DeRezAction</param> 2085 /// <param name='action'>DeRezAction</param>
2086 /// <param name='destinationID'>User folder ID to place derezzed object</param> 2086 /// <param name='destinationID'>User folder ID to place derezzed object</param>
2087 public virtual void DeRezObjects( 2087 public virtual void DeRezObjects(
2088 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID) 2088 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID, bool AddToReturns = true)
2089 { 2089 {
2090 // First, see of we can perform the requested action and 2090 // First, see of we can perform the requested action and
2091 // build a list of eligible objects 2091 // build a list of eligible objects
@@ -2094,7 +2094,11 @@ namespace OpenSim.Region.Framework.Scenes
2094 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>(); 2094 List<SceneObjectGroup> takeGroups = new List<SceneObjectGroup>();
2095 List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>(); 2095 List<SceneObjectGroup> takeDeleteGroups = new List<SceneObjectGroup>();
2096 2096
2097 ScenePresence sp = remoteClient.SceneAgent as ScenePresence; 2097 ScenePresence sp = null;
2098 if(remoteClient != null)
2099 sp = remoteClient.SceneAgent as ScenePresence;
2100 else if(action != DeRezAction.Return)
2101 return; // only Return can be called without a client
2098 2102
2099 // Start with true for both, then remove the flags if objects 2103 // Start with true for both, then remove the flags if objects
2100 // that we can't derez are part of the selection 2104 // that we can't derez are part of the selection
@@ -2201,13 +2205,14 @@ namespace OpenSim.Region.Framework.Scenes
2201 { 2205 {
2202 if (Permissions.CanReturnObjects( 2206 if (Permissions.CanReturnObjects(
2203 null, 2207 null,
2204 remoteClient.AgentId, 2208 remoteClient,
2205 new List<SceneObjectGroup>() {grp})) 2209 new List<SceneObjectGroup>() {grp}))
2206 { 2210 {
2207 permissionToTake = true; 2211 permissionToTake = true;
2208 permissionToDelete = true; 2212 permissionToDelete = true;
2209 2213 if(AddToReturns)
2210 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); 2214 AddReturn(grp.OwnerID == grp.GroupID ? grp.LastOwnerID : grp.OwnerID, grp.Name, grp.AbsolutePosition,
2215 "parcel owner return");
2211 } 2216 }
2212 } 2217 }
2213 else // Auto return passes through here with null agent 2218 else // Auto return passes through here with null agent
@@ -2641,7 +2646,7 @@ namespace OpenSim.Region.Framework.Scenes
2641 } 2646 }
2642 2647
2643 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, 2648 public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
2644 UUID AgentId) 2649 IClientAPI client)
2645 { 2650 {
2646 List<uint> localIDs = new List<uint>(); 2651 List<uint> localIDs = new List<uint>();
2647 2652
@@ -2651,8 +2656,8 @@ namespace OpenSim.Region.Framework.Scenes
2651 "parcel owner return"); 2656 "parcel owner return");
2652 localIDs.Add(grp.RootPart.LocalId); 2657 localIDs.Add(grp.RootPart.LocalId);
2653 } 2658 }
2654 DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, 2659 DeRezObjects(client, localIDs, UUID.Zero, DeRezAction.Return,
2655 UUID.Zero); 2660 UUID.Zero, false);
2656 2661
2657 return true; 2662 return true;
2658 } 2663 }
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
185 // A prim is only tainted if it's allowed to be edited by the person clicking it. 185 // A prim is only tainted if it's allowed to be edited by the person clicking it.
186 if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent)) 186 if (Permissions.CanChangeSelectedState(part, (ScenePresence)remoteClient.SceneAgent))
187 { 187 {
188 bool oldsel = part.IsSelected;
188 part.IsSelected = true; 189 part.IsSelected = true;
189 EventManager.TriggerParcelPrimCountTainted(); 190 if(!oldsel)
191 EventManager.TriggerParcelPrimCountTainted();
190 } 192 }
191 193
192 part.SendPropertiesToClient(remoteClient); 194 part.SendPropertiesToClient(remoteClient);
@@ -228,6 +230,7 @@ namespace OpenSim.Region.Framework.Scenes
228 if (so.OwnerID == remoteClient.AgentId) 230 if (so.OwnerID == remoteClient.AgentId)
229 { 231 {
230 so.SetGroup(groupID, remoteClient); 232 so.SetGroup(groupID, remoteClient);
233 EventManager.TriggerParcelPrimCountTainted();
231 } 234 }
232 } 235 }
233 } 236 }
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
54 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID); 54 public delegate bool EditObjectInventoryHandler(UUID objectID, UUID editorID);
55 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp); 55 public delegate bool MoveObjectHandler(SceneObjectGroup sog, ScenePresence sp);
56 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint); 56 public delegate bool ObjectEntryHandler(SceneObjectGroup sog, bool enteringRegion, Vector3 newPoint);
57 public delegate bool ReturnObjectsHandler(ILandObject land, UUID user, List<SceneObjectGroup> objects); 57 public delegate bool ReturnObjectsHandler(ILandObject land, ScenePresence sp, List<SceneObjectGroup> objects);
58 public delegate bool InstantMessageHandler(UUID user, UUID target); 58 public delegate bool InstantMessageHandler(UUID user, UUID target);
59 public delegate bool InventoryTransferHandler(UUID user, UUID target); 59 public delegate bool InventoryTransferHandler(UUID user, UUID target);
60 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user); 60 public delegate bool ViewScriptHandler(UUID script, UUID objectID, UUID user);
@@ -556,17 +556,24 @@ namespace OpenSim.Region.Framework.Scenes
556 #endregion 556 #endregion
557 557
558 #region RETURN OBJECT 558 #region RETURN OBJECT
559 public bool CanReturnObjects(ILandObject land, UUID user, List<SceneObjectGroup> objects) 559 public bool CanReturnObjects(ILandObject land, IClientAPI client, List<SceneObjectGroup> objects)
560 { 560 {
561 bool result = true; 561 bool result = true;
562 562
563 ReturnObjectsHandler handler = OnReturnObjects; 563 ReturnObjectsHandler handler = OnReturnObjects;
564 if (handler != null) 564 if (handler != null)
565 { 565 {
566 if(objects == null)
567 return false;
568
569 ScenePresence sp = null;
570 if(client != null && client.SceneAgent != null)
571 sp = client.SceneAgent as ScenePresence;
572
566 Delegate[] list = handler.GetInvocationList(); 573 Delegate[] list = handler.GetInvocationList();
567 foreach (ReturnObjectsHandler h in list) 574 foreach (ReturnObjectsHandler h in list)
568 { 575 {
569 if (h(land, user, objects) == false) 576 if (h(land, sp, objects) == false)
570 { 577 {
571 result = false; 578 result = false;
572 break; 579 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
2604 { 2604 {
2605 // Otherwise, use this default creation code; 2605 // Otherwise, use this default creation code;
2606 sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape); 2606 sceneObject = new SceneObjectGroup(ownerID, pos, rot, shape);
2607 AddNewSceneObject(sceneObject, true);
2608 sceneObject.SetGroup(groupID, null); 2607 sceneObject.SetGroup(groupID, null);
2608 AddNewSceneObject(sceneObject, true);
2609 2609
2610 if (AgentPreferencesService != null) // This will override the brave new full perm world! 2610 if (AgentPreferencesService != null) // This will override the brave new full perm world!
2611 { 2611 {
@@ -2784,7 +2784,7 @@ namespace OpenSim.Region.Framework.Scenes
2784 } 2784 }
2785 if (toReturn.Count > 0) 2785 if (toReturn.Count > 0)
2786 { 2786 {
2787 returnObjects(toReturn.ToArray(), UUID.Zero); 2787 returnObjects(toReturn.ToArray(), null);
2788 } 2788 }
2789 } 2789 }
2790 2790
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
645 localIDs.Add(sog.RootPart.LocalId); 645 localIDs.Add(sog.RootPart.LocalId);
646 sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition, 646 sogScene.AddReturn(sog.OwnerID, sog.Name, sog.AbsolutePosition,
647 "Returned at region cross"); 647 "Returned at region cross");
648 sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero); 648 sogScene.DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return, UUID.Zero, false);
649 } 649 }
650 catch (Exception) 650 catch (Exception)
651 { 651 {
@@ -2254,7 +2254,7 @@ namespace OpenSim.Region.Framework.Scenes
2254 RootPart.UUID); 2254 RootPart.UUID);
2255 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn"); 2255 m_scene.AddReturn(OwnerID == GroupID ? LastOwnerID : OwnerID, Name, AbsolutePosition, "parcel autoreturn");
2256 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero, 2256 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
2257 DeRezAction.Return, UUID.Zero); 2257 DeRezAction.Return, UUID.Zero, false);
2258 2258
2259 return; 2259 return;
2260 } 2260 }
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index bf74849..b26fa32 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -523,8 +523,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
523 523
524 rootPart.AddFlag(PrimFlags.Phantom); 524 rootPart.AddFlag(PrimFlags.Phantom);
525 525
526 m_scene.AddNewSceneObject(sceneObject, true);
527 sceneObject.SetGroup(groupID, null); 526 sceneObject.SetGroup(groupID, null);
527 m_scene.AddNewSceneObject(sceneObject, true);
528 sceneObject.AggregatePerms(); 528 sceneObject.AggregatePerms();
529 return sceneObject; 529 return sceneObject;
530 } 530 }