diff options
author | Teravus Ovares | 2008-05-24 21:13:44 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-24 21:13:44 +0000 |
commit | cd79be569cf74c7bead86305caed1f9050d0db8c (patch) | |
tree | 2ab1d7b8222959615c8b845ba89d7ba0b09aa37c /OpenSim/Region/Environment/Scenes | |
parent | * Get the xml2 entities serialization representation in the archiver module (diff) | |
download | opensim-SC-cd79be569cf74c7bead86305caed1f9050d0db8c.zip opensim-SC-cd79be569cf74c7bead86305caed1f9050d0db8c.tar.gz opensim-SC-cd79be569cf74c7bead86305caed1f9050d0db8c.tar.bz2 opensim-SC-cd79be569cf74c7bead86305caed1f9050d0db8c.tar.xz |
* Fixes endless loop in the Land Module when selecting any object.
* Fixes returning objects when the object owner hasn't been in the simulator since the simulator started up last.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/EventManager.cs | 21 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 158 |
2 files changed, 104 insertions, 75 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EventManager.cs b/OpenSim/Region/Environment/Scenes/EventManager.cs index 6c714f8..a3f5d2f 100644 --- a/OpenSim/Region/Environment/Scenes/EventManager.cs +++ b/OpenSim/Region/Environment/Scenes/EventManager.cs | |||
@@ -438,6 +438,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | ||
442 | { | ||
443 | handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | ||
444 | if (handlerObjectBeingRemovedFromScene != null) | ||
445 | { | ||
446 | handlerObjectBeingRemovedFromScene(obj); | ||
447 | |||
448 | } | ||
449 | } | ||
450 | |||
441 | public void TriggerShutdown() | 451 | public void TriggerShutdown() |
442 | { | 452 | { |
443 | handlerShutdown = OnShutdown; | 453 | handlerShutdown = OnShutdown; |
@@ -725,16 +735,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
725 | } | 735 | } |
726 | } | 736 | } |
727 | 737 | ||
728 | public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj) | 738 | |
729 | { | ||
730 | handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene; | ||
731 | if (handlerObjectBeingRemovedFromScene != null) | ||
732 | { | ||
733 | handlerObjectBeingRemovedFromScene(obj); | ||
734 | |||
735 | } | ||
736 | } | ||
737 | |||
738 | 739 | ||
739 | public void TriggerRequestParcelPrimCountUpdate() | 740 | public void TriggerRequestParcelPrimCountUpdate() |
740 | { | 741 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 850962d..409ee1e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1675,6 +1675,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1675 | } | 1675 | } |
1676 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, LLUUID AgentId) | 1676 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, LLUUID AgentId) |
1677 | { | 1677 | { |
1678 | string message = ""; | ||
1678 | if (returnobjects.Length <= 0) | 1679 | if (returnobjects.Length <= 0) |
1679 | return false; | 1680 | return false; |
1680 | 1681 | ||
@@ -1692,13 +1693,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1692 | 1693 | ||
1693 | 1694 | ||
1694 | 1695 | ||
1695 | bool permissionToDelete = false; | 1696 | bool permissionToDelete = false; |
1696 | 1697 | ||
1697 | for (int i = 0; i < returnobjects.Length; i++) | 1698 | for (int i = 0; i < returnobjects.Length; i++) |
1699 | { | ||
1700 | CachedUserInfo userInfo = | ||
1701 | CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID); | ||
1702 | if (userInfo == null) | ||
1703 | { | ||
1704 | CommsManager.UserProfileCacheService.AddNewUser(returnobjects[i].OwnerID); | ||
1705 | |||
1706 | } | ||
1707 | if (userInfo != null) | ||
1698 | { | 1708 | { |
1699 | CachedUserInfo userInfo = | 1709 | if (userInfo.HasInventory) |
1700 | CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID); | ||
1701 | if (userInfo != null) | ||
1702 | { | 1710 | { |
1703 | LLUUID folderID = LLUUID.Zero; | 1711 | LLUUID folderID = LLUUID.Zero; |
1704 | 1712 | ||
@@ -1716,76 +1724,96 @@ namespace OpenSim.Region.Environment.Scenes | |||
1716 | { | 1724 | { |
1717 | folderID = userInfo.RootFolder.ID; | 1725 | folderID = userInfo.RootFolder.ID; |
1718 | } | 1726 | } |
1719 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId); | 1727 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId); |
1728 | |||
1729 | // If the user doesn't have permission, go on to the next one. | ||
1730 | if (!permissionToDelete) | ||
1731 | continue; | ||
1732 | |||
1733 | string sceneObjectXml = returnobjects[i].ToXmlString2(); | ||
1734 | AssetBase asset = CreateAsset( | ||
1735 | returnobjects[i].GetPartName(returnobjects[i].LocalId), | ||
1736 | returnobjects[i].GetPartDescription(returnobjects[i].LocalId), | ||
1737 | (sbyte)InventoryType.Object, | ||
1738 | (sbyte)AssetType.Object, | ||
1739 | Helpers.StringToField(sceneObjectXml)); | ||
1740 | AssetCache.AddAsset(asset); | ||
1720 | 1741 | ||
1721 | // If the user doesn't have permission, go on to the next one. | 1742 | InventoryItemBase item = new InventoryItemBase(); |
1722 | if (!permissionToDelete) | 1743 | item.Creator = returnobjects[i].RootPart.CreatorID; |
1723 | continue; | 1744 | item.Owner = returnobjects[i].OwnerID; |
1745 | item.ID = LLUUID.Random(); | ||
1746 | item.AssetID = asset.FullID; | ||
1747 | item.Description = asset.Description; | ||
1748 | item.Name = asset.Name; | ||
1749 | item.AssetType = asset.Type; | ||
1750 | item.InvType = asset.InvType; | ||
1751 | item.Folder = folderID; | ||
1752 | if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) | ||
1753 | { | ||
1754 | uint perms = returnobjects[i].GetEffectivePermissions(); | ||
1755 | uint nextPerms = (perms & 7) << 13; | ||
1756 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
1757 | perms &= ~(uint)PermissionMask.Copy; | ||
1758 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
1759 | perms &= ~(uint)PermissionMask.Transfer; | ||
1760 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
1761 | perms &= ~(uint)PermissionMask.Modify; | ||
1762 | |||
1763 | item.BasePermissions = perms & returnobjects[i].RootPart.NextOwnerMask; | ||
1764 | item.CurrentPermissions = item.BasePermissions; | ||
1765 | item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask; | ||
1766 | item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask & returnobjects[i].RootPart.NextOwnerMask; | ||
1767 | item.CurrentPermissions |= 8; // Slam! | ||
1768 | } | ||
1769 | else | ||
1770 | { | ||
1771 | item.BasePermissions = returnobjects[i].GetEffectivePermissions(); | ||
1772 | item.CurrentPermissions = returnobjects[i].GetEffectivePermissions(); | ||
1773 | item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask; | ||
1774 | item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask; | ||
1775 | } | ||
1724 | 1776 | ||
1725 | string sceneObjectXml = returnobjects[i].ToXmlString2(); | 1777 | // TODO: add the new fields (Flags, Sale info, etc) |
1726 | AssetBase asset = CreateAsset( | ||
1727 | returnobjects[i].GetPartName(returnobjects[i].LocalId), | ||
1728 | returnobjects[i].GetPartDescription(returnobjects[i].LocalId), | ||
1729 | (sbyte)InventoryType.Object, | ||
1730 | (sbyte)AssetType.Object, | ||
1731 | Helpers.StringToField(sceneObjectXml)); | ||
1732 | AssetCache.AddAsset(asset); | ||
1733 | 1778 | ||
1734 | InventoryItemBase item = new InventoryItemBase(); | 1779 | userInfo.AddItem(item); |
1735 | item.Creator = returnobjects[i].RootPart.CreatorID; | ||
1736 | item.Owner = returnobjects[i].OwnerID; | ||
1737 | item.ID = LLUUID.Random(); | ||
1738 | item.AssetID = asset.FullID; | ||
1739 | item.Description = asset.Description; | ||
1740 | item.Name = asset.Name; | ||
1741 | item.AssetType = asset.Type; | ||
1742 | item.InvType = asset.InvType; | ||
1743 | item.Folder = folderID; | ||
1744 | if ((AgentId != returnobjects[i].RootPart.OwnerID) && ExternalChecks.ExternalChecksPropagatePermissions()) | ||
1745 | { | ||
1746 | uint perms = returnobjects[i].GetEffectivePermissions(); | ||
1747 | uint nextPerms = (perms & 7) << 13; | ||
1748 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
1749 | perms &= ~(uint)PermissionMask.Copy; | ||
1750 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
1751 | perms &= ~(uint)PermissionMask.Transfer; | ||
1752 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
1753 | perms &= ~(uint)PermissionMask.Modify; | ||
1754 | |||
1755 | item.BasePermissions = perms & returnobjects[i].RootPart.NextOwnerMask; | ||
1756 | item.CurrentPermissions = item.BasePermissions; | ||
1757 | item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask; | ||
1758 | item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask & returnobjects[i].RootPart.NextOwnerMask; | ||
1759 | item.CurrentPermissions |= 8; // Slam! | ||
1760 | } | ||
1761 | else | ||
1762 | { | ||
1763 | item.BasePermissions = returnobjects[i].GetEffectivePermissions(); | ||
1764 | item.CurrentPermissions = returnobjects[i].GetEffectivePermissions(); | ||
1765 | item.NextPermissions = returnobjects[i].RootPart.NextOwnerMask; | ||
1766 | item.EveryOnePermissions = returnobjects[i].RootPart.EveryoneMask; | ||
1767 | } | ||
1768 | 1780 | ||
1769 | // TODO: add the new fields (Flags, Sale info, etc) | 1781 | ScenePresence notifyUser = GetScenePresence(item.Owner); |
1782 | if (notifyUser != null) | ||
1783 | { | ||
1784 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); | ||
1785 | } | ||
1770 | 1786 | ||
1771 | userInfo.AddItem(item); | 1787 | SceneObjectGroup ObjectDeleting = returnobjects[i]; |
1772 | 1788 | ||
1773 | ScenePresence notifyUser = GetScenePresence(item.Owner); | 1789 | returnobjects[i] = null; |
1774 | if (notifyUser != null) | 1790 | |
1791 | DeleteSceneObjectGroup(ObjectDeleting); | ||
1792 | ObjectDeleting = null; | ||
1793 | } | ||
1794 | else | ||
1775 | { | 1795 | { |
1776 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); | 1796 | CommsManager.UserProfileCacheService.RequestInventoryForUser(returnobjects[i].OwnerID); |
1797 | 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."; | ||
1777 | } | 1798 | } |
1778 | |||
1779 | SceneObjectGroup ObjectDeleting = returnobjects[i]; | ||
1780 | |||
1781 | returnobjects[i] = null; | ||
1782 | |||
1783 | DeleteSceneObjectGroup(ObjectDeleting); | ||
1784 | ObjectDeleting = null; | ||
1785 | } | 1799 | } |
1786 | return true; | 1800 | else |
1801 | { | ||
1802 | 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."; | ||
1803 | } | ||
1804 | //return true; | ||
1787 | } | 1805 | } |
1788 | return false; | 1806 | |
1807 | if (message.Length != 0) | ||
1808 | { | ||
1809 | ScenePresence returningavatar = GetScenePresence(AgentId); | ||
1810 | if (returningavatar != null) | ||
1811 | { | ||
1812 | returningavatar.ControllingClient.SendAlertMessage(message); | ||
1813 | } | ||
1814 | return false; | ||
1815 | } | ||
1816 | return true; | ||
1789 | 1817 | ||
1790 | } | 1818 | } |
1791 | 1819 | ||