Fully implement object return from the parcel dialog
parent
46278b34b1
commit
ee4d4d784e
|
@ -71,7 +71,7 @@ namespace OpenSim.Region.Environment.Interfaces
|
|||
void sendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
|
||||
void sendLandObjectOwners(IClientAPI remote_client);
|
||||
void returnObject(SceneObjectGroup obj);
|
||||
void returnLandObjects(uint type, UUID[] owners, IClientAPI remote_client);
|
||||
void returnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
|
||||
void resetLandPrimCounts();
|
||||
void addPrimToCount(SceneObjectGroup obj);
|
||||
void removePrimFromCount(SceneObjectGroup obj);
|
||||
|
|
|
@ -1149,10 +1149,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
|
||||
if (selectedParcel == null) return;
|
||||
|
||||
if (returnType == 16) // parcel return
|
||||
{
|
||||
selectedParcel.returnLandObjects(returnType, agentIDs, remoteClient);
|
||||
}
|
||||
selectedParcel.returnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
|
||||
}
|
||||
|
||||
public void NoLandDataFromStorage()
|
||||
|
|
|
@ -776,28 +776,73 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
|||
m_scene.returnObjects(objs, obj.OwnerID);
|
||||
}
|
||||
|
||||
public void returnLandObjects(uint type, UUID[] owners, IClientAPI remote_client)
|
||||
public void returnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
||||
{
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>();
|
||||
for (int i = 0; i < owners.Length; i++)
|
||||
Dictionary<UUID,List<SceneObjectGroup>> returns =
|
||||
new Dictionary<UUID,List<SceneObjectGroup>>();
|
||||
|
||||
lock (primsOverMe)
|
||||
{
|
||||
lock (primsOverMe)
|
||||
if (type == (uint)ObjectReturnType.Owner)
|
||||
{
|
||||
try
|
||||
foreach (SceneObjectGroup obj in primsOverMe)
|
||||
{
|
||||
foreach (SceneObjectGroup obj in primsOverMe)
|
||||
if (obj.OwnerID == m_landData.OwnerID)
|
||||
{
|
||||
if (obj.OwnerID == owners[i])
|
||||
objlist.Add(obj);
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] =
|
||||
new List<SceneObjectGroup>();
|
||||
returns[obj.OwnerID].Add(obj);
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
}
|
||||
else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero)
|
||||
{
|
||||
foreach (SceneObjectGroup obj in primsOverMe)
|
||||
{
|
||||
m_log.Info("[PARCEL]: Unable to figure out all the objects owned by " + owners[i].ToString() + " arr.");
|
||||
if (obj.GroupID == m_landData.GroupID)
|
||||
{
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] =
|
||||
new List<SceneObjectGroup>();
|
||||
returns[obj.OwnerID].Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == (uint)ObjectReturnType.Other)
|
||||
{
|
||||
foreach (SceneObjectGroup obj in primsOverMe)
|
||||
{
|
||||
if (obj.OwnerID != m_landData.OwnerID &&
|
||||
(obj.GroupID != m_landData.GroupID ||
|
||||
m_landData.GroupID == UUID.Zero))
|
||||
{
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] =
|
||||
new List<SceneObjectGroup>();
|
||||
returns[obj.OwnerID].Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == (uint)ObjectReturnType.List)
|
||||
{
|
||||
List<UUID> ownerlist = new List<UUID>(owners);
|
||||
|
||||
foreach (SceneObjectGroup obj in primsOverMe)
|
||||
{
|
||||
if (ownerlist.Contains(obj.OwnerID))
|
||||
{
|
||||
if (!returns.ContainsKey(obj.OwnerID))
|
||||
returns[obj.OwnerID] =
|
||||
new List<SceneObjectGroup>();
|
||||
returns[obj.OwnerID].Add(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_scene.returnObjects(objlist.ToArray(), remote_client.AgentId);
|
||||
|
||||
foreach (List<SceneObjectGroup> ol in returns.Values)
|
||||
m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -34,5 +34,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public int count;
|
||||
public Vector3 location;
|
||||
public string objectName;
|
||||
public string reason;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 += "<scene>\n";
|
||||
//for (int i = 0; i < returnobjects.Length; i++)
|
||||
//{
|
||||
// returnstring += grp.ToXmlString2();
|
||||
//}
|
||||
//returnstring += "</scene>\n";
|
||||
|
||||
bool permissionToDelete = false;
|
||||
|
||||
for (int i = 0; i < returnobjects.Length; i++)
|
||||
foreach (SceneObjectGroup grp in returnobjects)
|
||||
{
|
||||
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<InventoryFolderBase> 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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -966,54 +966,60 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <returns></returns>
|
||||
public void Backup()
|
||||
{
|
||||
m_returns.Clear();
|
||||
|
||||
EventManager.TriggerOnBackup(m_storageManager.DataStore);
|
||||
m_backingup = false;
|
||||
|
||||
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
|
||||
lock(m_returns)
|
||||
{
|
||||
UUID transaction = UUID.Random();
|
||||
EventManager.TriggerOnBackup(m_storageManager.DataStore);
|
||||
m_backingup = false;
|
||||
|
||||
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);
|
||||
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
|
||||
{
|
||||
UUID transaction = UUID.Random();
|
||||
|
||||
IMessageTransferModule tr = RequestModuleInterface<IMessageTransferModule>();
|
||||
if (tr != null)
|
||||
tr.SendInstantMessage(msg, delegate(bool success) {} );
|
||||
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<IMessageTransferModule>();
|
||||
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))
|
||||
lock(m_returns)
|
||||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue