diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 202 |
1 files changed, 107 insertions, 95 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 226f39a..b91eb83 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1517,78 +1517,90 @@ namespace OpenSim.Region.Environment.Scenes | |||
1517 | /// </summary> | 1517 | /// </summary> |
1518 | /// <param name="packet"></param> | 1518 | /// <param name="packet"></param> |
1519 | /// <param name="remoteClient"></param> | 1519 | /// <param name="remoteClient"></param> |
1520 | public virtual void DeRezObject(Packet packet, IClientAPI remoteClient) | 1520 | public virtual void DeRezObject(IClientAPI remoteClient, uint localID, |
1521 | UUID groupID, byte destination, UUID destinationID) | ||
1521 | { | 1522 | { |
1522 | DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) packet; | 1523 | SceneObjectPart part = GetSceneObjectPart(localID); |
1524 | if (part == null) | ||
1525 | return; | ||
1523 | 1526 | ||
1524 | UUID folderID = UUID.Zero; | 1527 | if (part.ParentGroup == null || part.ParentGroup.RootPart == null) |
1528 | return; | ||
1525 | 1529 | ||
1526 | foreach (DeRezObjectPacket.ObjectDataBlock Data in DeRezPacket.ObjectData) | 1530 | // Can't delete child prims |
1527 | { | 1531 | if (part != part.ParentGroup.RootPart) |
1528 | // m_log.DebugFormat( | 1532 | return; |
1529 | // "[AGENT INVENTORY]: Received request to derez {0} into folder {1}", | 1533 | |
1530 | // Data.ObjectLocalID, DeRezPacket.AgentBlock.DestinationID); | 1534 | SceneObjectGroup grp = part.ParentGroup; |
1535 | |||
1536 | bool permissionToTake = false; | ||
1537 | bool permissionToDelete = false; | ||
1531 | 1538 | ||
1532 | EntityBase selectedEnt = null; | 1539 | if (destination == 1) // Take Copy |
1533 | //m_log.Info("[CLIENT]: LocalID:" + Data.ObjectLocalID.ToString()); | 1540 | { |
1541 | permissionToTake = | ||
1542 | ExternalChecks.ExternalChecksCanTakeCopyObject( | ||
1543 | grp.UUID, | ||
1544 | remoteClient.AgentId); | ||
1545 | } | ||
1546 | else if (destination == 5) // God take copy | ||
1547 | { | ||
1548 | permissionToTake = | ||
1549 | ExternalChecks.ExternalChecksCanBeGodLike( | ||
1550 | remoteClient.AgentId); | ||
1551 | } | ||
1552 | else if (destination == 4) // Take | ||
1553 | { | ||
1554 | permissionToTake = | ||
1555 | ExternalChecks.ExternalChecksCanTakeObject( | ||
1556 | grp.UUID, | ||
1557 | remoteClient.AgentId); | ||
1534 | 1558 | ||
1535 | List<EntityBase> EntityList = GetEntities(); | 1559 | //If they can take, they can delete! |
1560 | permissionToDelete = permissionToTake; | ||
1561 | } | ||
1536 | 1562 | ||
1537 | foreach (EntityBase ent in EntityList) | 1563 | else if (destination == 6) //Delete |
1564 | { | ||
1565 | permissionToTake = | ||
1566 | ExternalChecks.ExternalChecksCanDeleteObject( | ||
1567 | grp.UUID, | ||
1568 | remoteClient.AgentId); | ||
1569 | permissionToDelete = | ||
1570 | ExternalChecks.ExternalChecksCanDeleteObject( | ||
1571 | grp.UUID, | ||
1572 | remoteClient.AgentId); | ||
1573 | } | ||
1574 | else if (destination == 9) //Return | ||
1575 | { | ||
1576 | if (remoteClient != null) | ||
1538 | { | 1577 | { |
1539 | if (ent.LocalId == Data.ObjectLocalID) | 1578 | permissionToTake = |
1540 | { | 1579 | ExternalChecks.ExternalChecksCanDeleteObject( |
1541 | selectedEnt = ent; | 1580 | grp.UUID, |
1542 | break; | 1581 | remoteClient.AgentId); |
1543 | } | 1582 | permissionToDelete = |
1583 | ExternalChecks.ExternalChecksCanDeleteObject( | ||
1584 | grp.UUID, | ||
1585 | remoteClient.AgentId); | ||
1544 | } | 1586 | } |
1545 | if (selectedEnt != null) | 1587 | else // Auto return passes through here with null agent |
1546 | { | 1588 | { |
1547 | bool permissionToTake = false; | 1589 | permissionToTake = true; |
1548 | bool permissionToDelete = false; | 1590 | permissionToDelete = true; |
1549 | if (DeRezPacket.AgentBlock.Destination == 1)// Take Copy | ||
1550 | { | ||
1551 | permissionToTake = ExternalChecks.ExternalChecksCanTakeCopyObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1552 | permissionToDelete = false; //Just taking copy! | ||
1553 | |||
1554 | } | ||
1555 | else if (DeRezPacket.AgentBlock.Destination == 5) //God take copy | ||
1556 | { | ||
1557 | permissionToTake = ExternalChecks.ExternalChecksCanBeGodLike(remoteClient.AgentId); | ||
1558 | permissionToDelete = false; //Just taking copy! | ||
1559 | |||
1560 | } | ||
1561 | else if (DeRezPacket.AgentBlock.Destination == 4) //Take | ||
1562 | { | ||
1563 | // Take | ||
1564 | permissionToTake = ExternalChecks.ExternalChecksCanTakeObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1565 | permissionToDelete = permissionToTake; //If they can take, they can delete! | ||
1566 | } | ||
1567 | |||
1568 | else if (DeRezPacket.AgentBlock.Destination == 6) //Delete | ||
1569 | { | ||
1570 | permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1571 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1572 | } | ||
1573 | else if (DeRezPacket.AgentBlock.Destination == 9) //Return | ||
1574 | { | ||
1575 | permissionToTake = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1576 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(((SceneObjectGroup)selectedEnt).UUID, remoteClient.AgentId); | ||
1577 | } | ||
1578 | |||
1579 | SceneObjectGroup objectGroup = (SceneObjectGroup)selectedEnt; | ||
1580 | |||
1581 | if (permissionToTake) | ||
1582 | { | ||
1583 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
1584 | DeRezPacket, folderID, objectGroup, remoteClient, selectedEnt, permissionToDelete); | ||
1585 | } | ||
1586 | else if (permissionToDelete) | ||
1587 | { | ||
1588 | DeleteSceneObject(objectGroup); | ||
1589 | } | ||
1590 | } | 1591 | } |
1591 | } | 1592 | } |
1593 | |||
1594 | if (permissionToTake) | ||
1595 | { | ||
1596 | m_asyncSceneObjectDeleter.DeleteToInventory( | ||
1597 | destination, destinationID, grp, remoteClient, | ||
1598 | permissionToDelete); | ||
1599 | } | ||
1600 | else if (permissionToDelete) | ||
1601 | { | ||
1602 | DeleteSceneObject(grp); | ||
1603 | } | ||
1592 | } | 1604 | } |
1593 | 1605 | ||
1594 | /// <summary> | 1606 | /// <summary> |
@@ -1600,51 +1612,50 @@ namespace OpenSim.Region.Environment.Scenes | |||
1600 | /// <param name="objectGroup"></param> | 1612 | /// <param name="objectGroup"></param> |
1601 | /// <param name="folderID"></param> | 1613 | /// <param name="folderID"></param> |
1602 | /// <param name="permissionToDelete"></param> | 1614 | /// <param name="permissionToDelete"></param> |
1603 | public void DeleteToInventory(DeRezObjectPacket DeRezPacket, EntityBase selectedEnt, IClientAPI remoteClient, | 1615 | public void DeleteToInventory(int destination, UUID folderID, |
1604 | SceneObjectGroup objectGroup, UUID folderID, bool permissionToDelete) | 1616 | SceneObjectGroup objectGroup, IClientAPI remoteClient, |
1617 | bool permissionToDelete) | ||
1605 | { | 1618 | { |
1606 | string sceneObjectXml = objectGroup.ToXmlString(); | 1619 | string sceneObjectXml = objectGroup.ToXmlString(); |
1607 | 1620 | ||
1608 | CachedUserInfo userInfo = | 1621 | CachedUserInfo userInfo = |
1609 | CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1622 | CommsManager.UserProfileCacheService.GetUserDetails( |
1610 | if (userInfo != null) | 1623 | remoteClient.AgentId); |
1611 | { | ||
1612 | // string searchFolder = ""; | ||
1613 | 1624 | ||
1614 | // if (DeRezPacket.AgentBlock.Destination == 6) | 1625 | if (remoteClient == null) |
1615 | // searchFolder = "Trash"; | 1626 | { |
1616 | // else if (DeRezPacket.AgentBlock.Destination == 9) | 1627 | userInfo = CommsManager.UserProfileCacheService.GetUserDetails( |
1617 | // searchFolder = "Lost And Found"; | 1628 | objectGroup.RootPart.OwnerID); |
1629 | } | ||
1630 | else | ||
1631 | { | ||
1632 | userInfo = CommsManager.UserProfileCacheService.GetUserDetails( | ||
1633 | remoteClient.AgentId); | ||
1634 | } | ||
1618 | 1635 | ||
1619 | // If we're deleting someone else's item, it goes back to their deleted items folder | 1636 | if (userInfo != null) |
1620 | // If we're returning someone's item, it goes back to the owner's Lost And Found folder. | 1637 | { |
1638 | // If we're deleting someone else's item, it goes back to | ||
1639 | // their deleted items folder | ||
1640 | // If we're returning someone's item, it goes back to the | ||
1641 | // owner's Lost And Found folder. | ||
1621 | 1642 | ||
1622 | if (DeRezPacket.AgentBlock.DestinationID == UUID.Zero || (DeRezPacket.AgentBlock.Destination == 6 && objectGroup.OwnerID != remoteClient.AgentId)) | 1643 | if (folderID == UUID.Zero || (destination == 6 && |
1644 | objectGroup.OwnerID != remoteClient.AgentId)) | ||
1623 | { | 1645 | { |
1624 | List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders(); | 1646 | InventoryFolderBase folder = |
1625 | foreach (InventoryFolderBase flder in subrootfolders) | 1647 | userInfo.FindFolderForType( |
1626 | { | 1648 | (int)AssetType.LostAndFoundFolder); |
1627 | if (flder.Name == "Lost And Found") | ||
1628 | { | ||
1629 | folderID = flder.ID; | ||
1630 | break; | ||
1631 | } | ||
1632 | } | ||
1633 | 1649 | ||
1634 | if (folderID == UUID.Zero) | 1650 | if (folder != null) |
1635 | { | 1651 | folderID = folder.ID; |
1652 | else | ||
1636 | folderID = userInfo.RootFolder.ID; | 1653 | folderID = userInfo.RootFolder.ID; |
1637 | } | ||
1638 | //currently following code not used (or don't know of any case of destination being zero | ||
1639 | } | ||
1640 | else | ||
1641 | { | ||
1642 | folderID = DeRezPacket.AgentBlock.DestinationID; | ||
1643 | } | 1654 | } |
1644 | 1655 | ||
1645 | AssetBase asset = CreateAsset( | 1656 | AssetBase asset = CreateAsset( |
1646 | ((SceneObjectGroup) selectedEnt).GetPartName(selectedEnt.LocalId), | 1657 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), |
1647 | ((SceneObjectGroup) selectedEnt).GetPartDescription(selectedEnt.LocalId), | 1658 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), |
1648 | (sbyte)AssetType.Object, | 1659 | (sbyte)AssetType.Object, |
1649 | Utils.StringToBytes(sceneObjectXml)); | 1660 | Utils.StringToBytes(sceneObjectXml)); |
1650 | AssetCache.AddAsset(asset); | 1661 | AssetCache.AddAsset(asset); |
@@ -1652,7 +1663,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1652 | InventoryItemBase item = new InventoryItemBase(); | 1663 | InventoryItemBase item = new InventoryItemBase(); |
1653 | item.Creator = objectGroup.RootPart.CreatorID; | 1664 | item.Creator = objectGroup.RootPart.CreatorID; |
1654 | 1665 | ||
1655 | if (DeRezPacket.AgentBlock.Destination == 1 || DeRezPacket.AgentBlock.Destination == 4)// Take / Copy | 1666 | if (destination == 1 || |
1667 | destination == 4)// Take / Copy | ||
1656 | item.Owner = remoteClient.AgentId; | 1668 | item.Owner = remoteClient.AgentId; |
1657 | else // Delete / Return | 1669 | else // Delete / Return |
1658 | item.Owner = objectGroup.OwnerID; | 1670 | item.Owner = objectGroup.OwnerID; |
@@ -1720,7 +1732,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1720 | { | 1732 | { |
1721 | if (!grp.HasGroupChanged) | 1733 | if (!grp.HasGroupChanged) |
1722 | { | 1734 | { |
1723 | m_log.InfoFormat("[ATTACHMENT] Detaching {0} which is unchanged", grp.UUID.ToString()); | 1735 | m_log.InfoFormat("[ATTACHMENT] Save request for {0} which is unchanged", grp.UUID.ToString()); |
1724 | return; | 1736 | return; |
1725 | } | 1737 | } |
1726 | m_log.InfoFormat("[ATTACHMENT] Updating asset for attachment {0}, attachpoint {1}", grp.UUID.ToString(), grp.GetAttachmentPoint()); | 1738 | m_log.InfoFormat("[ATTACHMENT] Updating asset for attachment {0}, attachpoint {1}", grp.UUID.ToString(), grp.GetAttachmentPoint()); |