diff options
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index 525381d..2fb1c63 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | |||
@@ -248,8 +248,6 @@ namespace OpenSim.Capabilities.Handlers | |||
248 | { | 248 | { |
249 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | 249 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); |
250 | } | 250 | } |
251 | |||
252 | descendents += inv.Folders.Count; | ||
253 | } | 251 | } |
254 | 252 | ||
255 | if (inv.Items != null) | 253 | if (inv.Items != null) |
@@ -449,13 +447,14 @@ namespace OpenSim.Capabilities.Handlers | |||
449 | { | 447 | { |
450 | InventoryCollectionWithDescendents ret = new InventoryCollectionWithDescendents(); | 448 | InventoryCollectionWithDescendents ret = new InventoryCollectionWithDescendents(); |
451 | ret.Collection = new InventoryCollection(); | 449 | ret.Collection = new InventoryCollection(); |
452 | ret.Collection.Folders = new List<InventoryFolderBase>(); | 450 | // ret.Collection.Folders = new List<InventoryFolderBase>(); |
451 | ret.Collection.Folders = fold.RequestListOfFolders(); | ||
453 | ret.Collection.Items = fold.RequestListOfItems(); | 452 | ret.Collection.Items = fold.RequestListOfItems(); |
454 | ret.Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner; | 453 | ret.Collection.OwnerID = m_LibraryService.LibraryRootFolder.Owner; |
455 | ret.Collection.FolderID = f.folder_id; | 454 | ret.Collection.FolderID = f.folder_id; |
456 | ret.Collection.Version = fold.Version; | 455 | ret.Collection.Version = fold.Version; |
457 | 456 | ||
458 | ret.Descendents = ret.Collection.Items.Count; | 457 | ret.Descendents = ret.Collection.Items.Count + ret.Collection.Folders.Count; |
459 | result.Add(ret); | 458 | result.Add(ret); |
460 | 459 | ||
461 | //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID); | 460 | //m_log.DebugFormat("[XXX]: Added libfolder {0} ({1}) {2}", ret.Collection.FolderID, ret.Collection.OwnerID); |
@@ -477,11 +476,18 @@ namespace OpenSim.Capabilities.Handlers | |||
477 | 476 | ||
478 | // Filter folder Zero right here. Some viewers (Firestorm) send request for folder Zero, which doesn't make sense | 477 | // Filter folder Zero right here. Some viewers (Firestorm) send request for folder Zero, which doesn't make sense |
479 | // and can kill the sim (all root folders have parent_id Zero) | 478 | // and can kill the sim (all root folders have parent_id Zero) |
479 | // send something. | ||
480 | LLSDFetchInventoryDescendents zero = fetchFolders.Find(f => f.folder_id == UUID.Zero); | 480 | LLSDFetchInventoryDescendents zero = fetchFolders.Find(f => f.folder_id == UUID.Zero); |
481 | if (zero != null) | 481 | if (zero != null) |
482 | { | 482 | { |
483 | fetchFolders.Remove(zero); | 483 | fetchFolders.Remove(zero); |
484 | BadFolder(zero, null, bad_folders); | 484 | InventoryCollectionWithDescendents zeroColl = new InventoryCollectionWithDescendents(); |
485 | zeroColl.Collection = new InventoryCollection(); | ||
486 | zeroColl.Collection.OwnerID = zero.owner_id; | ||
487 | zeroColl.Collection.Version = 0; | ||
488 | zeroColl.Collection.FolderID = zero.folder_id; | ||
489 | zeroColl.Descendents = 0; | ||
490 | result.Add(zeroColl); | ||
485 | } | 491 | } |
486 | 492 | ||
487 | if (fetchFolders.Count > 0) | 493 | if (fetchFolders.Count > 0) |
@@ -549,35 +555,8 @@ namespace OpenSim.Capabilities.Handlers | |||
549 | } | 555 | } |
550 | else | 556 | else |
551 | { | 557 | { |
552 | // Was it really a request for folder Zero? | 558 | m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id); |
553 | // This is an overkill, but Firestorm really asks for folder Zero. | 559 | bad_folders.Add(freq.folder_id); |
554 | // I'm leaving the code here for the time being, but commented. | ||
555 | if (freq.folder_id == UUID.Zero) | ||
556 | { | ||
557 | //coll.Collection.OwnerID = freq.owner_id; | ||
558 | //coll.Collection.FolderID = contents.FolderID; | ||
559 | //containingFolder = m_InventoryService.GetRootFolder(freq.owner_id); | ||
560 | //if (containingFolder != null) | ||
561 | //{ | ||
562 | // m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Request for parent of folder {0}", containingFolder.ID); | ||
563 | // coll.Collection.Folders.Clear(); | ||
564 | // coll.Collection.Folders.Add(containingFolder); | ||
565 | // if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null) | ||
566 | // { | ||
567 | // InventoryFolderBase lib = new InventoryFolderBase(m_LibraryService.LibraryRootFolder.ID, m_LibraryService.LibraryRootFolder.Owner); | ||
568 | // lib.Name = m_LibraryService.LibraryRootFolder.Name; | ||
569 | // lib.Type = m_LibraryService.LibraryRootFolder.Type; | ||
570 | // lib.Version = m_LibraryService.LibraryRootFolder.Version; | ||
571 | // coll.Collection.Folders.Add(lib); | ||
572 | // } | ||
573 | // coll.Collection.Items.Clear(); | ||
574 | //} | ||
575 | } | ||
576 | else | ||
577 | { | ||
578 | m_log.WarnFormat("[WEB FETCH INV DESC HANDLER]: Unable to fetch folder {0}", freq.folder_id); | ||
579 | bad_folders.Add(freq.folder_id); | ||
580 | } | ||
581 | bad = true; | 560 | bad = true; |
582 | } | 561 | } |
583 | } | 562 | } |
@@ -594,7 +573,7 @@ namespace OpenSim.Capabilities.Handlers | |||
594 | // viewers are lasy and want a copy of the linked item sent before the link to it | 573 | // viewers are lasy and want a copy of the linked item sent before the link to it |
595 | 574 | ||
596 | // descendents must only include the links, not the linked items we add | 575 | // descendents must only include the links, not the linked items we add |
597 | coll.Descendents = contents.Items.Count; | 576 | coll.Descendents = contents.Items.Count + contents.Folders.Count; |
598 | 577 | ||
599 | // look for item links | 578 | // look for item links |
600 | List<UUID> itemIDs = new List<UUID>(); | 579 | List<UUID> itemIDs = new List<UUID>(); |