aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/InventoryService/XInventoryService.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/InventoryService/XInventoryService.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Services/InventoryService/XInventoryService.cs')
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs172
1 files changed, 93 insertions, 79 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 7bad4b0..b75193f 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -111,40 +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 CreateFolder(principalID, rootFolder.ID, (int)AssetType.CallingCard, "Calling Cards"); 125 {
126 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Clothing) return true; return false; })) 126 XInventoryFolder folder = CreateFolder(principalID, rootFolder.ID, (int)FolderType.CallingCard, "Calling Cards");
127 CreateFolder(principalID, rootFolder.ID, (int)AssetType.Clothing, "Clothing"); 127 folder = CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "Friends");
128 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Gesture) return true; return false; })) 128 CreateFolder(principalID, folder.folderID, (int)FolderType.CallingCard, "All");
129 CreateFolder(principalID, rootFolder.ID, (int)AssetType.Gesture, "Gestures"); 129 }
130 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Landmark) 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.Landmark, "Landmarks"); 131 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Clothing, "Clothing");
132 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LostAndFoundFolder) 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.LostAndFoundFolder, "Lost And Found"); 133 CreateFolder(principalID, rootFolder.ID, (int)FolderType.CurrentOutfit, "Current Outfit");
134 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Notecard) 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.Notecard, "Notecards"); 135 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Favorites, "Favorites");
136 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Object) 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.Object, "Objects"); 137 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Gesture, "Gestures");
138 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.SnapshotFolder) 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.SnapshotFolder, "Photo Album"); 139 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Landmark, "Landmarks");
140 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.LSLText) 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.LSLText, "Scripts"); 141 CreateFolder(principalID, rootFolder.ID, (int)FolderType.LostAndFound, "Lost And Found");
142 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Sound) 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.Sound, "Sounds"); 143 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Notecard, "Notecards");
144 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Texture) 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.Texture, "Textures"); 145 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Object, "Objects");
146 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.TrashFolder) 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.TrashFolder, "Trash"); 147 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Snapshot, "Photo Album");
148 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.LSLText) return true; return false; }))
149 CreateFolder(principalID, rootFolder.ID, (int)FolderType.LSLText, "Scripts");
150 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Sound) return true; return false; }))
151 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Sound, "Sounds");
152 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Texture) return true; return false; }))
153 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Texture, "Textures");
154 if (!Array.Exists(sysFolders, delegate(XInventoryFolder f) { if (f.type == (int)FolderType.Trash) return true; return false; }))
155 CreateFolder(principalID, rootFolder.ID, (int)FolderType.Trash, "Trash");
148 156
149 return result; 157 return result;
150 } 158 }
@@ -220,7 +228,7 @@ namespace OpenSim.Services.InventoryService
220 XInventoryFolder root = null; 228 XInventoryFolder root = null;
221 foreach (XInventoryFolder folder in folders) 229 foreach (XInventoryFolder folder in folders)
222 { 230 {
223 if (folder.folderName == "My Inventory") 231 if (folder.folderName == InventoryFolderBase.ROOT_FOLDER_NAME)
224 { 232 {
225 root = folder; 233 root = folder;
226 break; 234 break;
@@ -233,7 +241,7 @@ namespace OpenSim.Services.InventoryService
233 return ConvertToOpenSim(root); 241 return ConvertToOpenSim(root);
234 } 242 }
235 243
236 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 244 public virtual InventoryFolderBase GetFolderForType(UUID principalID, FolderType type)
237 { 245 {
238// 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);
239 247
@@ -251,11 +259,11 @@ namespace OpenSim.Services.InventoryService
251 return GetSystemFolderForType(rootFolder, type); 259 return GetSystemFolderForType(rootFolder, type);
252 } 260 }
253 261
254 private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) 262 private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, FolderType type)
255 { 263 {
256// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); 264 //m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0}", type);
257 265
258 if (type == AssetType.RootFolder) 266 if (type == FolderType.Root)
259 return rootFolder; 267 return rootFolder;
260 268
261 XInventoryFolder[] folders = m_Database.GetFolders( 269 XInventoryFolder[] folders = m_Database.GetFolders(
@@ -264,13 +272,13 @@ namespace OpenSim.Services.InventoryService
264 272
265 if (folders.Length == 0) 273 if (folders.Length == 0)
266 { 274 {
267// m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID); 275 //m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} ", type);
268 return null; 276 return null;
269 } 277 }
270 278
271// m_log.DebugFormat( 279 //m_log.DebugFormat(
272// "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}", 280 // "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2}",
273// folders[0].folderName, folders[0].folderID, type, principalID); 281 // folders[0].folderName, folders[0].folderID, type);
274 282
275 return ConvertToOpenSim(folders[0]); 283 return ConvertToOpenSim(folders[0]);
276 } 284 }
@@ -283,7 +291,7 @@ namespace OpenSim.Services.InventoryService
283 // 291 //
284 //m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); 292 //m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString());
285 InventoryCollection inventory = new InventoryCollection(); 293 InventoryCollection inventory = new InventoryCollection();
286 inventory.UserID = principalID; 294 inventory.OwnerID = principalID;
287 inventory.Folders = new List<InventoryFolderBase>(); 295 inventory.Folders = new List<InventoryFolderBase>();
288 inventory.Items = new List<InventoryItemBase>(); 296 inventory.Items = new List<InventoryItemBase>();
289 297
@@ -307,8 +315,27 @@ namespace OpenSim.Services.InventoryService
307 inventory.Items.Add(ConvertToOpenSim(i)); 315 inventory.Items.Add(ConvertToOpenSim(i));
308 } 316 }
309 317
318 InventoryFolderBase f = new InventoryFolderBase(folderID, principalID);
319 f = GetFolder(f);
320 if (f != null)
321 {
322 inventory.Version = f.Version;
323 inventory.OwnerID = f.Owner;
324 }
325 inventory.FolderID = folderID;
326
310 return inventory; 327 return inventory;
311 } 328 }
329
330 public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs)
331 {
332 InventoryCollection[] multiple = new InventoryCollection[folderIDs.Length];
333 int i = 0;
334 foreach (UUID fid in folderIDs)
335 multiple[i++] = GetFolderContent(principalID, fid);
336
337 return multiple;
338 }
312 339
313 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 340 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
314 { 341 {
@@ -336,7 +363,7 @@ namespace OpenSim.Services.InventoryService
336 if (check != null) 363 if (check != null)
337 return false; 364 return false;
338 365
339 if (folder.Type != (short)AssetType.Folder && folder.Type != (short)AssetType.Unknown) 366 if (folder.Type != (short)FolderType.None)
340 { 367 {
341 InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); 368 InventoryFolderBase rootFolder = GetRootFolder(folder.Owner);
342 369
@@ -353,7 +380,7 @@ namespace OpenSim.Services.InventoryService
353 if (folder.ParentID == rootFolder.ID) 380 if (folder.ParentID == rootFolder.ID)
354 { 381 {
355 InventoryFolderBase existingSystemFolder 382 InventoryFolderBase existingSystemFolder
356 = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); 383 = GetSystemFolderForType(rootFolder, (FolderType)folder.Type);
357 384
358 if (existingSystemFolder != null) 385 if (existingSystemFolder != null)
359 { 386 {
@@ -380,8 +407,8 @@ namespace OpenSim.Services.InventoryService
380 if (check == null) 407 if (check == null)
381 return AddFolder(folder); 408 return AddFolder(folder);
382 409
383 if ((check.Type != (short)AssetType.Unknown || xFolder.type != (short)AssetType.Unknown) 410 if ((check.Type != (short)FolderType.None || xFolder.type != (short)FolderType.None)
384 && (check.Type != (short)AssetType.OutfitFolder || xFolder.type != (short)AssetType.OutfitFolder)) 411 && (check.Type != (short)FolderType.Outfit || xFolder.type != (short)FolderType.Outfit))
385 { 412 {
386 if (xFolder.version < check.Version) 413 if (xFolder.version < check.Version)
387 { 414 {
@@ -583,6 +610,21 @@ namespace OpenSim.Services.InventoryService
583 return ConvertToOpenSim(items[0]); 610 return ConvertToOpenSim(items[0]);
584 } 611 }
585 612
613 public virtual InventoryItemBase[] GetMultipleItems(UUID userID, UUID[] ids)
614 {
615 InventoryItemBase[] items = new InventoryItemBase[ids.Length];
616 int i = 0;
617 InventoryItemBase item = new InventoryItemBase();
618 item.Owner = userID;
619 foreach (UUID id in ids)
620 {
621 item.ID = id;
622 items[i++] = GetItem(item);
623 }
624
625 return items;
626 }
627
586 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder) 628 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
587 { 629 {
588 XInventoryFolder[] folders = m_Database.GetFolders( 630 XInventoryFolder[] folders = m_Database.GetFolders(
@@ -615,34 +657,6 @@ namespace OpenSim.Services.InventoryService
615 return m_Database.GetAssetPermissions(principalID, assetID); 657 return m_Database.GetAssetPermissions(principalID, assetID);
616 } 658 }
617 659
618 public virtual InventoryCollection GetUserInventory(UUID userID)
619 {
620 InventoryCollection userInventory = new InventoryCollection();
621 userInventory.UserID = userID;
622 userInventory.Folders = new List<InventoryFolderBase>();
623 userInventory.Items = new List<InventoryItemBase>();
624
625 List<InventoryFolderBase> skel = GetInventorySkeleton(userID);
626 if (skel != null)
627 {
628 foreach (InventoryFolderBase f in skel)
629 {
630 InventoryCollection c = GetFolderContent(userID, f.ID);
631 if (c != null && c.Items != null && c.Items.Count > 0)
632 userInventory.Items.AddRange(c.Items);
633 if (c != null && c.Folders != null && c.Folders.Count > 0)
634 userInventory.Folders.AddRange(c.Folders);
635 }
636 }
637 m_log.DebugFormat("[XINVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items",
638 userID, userInventory.Folders.Count, userInventory.Items.Count);
639 return userInventory;
640 }
641
642 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
643 {
644 }
645
646 // Unused. 660 // Unused.
647 // 661 //
648 public bool HasInventoryForUser(UUID userID) 662 public bool HasInventoryForUser(UUID userID)
@@ -658,9 +672,9 @@ namespace OpenSim.Services.InventoryService
658 672
659 newFolder.ParentID = folder.parentFolderID; 673 newFolder.ParentID = folder.parentFolderID;
660 newFolder.Type = (short)folder.type; 674 newFolder.Type = (short)folder.type;
661 // 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
662 if (newFolder.Type == 100) 676 //if (newFolder.Type == InventoryItemBase.SUITCASE_FOLDER_TYPE)
663 newFolder.Type = -1; 677 // newFolder.Type = InventoryItemBase.SUITCASE_FOLDER_FAKE_TYPE;
664 newFolder.Version = (ushort)folder.version; 678 newFolder.Version = (ushort)folder.version;
665 newFolder.Name = folder.folderName; 679 newFolder.Name = folder.folderName;
666 newFolder.Owner = folder.agentID; 680 newFolder.Owner = folder.agentID;
@@ -751,7 +765,7 @@ namespace OpenSim.Services.InventoryService
751 if (folder.Length < 1) 765 if (folder.Length < 1)
752 return false; 766 return false;
753 767
754 if (folder[0].type == (int)AssetType.TrashFolder) 768 if (folder[0].type == (int)FolderType.Trash)
755 return true; 769 return true;
756 770
757 UUID parentFolder = folder[0].parentFolderID; 771 UUID parentFolder = folder[0].parentFolderID;
@@ -762,9 +776,9 @@ namespace OpenSim.Services.InventoryService
762 if (parent.Length < 1) 776 if (parent.Length < 1)
763 return false; 777 return false;
764 778
765 if (parent[0].type == (int)AssetType.TrashFolder) 779 if (parent[0].type == (int)FolderType.Trash)
766 return true; 780 return true;
767 if (parent[0].type == (int)AssetType.RootFolder) 781 if (parent[0].type == (int)FolderType.Root)
768 return false; 782 return false;
769 783
770 parentFolder = parent[0].parentFolderID; 784 parentFolder = parent[0].parentFolderID;