aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs118
1 files changed, 60 insertions, 58 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 15540ea..8e64137 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -1150,6 +1150,9 @@ namespace OpenSim.Region.ClientStack
1150 List<InventoryFolderBase> folders, 1150 List<InventoryFolderBase> folders,
1151 bool fetchFolders, bool fetchItems) 1151 bool fetchFolders, bool fetchItems)
1152 { 1152 {
1153 // XXX Very temporarily, always fetch the folders
1154 fetchFolders = true;
1155
1153 // An inventory descendents packet consists of a single agent section and an inventory details 1156 // An inventory descendents packet consists of a single agent section and an inventory details
1154 // section for each inventory item. The size of each inventory item is approximately 550 bytes. 1157 // section for each inventory item. The size of each inventory item is approximately 550 bytes.
1155 // In theory, UDP has a maximum packet size of 64k, so it should be possible to send descendent 1158 // 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
1163 int MAX_ITEMS_PER_PACKET = 6; 1166 int MAX_ITEMS_PER_PACKET = 6;
1164 1167
1165 Encoding enc = Encoding.ASCII; 1168 Encoding enc = Encoding.ASCII;
1166 InventoryDescendentsPacket descend; 1169 uint FULL_MASK_PERMISSIONS = 2147483647;
1167 int i;
1168 int count;
1169 1170
1170 if (fetchItems) 1171 if (fetchItems)
1171 { 1172 {
1172 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1173 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1173 1174
1174 if (items.Count < MAX_ITEMS_PER_PACKET) 1175 if (items.Count < MAX_ITEMS_PER_PACKET)
1175 { 1176 {
@@ -1191,8 +1192,8 @@ namespace OpenSim.Region.ClientStack
1191 descend.AgentData.Descendents += folders.Count; 1192 descend.AgentData.Descendents += folders.Count;
1192 } 1193 }
1193 1194
1194 count = 0; 1195 int count = 0;
1195 i = 0; 1196 int i = 0;
1196 foreach (InventoryItemBase item in items) 1197 foreach (InventoryItemBase item in items)
1197 { 1198 {
1198 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); 1199 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
@@ -1207,14 +1208,14 @@ namespace OpenSim.Region.ClientStack
1207 descend.ItemData[i].FolderID = item.parentFolderID; 1208 descend.ItemData[i].FolderID = item.parentFolderID;
1208 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); 1209 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
1209 descend.ItemData[i].GroupMask = 0; 1210 descend.ItemData[i].GroupMask = 0;
1210 descend.ItemData[i].InvType = (sbyte)item.invType; 1211 descend.ItemData[i].InvType = (sbyte) item.invType;
1211 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); 1212 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
1212 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; 1213 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
1213 descend.ItemData[i].OwnerID = item.avatarID; 1214 descend.ItemData[i].OwnerID = item.avatarID;
1214 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; 1215 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
1215 descend.ItemData[i].SalePrice = 0; 1216 descend.ItemData[i].SalePrice = 0;
1216 descend.ItemData[i].SaleType = 0; 1217 descend.ItemData[i].SaleType = 0;
1217 descend.ItemData[i].Type = (sbyte)item.assetType; 1218 descend.ItemData[i].Type = (sbyte) item.assetType;
1218 descend.ItemData[i].CRC = 1219 descend.ItemData[i].CRC =
1219 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, 1220 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
1220 descend.ItemData[i].InvType, descend.ItemData[i].Type, 1221 descend.ItemData[i].InvType, descend.ItemData[i].Type,
@@ -1257,68 +1258,69 @@ namespace OpenSim.Region.ClientStack
1257 } 1258 }
1258 1259
1259 //send subfolders 1260 //send subfolders
1260 1261 if (fetchFolders)
1261 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1262
1263 if (folders.Count < MAX_ITEMS_PER_PACKET)
1264 {
1265 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
1266 descend.AgentData.Descendents = folders.Count;
1267 }
1268 else
1269 { 1262 {
1270 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; 1263 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1271 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1272 }
1273 1264
1274 // Not sure if this scenario ever actually occurs, but nonetheless we include the items 1265 if (folders.Count < MAX_ITEMS_PER_PACKET)
1275 // count even if we're not sending item data for the same reasons as above. 1266 {
1276 if (!fetchItems) 1267 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
1277 { 1268 descend.AgentData.Descendents = folders.Count;
1278 descend.AgentData.Descendents += items.Count; 1269 }
1279 } 1270 else
1271 {
1272 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1273 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1274 }
1280 1275
1281 i = 0; 1276 // Not sure if this scenario ever actually occurs, but nonetheless we include the items
1282 count = 0; 1277 // count even if we're not sending item data for the same reasons as above.
1283 foreach (InventoryFolderBase folder in folders) 1278 if (!fetchItems)
1284 {
1285 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
1286 descend.FolderData[i].FolderID = folder.folderID;
1287 descend.FolderData[i].Name = Helpers.StringToField(folder.name);
1288 descend.FolderData[i].ParentID = folder.parentID;
1289 descend.FolderData[i].Type = (sbyte)folder.type;
1290
1291 i++;
1292 count++;
1293 if (i == MAX_ITEMS_PER_PACKET)
1294 { 1279 {
1295 OutPacket(descend, ThrottleOutPacketType.Asset); 1280 descend.AgentData.Descendents += items.Count;
1281 }
1282
1283 int i = 0;
1284 int count = 0;
1285 foreach (InventoryFolderBase folder in folders)
1286 {
1287 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
1288 descend.FolderData[i].FolderID = folder.folderID;
1289 descend.FolderData[i].Name = Helpers.StringToField(folder.name);
1290 descend.FolderData[i].ParentID = folder.parentID;
1291 descend.FolderData[i].Type = (sbyte) folder.type;
1296 1292
1297 if ((folders.Count - count) > 0) 1293 i++;
1294 count++;
1295 if (i == MAX_ITEMS_PER_PACKET)
1298 { 1296 {
1299 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1297 OutPacket(descend, ThrottleOutPacketType.Asset);
1300 if ((folders.Count - count) < MAX_ITEMS_PER_PACKET) 1298
1301 { 1299 if ((folders.Count - count) > 0)
1302 descend.FolderData =
1303 new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
1304 descend.AgentData.Descendents = folders.Count - count;
1305 }
1306 else
1307 { 1300 {
1308 descend.FolderData = 1301 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1309 new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; 1302 if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
1310 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; 1303 {
1304 descend.FolderData =
1305 new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
1306 descend.AgentData.Descendents = folders.Count - count;
1307 }
1308 else
1309 {
1310 descend.FolderData =
1311 new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
1312 descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET;
1313 }
1314 i = 0;
1311 } 1315 }
1312 i = 0;
1313 } 1316 }
1314 } 1317 }
1315 }
1316 1318
1317 if (i < MAX_ITEMS_PER_PACKET) 1319 if (i < MAX_ITEMS_PER_PACKET)
1318 { 1320 {
1319 OutPacket(descend, ThrottleOutPacketType.Asset); 1321 OutPacket(descend, ThrottleOutPacketType.Asset);
1322 }
1320 } 1323 }
1321
1322 } 1324 }
1323 1325
1324 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) 1326 private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID)