diff options
author | Melanie | 2010-12-21 20:47:00 +0000 |
---|---|---|
committer | Melanie | 2010-12-21 20:49:31 +0000 |
commit | 043dace1184b14c1b07863c2ffabaf5e24fb53c4 (patch) | |
tree | 694712bc17b61db47a6a2033de4b17d46894ac96 /OpenSim/Region | |
parent | Shooting in the dark for solutions to the appearance problem (diff) | |
download | opensim-SC_OLD-043dace1184b14c1b07863c2ffabaf5e24fb53c4.zip opensim-SC_OLD-043dace1184b14c1b07863c2ffabaf5e24fb53c4.tar.gz opensim-SC_OLD-043dace1184b14c1b07863c2ffabaf5e24fb53c4.tar.bz2 opensim-SC_OLD-043dace1184b14c1b07863c2ffabaf5e24fb53c4.tar.xz |
Make prim inventories a bit more sane
Diffstat (limited to '')
4 files changed, 39 insertions, 108 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 64664ab..15060fd 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -194,13 +194,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
194 | int RemoveInventoryItem(UUID itemID); | 194 | int RemoveInventoryItem(UUID itemID); |
195 | 195 | ||
196 | /// <summary> | 196 | /// <summary> |
197 | /// Return the name with which a client can request a xfer of this prim's inventory metadata | ||
198 | /// </summary> | ||
199 | string GetInventoryFileName(); | ||
200 | |||
201 | bool GetInventoryFileName(IClientAPI client, uint localID); | ||
202 | |||
203 | /// <summary> | ||
204 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client | 197 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client |
205 | /// </summary> | 198 | /// </summary> |
206 | /// <param name="xferManager"></param> | 199 | /// <param name="xferManager"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 2cf0ced..321d0aa 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -949,23 +949,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
949 | /// <param name="primLocalID"></param> | 949 | /// <param name="primLocalID"></param> |
950 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) | 950 | public void RequestTaskInventory(IClientAPI remoteClient, uint primLocalID) |
951 | { | 951 | { |
952 | SceneObjectGroup group = GetGroupByPrim(primLocalID); | 952 | SceneObjectPart part = GetSceneObjectPart(primLocalID); |
953 | if (group != null) | 953 | if (part == null) |
954 | { | 954 | return; |
955 | bool fileChange = group.GetPartInventoryFileName(remoteClient, primLocalID); | 955 | |
956 | if (fileChange) | 956 | if (XferManager != null) |
957 | { | 957 | part.Inventory.RequestInventoryFile(remoteClient, XferManager); |
958 | if (XferManager != null) | ||
959 | { | ||
960 | group.RequestInventoryFile(remoteClient, primLocalID, XferManager); | ||
961 | } | ||
962 | } | ||
963 | } | ||
964 | else | ||
965 | { | ||
966 | m_log.ErrorFormat( | ||
967 | "[PRIM INVENTORY]: Inventory requested of prim {0} which doesn't exist", primLocalID); | ||
968 | } | ||
969 | } | 958 | } |
970 | 959 | ||
971 | /// <summary> | 960 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index a86223c..982e280 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -81,49 +81,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
81 | } | 81 | } |
82 | 82 | ||
83 | /// <summary> | 83 | /// <summary> |
84 | /// | ||
85 | /// </summary> | ||
86 | /// <param name="remoteClient"></param> | ||
87 | /// <param name="localID"></param> | ||
88 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | ||
89 | { | ||
90 | SceneObjectPart part = GetChildPart(localID); | ||
91 | if (part != null) | ||
92 | { | ||
93 | return part.Inventory.GetInventoryFileName(remoteClient, localID); | ||
94 | } | ||
95 | else | ||
96 | { | ||
97 | m_log.ErrorFormat( | ||
98 | "[PRIM INVENTORY]: " + | ||
99 | "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", | ||
100 | localID, Name, UUID); | ||
101 | } | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | /// <summary> | ||
106 | /// Return serialized inventory metadata for the given constituent prim | ||
107 | /// </summary> | ||
108 | /// <param name="localID"></param> | ||
109 | /// <param name="xferManager"></param> | ||
110 | public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) | ||
111 | { | ||
112 | SceneObjectPart part = GetChildPart(localID); | ||
113 | if (part != null) | ||
114 | { | ||
115 | part.Inventory.RequestInventoryFile(client, xferManager); | ||
116 | } | ||
117 | else | ||
118 | { | ||
119 | m_log.ErrorFormat( | ||
120 | "[PRIM INVENTORY]: " + | ||
121 | "Couldn't find part {0} in object group {1}, {2} to request inventory data", | ||
122 | localID, Name, UUID); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | /// <summary> | ||
127 | /// Add an inventory item to a prim in this group. | 84 | /// Add an inventory item to a prim in this group. |
128 | /// </summary> | 85 | /// </summary> |
129 | /// <param name="remoteClient"></param> | 86 | /// <param name="remoteClient"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6a204c3..ac69f16 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
47 | 47 | ||
48 | private string m_inventoryFileName = String.Empty; | 48 | private string m_inventoryFileName = String.Empty; |
49 | private byte[] m_inventoryFileData = new byte[0]; | ||
49 | private int m_inventoryFileNameSerial = 0; | 50 | private int m_inventoryFileNameSerial = 0; |
50 | 51 | ||
51 | /// <value> | 52 | /// <value> |
@@ -765,39 +766,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
765 | return -1; | 766 | return -1; |
766 | } | 767 | } |
767 | 768 | ||
768 | public string GetInventoryFileName() | 769 | private bool CreateInventoryFileName() |
769 | { | 770 | { |
770 | if (m_inventoryFileName == String.Empty) | 771 | if (m_inventoryFileName == String.Empty || |
771 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; | 772 | m_inventoryFileNameSerial < m_inventorySerial) |
772 | if (m_inventoryFileNameSerial < m_inventorySerial) | ||
773 | { | 773 | { |
774 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; | 774 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; |
775 | } | ||
776 | return m_inventoryFileName; | ||
777 | } | ||
778 | |||
779 | /// <summary> | ||
780 | /// Return the name with which a client can request a xfer of this prim's inventory metadata | ||
781 | /// </summary> | ||
782 | /// <param name="client"></param> | ||
783 | /// <param name="localID"></param> | ||
784 | public bool GetInventoryFileName(IClientAPI client, uint localID) | ||
785 | { | ||
786 | // m_log.DebugFormat( | ||
787 | // "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", | ||
788 | // client.AgentId, Name, UUID); | ||
789 | |||
790 | if (m_inventorySerial > 0) | ||
791 | { | ||
792 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
793 | Utils.StringToBytes(GetInventoryFileName())); | ||
794 | return true; | 775 | return true; |
795 | } | 776 | } |
796 | else | 777 | |
797 | { | 778 | return false; |
798 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
799 | return false; | ||
800 | } | ||
801 | } | 779 | } |
802 | 780 | ||
803 | /// <summary> | 781 | /// <summary> |
@@ -806,19 +784,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
806 | /// <param name="xferManager"></param> | 784 | /// <param name="xferManager"></param> |
807 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | 785 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) |
808 | { | 786 | { |
809 | byte[] fileData = new byte[0]; | 787 | bool changed = CreateInventoryFileName(); |
810 | 788 | ||
811 | // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches | ||
812 | // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality | ||
813 | // isn't available (such as drag from prim inventory to agent inventory) | ||
814 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 789 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
815 | 790 | ||
816 | bool includeAssets = false; | ||
817 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) | ||
818 | includeAssets = true; | ||
819 | |||
820 | lock (m_items) | 791 | lock (m_items) |
821 | { | 792 | { |
793 | if (m_inventorySerial == 0) // No inventory | ||
794 | { | ||
795 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
796 | return; | ||
797 | } | ||
798 | |||
799 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
800 | Util.StringToBytes256(m_inventoryFileName)); | ||
801 | |||
802 | if (!changed) | ||
803 | { | ||
804 | if (m_inventoryFileData.Length > 2) | ||
805 | { | ||
806 | xferManager.AddNewFile(m_inventoryFileName, | ||
807 | m_inventoryFileData); | ||
808 | } | ||
809 | } | ||
810 | |||
811 | bool includeAssets = false; | ||
812 | if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId)) | ||
813 | includeAssets = true; | ||
814 | |||
822 | foreach (TaskInventoryItem item in m_items.Values) | 815 | foreach (TaskInventoryItem item in m_items.Values) |
823 | { | 816 | { |
824 | UUID ownerID = item.OwnerID; | 817 | UUID ownerID = item.OwnerID; |
@@ -868,14 +861,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
868 | } | 861 | } |
869 | } | 862 | } |
870 | 863 | ||
871 | fileData = Utils.StringToBytes(invString.BuildString); | 864 | int count = m_items.Count; |
872 | 865 | ||
873 | //m_log.Debug(Utils.BytesToString(fileData)); | 866 | m_inventoryFileData = Utils.StringToBytes(invString.BuildString); |
874 | //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Utils.BytesToString(fileData)); | ||
875 | 867 | ||
876 | if (fileData.Length > 2) | 868 | if (m_inventoryFileData.Length > 2) |
877 | { | 869 | { |
878 | xferManager.AddNewFile(m_inventoryFileName, fileData); | 870 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); |
879 | } | 871 | } |
880 | } | 872 | } |
881 | 873 | ||