diff options
author | Teravus Ovares | 2008-05-24 11:10:21 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-24 11:10:21 +0000 |
commit | 375673ec903719f0225b182cb62aab153c86e04e (patch) | |
tree | 66ca3c7493119c47cc4488985f9535572a767e1c /OpenSim/Region/Environment | |
parent | * Implements selected object return. (diff) | |
download | opensim-SC-375673ec903719f0225b182cb62aab153c86e04e.zip opensim-SC-375673ec903719f0225b182cb62aab153c86e04e.tar.gz opensim-SC-375673ec903719f0225b182cb62aab153c86e04e.tar.bz2 opensim-SC-375673ec903719f0225b182cb62aab153c86e04e.tar.xz |
This enables return from the parcel object owner display.
There's some oddness with the parcel counts, but if you can get past the oddness, you can return objects under an owner that you have permission to return.
Diffstat (limited to 'OpenSim/Region/Environment')
8 files changed, 132 insertions, 47 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs index f370ee5..6c53177 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs | |||
@@ -41,5 +41,6 @@ namespace OpenSim.Region.Environment.Interfaces | |||
41 | bool IsLandPrimCountTainted(); | 41 | bool IsLandPrimCountTainted(); |
42 | bool IsForcefulBansAllowed(); | 42 | bool IsForcefulBansAllowed(); |
43 | void UpdateLandObject(int localID, LandData data); | 43 | void UpdateLandObject(int localID, LandData data); |
44 | void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient); | ||
44 | } | 45 | } |
45 | } | 46 | } |
diff --git a/OpenSim/Region/Environment/Interfaces/ILandObject.cs b/OpenSim/Region/Environment/Interfaces/ILandObject.cs index 25c51de..4368493 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandObject.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandObject.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Environment.Interfaces | |||
64 | void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client); | 64 | void sendForceObjectSelect(int local_id, int request_type, IClientAPI remote_client); |
65 | void sendLandObjectOwners(IClientAPI remote_client); | 65 | void sendLandObjectOwners(IClientAPI remote_client); |
66 | void returnObject(SceneObjectGroup obj); | 66 | void returnObject(SceneObjectGroup obj); |
67 | void returnLandObjects(int type, LLUUID owner); | 67 | void returnLandObjects(uint type, LLUUID[] owners, IClientAPI remote_client); |
68 | void resetLandPrimCounts(); | 68 | void resetLandPrimCounts(); |
69 | void addPrimToCount(SceneObjectGroup obj); | 69 | void addPrimToCount(SceneObjectGroup obj); |
70 | void removePrimFromCount(SceneObjectGroup obj); | 70 | void removePrimFromCount(SceneObjectGroup obj); |
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index 77c70a8..0b77b23 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs | |||
@@ -142,6 +142,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
142 | m_landManagementModule.UpdateLandObject(localID, data); | 142 | m_landManagementModule.UpdateLandObject(localID, data); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | public void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient) | ||
146 | { | ||
147 | if (m_landManagementModule != null) | ||
148 | { | ||
149 | m_landManagementModule.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); | ||
150 | } | ||
151 | } | ||
145 | #endregion | 152 | #endregion |
146 | 153 | ||
147 | } | 154 | } |
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs index 7163769..5bc28f7 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandManagementModule.cs | |||
@@ -902,7 +902,17 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
902 | 902 | ||
903 | public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) | 903 | public void handleParcelObjectOwnersRequest(int local_id, IClientAPI remote_client) |
904 | { | 904 | { |
905 | landList[local_id].sendLandObjectOwners(remote_client); | 905 | lock (landList) |
906 | { | ||
907 | if (landList.ContainsKey(local_id)) | ||
908 | { | ||
909 | landList[local_id].sendLandObjectOwners(remote_client); | ||
910 | } | ||
911 | else | ||
912 | { | ||
913 | System.Console.WriteLine("[PARCEL]: Invalid land object passed for parcel object owner request"); | ||
914 | } | ||
915 | } | ||
906 | } | 916 | } |
907 | 917 | ||
908 | public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client) | 918 | public void handleParcelAbandonRequest(int local_id, IClientAPI remote_client) |
@@ -1004,6 +1014,24 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
1004 | AddLandObject(new_land); | 1014 | AddLandObject(new_land); |
1005 | } | 1015 | } |
1006 | 1016 | ||
1017 | public void ReturnObjectsInParcel(int localID, uint returnType, LLUUID[] agentIDs, LLUUID[] taskIDs, IClientAPI remoteClient) | ||
1018 | { | ||
1019 | ILandObject selectedParcel = null; | ||
1020 | lock (landList) | ||
1021 | { | ||
1022 | if (landList.ContainsKey(localID)) | ||
1023 | selectedParcel = landList[localID]; | ||
1024 | } | ||
1025 | if (selectedParcel == null) | ||
1026 | return; | ||
1027 | |||
1028 | if (returnType == 16) // parcel return | ||
1029 | { | ||
1030 | selectedParcel.returnLandObjects(returnType, agentIDs, remoteClient); | ||
1031 | } | ||
1032 | |||
1033 | } | ||
1034 | |||
1007 | public void NoLandDataFromStorage() | 1035 | public void NoLandDataFromStorage() |
1008 | { | 1036 | { |
1009 | ResetSimLandObjects(); | 1037 | ResetSimLandObjects(); |
diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 98f3a3a..1a83f60 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs | |||
@@ -683,13 +683,25 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
683 | public Dictionary<LLUUID, int> getLandObjectOwners() | 683 | public Dictionary<LLUUID, int> getLandObjectOwners() |
684 | { | 684 | { |
685 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); | 685 | Dictionary<LLUUID, int> ownersAndCount = new Dictionary<LLUUID, int>(); |
686 | foreach (SceneObjectGroup obj in primsOverMe) | 686 | lock (primsOverMe) |
687 | { | 687 | { |
688 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | 688 | try |
689 | { | ||
690 | |||
691 | foreach (SceneObjectGroup obj in primsOverMe) | ||
692 | { | ||
693 | if (!ownersAndCount.ContainsKey(obj.OwnerID)) | ||
694 | { | ||
695 | ownersAndCount.Add(obj.OwnerID, 0); | ||
696 | } | ||
697 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | ||
698 | } | ||
699 | } | ||
700 | catch (InvalidOperationException) | ||
689 | { | 701 | { |
690 | ownersAndCount.Add(obj.OwnerID, 0); | 702 | m_log.Error("[LAND]: Unable to enumerate land owners. arr."); |
691 | } | 703 | } |
692 | ownersAndCount[obj.OwnerID] += obj.PrimCount; | 704 | |
693 | } | 705 | } |
694 | return ownersAndCount; | 706 | return ownersAndCount; |
695 | } | 707 | } |
@@ -700,10 +712,33 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
700 | 712 | ||
701 | public void returnObject(SceneObjectGroup obj) | 713 | public void returnObject(SceneObjectGroup obj) |
702 | { | 714 | { |
715 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
716 | objs[0] = obj; | ||
717 | m_scene.returnObjects(objs, obj.OwnerID); | ||
703 | } | 718 | } |
704 | 719 | ||
705 | public void returnLandObjects(int type, LLUUID owner) | 720 | public void returnLandObjects(uint type, LLUUID[] owners, IClientAPI remote_client) |
706 | { | 721 | { |
722 | List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(); | ||
723 | for (int i = 0; i < owners.Length; i++) | ||
724 | { | ||
725 | lock (primsOverMe) | ||
726 | { | ||
727 | try | ||
728 | { | ||
729 | foreach (SceneObjectGroup obj in primsOverMe) | ||
730 | { | ||
731 | if (obj.OwnerID == owners[i]) | ||
732 | objlist.Add(obj); | ||
733 | } | ||
734 | } | ||
735 | catch (InvalidOperationException) | ||
736 | { | ||
737 | m_log.Info("[PARCEL]: Unable to figure out all the objects owned by " + owners[i].ToString() + " arr."); | ||
738 | } | ||
739 | } | ||
740 | } | ||
741 | m_scene.returnObjects(objlist.ToArray(), remote_client.AgentId); | ||
707 | } | 742 | } |
708 | 743 | ||
709 | #endregion | 744 | #endregion |
@@ -716,7 +751,8 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
716 | landData.ownerPrims = 0; | 751 | landData.ownerPrims = 0; |
717 | landData.otherPrims = 0; | 752 | landData.otherPrims = 0; |
718 | landData.selectedPrims = 0; | 753 | landData.selectedPrims = 0; |
719 | primsOverMe.Clear(); | 754 | lock (primsOverMe) |
755 | primsOverMe.Clear(); | ||
720 | } | 756 | } |
721 | 757 | ||
722 | public void addPrimToCount(SceneObjectGroup obj) | 758 | public void addPrimToCount(SceneObjectGroup obj) |
@@ -740,30 +776,34 @@ namespace OpenSim.Region.Environment.Modules.World.Land | |||
740 | } | 776 | } |
741 | } | 777 | } |
742 | 778 | ||
743 | primsOverMe.Add(obj); | 779 | lock (primsOverMe) |
780 | primsOverMe.Add(obj); | ||
744 | } | 781 | } |
745 | 782 | ||
746 | public void removePrimFromCount(SceneObjectGroup obj) | 783 | public void removePrimFromCount(SceneObjectGroup obj) |
747 | { | 784 | { |
748 | if (primsOverMe.Contains(obj)) | 785 | lock (primsOverMe) |
749 | { | 786 | { |
750 | LLUUID prim_owner = obj.OwnerID; | 787 | if (primsOverMe.Contains(obj)) |
751 | int prim_count = obj.PrimCount; | ||
752 | |||
753 | if (prim_owner == landData.ownerID) | ||
754 | { | ||
755 | landData.ownerPrims -= prim_count; | ||
756 | } | ||
757 | else if (prim_owner == landData.groupID) | ||
758 | { | ||
759 | landData.groupPrims -= prim_count; | ||
760 | } | ||
761 | else | ||
762 | { | 788 | { |
763 | landData.otherPrims -= prim_count; | 789 | LLUUID prim_owner = obj.OwnerID; |
764 | } | 790 | int prim_count = obj.PrimCount; |
765 | 791 | ||
766 | primsOverMe.Remove(obj); | 792 | if (prim_owner == landData.ownerID) |
793 | { | ||
794 | landData.ownerPrims -= prim_count; | ||
795 | } | ||
796 | else if (prim_owner == landData.groupID) | ||
797 | { | ||
798 | landData.groupPrims -= prim_count; | ||
799 | } | ||
800 | else | ||
801 | { | ||
802 | landData.otherPrims -= prim_count; | ||
803 | } | ||
804 | |||
805 | primsOverMe.Remove(obj); | ||
806 | } | ||
767 | } | 807 | } |
768 | } | 808 | } |
769 | 809 | ||
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index 71ea0e4..cd5ca61 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -243,6 +243,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
243 | public event ParcelJoinRequest OnParcelJoinRequest; | 243 | public event ParcelJoinRequest OnParcelJoinRequest; |
244 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; | 244 | public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; |
245 | public event ParcelAbandonRequest OnParcelAbandonRequest; | 245 | public event ParcelAbandonRequest OnParcelAbandonRequest; |
246 | public event ParcelReturnObjectsRequest OnParcelReturnObjectsRequest; | ||
246 | public event ParcelAccessListRequest OnParcelAccessListRequest; | 247 | public event ParcelAccessListRequest OnParcelAccessListRequest; |
247 | public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; | 248 | public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest; |
248 | public event ParcelSelectObjects OnParcelSelectObjects; | 249 | public event ParcelSelectObjects OnParcelSelectObjects; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index a284ba5..850962d 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -1690,31 +1690,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
1690 | //returnstring += "</scene>\n"; | 1690 | //returnstring += "</scene>\n"; |
1691 | 1691 | ||
1692 | 1692 | ||
1693 | CachedUserInfo userInfo = | 1693 | |
1694 | CommsManager.UserProfileCacheService.GetUserDetails(AgentId); | ||
1695 | if (userInfo != null) | ||
1696 | { | ||
1697 | LLUUID folderID = LLUUID.Zero; | ||
1698 | |||
1699 | List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders(); | ||
1700 | foreach (InventoryFolderBase flder in subrootfolders) | ||
1701 | { | ||
1702 | if (flder.Name == "Lost And Found") | ||
1703 | { | ||
1704 | folderID = flder.ID; | ||
1705 | break; | ||
1706 | } | ||
1707 | } | ||
1708 | |||
1709 | if (folderID == LLUUID.Zero) | ||
1710 | { | ||
1711 | folderID = userInfo.RootFolder.ID; | ||
1712 | } | ||
1713 | 1694 | ||
1714 | bool permissionToDelete = false; | 1695 | bool permissionToDelete = false; |
1715 | 1696 | ||
1716 | for (int i = 0; i < returnobjects.Length; i++) | 1697 | for (int i = 0; i < returnobjects.Length; i++) |
1717 | { | 1698 | { |
1699 | CachedUserInfo userInfo = | ||
1700 | CommsManager.UserProfileCacheService.GetUserDetails(returnobjects[i].OwnerID); | ||
1701 | if (userInfo != null) | ||
1702 | { | ||
1703 | LLUUID folderID = LLUUID.Zero; | ||
1704 | |||
1705 | List<InventoryFolderBase> subrootfolders = userInfo.RootFolder.RequestListOfFolders(); | ||
1706 | foreach (InventoryFolderBase flder in subrootfolders) | ||
1707 | { | ||
1708 | if (flder.Name == "Lost And Found") | ||
1709 | { | ||
1710 | folderID = flder.ID; | ||
1711 | break; | ||
1712 | } | ||
1713 | } | ||
1714 | |||
1715 | if (folderID == LLUUID.Zero) | ||
1716 | { | ||
1717 | folderID = userInfo.RootFolder.ID; | ||
1718 | } | ||
1718 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId); | 1719 | permissionToDelete = ExternalChecks.ExternalChecksCanDeleteObject(returnobjects[i].UUID, AgentId); |
1719 | 1720 | ||
1720 | // If the user doesn't have permission, go on to the next one. | 1721 | // If the user doesn't have permission, go on to the next one. |
@@ -1732,7 +1733,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1732 | 1733 | ||
1733 | InventoryItemBase item = new InventoryItemBase(); | 1734 | InventoryItemBase item = new InventoryItemBase(); |
1734 | item.Creator = returnobjects[i].RootPart.CreatorID; | 1735 | item.Creator = returnobjects[i].RootPart.CreatorID; |
1735 | item.Owner = AgentId; | 1736 | item.Owner = returnobjects[i].OwnerID; |
1736 | item.ID = LLUUID.Random(); | 1737 | item.ID = LLUUID.Random(); |
1737 | item.AssetID = asset.FullID; | 1738 | item.AssetID = asset.FullID; |
1738 | item.Description = asset.Description; | 1739 | item.Description = asset.Description; |
@@ -1768,7 +1769,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1768 | // TODO: add the new fields (Flags, Sale info, etc) | 1769 | // TODO: add the new fields (Flags, Sale info, etc) |
1769 | 1770 | ||
1770 | userInfo.AddItem(item); | 1771 | userInfo.AddItem(item); |
1771 | 1772 | ||
1773 | ScenePresence notifyUser = GetScenePresence(item.Owner); | ||
1774 | if (notifyUser != null) | ||
1775 | { | ||
1776 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); | ||
1777 | } | ||
1778 | |||
1772 | SceneObjectGroup ObjectDeleting = returnobjects[i]; | 1779 | SceneObjectGroup ObjectDeleting = returnobjects[i]; |
1773 | 1780 | ||
1774 | returnobjects[i] = null; | 1781 | returnobjects[i] = null; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 71c5b18..a42bad5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1660,6 +1660,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1660 | client.OnSetStartLocationRequest += SetHomeRezPoint; | 1660 | client.OnSetStartLocationRequest += SetHomeRezPoint; |
1661 | client.OnUndo += m_innerScene.HandleUndo; | 1661 | client.OnUndo += m_innerScene.HandleUndo; |
1662 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; | 1662 | client.OnObjectGroupRequest += m_innerScene.HandleObjectGroupUpdate; |
1663 | client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; | ||
1663 | 1664 | ||
1664 | // EventManager.TriggerOnNewClient(client); | 1665 | // EventManager.TriggerOnNewClient(client); |
1665 | } | 1666 | } |