Fix broken inventory links on viewer 2.

It appears that if the viewer requests a folder containing links, we must also send the folders that contain the link targets first.
This was tested with Kokua 0.1.0 WIP though I predict it will also work with other viewer 2s
bulletsim
Justin Clark-Casey (justincc) 2011-05-13 03:24:19 +01:00
parent 691283c44e
commit 5f9edd195c
4 changed files with 30 additions and 4 deletions

View File

@ -1612,15 +1612,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]);
else else
{ {
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
currentPacket = null; currentPacket = null;
} }
} }
if (currentPacket != null) if (currentPacket != null)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
} }
}
private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder)
{ {

View File

@ -1386,8 +1386,25 @@ namespace OpenSim.Region.Framework.Scenes
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
if (containingFolder != null && containingFolder != null) if (containingFolder != null && containingFolder != null)
{
// If the folder requested contains links, then we need to send those folders first, otherwise the links
// will be broken in the viewer.
HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
foreach (InventoryItemBase item in contents.Items)
{
if (item.AssetType == (int)AssetType.Link)
{
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
}
}
foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems);
} }
}
/// <summary> /// <summary>
/// Update an item in a prim (task) inventory. /// Update an item in a prim (task) inventory.

View File

@ -499,6 +499,10 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder) bool fetchFolders, bool fetchItems, int sortOrder)
{ {
// m_log.DebugFormat(
// "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}",
// remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder);
if (folderID == UUID.Zero) if (folderID == UUID.Zero)
return; return;