From 7cedb098699fe31ac906c95d1b1fd906dd502955 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 6 Jan 2008 01:16:06 +0000 Subject: Prim inventory phase 4. Properly recover the prim folder ID from storage. Scripts now show up in prim inventories after region restart. Probably doesn't yet work for any items other than scripts. Still some work to do. No user functionality exposed. Not yet user tieable into normal code. --- .../Region/Environment/Scenes/SceneObjectPart.cs | 98 +++++++++++++++++----- 1 file changed, 76 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 051884d..2ddcf7b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -56,7 +56,21 @@ namespace OpenSim.Region.Environment.Scenes private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; private string m_inventoryFileName = ""; + + /// + /// The inventory folder for this prim + /// private LLUUID m_folderID = LLUUID.Zero; + + /// + /// Exposing this is not particularly good, but it's one of the least evils at the moment to see + /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim. + /// + public LLUUID FolderID + { + get { return m_folderID; } + set { m_folderID = value; } + } [XmlIgnore] public PhysicsActor PhysActor = null; @@ -67,14 +81,9 @@ namespace OpenSim.Region.Environment.Scenes = new Dictionary(); [XmlIgnore] - /// - /// Not really ideal to allow this to be set, but currently expedient for inserting a prim inventory - /// from persistence. - /// public IDictionary TaskInventory { get { return m_taskInventory; } - set { m_taskInventory = value; } } public LLUUID LastOwnerID; @@ -1059,6 +1068,10 @@ namespace OpenSim.Region.Environment.Scenes #region Inventory + /// + /// Add an item to this prim's inventory. + /// + /// public void AddInventoryItem(TaskInventoryItem item) { item.parent_id = m_folderID; @@ -1067,6 +1080,21 @@ namespace OpenSim.Region.Environment.Scenes m_taskInventory.Add(item.item_id, item); m_inventorySerial++; } + + /// + /// Add a whole collection of items to the prim's inventory at once. We assume that the items already + /// have all their fields correctly filled out. + /// + /// + public void AddInventoryItems(ICollection items) + { + foreach (TaskInventoryItem item in items) + { + m_taskInventory.Add(item.item_id, item); + } + + m_inventorySerial++; + } public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) { @@ -1077,7 +1105,7 @@ namespace OpenSim.Region.Environment.Scenes string type = m_taskInventory[itemID].inv_type; m_taskInventory.Remove(itemID); m_inventorySerial++; - if (type == "lsltext") + if (type == "lsl_text") { return 10; } @@ -1110,7 +1138,7 @@ namespace OpenSim.Region.Environment.Scenes } } - public string RequestInventoryFile(IXfer xferManager) + public void RequestInventoryFile(IXfer xferManager) { byte[] fileData = new byte[0]; InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID); @@ -1141,12 +1169,16 @@ namespace OpenSim.Region.Environment.Scenes invString.AddNameValueLine("creation_date", item.creation_date.ToString()); invString.AddSectionEnd(); } + fileData = Helpers.StringToField(invString.BuildString); + +// MainLog.Instance.Verbose( +// "PRIMINVENTORY", "RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData)); + if (fileData.Length > 2) { xferManager.AddNewFile(m_inventoryFileName, fileData); } - return ""; } #endregion @@ -1707,21 +1739,43 @@ namespace OpenSim.Region.Environment.Scenes public class TaskInventoryItem { + /// + /// Inventory types + /// + public static string[] InvTypes = new string[] + { + "texture", + "sound", + "", + "", + "", + "", + "", + "", + "", + "", + "lsl_text", + "" + }; + + /// + /// Asset types + /// public static string[] Types = new string[] - { - "texture", - "sound", - "", - "", - "", - "", - "", - "", - "", - "", - "lsltext", - "" - }; + { + "texture", + "sound", + "", + "", + "", + "", + "", + "", + "", + "", + "lsltext", + "" + }; public LLUUID item_id = LLUUID.Zero; public LLUUID parent_id = LLUUID.Zero; //parent folder id -- cgit v1.1