aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs62
1 files changed, 48 insertions, 14 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 7b2c3a6..0e7a358 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -40,9 +40,9 @@ namespace OpenSim.Services.InventoryService
40{ 40{
41 public class XInventoryService : ServiceBase, IInventoryService 41 public class XInventoryService : ServiceBase, IInventoryService
42 { 42 {
43// private static readonly ILog m_log = 43 private static readonly ILog m_log =
44// LogManager.GetLogger( 44 LogManager.GetLogger(
45// MethodBase.GetCurrentMethod().DeclaringType); 45 MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 protected IXInventoryData m_Database; 47 protected IXInventoryData m_Database;
48 protected bool m_AllowDelete = true; 48 protected bool m_AllowDelete = true;
@@ -113,7 +113,7 @@ namespace OpenSim.Services.InventoryService
113 result = true; 113 result = true;
114 } 114 }
115 115
116 XInventoryFolder[] sysFolders = GetSystemFolders(principalID); 116 XInventoryFolder[] sysFolders = GetSystemFolders(principalID, rootFolder.ID);
117 117
118 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; })) 118 if (!Array.Exists(sysFolders, delegate (XInventoryFolder f) { if (f.type == (int)AssetType.Animation) return true; return false; }))
119 CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations"); 119 CreateFolder(principalID, rootFolder.ID, (int)AssetType.Animation, "Animations");
@@ -163,13 +163,13 @@ namespace OpenSim.Services.InventoryService
163 return newFolder; 163 return newFolder;
164 } 164 }
165 165
166 protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID) 166 protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID, UUID rootID)
167 { 167 {
168// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID); 168// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID);
169 169
170 XInventoryFolder[] allFolders = m_Database.GetFolders( 170 XInventoryFolder[] allFolders = m_Database.GetFolders(
171 new string[] { "agentID" }, 171 new string[] { "agentID", "parentFolderID" },
172 new string[] { principalID.ToString() }); 172 new string[] { principalID.ToString(), rootID.ToString() });
173 173
174 XInventoryFolder[] sysFolders = Array.FindAll( 174 XInventoryFolder[] sysFolders = Array.FindAll(
175 allFolders, 175 allFolders,
@@ -301,16 +301,26 @@ namespace OpenSim.Services.InventoryService
301 301
302 public virtual bool AddFolder(InventoryFolderBase folder) 302 public virtual bool AddFolder(InventoryFolderBase folder)
303 { 303 {
304 //m_log.DebugFormat("[XINVENTORY]: Add folder {0} type {1} in parent {2}", folder.Name, folder.Type, folder.ParentID);
304 InventoryFolderBase check = GetFolder(folder); 305 InventoryFolderBase check = GetFolder(folder);
305 if (check != null) 306 if (check != null)
306 return false; 307 return false;
307 308
308 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 309 if (folder.Type == (short)AssetType.Folder || folder.Type == (short)AssetType.Unknown ||
309 return m_Database.StoreFolder(xFolder); 310 GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null)
311 {
312 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
313 return m_Database.StoreFolder(xFolder);
314 }
315 else
316 m_log.DebugFormat("[XINVENTORY]: Folder {0} of type {1} already exists", folder.Name, folder.Type);
317
318 return false;
310 } 319 }
311 320
312 public virtual bool UpdateFolder(InventoryFolderBase folder) 321 public virtual bool UpdateFolder(InventoryFolderBase folder)
313 { 322 {
323 //m_log.DebugFormat("[XINVENTORY]: Update folder {0} {1} ({2})", folder.Name, folder.Type, folder.ID);
314 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 324 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
315 InventoryFolderBase check = GetFolder(folder); 325 InventoryFolderBase check = GetFolder(folder);
316 if (check == null) 326 if (check == null)
@@ -319,9 +329,13 @@ namespace OpenSim.Services.InventoryService
319 if (check.Type != -1 || xFolder.type != -1) 329 if (check.Type != -1 || xFolder.type != -1)
320 { 330 {
321 if (xFolder.version < check.Version) 331 if (xFolder.version < check.Version)
332 {
333 //m_log.DebugFormat("[XINVENTORY]: {0} < {1} can't do", xFolder.version, check.Version);
322 return false; 334 return false;
335 }
323 check.Version = (ushort)xFolder.version; 336 check.Version = (ushort)xFolder.version;
324 xFolder = ConvertFromOpenSim(check); 337 xFolder = ConvertFromOpenSim(check);
338 //m_log.DebugFormat("[XINVENTORY]: Storing {0} {1} {2}", xFolder.folderName, xFolder.version, xFolder.type);
325 return m_Database.StoreFolder(xFolder); 339 return m_Database.StoreFolder(xFolder);
326 } 340 }
327 341
@@ -499,13 +513,30 @@ namespace OpenSim.Services.InventoryService
499 return m_Database.GetAssetPermissions(principalID, assetID); 513 return m_Database.GetAssetPermissions(principalID, assetID);
500 } 514 }
501 515
502 // CM never needed those. Left unimplemented. 516 public virtual InventoryCollection GetUserInventory(UUID userID)
503 // Obsolete in core
504 //
505 public InventoryCollection GetUserInventory(UUID userID)
506 { 517 {
507 return null; 518 InventoryCollection userInventory = new InventoryCollection();
519 userInventory.UserID = userID;
520 userInventory.Folders = new List<InventoryFolderBase>();
521 userInventory.Items = new List<InventoryItemBase>();
522
523 List<InventoryFolderBase> skel = GetInventorySkeleton(userID);
524 if (skel != null)
525 {
526 foreach (InventoryFolderBase f in skel)
527 {
528 InventoryCollection c = GetFolderContent(userID, f.ID);
529 if (c != null && c.Items != null && c.Items.Count > 0)
530 userInventory.Items.AddRange(c.Items);
531 if (c != null && c.Folders != null && c.Folders.Count > 0)
532 userInventory.Folders.AddRange(c.Folders);
533 }
534 }
535 m_log.DebugFormat("[XINVENTORY SERVICE]: GetUserInventory for user {0} returning {1} folders and {2} items",
536 userID, userInventory.Folders.Count, userInventory.Items.Count);
537 return userInventory;
508 } 538 }
539
509 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) 540 public void GetUserInventory(UUID userID, InventoryReceiptCallback callback)
510 { 541 {
511 } 542 }
@@ -525,6 +556,9 @@ namespace OpenSim.Services.InventoryService
525 556
526 newFolder.ParentID = folder.parentFolderID; 557 newFolder.ParentID = folder.parentFolderID;
527 newFolder.Type = (short)folder.type; 558 newFolder.Type = (short)folder.type;
559 // Viewer can't understand anything that's not in it's LLFolderType enum
560 if (newFolder.Type == 100)
561 newFolder.Type = -1;
528 newFolder.Version = (ushort)folder.version; 562 newFolder.Version = (ushort)folder.version;
529 newFolder.Name = folder.folderName; 563 newFolder.Name = folder.folderName;
530 newFolder.Owner = folder.agentID; 564 newFolder.Owner = folder.agentID;