From 959872315f67a1a33a2bae7330749f7dd74a4774 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 8 Aug 2015 12:12:50 -0700 Subject: WARNING: massive refactor to follow libomv's latest changes regarding inventory folders. The newest version of libomv itself is committed here. Basically, everything that was using the AssetType enum has been combed through; many of those uses were changed to the new FolderType enum. This means that from now on, [new] root folders have code 8 (FolderType.Root), as the viewers expect, as opposed to 9, which was what we had been doing. Normal folders are as they were, -1. Also now sending folder code 100 for Suitcase folders to viewers, with no filter. All tests pass, but fingers crossed! --- .../RemoteController/RemoteAdminPlugin.cs | 29 +++--- .../Tests/FetchInventory2HandlerTests.cs | 4 +- .../FetchInventoryDescendents2HandlerTests.cs | 6 +- OpenSim/Framework/AssetBase.cs | 10 +-- OpenSim/Framework/InventoryFolderBase.cs | 3 + OpenSim/Framework/InventoryItemBase.cs | 6 +- OpenSim/Framework/SLUtil.cs | 68 +++++++++----- .../Framework/Serialization/ArchiveConstants.cs | 10 +-- OpenSim/Framework/Tests/AssetBaseTest.cs | 4 - .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 4 +- .../Caps/Tests/WebFetchInvDescModuleTests.cs | 4 +- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 9 +- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Attachments/Tests/AttachmentsModuleTests.cs | 8 +- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 16 ++-- .../Avatar/Friends/CallingCardModule.cs | 4 +- .../Archiver/InventoryArchiveReadRequest.cs | 8 +- .../Inventory/Transfer/InventoryTransferModule.cs | 2 +- .../Transfer/Tests/InventoryTransferModuleTests.cs | 8 +- .../InventoryAccess/InventoryAccessModule.cs | 14 +-- .../Framework/Library/LocalInventoryService.cs | 2 +- .../Inventory/HGInventoryBroker.cs | 2 +- .../Inventory/InventoryCache.cs | 12 +-- .../Inventory/LocalInventoryServiceConnector.cs | 2 +- .../Inventory/RemoteXInventoryServiceConnector.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 10 ++- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- .../Inventory/XInventoryServicesConnector.cs | 2 +- .../SimianGrid/SimianInventoryServiceConnector.cs | 6 +- .../HypergridService/HGInventoryService.cs | 4 +- .../HypergridService/HGSuitcaseInventoryService.cs | 82 ++++++++--------- OpenSim/Services/Interfaces/IInventoryService.cs | 2 +- .../Services/InventoryService/XInventoryService.cs | 100 ++++++++++----------- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 2 +- .../UserAccountService/UserAccountService.cs | 4 +- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 2 +- .../Robust/Clients/Inventory/InventoryClient.cs | 8 +- 37 files changed, 238 insertions(+), 225 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 3096323..0228c3c 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -2539,8 +2539,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController try { Dictionary inventoryMap = new Dictionary(); - CopyInventoryFolders(destination, source, AssetType.Clothing, inventoryMap, avatarAppearance); - CopyInventoryFolders(destination, source, AssetType.Bodypart, inventoryMap, avatarAppearance); + CopyInventoryFolders(destination, source, FolderType.Clothing, inventoryMap, avatarAppearance); + CopyInventoryFolders(destination, source, FolderType.BodyPart, inventoryMap, avatarAppearance); AvatarWearable[] wearables = avatarAppearance.Wearables; @@ -2576,20 +2576,20 @@ namespace OpenSim.ApplicationPlugins.RemoteController IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; // Get Clothing folder of receiver - InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, AssetType.Clothing); + InventoryFolderBase destinationFolder = inventoryService.GetFolderForType(destination, FolderType.Clothing); if (destinationFolder == null) throw new Exception("Cannot locate folder(s)"); // Missing destination folder? This should *never* be the case - if (destinationFolder.Type != (short)AssetType.Clothing) + if (destinationFolder.Type != (short)FolderType.Clothing) { destinationFolder = new InventoryFolderBase(); destinationFolder.ID = UUID.Random(); destinationFolder.Name = "Clothing"; destinationFolder.Owner = destination; - destinationFolder.Type = (short)AssetType.Clothing; + destinationFolder.Type = (short)FolderType.Clothing; destinationFolder.ParentID = inventoryService.GetRootFolder(destination).ID; destinationFolder.Version = 1; inventoryService.AddFolder(destinationFolder); // store base record @@ -2707,7 +2707,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController /// This method is called by establishAppearance to copy inventory folders to make /// copies of Clothing and Bodyparts inventory folders and attaches worn attachments /// - private void CopyInventoryFolders(UUID destination, UUID source, AssetType assetType, Dictionary inventoryMap, + private void CopyInventoryFolders(UUID destination, UUID source, FolderType assetType, Dictionary inventoryMap, AvatarAppearance avatarAppearance) { IInventoryService inventoryService = m_application.SceneManager.CurrentOrFirstScene.InventoryService; @@ -2723,9 +2723,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController { sourceFolder = new InventoryFolderBase(); sourceFolder.ID = UUID.Random(); - if (assetType == AssetType.Clothing) { + if (assetType == FolderType.Clothing) + { sourceFolder.Name = "Clothing"; - } else { + } + else + { sourceFolder.Name = "Body Parts"; } sourceFolder.Owner = source; @@ -2741,7 +2744,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController { destinationFolder = new InventoryFolderBase(); destinationFolder.ID = UUID.Random(); - if (assetType == AssetType.Clothing) + if (assetType == FolderType.Clothing) { destinationFolder.Name = "Clothing"; } @@ -2980,16 +2983,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController // m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory", // uic.folders.Count, uic.items.Count); - InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, AssetType.Clothing); + InventoryFolderBase clothingFolder = inventoryService.GetFolderForType(ID, FolderType.Clothing); // This should *never* be the case - if (clothingFolder == null || clothingFolder.Type != (short)AssetType.Clothing) + if (clothingFolder == null || clothingFolder.Type != (short)FolderType.Clothing) { clothingFolder = new InventoryFolderBase(); clothingFolder.ID = UUID.Random(); clothingFolder.Name = "Clothing"; clothingFolder.Owner = ID; - clothingFolder.Type = (short)AssetType.Clothing; + clothingFolder.Type = (short)FolderType.Clothing; clothingFolder.ParentID = inventoryService.GetRootFolder(ID).ID; clothingFolder.Version = 1; inventoryService.AddFolder(clothingFolder); // store base record @@ -3035,7 +3038,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController extraFolder.ID = UUID.Random(); extraFolder.Name = outfitName; extraFolder.Owner = ID; - extraFolder.Type = (short)AssetType.Clothing; + extraFolder.Type = (short)FolderType.Clothing; extraFolder.Version = 1; extraFolder.ParentID = clothingFolder.ID; inventoryService.AddFolder(extraFolder); diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs index 653e791..8af3c64 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventory2HandlerTests.cs @@ -75,7 +75,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests m_rootFolderID = m_scene.InventoryService.GetRootFolder(m_userID).ID; - InventoryFolderBase of = m_scene.InventoryService.GetFolderForType(m_userID, AssetType.Object); + InventoryFolderBase of = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Object); m_objectsFolder = of.ID; // Add 3 objects @@ -90,7 +90,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests m_scene.InventoryService.AddItem(item); } - InventoryFolderBase ncf = m_scene.InventoryService.GetFolderForType(m_userID, AssetType.Notecard); + InventoryFolderBase ncf = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Notecard); m_notecardsFolder = ncf.ID; // Add 5 notecards diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs index 0b66835..2d5531a 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs @@ -74,7 +74,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests m_rootFolderID = m_scene.InventoryService.GetRootFolder(m_userID).ID; - InventoryFolderBase of = m_scene.InventoryService.GetFolderForType(m_userID, AssetType.Object); + InventoryFolderBase of = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Object); m_objectsFolder = of.ID; // Add an object @@ -85,7 +85,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests item.Name = "Some Object"; m_scene.InventoryService.AddItem(item); - InventoryFolderBase ncf = m_scene.InventoryService.GetFolderForType(m_userID, AssetType.Notecard); + InventoryFolderBase ncf = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Notecard); m_notecardsFolder = ncf.ID; // Add a notecard @@ -114,7 +114,7 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests m_scene.InventoryService.AddItem(item); // Add a link to the Objects folder in Test Folder - item.AssetID = m_scene.InventoryService.GetFolderForType(m_userID, AssetType.Object).ID; // use item ID of Objects folder + item.AssetID = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Object).ID; // use item ID of Objects folder item.ID = new UUID("50000000-0000-0000-0000-000000000005"); item.AssetType = (int)AssetType.LinkFolder; item.Folder = folder.ID; diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs index 153a1d0..2f04d2e 100644 --- a/OpenSim/Framework/AssetBase.cs +++ b/OpenSim/Framework/AssetBase.cs @@ -136,7 +136,7 @@ namespace OpenSim.Framework get { return - (Type == (sbyte) AssetType.Animation || + (Type == (sbyte)AssetType.Animation || Type == (sbyte)AssetType.Gesture || Type == (sbyte)AssetType.Simstate || Type == (sbyte)AssetType.Unknown || @@ -146,13 +146,9 @@ namespace OpenSim.Framework Type == (sbyte)AssetType.Texture || Type == (sbyte)AssetType.TextureTGA || Type == (sbyte)AssetType.Folder || - Type == (sbyte)AssetType.RootFolder || - Type == (sbyte)AssetType.LostAndFoundFolder || - Type == (sbyte)AssetType.SnapshotFolder || - Type == (sbyte)AssetType.TrashFolder || Type == (sbyte)AssetType.ImageJPEG || - Type == (sbyte) AssetType.ImageTGA || - Type == (sbyte) AssetType.LSLBytecode); + Type == (sbyte)AssetType.ImageTGA || + Type == (sbyte)AssetType.LSLBytecode); } } diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs index b3457a6..fb66056 100644 --- a/OpenSim/Framework/InventoryFolderBase.cs +++ b/OpenSim/Framework/InventoryFolderBase.cs @@ -34,6 +34,9 @@ namespace OpenSim.Framework /// public class InventoryFolderBase : InventoryNodeBase { + public static readonly string ROOT_FOLDER_NAME = "My Inventory"; + public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase"; + /// /// The folder this folder is contained in /// diff --git a/OpenSim/Framework/InventoryItemBase.cs b/OpenSim/Framework/InventoryItemBase.cs index ce63ee0..f9fd752 100644 --- a/OpenSim/Framework/InventoryItemBase.cs +++ b/OpenSim/Framework/InventoryItemBase.cs @@ -34,11 +34,7 @@ namespace OpenSim.Framework /// Inventory Item - contains all the properties associated with an individual inventory piece. /// public class InventoryItemBase : InventoryNodeBase, ICloneable - { - public static readonly string SUITCASE_FOLDER_NAME = "My Suitcase"; - public static readonly sbyte SUITCASE_FOLDER_TYPE = 100; - public static readonly sbyte SUITCASE_FOLDER_FAKE_TYPE = 8; - + { /// /// The inventory type of the item. This is slightly different from the asset type in some situations. /// diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index 027fc0e..e66d5be 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -64,7 +64,7 @@ namespace OpenSim.Framework private class TypeMapping { private sbyte assetType; - private InventoryType inventoryType; + private sbyte inventoryType; private string contentType; private string contentType2; private string extension; @@ -79,7 +79,7 @@ namespace OpenSim.Framework get { return AssetTypeFromCode(assetType); } } - public InventoryType InventoryType + public sbyte InventoryType { get { return inventoryType; } } @@ -99,7 +99,7 @@ namespace OpenSim.Framework get { return extension; } } - private TypeMapping(sbyte assetType, InventoryType inventoryType, string contentType, string contentType2, string extension) + private TypeMapping(sbyte assetType, sbyte inventoryType, string contentType, string contentType2, string extension) { this.assetType = assetType; this.inventoryType = inventoryType; @@ -108,18 +108,28 @@ namespace OpenSim.Framework this.extension = extension; } - public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string contentType2, string extension) + public TypeMapping(AssetType assetType, sbyte inventoryType, string contentType, string contentType2, string extension) : this((sbyte)assetType, inventoryType, contentType, contentType2, extension) { } + public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string contentType2, string extension) + : this((sbyte)assetType, (sbyte)inventoryType, contentType, contentType2, extension) + { + } + public TypeMapping(AssetType assetType, InventoryType inventoryType, string contentType, string extension) - : this((sbyte)assetType, inventoryType, contentType, null, extension) + : this((sbyte)assetType, (sbyte)inventoryType, contentType, null, extension) + { + } + + public TypeMapping(AssetType assetType, FolderType inventoryType, string contentType, string extension) + : this((sbyte)assetType, (sbyte)inventoryType, contentType, null, extension) { } public TypeMapping(OpenSimAssetType assetType, InventoryType inventoryType, string contentType, string extension) - : this((sbyte)assetType, inventoryType, contentType, null, extension) + : this((sbyte)assetType, (sbyte)inventoryType, contentType, null, extension) { } } @@ -145,53 +155,65 @@ namespace OpenSim.Framework new TypeMapping(AssetType.Object, InventoryType.Object, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"), new TypeMapping(AssetType.Object, InventoryType.Attachment, "application/vnd.ll.primitive", "application/x-metaverse-primitive", "primitive"), new TypeMapping(AssetType.Notecard, InventoryType.Notecard, "application/vnd.ll.notecard", "application/x-metaverse-notecard", "notecard"), - new TypeMapping(AssetType.Folder, InventoryType.Folder, "application/vnd.ll.folder", "folder"), - new TypeMapping(AssetType.RootFolder, InventoryType.RootCategory, "application/vnd.ll.rootfolder", "rootfolder"), new TypeMapping(AssetType.LSLText, InventoryType.LSL, "application/vnd.ll.lsltext", "application/x-metaverse-lsl", "lsl"), new TypeMapping(AssetType.LSLBytecode, InventoryType.LSL, "application/vnd.ll.lslbyte", "application/x-metaverse-lso", "lso"), new TypeMapping(AssetType.Bodypart, InventoryType.Wearable, "application/vnd.ll.bodypart", "application/x-metaverse-bodypart", "bodypart"), - new TypeMapping(AssetType.TrashFolder, InventoryType.Folder, "application/vnd.ll.trashfolder", "trashfolder"), - new TypeMapping(AssetType.SnapshotFolder, InventoryType.Folder, "application/vnd.ll.snapshotfolder", "snapshotfolder"), - new TypeMapping(AssetType.LostAndFoundFolder, InventoryType.Folder, "application/vnd.ll.lostandfoundfolder", "lostandfoundfolder"), new TypeMapping(AssetType.Animation, InventoryType.Animation, "application/vnd.ll.animation", "application/x-metaverse-animation", "animation"), new TypeMapping(AssetType.Gesture, InventoryType.Gesture, "application/vnd.ll.gesture", "application/x-metaverse-gesture", "gesture"), new TypeMapping(AssetType.Simstate, InventoryType.Snapshot, "application/x-metaverse-simstate", "simstate"), - new TypeMapping(AssetType.FavoriteFolder, InventoryType.Unknown, "application/vnd.ll.favoritefolder", "favoritefolder"), new TypeMapping(AssetType.Link, InventoryType.Unknown, "application/vnd.ll.link", "link"), new TypeMapping(AssetType.LinkFolder, InventoryType.Unknown, "application/vnd.ll.linkfolder", "linkfolder"), - new TypeMapping(AssetType.CurrentOutfitFolder, InventoryType.Unknown, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), - new TypeMapping(AssetType.OutfitFolder, InventoryType.Unknown, "application/vnd.ll.outfitfolder", "outfitfolder"), - new TypeMapping(AssetType.MyOutfitsFolder, InventoryType.Unknown, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), new TypeMapping(AssetType.Mesh, InventoryType.Mesh, "application/vnd.ll.mesh", "llm"), + + // The next few items are about inventory folders + new TypeMapping(AssetType.Folder, FolderType.None, "application/vnd.ll.folder", "folder"), + new TypeMapping(AssetType.Folder, FolderType.Root, "application/vnd.ll.rootfolder", "rootfolder"), + new TypeMapping(AssetType.Folder, FolderType.Trash, "application/vnd.ll.trashfolder", "trashfolder"), + new TypeMapping(AssetType.Folder, FolderType.Snapshot, "application/vnd.ll.snapshotfolder", "snapshotfolder"), + new TypeMapping(AssetType.Folder, FolderType.LostAndFound, "application/vnd.ll.lostandfoundfolder", "lostandfoundfolder"), + new TypeMapping(AssetType.Folder, FolderType.Favorites, "application/vnd.ll.favoritefolder", "favoritefolder"), + new TypeMapping(AssetType.Folder, FolderType.CurrentOutfit, "application/vnd.ll.currentoutfitfolder", "currentoutfitfolder"), + new TypeMapping(AssetType.Folder, FolderType.Outfit, "application/vnd.ll.outfitfolder", "outfitfolder"), + new TypeMapping(AssetType.Folder, FolderType.MyOutfits, "application/vnd.ll.myoutfitsfolder", "myoutfitsfolder"), + // This next mappping is an asset to inventory item mapping. + // Note: LL stores folders as assets of type Folder = 8, and it has a corresponding InventoryType = 8 + // OpenSim doesn't store folders as assets, so this mapping should only be used when parsing things from the viewer to the server + new TypeMapping(AssetType.Folder, InventoryType.Folder, "application/vnd.ll.folder", "folder"), + + // OpenSim specific new TypeMapping(OpenSimAssetType.Material, InventoryType.Unknown, "application/llsd+xml", "material") }; private static Dictionary asset2Content; private static Dictionary asset2Extension; - private static Dictionary inventory2Content; + private static Dictionary inventory2Content; private static Dictionary content2Asset; - private static Dictionary content2Inventory; + private static Dictionary content2Inventory; static SLUtil() { asset2Content = new Dictionary(); asset2Extension = new Dictionary(); - inventory2Content = new Dictionary(); + inventory2Content = new Dictionary(); content2Asset = new Dictionary(); - content2Inventory = new Dictionary(); + content2Inventory = new Dictionary(); foreach (TypeMapping mapping in MAPPINGS) { sbyte assetType = mapping.AssetTypeCode; if (!asset2Content.ContainsKey(assetType)) asset2Content.Add(assetType, mapping.ContentType); + if (!asset2Extension.ContainsKey(assetType)) asset2Extension.Add(assetType, mapping.Extension); + if (!inventory2Content.ContainsKey(mapping.InventoryType)) inventory2Content.Add(mapping.InventoryType, mapping.ContentType); + if (!content2Asset.ContainsKey(mapping.ContentType)) content2Asset.Add(mapping.ContentType, assetType); + if (!content2Inventory.ContainsKey(mapping.ContentType)) content2Inventory.Add(mapping.ContentType, mapping.InventoryType); @@ -216,8 +238,8 @@ namespace OpenSim.Framework public static string SLInvTypeToContentType(int invType) { string contentType; - if (!inventory2Content.TryGetValue((InventoryType)invType, out contentType)) - contentType = inventory2Content[InventoryType.Unknown]; + if (!inventory2Content.TryGetValue((sbyte)invType, out contentType)) + contentType = inventory2Content[(sbyte)InventoryType.Unknown]; return contentType; } @@ -231,9 +253,9 @@ namespace OpenSim.Framework public static sbyte ContentTypeToSLInvType(string contentType) { - InventoryType invType; + sbyte invType; if (!content2Inventory.TryGetValue(contentType, out invType)) - invType = InventoryType.Unknown; + invType = (sbyte)InventoryType.Unknown; return (sbyte)invType; } diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs index 73ebfae..ab3c285 100644 --- a/OpenSim/Framework/Serialization/ArchiveConstants.cs +++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs @@ -115,20 +115,16 @@ namespace OpenSim.Framework.Serialization ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageJPEG] = ASSET_EXTENSION_SEPARATOR + "image.jpg"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.ImageTGA] = ASSET_EXTENSION_SEPARATOR + "image.tga"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Landmark] = ASSET_EXTENSION_SEPARATOR + "landmark.txt"; - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LostAndFoundFolder] = ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLBytecode] = ASSET_EXTENSION_SEPARATOR + "bytecode.lso"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.LSLText] = ASSET_EXTENSION_SEPARATOR + "script.lsl"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Mesh] = ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Notecard] = ASSET_EXTENSION_SEPARATOR + "notecard.txt"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Object] = ASSET_EXTENSION_SEPARATOR + "object.xml"; - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.RootFolder] = ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Simstate] = ASSET_EXTENSION_SEPARATOR + "simstate.bin"; // Not sure if we'll ever see this - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SnapshotFolder] = ASSET_EXTENSION_SEPARATOR + "snapshotfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Sound] = ASSET_EXTENSION_SEPARATOR + "sound.ogg"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV] = ASSET_EXTENSION_SEPARATOR + "sound.wav"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.Texture] = ASSET_EXTENSION_SEPARATOR + "texture.jp2"; ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TextureTGA] = ASSET_EXTENSION_SEPARATOR + "texture.tga"; - ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.TrashFolder] = ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"; // Not sure if we'll ever see this ASSET_TYPE_TO_EXTENSION[(sbyte)OpenSimAssetType.Material] = ASSET_EXTENSION_SEPARATOR + "material.xml"; // Not sure if we'll ever see this EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "animation.bvh"] = (sbyte)AssetType.Animation; @@ -140,21 +136,17 @@ namespace OpenSim.Framework.Serialization EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "image.jpg"] = (sbyte)AssetType.ImageJPEG; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "image.tga"] = (sbyte)AssetType.ImageTGA; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "landmark.txt"] = (sbyte)AssetType.Landmark; - EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "lostandfoundfolder.txt"] = (sbyte)AssetType.LostAndFoundFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "bytecode.lso"] = (sbyte)AssetType.LSLBytecode; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "script.lsl"] = (sbyte)AssetType.LSLText; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "mesh.llmesh"] = (sbyte)AssetType.Mesh; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "notecard.txt"] = (sbyte)AssetType.Notecard; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "object.xml"] = (sbyte)AssetType.Object; - EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "rootfolder.txt"] = (sbyte)AssetType.RootFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "simstate.bin"] = (sbyte)AssetType.Simstate; - EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "snapshotfolder.txt"] = (sbyte)AssetType.SnapshotFolder; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "sound.ogg"] = (sbyte)AssetType.Sound; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "sound.wav"] = (sbyte)AssetType.SoundWAV; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.jp2"] = (sbyte)AssetType.Texture; EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "texture.tga"] = (sbyte)AssetType.TextureTGA; - EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "trashfolder.txt"] = (sbyte)AssetType.TrashFolder; - EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material; + EXTENSION_TO_ASSET_TYPE[ASSET_EXTENSION_SEPARATOR + "material.xml"] = (sbyte)OpenSimAssetType.Material; } public static string CreateOarLandDataPath(LandData ld) diff --git a/OpenSim/Framework/Tests/AssetBaseTest.cs b/OpenSim/Framework/Tests/AssetBaseTest.cs index 25d2393..1975a4d 100644 --- a/OpenSim/Framework/Tests/AssetBaseTest.cs +++ b/OpenSim/Framework/Tests/AssetBaseTest.cs @@ -50,19 +50,15 @@ namespace OpenSim.Framework.Tests CheckContainsReferences(AssetType.ImageJPEG , false); CheckContainsReferences(AssetType.ImageTGA , false); CheckContainsReferences(AssetType.Landmark , false); - CheckContainsReferences(AssetType.LostAndFoundFolder, false); CheckContainsReferences(AssetType.LSLBytecode, false); CheckContainsReferences(AssetType.LSLText, false); CheckContainsReferences(AssetType.Notecard, false); CheckContainsReferences(AssetType.Object, false); - CheckContainsReferences(AssetType.RootFolder, false); CheckContainsReferences(AssetType.Simstate, false); - CheckContainsReferences(AssetType.SnapshotFolder, false); CheckContainsReferences(AssetType.Sound, false); CheckContainsReferences(AssetType.SoundWAV, false); CheckContainsReferences(AssetType.Texture, false); CheckContainsReferences(AssetType.TextureTGA, false); - CheckContainsReferences(AssetType.TrashFolder, false); CheckContainsReferences(AssetType.Unknown, false); } diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 985451c..774202e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -554,8 +554,8 @@ namespace OpenSim.Region.ClientStack.Linden if (core.TryGet(out clientInv)) { - var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, AssetType.Texture); - textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)AssetType.Unknown, systemTextureFolder.ID, 1); + var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture); + textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1); if (m_Scene.InventoryService.AddFolder(textureUploadFolder)) { foldersToUpdate.Add(textureUploadFolder); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs index 39209ec..dd4a691 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/Tests/WebFetchInvDescModuleTests.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests PollServiceEventArgs pseArgs; userCaps.TryGetPollHandler("FetchInventoryDescendents2", out pseArgs); req.UriPath = pseArgs.Url; - req.Uri = new Uri(req.UriPath); + req.Uri = new Uri("file://" + req.UriPath); // Retrieve root folder details directly so that we can request InventoryFolderBase folder = scene.InventoryService.GetRootFolder(ua.PrincipalID); @@ -137,6 +137,8 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests req.Body = new MemoryStream(OSDParser.SerializeLLSDXmlBytes(osdReqMap)); TestHttpClientContext context = new TestHttpClientContext(false); + + // WARNING: This results in a caught exception, because queryString is null MainServer.Instance.OnRequest(context, new RequestEventArgs(req)); // Drive processing of the queued inventory request synchronously. diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 284c5fa..c8e5881 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1866,8 +1866,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP newBlock.Name = Util.StringToBytes256(folder.Name); newBlock.ParentID = folder.ParentID; newBlock.Type = (sbyte)folder.Type; - if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) - newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; + //if (newBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) + // newBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; return newBlock; } @@ -2118,8 +2118,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP folderBlock.FolderID = folder.ID; folderBlock.ParentID = folder.ParentID; folderBlock.Type = (sbyte)folder.Type; - if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) - folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; + // Leaving this here for now, just in case we need to do this for a while + //if (folderBlock.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) + // folderBlock.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; folderBlock.Name = Util.StringToBytes256(folder.Name); return folderBlock; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 59c2179..2f67c4e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -908,7 +908,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments InventoryItemBase newItem = m_invAccessModule.CopyToInventory( DeRezAction.TakeCopy, - m_scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object).ID, + m_scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object).ID, new List { grp }, sp.ControllingClient, true)[0]; diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index f0dc238..f1b002b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -224,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(attName)); - InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); + InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object); Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); @@ -271,7 +271,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so.Name)); - InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); + InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object); Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(2)); @@ -304,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); - InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); + InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object); Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); @@ -337,7 +337,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests Assert.That(attachmentItem, Is.Not.Null); Assert.That(attachmentItem.Name, Is.EqualTo(so2.Name)); - InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, AssetType.Object); + InventoryFolderBase targetFolder = scene.InventoryService.GetFolderForType(sp.UUID, FolderType.Object); Assert.That(attachmentItem.Folder, Is.EqualTo(targetFolder.ID)); Assert.That(scene.GetSceneObjectGroups().Count, Is.EqualTo(1)); diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index ea7481d..cfb082b 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -908,8 +908,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory AssetType = (int) - AssetType - .Bodypart, + FolderType + .BodyPart, CreatorId = userID @@ -924,8 +924,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory invService .GetFolderForType (userID, - AssetType - .Bodypart) + FolderType + .BodyPart) .ID, Flags = (uint) type, Name = Enum.GetName(typeof (WearableType), type), @@ -960,8 +960,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory invService .GetFolderForType (userID, - AssetType - .CurrentOutfitFolder) + FolderType + .CurrentOutfit) .ID, Flags = (uint) type, Name = Enum.GetName(typeof (WearableType), type), @@ -978,8 +978,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_scene.SendInventoryUpdate(presence.ControllingClient, invService.GetFolderForType(userID, - AssetType - .CurrentOutfitFolder), + FolderType + .CurrentOutfit), false, true); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs index b44a5c9..eb23e83 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/CallingCardModule.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (folderID == UUID.Zero) { InventoryFolderBase folder = inv.GetFolderForType(userID, - AssetType.CallingCard); + FolderType.CallingCard); if (folder == null) // Nowhere to put it return UUID.Zero; @@ -237,7 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends IInventoryService invService = m_Scenes[0].InventoryService; InventoryFolderBase trashFolder = - invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); + invService.GetFolderForType(client.AgentId, FolderType.Trash); InventoryItemBase item = new InventoryItemBase(transactionID, client.AgentId); item = invService.GetItem(item); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 2ecec9e..4a06fd1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -412,14 +412,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); UUID newFolderId = UUID.Random(); - // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be - // deleted once the client has relogged. - // The root folder appears to be labelled AssetType.Folder (shows up as "Category" in the client) - // even though there is a AssetType.RootCategory destFolder = new InventoryFolderBase( - newFolderId, newFolderName, m_userInfo.PrincipalID, - (short)AssetType.Unknown, destFolder.ID, 1); + newFolderId, newFolderName, m_userInfo.PrincipalID, + (short)FolderType.None, destFolder.ID, 1); m_InventoryService.AddFolder(destFolder); // Record that we have now created this folder diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index c88141c..bba48cc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs @@ -372,7 +372,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer IInventoryService invService = scene.InventoryService; InventoryFolderBase trashFolder = - invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); + invService.GetFolderForType(client.AgentId, FolderType.Trash); UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs index d615cce..7ddc396 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs @@ -236,8 +236,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests InventoryItemBase receivedItem = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); - InventoryFolderBase trashFolder - = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); + InventoryFolderBase trashFolder + = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash); Assert.That(receivedItem, Is.Not.Null); Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID)); @@ -429,8 +429,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests InventoryFolderBase receivedFolder = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); - InventoryFolderBase trashFolder - = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); + InventoryFolderBase trashFolder + = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash); Assert.That(receivedFolder, Is.Not.Null); Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID)); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a77bc63..5a9efb8 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -695,18 +695,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (remoteClient == null || so.OwnerID != remoteClient.AgentId) { - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound); } else { - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Trash); } } else if (action == DeRezAction.Return) { // Dump to lost + found unconditionally // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound); } if (folderID == UUID.Zero && folder == null) @@ -715,7 +715,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { // Deletes go to trash by default // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Trash); } else { @@ -723,14 +723,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { // Taking copy of another person's item. Take to // Objects folder. - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Object); so.FromFolderID = UUID.Zero; } else { // Catch all. Use lost & found // - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.LostAndFound); } } } @@ -748,7 +748,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if(folder.Type == 14 || folder.Type == 16) { // folder.Type = 6; - folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); + folder = m_Scene.InventoryService.GetFolderForType(userID, FolderType.Object); } } } diff --git a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs index e657f53..e1e1838 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LocalInventoryService.cs @@ -175,7 +175,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library /// /// /// - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) { return null; } + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { return null; } /// diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 6a83b42..48f228a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs @@ -345,7 +345,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return root; } - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); InventoryFolderBase f = m_Cache.GetFolderForType(userID, type); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 71dc337..3195e6b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour private static ExpiringCache m_RootFolders = new ExpiringCache(); - private static ExpiringCache> m_FolderTypes = new ExpiringCache>(); + private static ExpiringCache> m_FolderTypes = new ExpiringCache>(); private static ExpiringCache m_Inventories = new ExpiringCache(); public void Cache(UUID userID, InventoryFolderBase root) @@ -58,12 +58,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return null; } - public void Cache(UUID userID, AssetType type, InventoryFolderBase folder) + public void Cache(UUID userID, FolderType type, InventoryFolderBase folder) { - Dictionary ff = null; + Dictionary ff = null; if (!m_FolderTypes.TryGetValue(userID, out ff)) { - ff = new Dictionary(); + ff = new Dictionary(); m_FolderTypes.Add(userID, ff, CACHE_EXPIRATION_SECONDS); } @@ -77,9 +77,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory } } - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { - Dictionary ff = null; + Dictionary ff = null; if (m_FolderTypes.TryGetValue(userID, out ff)) { InventoryFolderBase f = null; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 2f29a7c..20d4e02 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs @@ -170,7 +170,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_InventoryService.GetRootFolder(userID); } - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { return m_InventoryService.GetFolderForType(userID, type); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index e0cc1e8..978b9d9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs @@ -177,7 +177,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory return m_RemoteConnector.GetRootFolder(userID); } - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { return m_RemoteConnector.GetFolderForType(userID, type); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dde54d5..ac27716 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -156,7 +156,9 @@ namespace OpenSim.Region.Framework.Scenes // OK so either the viewer didn't send a folderID or AddItem failed UUID originalFolder = item.Folder; - InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); + InventoryFolderBase f = null; + if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) + f = InventoryService.GetFolderForType(item.Owner, (FolderType)item.AssetType); if (f != null) { m_log.DebugFormat( @@ -743,7 +745,9 @@ namespace OpenSim.Region.Framework.Scenes if (itemCopy.Folder == UUID.Zero) { - InventoryFolderBase folder = InventoryService.GetFolderForType(recipient, (AssetType)itemCopy.AssetType); + InventoryFolderBase folder = null; + if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) + folder = InventoryService.GetFolderForType(recipient, (FolderType)itemCopy.AssetType); if (folder != null) { @@ -1155,7 +1159,7 @@ namespace OpenSim.Region.Framework.Scenes if (item == null) return; - InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); + InventoryFolderBase destFolder = InventoryService.GetFolderForType(remoteClient.AgentId, FolderType.Trash); // Move the item to trash. If this is a copyable item, only // a copy will be moved and we will still need to delete diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index cf0762b..5c4e7a9 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -269,7 +269,7 @@ namespace OpenSim.Server.Handlers.Inventory UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); int type = 0; Int32.TryParse(request["TYPE"].ToString(), out type); - InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); + InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (FolderType)type); if (folder != null) result["folder"] = EncodeFolder(folder); diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 597d92b..b0615b8 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -189,7 +189,7 @@ namespace OpenSim.Services.Connectors return BuildFolder((Dictionary)ret["folder"]); } - public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) { Dictionary ret = MakeRequest("GETFOLDERFORTYPE", new Dictionary { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index a92c4fb..e793420 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -240,7 +240,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// /// /// - public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) + public InventoryFolderBase GetFolderForType(UUID userID, FolderType type) { string contentType = SLUtil.SLAssetTypeToContentType((int)type); @@ -580,7 +580,9 @@ namespace OpenSim.Services.Connectors.SimianGrid // A folder of UUID.Zero means we need to find the most appropriate home for this item if (item.Folder == UUID.Zero) { - InventoryFolderBase folder = GetFolderForType(item.Owner, (AssetType)item.AssetType); + InventoryFolderBase folder = null; + if (Enum.IsDefined(typeof(FolderType), (sbyte)item.AssetType)) + folder = GetFolderForType(item.Owner, (FolderType)item.AssetType); if (folder != null && folder.ID != UUID.Zero) item.Folder = folder.ID; else diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 5f245e4..9158b41 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -115,7 +115,7 @@ namespace OpenSim.Services.HypergridService return ConvertToOpenSim(folders[0]); // make one - XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Suitcase"); + XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)FolderType.Suitcase, "My Suitcase"); return ConvertToOpenSim(suitcase); } @@ -141,7 +141,7 @@ namespace OpenSim.Services.HypergridService //} - public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + public override InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) { //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); return GetRootFolder(principalID); diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index d158537..319c2db 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -158,7 +158,7 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder. Creating it...", principalID); // Create the My Suitcase folder under the user's root folder. // In the DB we tag it as type 100, but we use type 8 (Folder) outside, as this affects the sort order. - suitcase = CreateFolder(principalID, root.folderID, InventoryItemBase.SUITCASE_FOLDER_TYPE, InventoryItemBase.SUITCASE_FOLDER_NAME); + suitcase = CreateFolder(principalID, root.folderID, (int)FolderType.Suitcase, InventoryFolderBase.SUITCASE_FOLDER_NAME); if (suitcase == null) { m_log.ErrorFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to create suitcase folder"); @@ -178,41 +178,41 @@ namespace OpenSim.Services.HypergridService m_log.Debug("[HG SUITCASE INVENTORY SERVICE]: Creating System folders under Suitcase..."); XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootID); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Animation, "Animations"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Bodypart, "Body Parts"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.CallingCard, "Calling Cards"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Clothing, "Clothing"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.FavoriteFolder, "Favorites"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Gesture, "Gestures"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Landmark, "Landmarks"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Notecard, "Notecards"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Object, "Objects"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.SnapshotFolder, "Photo Album"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.LSLText, "Scripts"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Sound, "Sounds"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.Texture, "Textures"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) - CreateFolder(principalID, rootID, (int)AssetType.TrashFolder, "Trash"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Animation) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Animation, "Animations"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.BodyPart) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.BodyPart, "Body Parts"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CallingCard) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.CallingCard, "Calling Cards"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Clothing) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Clothing, "Clothing"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CurrentOutfit) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.CurrentOutfit, "Current Outfit"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Favorites) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Favorites, "Favorites"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Gesture) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Gesture, "Gestures"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Landmark) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Landmark, "Landmarks"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LostAndFound) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.LostAndFound, "Lost And Found"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Notecard) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Notecard, "Notecards"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Object) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Object, "Objects"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Snapshot) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Snapshot, "Photo Album"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.LSLText, "Scripts"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Sound, "Sounds"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Texture, "Textures"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; })) + CreateFolder(principalID, rootID, (int)FolderType.Trash, "Trash"); } - public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + public override InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) { //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); @@ -468,7 +468,7 @@ namespace OpenSim.Services.HypergridService { XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "folderName", "type" }, - new string[] { principalID.ToString(), "My Inventory", ((int)AssetType.RootFolder).ToString() }); + new string[] { principalID.ToString(), InventoryFolderBase.ROOT_FOLDER_NAME, ((int)FolderType.Root).ToString() }); if (folders != null && folders.Length > 0) return folders[0]; @@ -476,7 +476,7 @@ namespace OpenSim.Services.HypergridService // OK, so the RootFolder type didn't work. Let's look for any type with parent UUID.Zero. folders = m_Database.GetFolders( new string[] { "agentID", "folderName", "parentFolderID" }, - new string[] { principalID.ToString(), "My Inventory", UUID.Zero.ToString() }); + new string[] { principalID.ToString(), InventoryFolderBase.ROOT_FOLDER_NAME, UUID.Zero.ToString() }); if (folders != null && folders.Length > 0) return folders[0]; @@ -492,7 +492,7 @@ namespace OpenSim.Services.HypergridService XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type", "parentFolderID" }, - new string[] { userID.ToString(), ((int)AssetType.CurrentOutfitFolder).ToString(), root.folderID.ToString() }); + new string[] { userID.ToString(), ((int)FolderType.CurrentOutfit).ToString(), root.folderID.ToString() }); if (folders.Length == 0) return null; @@ -505,7 +505,7 @@ namespace OpenSim.Services.HypergridService // Warp! Root folder for travelers XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type" }, - new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_TYPE.ToString() }); // This is a special folder type... + new string[] { principalID.ToString(), FolderType.Suitcase.ToString() }); if (folders != null && folders.Length > 0) return folders[0]; @@ -513,13 +513,13 @@ namespace OpenSim.Services.HypergridService // check to see if we have the old Suitcase folder folders = m_Database.GetFolders( new string[] { "agentID", "folderName", "parentFolderID" }, - new string[] { principalID.ToString(), InventoryItemBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() }); + new string[] { principalID.ToString(), InventoryFolderBase.SUITCASE_FOLDER_NAME, UUID.Zero.ToString() }); if (folders != null && folders.Length > 0) { // Move it to under the root folder XInventoryFolder root = GetRootXFolder(principalID); folders[0].parentFolderID = root.folderID; - folders[0].type = InventoryItemBase.SUITCASE_FOLDER_TYPE; + folders[0].type = (int)FolderType.Suitcase; m_Database.StoreFolder(folders[0]); return folders[0]; } @@ -529,7 +529,7 @@ namespace OpenSim.Services.HypergridService private void SetAsNormalFolder(XInventoryFolder suitcase) { - suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; + //suitcase.type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; } private List GetFolderTree(UUID principalID, UUID folder) diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 1e8652c..4289bba 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs @@ -67,7 +67,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - InventoryFolderBase GetFolderForType(UUID userID, AssetType type); + InventoryFolderBase GetFolderForType(UUID userID, FolderType type); /// /// Gets everything (folders and items) inside a folder diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 64f727c..b75193f 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -111,48 +111,48 @@ namespace OpenSim.Services.InventoryService if (rootFolder == null) { - rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory")); + rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)FolderType.Root, InventoryFolderBase.ROOT_FOLDER_NAME)); result = true; } XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Animation) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Animation, "Animations"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.BodyPart) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.BodyPart, "Body Parts"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CallingCard) return true; return false; })) { - XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); - folder = CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "Friends"); - CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "All"); + XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)FolderType.CallingCard, "Calling Cards"); + folder = CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "Friends"); + CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "All"); } - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.FavoriteFolder, "Favorites"); - if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures"); - if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) - CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Clothing) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Clothing, "Clothing"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CurrentOutfit) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.CurrentOutfit, "Current Outfit"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Favorites) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Favorites, "Favorites"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Gesture) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Gesture, "Gestures"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Landmark) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Landmark, "Landmarks"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LostAndFound) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.LostAndFound, "Lost And Found"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Notecard) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Notecard, "Notecards"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Object) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Object, "Objects"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Snapshot) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Snapshot, "Photo Album"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.LSLText, "Scripts"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Sound, "Sounds"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Texture, "Textures"); + if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; })) + CreateFolder(principalID, rootFolder.ID, (int)FolderType.Trash, "Trash"); return result; } @@ -228,7 +228,7 @@ namespace OpenSim.Services.InventoryService XInventoryFolder root = null; foreach (XInventoryFolder folder in folders) { - if (folder.folderName == "My Inventory") + if (folder.folderName == InventoryFolderBase.ROOT_FOLDER_NAME) { root = folder; break; @@ -241,7 +241,7 @@ namespace OpenSim.Services.InventoryService return ConvertToOpenSim(root); } - public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) + public virtual InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); @@ -259,11 +259,11 @@ namespace OpenSim.Services.InventoryService return GetSystemFolderForType(rootFolder, type); } - private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) + private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, FolderType type) { //m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0}", type); - - if (type == AssetType.RootFolder) + + if (type == FolderType.Root) return rootFolder; XInventoryFolder[] folders = m_Database.GetFolders( @@ -363,7 +363,7 @@ namespace OpenSim.Services.InventoryService if (check != null) return false; - if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) + if (folder.Type != (short)FolderType.None) { InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); @@ -380,7 +380,7 @@ namespace OpenSim.Services.InventoryService if (folder.ParentID == rootFolder.ID) { InventoryFolderBase existingSystemFolder - = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); + = GetSystemFolderForType(rootFolder, (FolderType)folder.Type); if (existingSystemFolder != null) { @@ -407,8 +407,8 @@ namespace OpenSim.Services.InventoryService if (check == null) return AddFolder(folder); - if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown) - && (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder)) + if ((check.Type != (short)FolderType.None || xFolder.type != (short)FolderType.None) + && (check.Type != (short)FolderType.Outfit || xFolder.type != (short)FolderType.Outfit)) { if (xFolder.version < check.Version) { @@ -672,9 +672,9 @@ namespace OpenSim.Services.InventoryService newFolder.ParentID = folder.parentFolderID; newFolder.Type = (short)folder.type; - // Viewer can't understand anything that's not in it's LLFolderType enum - if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) - newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; + //// Viewer can't understand anything that's not in it's LLFolderType enum + //if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) + // newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; newFolder.Version = (ushort)folder.version; newFolder.Name = folder.folderName; newFolder.Owner = folder.agentID; @@ -765,7 +765,7 @@ namespace OpenSim.Services.InventoryService if (folder.Length < 1) return false; - if (folder[0].type == (int)AssetType.TrashFolder) + if (folder[0].type == (int)FolderType.Trash) return true; UUID parentFolder = folder[0].parentFolderID; @@ -776,9 +776,9 @@ namespace OpenSim.Services.InventoryService if (parent.Length < 1) return false; - if (parent[0].type == (int)AssetType.TrashFolder) + if (parent[0].type == (int)FolderType.Trash) return true; - if (parent[0].type == (int)AssetType.RootFolder) + if (parent[0].type == (int)FolderType.Root) return false; parentFolder = parent[0].parentFolderID; diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index fdf89be..c3756d0 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -788,7 +788,7 @@ namespace OpenSim.Services.LLLoginService Hashtable TempHash; foreach (InventoryFolderBase InvFolder in folders) { - if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == "My Inventory") + if (InvFolder.ParentID == UUID.Zero && InvFolder.Name == InventoryFolderBase.ROOT_FOLDER_NAME) { rootID = InvFolder.ID; } diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 4705445..2e19ece 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -595,7 +595,7 @@ namespace OpenSim.Services.UserAccountService { m_log.DebugFormat("[USER ACCOUNT SERVICE]: Creating default appearance items for {0}", principalID); - InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Bodypart); + InventoryFolderBase bodyPartsFolder = m_InventoryService.GetFolderForType(principalID, FolderType.BodyPart); InventoryItemBase eyes = new InventoryItemBase(UUID.Random(), principalID); eyes.AssetID = new UUID("4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7"); @@ -657,7 +657,7 @@ namespace OpenSim.Services.UserAccountService hair.Flags = (uint)WearableType.Hair; m_InventoryService.AddItem(hair); - InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, AssetType.Clothing); + InventoryFolderBase clothingFolder = m_InventoryService.GetFolderForType(principalID, FolderType.Clothing); InventoryItemBase shirt = new InventoryItemBase(UUID.Random(), principalID); shirt.AssetID = AvatarWearable.DEFAULT_SHIRT_ASSET; diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index b3b75af..5a36332 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -102,7 +102,7 @@ namespace OpenSim.Tests.Common { return AddInventoryItem( scene, itemName, itemId, itemType, asset, userId, - scene.InventoryService.GetFolderForType(userId, (AssetType)asset.Type).Name); + scene.InventoryService.GetFolderForType(userId, (FolderType)asset.Type).Name); } /// diff --git a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs index 2fb0751..0280b73 100644 --- a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs +++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs @@ -78,7 +78,7 @@ namespace Robust.Tests m_rootFolderID = m_Connector.GetRootFolder(m_userID).ID; Assert.AreNotEqual(m_rootFolderID, UUID.Zero, "Root folder ID must not be UUID.Zero"); - InventoryFolderBase of = m_Connector.GetFolderForType(m_userID, AssetType.Object); + InventoryFolderBase of = m_Connector.GetFolderForType(m_userID, FolderType.Object); Assert.IsNotNull(of, "Failed to retrieve Objects folder"); m_objectsFolder = of.ID; Assert.AreNotEqual(m_objectsFolder, UUID.Zero, "Objects folder ID must not be UUID.Zero"); @@ -93,7 +93,7 @@ namespace Robust.Tests success = m_Connector.AddItem(item); Assert.IsTrue(success, "Failed to add object to inventory"); - InventoryFolderBase ncf = m_Connector.GetFolderForType(m_userID, AssetType.Notecard); + InventoryFolderBase ncf = m_Connector.GetFolderForType(m_userID, FolderType.Notecard); Assert.IsNotNull(of, "Failed to retrieve Notecards folder"); m_notecardsFolder = ncf.ID; Assert.AreNotEqual(m_notecardsFolder, UUID.Zero, "Notecards folder ID must not be UUID.Zero"); @@ -118,7 +118,7 @@ namespace Robust.Tests // Add a folder InventoryFolderBase folder = new InventoryFolderBase(new UUID("f0000000-0000-0000-0000-00000000000f"), "Test Folder", m_userID, m_rootFolderID); - folder.Type = (int)AssetType.Folder; + folder.Type = (int)FolderType.None; success = m_Connector.AddFolder(folder); Assert.IsTrue(success, "Failed to add Test Folder to inventory"); @@ -133,7 +133,7 @@ namespace Robust.Tests Assert.IsTrue(success, "Failed to add link to notecard to inventory"); // Add a link to the Objects folder in Test Folder - item.AssetID = m_Connector.GetFolderForType(m_userID, AssetType.Object).ID; // use item ID of Objects folder + item.AssetID = m_Connector.GetFolderForType(m_userID, FolderType.Object).ID; // use item ID of Objects folder item.ID = new UUID("50000000-0000-0000-0000-000000000005"); item.AssetType = (int)AssetType.LinkFolder; item.Folder = folder.ID; -- cgit v1.1