diff options
author | Melanie | 2009-08-29 03:26:44 +0100 |
---|---|---|
committer | Melanie | 2009-08-29 03:26:44 +0100 |
commit | 976cf4284bdbef14553c2e164cb67d25bd2b9076 (patch) | |
tree | 20004db93f70bc5116df39986d0da4119c7891e0 /OpenSim | |
parent | Modify CAPS inventory code. Currently this is not executed (diff) | |
download | opensim-SC-976cf4284bdbef14553c2e164cb67d25bd2b9076.zip opensim-SC-976cf4284bdbef14553c2e164cb67d25bd2b9076.tar.gz opensim-SC-976cf4284bdbef14553c2e164cb67d25bd2b9076.tar.bz2 opensim-SC-976cf4284bdbef14553c2e164cb67d25bd2b9076.tar.xz |
Fix up WebFetchInventoryDescendents to really return all data needed,
especially the folder version and the subfolders. Fixes inventory search
hang and folders not loading.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 28 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 18 |
3 files changed, 30 insertions, 18 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 5ae33d6..c5560b8 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.Capabilities | |||
58 | bool isScriptRunning, byte[] data); | 58 | bool isScriptRunning, byte[] data); |
59 | 59 | ||
60 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | 60 | public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, |
61 | bool fetchFolders, bool fetchItems, int sortOrder); | 61 | bool fetchFolders, bool fetchItems, int sortOrder, out int version); |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
64 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | 64 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that |
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities | |||
89 | //private static readonly string m_requestTexture = "0003/"; | 89 | //private static readonly string m_requestTexture = "0003/"; |
90 | private static readonly string m_notecardUpdatePath = "0004/"; | 90 | private static readonly string m_notecardUpdatePath = "0004/"; |
91 | private static readonly string m_notecardTaskUpdatePath = "0005/"; | 91 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
92 | // private static readonly string m_fetchInventoryPath = "0006/"; | 92 | private static readonly string m_fetchInventoryPath = "0006/"; |
93 | 93 | ||
94 | // The following entries are in a module, however, they are also here so that we don't re-assign | 94 | // The following entries are in a module, however, they are also here so that we don't re-assign |
95 | // the path to another cap by mistake. | 95 | // the path to another cap by mistake. |
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Capabilities | |||
207 | // As of RC 1.22.9 of the Linden client this is | 207 | // As of RC 1.22.9 of the Linden client this is |
208 | // supported | 208 | // supported |
209 | 209 | ||
210 | // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); | 210 | m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); |
211 | 211 | ||
212 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and | 212 | // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and |
213 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires | 213 | // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires |
@@ -449,23 +449,14 @@ namespace OpenSim.Framework.Capabilities | |||
449 | contents.owner_id = invFetch.owner_id; | 449 | contents.owner_id = invFetch.owner_id; |
450 | contents.folder_id = invFetch.folder_id; | 450 | contents.folder_id = invFetch.folder_id; |
451 | 451 | ||
452 | // The version number being sent back was originally 1. | ||
453 | // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins | ||
454 | // without clearing client cache, objects in the root folder disappear until the cache is cleared, | ||
455 | // at which point they reappear. | ||
456 | // | ||
457 | // Seeing the version to something other than 0 may be the right thing to do, but there is | ||
458 | // a greater subtlety of the second life protocol that needs to be understood first. | ||
459 | contents.version = 0; | ||
460 | |||
461 | contents.descendents = 0; | ||
462 | reply.folders.Array.Add(contents); | 452 | reply.folders.Array.Add(contents); |
463 | InventoryCollection inv = new InventoryCollection(); | 453 | InventoryCollection inv = new InventoryCollection(); |
464 | inv.Folders = new List<InventoryFolderBase>(); | 454 | inv.Folders = new List<InventoryFolderBase>(); |
465 | inv.Items = new List<InventoryItemBase>(); | 455 | inv.Items = new List<InventoryItemBase>(); |
456 | int version = 0; | ||
466 | if (CAPSFetchInventoryDescendents != null) | 457 | if (CAPSFetchInventoryDescendents != null) |
467 | { | 458 | { |
468 | inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | 459 | inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); |
469 | } | 460 | } |
470 | 461 | ||
471 | if (inv.Folders != null) | 462 | if (inv.Folders != null) |
@@ -484,7 +475,9 @@ namespace OpenSim.Framework.Capabilities | |||
484 | } | 475 | } |
485 | } | 476 | } |
486 | 477 | ||
487 | contents.descendents = contents.items.Array.Count; | 478 | contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; |
479 | contents.version = version; | ||
480 | |||
488 | return reply; | 481 | return reply; |
489 | } | 482 | } |
490 | 483 | ||
@@ -499,7 +492,10 @@ namespace OpenSim.Framework.Capabilities | |||
499 | llsdFolder.folder_id = invFolder.ID; | 492 | llsdFolder.folder_id = invFolder.ID; |
500 | llsdFolder.parent_id = invFolder.ParentID; | 493 | llsdFolder.parent_id = invFolder.ParentID; |
501 | llsdFolder.name = invFolder.Name; | 494 | llsdFolder.name = invFolder.Name; |
502 | llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type]; | 495 | if (invFolder.Type == -1) |
496 | llsdFolder.type = "-1"; | ||
497 | else | ||
498 | llsdFolder.type = TaskInventoryItem.Types[invFolder.Type]; | ||
503 | llsdFolder.preferred_type = "-1"; | 499 | llsdFolder.preferred_type = "-1"; |
504 | 500 | ||
505 | return llsdFolder; | 501 | return llsdFolder; |
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 2ef4a36..3f72c31 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | |||
@@ -94,6 +94,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
94 | 94 | ||
95 | Stream requestStream = request.GetRequestStream(); | 95 | Stream requestStream = request.GetRequestStream(); |
96 | requestStream.Write(buffer.ToArray(), 0, length); | 96 | requestStream.Write(buffer.ToArray(), 0, length); |
97 | requestStream.Close(); | ||
97 | TResponse deserial = default(TResponse); | 98 | TResponse deserial = default(TResponse); |
98 | using (WebResponse resp = request.GetResponse()) | 99 | using (WebResponse resp = request.GetResponse()) |
99 | { | 100 | { |
@@ -101,7 +102,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
101 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); | 102 | deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); |
102 | resp.Close(); | 103 | resp.Close(); |
103 | } | 104 | } |
104 | requestStream.Close(); | ||
105 | return deserial; | 105 | return deserial; |
106 | } | 106 | } |
107 | } | 107 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index c816790..55b100b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -473,7 +473,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
473 | /// <param name="sortOrder"></param> | 473 | /// <param name="sortOrder"></param> |
474 | /// <returns>null if the inventory look up failed</returns> | 474 | /// <returns>null if the inventory look up failed</returns> |
475 | public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | 475 | public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, |
476 | bool fetchFolders, bool fetchItems, int sortOrder) | 476 | bool fetchFolders, bool fetchItems, int sortOrder, out int version) |
477 | { | 477 | { |
478 | // m_log.DebugFormat( | 478 | // m_log.DebugFormat( |
479 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | 479 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", |
@@ -487,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
487 | InventoryFolderImpl fold; | 487 | InventoryFolderImpl fold; |
488 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | 488 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) |
489 | { | 489 | { |
490 | version = 0; | ||
490 | InventoryCollection ret = new InventoryCollection(); | 491 | InventoryCollection ret = new InventoryCollection(); |
491 | ret.Folders = new List<InventoryFolderBase>(); | 492 | ret.Folders = new List<InventoryFolderBase>(); |
492 | ret.Items = fold.RequestListOfItems(); | 493 | ret.Items = fold.RequestListOfItems(); |
@@ -495,6 +496,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
495 | } | 496 | } |
496 | 497 | ||
497 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); | 498 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
499 | |||
500 | if (folderID != UUID.Zero) | ||
501 | { | ||
502 | InventoryFolderBase containingFolder = new InventoryFolderBase(); | ||
503 | containingFolder.ID = folderID; | ||
504 | containingFolder.Owner = agentID; | ||
505 | containingFolder = InventoryService.GetFolder(containingFolder); | ||
506 | version = containingFolder.Version; | ||
507 | } | ||
508 | else | ||
509 | { | ||
510 | // Lost itemsm don't really need a version | ||
511 | version = 1; | ||
512 | } | ||
513 | |||
498 | return contents; | 514 | return contents; |
499 | 515 | ||
500 | } | 516 | } |