* Inserting code to prepare to fix trash emptying and the edit texture inventory (again)

* Can't just do this fix since it stops subfolders working (though it appears subfolder renaming may be fubar at the moment)
0.6.0-stable
Justin Clarke Casey 2008-03-17 21:34:58 +00:00
parent 79209c4297
commit 872184fa2a
1 changed files with 61 additions and 59 deletions

View File

@ -1150,6 +1150,9 @@ namespace OpenSim.Region.ClientStack
List<InventoryFolderBase> folders,
bool fetchFolders, bool fetchItems)
{
// XXX Very temporarily, always fetch the folders
fetchFolders = true;
// An inventory descendents packet consists of a single agent section and an inventory details
// section for each inventory item. The size of each inventory item is approximately 550 bytes.
// In theory, UDP has a maximum packet size of 64k, so it should be possible to send descendent
@ -1163,13 +1166,11 @@ namespace OpenSim.Region.ClientStack
int MAX_ITEMS_PER_PACKET = 6;
Encoding enc = Encoding.ASCII;
InventoryDescendentsPacket descend;
int i;
int count;
uint FULL_MASK_PERMISSIONS = 2147483647;
if (fetchItems)
{
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if (items.Count < MAX_ITEMS_PER_PACKET)
{
@ -1191,8 +1192,8 @@ namespace OpenSim.Region.ClientStack
descend.AgentData.Descendents += folders.Count;
}
count = 0;
i = 0;
int count = 0;
int i = 0;
foreach (InventoryItemBase item in items)
{
descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
@ -1207,14 +1208,14 @@ namespace OpenSim.Region.ClientStack
descend.ItemData[i].FolderID = item.parentFolderID;
descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
descend.ItemData[i].GroupMask = 0;
descend.ItemData[i].InvType = (sbyte)item.invType;
descend.ItemData[i].InvType = (sbyte) item.invType;
descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
descend.ItemData[i].OwnerID = item.avatarID;
descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
descend.ItemData[i].SalePrice = 0;
descend.ItemData[i].SaleType = 0;
descend.ItemData[i].Type = (sbyte)item.assetType;
descend.ItemData[i].Type = (sbyte) item.assetType;
descend.ItemData[i].CRC =
Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
descend.ItemData[i].InvType, descend.ItemData[i].Type,
@ -1257,68 +1258,69 @@ namespace OpenSim.Region.ClientStack
}
//send subfolders
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if (folders.Count < MAX_ITEMS_PER_PACKET)
if (fetchFolders)
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
descend.AgentData.Descendents = folders.Count;
}
else
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
}
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
// Not sure if this scenario ever actually occurs, but nonetheless we include the items
// count even if we're not sending item data for the same reasons as above.
if (!fetchItems)
{
descend.AgentData.Descendents += items.Count;
}
i = 0;
count = 0;
foreach (InventoryFolderBase folder in folders)
{
descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
descend.FolderData[i].FolderID = folder.folderID;
descend.FolderData[i].Name = Helpers.StringToField(folder.name);
descend.FolderData[i].ParentID = folder.parentID;
descend.FolderData[i].Type = (sbyte)folder.type;
i++;
count++;
if (i == MAX_ITEMS_PER_PACKET)
if (folders.Count < MAX_ITEMS_PER_PACKET)
{
OutPacket(descend, ThrottleOutPacketType.Asset);
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
descend.AgentData.Descendents = folders.Count;
}
else
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
}
if ((folders.Count - count) > 0)
// Not sure if this scenario ever actually occurs, but nonetheless we include the items
// count even if we're not sending item data for the same reasons as above.
if (!fetchItems)
{
descend.AgentData.Descendents += items.Count;
}
int i = 0;
int count = 0;
foreach (InventoryFolderBase folder in folders)
{
descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
descend.FolderData[i].FolderID = folder.folderID;
descend.FolderData[i].Name = Helpers.StringToField(folder.name);
descend.FolderData[i].ParentID = folder.parentID;
descend.FolderData[i].Type = (sbyte) folder.type;
i++;
count++;
if (i == MAX_ITEMS_PER_PACKET)
{
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
OutPacket(descend, ThrottleOutPacketType.Asset);
if ((folders.Count - count) > 0)
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
descend.AgentData.Descendents = folders.Count - count;
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
descend.AgentData.Descendents = folders.Count - count;
}
else
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
}
i = 0;
}
else
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
}
i = 0;
}
}
}
if (i < MAX_ITEMS_PER_PACKET)
{
OutPacket(descend, ThrottleOutPacketType.Asset);
if (i < MAX_ITEMS_PER_PACKET)
{
OutPacket(descend, ThrottleOutPacketType.Asset);
}
}
}
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)