diff options
author | Diva Canto | 2015-08-08 12:12:50 -0700 |
---|---|---|
committer | Diva Canto | 2015-08-08 12:12:50 -0700 |
commit | 959872315f67a1a33a2bae7330749f7dd74a4774 (patch) | |
tree | e31f6900453e77815859767cb2331d0412ec5b57 /OpenSim/Services/InventoryService/XInventoryService.cs | |
parent | Have osAvatarName2Key check the cache first, even for foreign users (diff) | |
download | opensim-SC_OLD-959872315f67a1a33a2bae7330749f7dd74a4774.zip opensim-SC_OLD-959872315f67a1a33a2bae7330749f7dd74a4774.tar.gz opensim-SC_OLD-959872315f67a1a33a2bae7330749f7dd74a4774.tar.bz2 opensim-SC_OLD-959872315f67a1a33a2bae7330749f7dd74a4774.tar.xz |
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!
Diffstat (limited to 'OpenSim/Services/InventoryService/XInventoryService.cs')
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 100 |
1 files changed, 50 insertions, 50 deletions
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 | |||
111 | 111 | ||
112 | if (rootFolder == null) | 112 | if (rootFolder == null) |
113 | { | 113 | { |
114 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory")); | 114 | rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)FolderType.Root, InventoryFolderBase.ROOT_FOLDER_NAME)); |
115 | result = true; | 115 | result = true; |
116 | } | 116 | } |
117 | 117 | ||
118 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID); | 118 | XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID); |
119 | 119 | ||
120 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) | 120 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Animation) return true; return false; })) |
121 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations"); | 121 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Animation, "Animations"); |
122 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Bodypart) return true; return false; })) | 122 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.BodyPart) return true; return false; })) |
123 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Bodypart, "Body Parts"); | 123 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.BodyPart, "Body Parts"); |
124 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CallingCard) return true; return false; })) | 124 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CallingCard) return true; return false; })) |
125 | { | 125 | { |
126 | XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); | 126 | XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)FolderType.CallingCard, "Calling Cards"); |
127 | folder = CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "Friends"); | 127 | folder = CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "Friends"); |
128 | CreateFolder(principalID, folder.folderID, (int)AssetType.CallingCard, "All"); | 128 | CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "All"); |
129 | } | 129 | } |
130 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) | 130 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Clothing) return true; return false; })) |
131 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); | 131 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Clothing, "Clothing"); |
132 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.CurrentOutfitFolder) return true; return false; })) | 132 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.CurrentOutfit) return true; return false; })) |
133 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.CurrentOutfitFolder, "Current Outfit"); | 133 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.CurrentOutfit, "Current Outfit"); |
134 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.FavoriteFolder) return true; return false; })) | 134 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Favorites) return true; return false; })) |
135 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.FavoriteFolder, "Favorites"); | 135 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Favorites, "Favorites"); |
136 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) | 136 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Gesture) return true; return false; })) |
137 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); | 137 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Gesture, "Gestures"); |
138 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) return true; return false; })) | 138 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Landmark) return true; return false; })) |
139 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Landmark, "Landmarks"); | 139 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Landmark, "Landmarks"); |
140 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) return true; return false; })) | 140 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LostAndFound) return true; return false; })) |
141 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LostAndFoundFolder, "Lost And Found"); | 141 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.LostAndFound, "Lost And Found"); |
142 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) return true; return false; })) | 142 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Notecard) return true; return false; })) |
143 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Notecard, "Notecards"); | 143 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Notecard, "Notecards"); |
144 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) return true; return false; })) | 144 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Object) return true; return false; })) |
145 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Object, "Objects"); | 145 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Object, "Objects"); |
146 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) return true; return false; })) | 146 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Snapshot) return true; return false; })) |
147 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.SnapshotFolder, "Photo Album"); | 147 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Snapshot, "Photo Album"); |
148 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) return true; return false; })) | 148 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; })) |
149 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.LSLText, "Scripts"); | 149 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.LSLText, "Scripts"); |
150 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) return true; return false; })) | 150 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; })) |
151 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Sound, "Sounds"); | 151 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Sound, "Sounds"); |
152 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) return true; return false; })) | 152 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; })) |
153 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.Texture, "Textures"); | 153 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Texture, "Textures"); |
154 | if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) return true; return false; })) | 154 | if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; })) |
155 | CreateFolder(principalID, rootFolder.ID, (int)AssetType.TrashFolder, "Trash"); | 155 | CreateFolder(principalID, rootFolder.ID, (int)FolderType.Trash, "Trash"); |
156 | 156 | ||
157 | return result; | 157 | return result; |
158 | } | 158 | } |
@@ -228,7 +228,7 @@ namespace OpenSim.Services.InventoryService | |||
228 | XInventoryFolder root = null; | 228 | XInventoryFolder root = null; |
229 | foreach (XInventoryFolder folder in folders) | 229 | foreach (XInventoryFolder folder in folders) |
230 | { | 230 | { |
231 | if (folder.folderName == "My Inventory") | 231 | if (folder.folderName == InventoryFolderBase.ROOT_FOLDER_NAME) |
232 | { | 232 | { |
233 | root = folder; | 233 | root = folder; |
234 | break; | 234 | break; |
@@ -241,7 +241,7 @@ namespace OpenSim.Services.InventoryService | |||
241 | return ConvertToOpenSim(root); | 241 | return ConvertToOpenSim(root); |
242 | } | 242 | } |
243 | 243 | ||
244 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 244 | public virtual InventoryFolderBase GetFolderForType(UUID principalID, FolderType type) |
245 | { | 245 | { |
246 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); | 246 | // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); |
247 | 247 | ||
@@ -259,11 +259,11 @@ namespace OpenSim.Services.InventoryService | |||
259 | return GetSystemFolderForType(rootFolder, type); | 259 | return GetSystemFolderForType(rootFolder, type); |
260 | } | 260 | } |
261 | 261 | ||
262 | private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) | 262 | private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, FolderType type) |
263 | { | 263 | { |
264 | //m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0}", type); | 264 | //m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0}", type); |
265 | 265 | ||
266 | if (type == AssetType.RootFolder) | 266 | if (type == FolderType.Root) |
267 | return rootFolder; | 267 | return rootFolder; |
268 | 268 | ||
269 | XInventoryFolder[] folders = m_Database.GetFolders( | 269 | XInventoryFolder[] folders = m_Database.GetFolders( |
@@ -363,7 +363,7 @@ namespace OpenSim.Services.InventoryService | |||
363 | if (check != null) | 363 | if (check != null) |
364 | return false; | 364 | return false; |
365 | 365 | ||
366 | if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) | 366 | if (folder.Type != (short)FolderType.None) |
367 | { | 367 | { |
368 | InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); | 368 | InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); |
369 | 369 | ||
@@ -380,7 +380,7 @@ namespace OpenSim.Services.InventoryService | |||
380 | if (folder.ParentID == rootFolder.ID) | 380 | if (folder.ParentID == rootFolder.ID) |
381 | { | 381 | { |
382 | InventoryFolderBase existingSystemFolder | 382 | InventoryFolderBase existingSystemFolder |
383 | = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); | 383 | = GetSystemFolderForType(rootFolder, (FolderType)folder.Type); |
384 | 384 | ||
385 | if (existingSystemFolder != null) | 385 | if (existingSystemFolder != null) |
386 | { | 386 | { |
@@ -407,8 +407,8 @@ namespace OpenSim.Services.InventoryService | |||
407 | if (check == null) | 407 | if (check == null) |
408 | return AddFolder(folder); | 408 | return AddFolder(folder); |
409 | 409 | ||
410 | if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown) | 410 | if ((check.Type != (short)FolderType.None || xFolder.type != (short)FolderType.None) |
411 | && (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder)) | 411 | && (check.Type != (short)FolderType.Outfit || xFolder.type != (short)FolderType.Outfit)) |
412 | { | 412 | { |
413 | if (xFolder.version < check.Version) | 413 | if (xFolder.version < check.Version) |
414 | { | 414 | { |
@@ -672,9 +672,9 @@ namespace OpenSim.Services.InventoryService | |||
672 | 672 | ||
673 | newFolder.ParentID = folder.parentFolderID; | 673 | newFolder.ParentID = folder.parentFolderID; |
674 | newFolder.Type = (short)folder.type; | 674 | newFolder.Type = (short)folder.type; |
675 | // Viewer can't understand anything that's not in it's LLFolderType enum | 675 | //// Viewer can't understand anything that's not in it's LLFolderType enum |
676 | if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) | 676 | //if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE) |
677 | newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; | 677 | // newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE; |
678 | newFolder.Version = (ushort)folder.version; | 678 | newFolder.Version = (ushort)folder.version; |
679 | newFolder.Name = folder.folderName; | 679 | newFolder.Name = folder.folderName; |
680 | newFolder.Owner = folder.agentID; | 680 | newFolder.Owner = folder.agentID; |
@@ -765,7 +765,7 @@ namespace OpenSim.Services.InventoryService | |||
765 | if (folder.Length < 1) | 765 | if (folder.Length < 1) |
766 | return false; | 766 | return false; |
767 | 767 | ||
768 | if (folder[0].type == (int)AssetType.TrashFolder) | 768 | if (folder[0].type == (int)FolderType.Trash) |
769 | return true; | 769 | return true; |
770 | 770 | ||
771 | UUID parentFolder = folder[0].parentFolderID; | 771 | UUID parentFolder = folder[0].parentFolderID; |
@@ -776,9 +776,9 @@ namespace OpenSim.Services.InventoryService | |||
776 | if (parent.Length < 1) | 776 | if (parent.Length < 1) |
777 | return false; | 777 | return false; |
778 | 778 | ||
779 | if (parent[0].type == (int)AssetType.TrashFolder) | 779 | if (parent[0].type == (int)FolderType.Trash) |
780 | return true; | 780 | return true; |
781 | if (parent[0].type == (int)AssetType.RootFolder) | 781 | if (parent[0].type == (int)FolderType.Root) |
782 | return false; | 782 | return false; |
783 | 783 | ||
784 | parentFolder = parent[0].parentFolderID; | 784 | parentFolder = parent[0].parentFolderID; |