From ee4d4d784eb9b51b29fe4bda3fc9ec3594d24f5a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Fri, 21 Nov 2008 07:33:13 +0000
Subject: Fully implement object return from the parcel dialog
---
OpenSim/Region/Environment/Scenes/ReturnInfo.cs | 1 +
.../Region/Environment/Scenes/Scene.Inventory.cs | 144 ++-------------------
OpenSim/Region/Environment/Scenes/Scene.cs | 90 +++++++------
.../Region/Environment/Scenes/SceneObjectGroup.cs | 2 +-
4 files changed, 58 insertions(+), 179 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes')
diff --git a/OpenSim/Region/Environment/Scenes/ReturnInfo.cs b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
index 68c563d..898baab 100644
--- a/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
+++ b/OpenSim/Region/Environment/Scenes/ReturnInfo.cs
@@ -34,5 +34,6 @@ namespace OpenSim.Region.Environment.Scenes
public int count;
public Vector3 location;
public string objectName;
+ public string reason;
}
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 79d79ef..19b8e16 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1610,6 +1610,10 @@ namespace OpenSim.Region.Environment.Scenes
ExternalChecks.ExternalChecksCanDeleteObject(
grp.UUID,
remoteClient.AgentId);
+ if (permissionToDelete)
+ {
+ AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
+ }
}
else // Auto return passes through here with null agent
{
@@ -2207,145 +2211,13 @@ namespace OpenSim.Region.Environment.Scenes
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
{
- string message = "";
- if (returnobjects.Length <= 0)
- return false;
-
- // for the moment we're going to store them individually.. however, in the future, the rezObject
- // will be able to have more items.
-
- //string returnstring = "";
- //returnstring += "\n";
- //for (int i = 0; i < returnobjects.Length; i++)
- //{
- // returnstring += grp.ToXmlString2();
- //}
- //returnstring += "\n";
-
- bool permissionToDelete = false;
-
- for (int i = 0; i < returnobjects.Length; i++)
- {
- CachedUserInfo userInfo =
- CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID);
- if (userInfo == null)
- {
- CommsManager.UserProfileCacheService.AddNewUser(returnobjects[i].OwnerID);
-
- }
- if (userInfo != null)
- {
- if (userInfo.HasReceivedInventory)
- {
- UUID folderID = UUID.Zero;
-
- List subrootfolders = userInfo.RootFolder.RequestListOfFolders();
- foreach (InventoryFolderBase flder in subrootfolders)
- {
- if (flder.Name == "Lost And Found")
- {
- folderID = flder.ID;
- break;
- }
- }
-
- if (folderID == UUID.Zero)
- {
- folderID = userInfo.RootFolder.ID;
- }
- permissionToDelete = ExternalChecks.ExternalChecksCanReturnObject(returnobjects[i].UUID, AgentId);
-
- // If the user doesn't have permission, go on to the next one.
- if (!permissionToDelete)
- continue;
-
- string sceneObjectXml = returnobjects[i].ToXmlString2();
- AssetBase asset = CreateAsset(
- returnobjects[i].GetPartName(returnobjects[i].LocalId),
- returnobjects[i].GetPartDescription(returnobjects[i].LocalId),
- (sbyte)AssetType.Object,
- Utils.StringToBytes(sceneObjectXml));
- AssetCache.AddAsset(asset);
-
- InventoryItemBase item = new InventoryItemBase();
- item.Creator = returnobjects[i].RootPart.CreatorID;
- item.Owner = returnobjects[i].OwnerID;
- item.ID = UUID.Random();
- item.AssetID = asset.FullID;
- item.Description = asset.Description;
- item.Name = asset.Name;
- item.AssetType = asset.Type;
- item.InvType = (int)InventoryType.Object;
- item.Folder = folderID;
-
- if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
- {
- uint perms = returnobjects[i].GetEffectivePermissions();
- uint nextPerms = (perms & 7) << 13;
- if ((nextPerms & (uint)PermissionMask.Copy) == 0)
- perms &= ~(uint)PermissionMask.Copy;
- if ((nextPerms & (uint)PermissionMask.Transfer) == 0)
- perms &= ~(uint)PermissionMask.Transfer;
- if ((nextPerms & (uint)PermissionMask.Modify) == 0)
- perms &= ~(uint)PermissionMask.Modify;
-
- item.BasePermissions = perms & returnobjects[i].RootPart.NextOwnerMask;
- item.CurrentPermissions = item.BasePermissions;
- item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask;
- item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask & returnobjects[i].RootPart.NextOwnerMask;
- item.GroupPermissions = returnobjects[i].RootPart.GroupMask & returnobjects[i].RootPart.NextOwnerMask;
- item.CurrentPermissions |= 8; // Slam!
- }
- else
- {
- item.BasePermissions = returnobjects[i].GetEffectivePermissions();
- item.CurrentPermissions = returnobjects[i].GetEffectivePermissions();
- item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask;
- item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask;
- item.GroupPermissions = returnobjects[i].RootPart.GroupMask;
- }
-
- // TODO: add the new fields (Flags, Sale info, etc)
-
- userInfo.AddItem(item);
-
- ScenePresence notifyUser = GetScenePresence(item.Owner);
- if (notifyUser != null)
- {
- notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
- }
-
- SceneObjectGroup ObjectDeleting = returnobjects[i];
-
- returnobjects[i] = null;
-
- DeleteSceneObject(ObjectDeleting, false);
- ObjectDeleting = null;
- }
- else
- {
- CommsManager.UserProfileCacheService.RequestInventoryForUser(returnobjects[i].OwnerID);
- message = "Still waiting on the inventory service, some of the items won't be returned until the inventory services completes it's task. Try again shortly.";
- }
- }
- else
- {
- message = "Still waiting on the inventory service, some of the items won't be returned until the inventory services completes it's task. Try again shortly.";
- }
- //return true;
- }
-
- if (message.Length != 0)
+ foreach (SceneObjectGroup grp in returnobjects)
{
- ScenePresence returningavatar = GetScenePresence(AgentId);
- if (returningavatar != null)
- {
- returningavatar.ControllingClient.SendAlertMessage(message);
- }
- return false;
+ AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
+ DeRezObject(null, grp.RootPart.LocalId,
+ grp.RootPart.GroupID, 9, UUID.Zero);
}
return true;
-
}
public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f37ba25..741c47e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -966,54 +966,60 @@ namespace OpenSim.Region.Environment.Scenes
///
public void Backup()
{
- m_returns.Clear();
-
- EventManager.TriggerOnBackup(m_storageManager.DataStore);
- m_backingup = false;
-
- foreach (KeyValuePair ret in m_returns)
- {
- UUID transaction = UUID.Random();
-
- GridInstantMessage msg = new GridInstantMessage();
- msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
- msg.toAgentID = new Guid(ret.Key.ToString());
- msg.imSessionID = new Guid(transaction.ToString());
- msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
- msg.fromAgentName = "Server";
- msg.dialog = (byte)19; // Object msg
- msg.fromGroup = false;
- msg.offline = (byte)1;
- msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
- msg.Position = Vector3.Zero;
- msg.RegionID = RegionInfo.RegionID.Guid;
- msg.binaryBucket = new byte[0];
- if (ret.Value.count > 1)
- msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to parcel auto return", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName);
- else
- msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to parcel auto return", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName);
+ lock(m_returns)
+ {
+ EventManager.TriggerOnBackup(m_storageManager.DataStore);
+ m_backingup = false;
- IMessageTransferModule tr = RequestModuleInterface();
- if (tr != null)
- tr.SendInstantMessage(msg, delegate(bool success) {} );
+ foreach (KeyValuePair ret in m_returns)
+ {
+ UUID transaction = UUID.Random();
+
+ GridInstantMessage msg = new GridInstantMessage();
+ msg.fromAgentID = new Guid(UUID.Zero.ToString()); // From server
+ msg.toAgentID = new Guid(ret.Key.ToString());
+ msg.imSessionID = new Guid(transaction.ToString());
+ msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
+ msg.fromAgentName = "Server";
+ msg.dialog = (byte)19; // Object msg
+ msg.fromGroup = false;
+ msg.offline = (byte)1;
+ msg.ParentEstateID = RegionInfo.EstateSettings.ParentEstateID;
+ msg.Position = Vector3.Zero;
+ msg.RegionID = RegionInfo.RegionID.Guid;
+ msg.binaryBucket = new byte[0];
+ if (ret.Value.count > 1)
+ msg.message = string.Format("Your {0} objects were returned from {1} in region {2} due to {3}", ret.Value.count, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason);
+ else
+ msg.message = string.Format("Your object {0} was returned from {1} in region {2} due to {3}", ret.Value.objectName, ret.Value.location.ToString(), RegionInfo.RegionName, ret.Value.reason);
+
+ IMessageTransferModule tr = RequestModuleInterface();
+ if (tr != null)
+ tr.SendInstantMessage(msg, delegate(bool success) {} );
+ }
+ m_returns.Clear();
}
}
- public void AddReturn(UUID agentID, string objectName, Vector3 location)
+ public void AddReturn(UUID agentID, string objectName, Vector3 location, string reason)
{
- if (m_returns.ContainsKey(agentID))
- {
- ReturnInfo info = m_returns[agentID];
- info.count++;
- m_returns[agentID] = info;
- }
- else
+ lock(m_returns)
{
- ReturnInfo info = new ReturnInfo();
- info.count = 1;
- info.objectName = objectName;
- info.location = location;
- m_returns[agentID] = info;
+ if (m_returns.ContainsKey(agentID))
+ {
+ ReturnInfo info = m_returns[agentID];
+ info.count++;
+ m_returns[agentID] = info;
+ }
+ else
+ {
+ ReturnInfo info = new ReturnInfo();
+ info.count = 1;
+ info.objectName = objectName;
+ info.location = location;
+ info.reason = reason;
+ m_returns[agentID] = info;
+ }
}
}
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 82ab4eb..e8eaef8 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -1224,7 +1224,7 @@ namespace OpenSim.Region.Environment.Scenes
parcel.landData.OtherCleanTime)
{
m_log.InfoFormat("[SCENE] Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
- m_scene.AddReturn(OwnerID, Name, AbsolutePosition);
+ m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return");
m_scene.DeRezObject(null, RootPart.LocalId,
RootPart.GroupID, 9, UUID.Zero);
--
cgit v1.1