* Implements selected object return.
* If user is in the same sim with you, they'll get an inventory update, if not.... oh well, they'll have to clear their cache potentially before they'll see it.0.6.0-stable
parent
c98fb26789
commit
3965fa2ff3
|
@ -3868,6 +3868,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (Pack.Type)
|
switch (Pack.Type)
|
||||||
{
|
{
|
||||||
#region Scene/Avatar
|
#region Scene/Avatar
|
||||||
|
|
|
@ -596,6 +596,10 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
||||||
if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
|
if (m_scene.ExternalChecks.ExternalChecksCanEditParcel(remote_client.AgentId, this))
|
||||||
{
|
{
|
||||||
List<uint> resultLocalIDs = new List<uint>();
|
List<uint> resultLocalIDs = new List<uint>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (primsOverMe)
|
||||||
|
{
|
||||||
foreach (SceneObjectGroup obj in primsOverMe)
|
foreach (SceneObjectGroup obj in primsOverMe)
|
||||||
{
|
{
|
||||||
if (obj.LocalId > 0)
|
if (obj.LocalId > 0)
|
||||||
|
@ -614,6 +618,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
m_log.Error("[LAND]: Unable to force select the parcel objects. Arr.");
|
||||||
|
}
|
||||||
|
|
||||||
remote_client.sendForceClientSelectObjects(resultLocalIDs);
|
remote_client.sendForceClientSelectObjects(resultLocalIDs);
|
||||||
}
|
}
|
||||||
|
@ -633,6 +642,11 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
||||||
{
|
{
|
||||||
Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
|
Dictionary<LLUUID, int> primCount = new Dictionary<LLUUID, int>();
|
||||||
|
|
||||||
|
lock (primsOverMe)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
foreach (SceneObjectGroup obj in primsOverMe)
|
foreach (SceneObjectGroup obj in primsOverMe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -655,6 +669,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land
|
||||||
m_log.Error("[LAND]: Unable to match a prim with it's owner.");
|
m_log.Error("[LAND]: Unable to match a prim with it's owner.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
m_log.Error("[LAND]: Unable to Enumerate Land object arr.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remote_client.sendLandObjectOwners(primCount);
|
remote_client.sendLandObjectOwners(primCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,24 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
AddInventoryItem(agentID, item);
|
AddInventoryItem(agentID, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AddInventoryItemReturned(LLUUID AgentId, InventoryItemBase item)
|
||||||
|
{
|
||||||
|
CachedUserInfo userInfo
|
||||||
|
= CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
userInfo.AddItem(item);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[AGENT INVENTORY]: Agent was not found for add of item {1} {2}", item.Name, item.ID);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add an inventory item to an avatar's inventory.
|
/// Add an inventory item to an avatar's inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1060,6 +1078,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when an object is removed from the environment into inventory.
|
/// Called when an object is removed from the environment into inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1069,12 +1088,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
{
|
{
|
||||||
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
|
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet;
|
||||||
|
|
||||||
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero)
|
LLUUID folderID = LLUUID.Zero;
|
||||||
{
|
|
||||||
//currently following code not used (or don't know of any case of destination being zero
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
|
foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
|
@ -1113,7 +1132,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
else if (DeRezPacket.AgentBlock.Destination == 6) //Delete
|
else if (DeRezPacket.AgentBlock.Destination == 6) //Delete
|
||||||
{
|
{
|
||||||
permissionToTake = false;
|
permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
|
||||||
|
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
|
||||||
|
}
|
||||||
|
else if (DeRezPacket.AgentBlock.Destination == 9) //Return
|
||||||
|
{
|
||||||
|
permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
|
||||||
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
|
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1121,12 +1145,46 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
if (permissionToTake)
|
if (permissionToTake)
|
||||||
{
|
{
|
||||||
|
|
||||||
string sceneObjectXml = objectGroup.ToXmlString();
|
string sceneObjectXml = objectGroup.ToXmlString();
|
||||||
|
|
||||||
CachedUserInfo userInfo =
|
CachedUserInfo userInfo =
|
||||||
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
{
|
{
|
||||||
|
string searchFolder = "";
|
||||||
|
|
||||||
|
if (DeRezPacket.AgentBlock.Destination == 6)
|
||||||
|
searchFolder = "Trash";
|
||||||
|
else if (DeRezPacket.AgentBlock.Destination == 9)
|
||||||
|
searchFolder = "Lost And Found";
|
||||||
|
|
||||||
|
// If we're deleting someone else's item, it goes back to their deleted items folder
|
||||||
|
// If we're returning someone's item, it goes back to the owner's Lost And Found folder.
|
||||||
|
|
||||||
|
if (DeRezPacket.AgentBlock.DestinationID == LLUUID.Zero || (DeRezPacket.AgentBlock.Destination == 6 && objectGroup.OwnerID != remoteClient.AgentId))
|
||||||
|
{
|
||||||
|
List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders();
|
||||||
|
foreach (InventoryFolderBase flder in subrootfolders)
|
||||||
|
{
|
||||||
|
if (flder.Name == "Lost And Found")
|
||||||
|
{
|
||||||
|
folderID = flder.ID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (folderID == LLUUID.Zero)
|
||||||
|
{
|
||||||
|
folderID = userInfo.RootFolder.ID;
|
||||||
|
}
|
||||||
|
//currently following code not used (or don't know of any case of destination being zero
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folderID = DeRezPacket.AgentBlock.DestinationID;
|
||||||
|
}
|
||||||
|
|
||||||
AssetBase asset = CreateAsset(
|
AssetBase asset = CreateAsset(
|
||||||
((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
|
((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId),
|
||||||
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
|
((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId),
|
||||||
|
@ -1137,14 +1195,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
item.Creator = objectGroup.RootPart.CreatorID;
|
item.Creator = objectGroup.RootPart.CreatorID;
|
||||||
|
|
||||||
|
if (DeRezPacket.AgentBlock.Destination == 1 || DeRezPacket.AgentBlock.Destination == 4)// Take / Copy
|
||||||
item.Owner = remoteClient.AgentId;
|
item.Owner = remoteClient.AgentId;
|
||||||
|
else // Delete / Return
|
||||||
|
item.Owner = objectGroup.OwnerID;
|
||||||
|
|
||||||
item.ID = LLUUID.Random();
|
item.ID = LLUUID.Random();
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
item.Description = asset.Description;
|
item.Description = asset.Description;
|
||||||
item.Name = asset.Name;
|
item.Name = asset.Name;
|
||||||
item.AssetType = asset.Type;
|
item.AssetType = asset.Type;
|
||||||
item.InvType = asset.InvType;
|
item.InvType = asset.InvType;
|
||||||
item.Folder = DeRezPacket.AgentBlock.DestinationID;
|
item.Folder = folderID;
|
||||||
if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
if ((remoteClient.AgentId != objectGroup.RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions())
|
||||||
{
|
{
|
||||||
uint perms=objectGroup.GetEffectivePermissions();
|
uint perms=objectGroup.GetEffectivePermissions();
|
||||||
|
@ -1173,8 +1236,19 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
// TODO: add the new fields (Flags, Sale info, etc)
|
// TODO: add the new fields (Flags, Sale info, etc)
|
||||||
|
|
||||||
userInfo.AddItem(item);
|
userInfo.AddItem(item);
|
||||||
|
if (item.Owner == remoteClient.AgentId)
|
||||||
|
{
|
||||||
remoteClient.SendInventoryItemCreateUpdate(item);
|
remoteClient.SendInventoryItemCreateUpdate(item);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ScenePresence notifyUser = GetScenePresence(item.Owner);
|
||||||
|
if (notifyUser != null)
|
||||||
|
{
|
||||||
|
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1184,7 +1258,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
|
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, LLUUID assetID, LLUUID agentID)
|
||||||
|
@ -1599,6 +1673,114 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, LLUUID AgentId)
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
|
||||||
|
|
||||||
|
CachedUserInfo userInfo =
|
||||||
|
CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||||
|
if (userInfo != null)
|
||||||
|
{
|
||||||
|
LLUUID folderID = LLUUID.Zero;
|
||||||
|
|
||||||
|
List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders();
|
||||||
|
foreach (InventoryFolderBase flder in subrootfolders)
|
||||||
|
{
|
||||||
|
if (flder.Name == "Lost And Found")
|
||||||
|
{
|
||||||
|
folderID = flder.ID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (folderID == LLUUID.Zero)
|
||||||
|
{
|
||||||
|
folderID = userInfo.RootFolder.ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool permissionToDelete = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < returnobjects.Length; i++)
|
||||||
|
{
|
||||||
|
permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(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)InventoryType.Object,
|
||||||
|
(sbyte)AssetType.Object,
|
||||||
|
Helpers.StringToField(sceneObjectXml));
|
||||||
|
AssetCache.AddAsset(asset);
|
||||||
|
|
||||||
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
item.Creator = returnobjects[i].RootPart.CreatorID;
|
||||||
|
item.Owner = AgentId;
|
||||||
|
item.ID = LLUUID.Random();
|
||||||
|
item.AssetID = asset.FullID;
|
||||||
|
item.Description = asset.Description;
|
||||||
|
item.Name = asset.Name;
|
||||||
|
item.AssetType = asset.Type;
|
||||||
|
item.InvType = asset.InvType;
|
||||||
|
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.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add the new fields (Flags, Sale info, etc)
|
||||||
|
|
||||||
|
userInfo.AddItem(item);
|
||||||
|
|
||||||
|
SceneObjectGroup ObjectDeleting = returnobjects[i];
|
||||||
|
|
||||||
|
returnobjects[i] = null;
|
||||||
|
|
||||||
|
DeleteSceneObjectGroup(ObjectDeleting);
|
||||||
|
ObjectDeleting = null;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue