diff options
author | Melanie | 2010-07-24 23:15:06 +0100 |
---|---|---|
committer | Melanie | 2010-07-24 23:15:06 +0100 |
commit | 4dbff62ef505dae8eb8f0e058e98fafb45079fb2 (patch) | |
tree | f57940e0307b81cae41ae8eeb532b4182e310aa0 /OpenSim | |
parent | Adding sample configuration to previous patch (diff) | |
download | opensim-SC_OLD-4dbff62ef505dae8eb8f0e058e98fafb45079fb2.zip opensim-SC_OLD-4dbff62ef505dae8eb8f0e058e98fafb45079fb2.tar.gz opensim-SC_OLD-4dbff62ef505dae8eb8f0e058e98fafb45079fb2.tar.bz2 opensim-SC_OLD-4dbff62ef505dae8eb8f0e058e98fafb45079fb2.tar.xz |
Fix some inventory issues
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index bb24292..79afc8d 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -308,6 +308,8 @@ namespace OpenSim.Services.InventoryService | |||
308 | // | 308 | // |
309 | foreach (UUID id in folderIDs) | 309 | foreach (UUID id in folderIDs) |
310 | { | 310 | { |
311 | if (!ParentIsTrash(id)) | ||
312 | continue; | ||
311 | InventoryFolderBase f = new InventoryFolderBase(); | 313 | InventoryFolderBase f = new InventoryFolderBase(); |
312 | f.ID = id; | 314 | f.ID = id; |
313 | PurgeFolder(f); | 315 | PurgeFolder(f); |
@@ -319,6 +321,9 @@ namespace OpenSim.Services.InventoryService | |||
319 | 321 | ||
320 | public virtual bool PurgeFolder(InventoryFolderBase folder) | 322 | public virtual bool PurgeFolder(InventoryFolderBase folder) |
321 | { | 323 | { |
324 | if (!ParentIsTrash(folder.ID)) | ||
325 | return false; | ||
326 | |||
322 | XInventoryFolder[] subFolders = m_Database.GetFolders( | 327 | XInventoryFolder[] subFolders = m_Database.GetFolders( |
323 | new string[] { "parentFolderID" }, | 328 | new string[] { "parentFolderID" }, |
324 | new string[] { folder.ID.ToString() }); | 329 | new string[] { folder.ID.ToString() }); |
@@ -519,5 +524,29 @@ namespace OpenSim.Services.InventoryService | |||
519 | 524 | ||
520 | return newItem; | 525 | return newItem; |
521 | } | 526 | } |
527 | |||
528 | private bool ParentIsTrash(UUID folderID) | ||
529 | { | ||
530 | XInventoryFolder[] folder = m_Database.GetFolders(new string[] {"folderID"}, new string[] {folderID.ToString()}); | ||
531 | if (folder.Length < 1) | ||
532 | return false; | ||
533 | |||
534 | UUID parentFolder = folder[0].parentFolderID; | ||
535 | |||
536 | while (parentFolder != UUID.Zero) | ||
537 | { | ||
538 | XInventoryFolder[] parent = m_Database.GetFolders(new string[] {"folderID"}, new string[] {parentFolder.ToString()}); | ||
539 | if (parent.Length < 1) | ||
540 | return false; | ||
541 | |||
542 | if (parent[0].type == (int)AssetType.TrashFolder) | ||
543 | return true; | ||
544 | if (parent[0].type == (int)AssetType.RootFolder) | ||
545 | return false; | ||
546 | |||
547 | parentFolder = parent[0].parentFolderID; | ||
548 | } | ||
549 | return false; | ||
550 | } | ||
522 | } | 551 | } |
523 | } | 552 | } |