diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index c2c514e..42ca4b7 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -949,10 +949,13 @@ namespace OpenSim.Region.ClientStack | |||
949 | 949 | ||
950 | Encoding enc = Encoding.ASCII; | 950 | Encoding enc = Encoding.ASCII; |
951 | uint FULL_MASK_PERMISSIONS = 2147483647; | 951 | uint FULL_MASK_PERMISSIONS = 2147483647; |
952 | InventoryDescendentsPacket descend; | ||
953 | int i; | ||
954 | int count; | ||
952 | 955 | ||
953 | if (fetchItems) | 956 | if (fetchItems) |
954 | { | 957 | { |
955 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); | 958 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
956 | 959 | ||
957 | if (items.Count < MAX_ITEMS_PER_PACKET) | 960 | if (items.Count < MAX_ITEMS_PER_PACKET) |
958 | { | 961 | { |
@@ -974,8 +977,8 @@ namespace OpenSim.Region.ClientStack | |||
974 | descend.AgentData.Descendents += folders.Count; | 977 | descend.AgentData.Descendents += folders.Count; |
975 | } | 978 | } |
976 | 979 | ||
977 | int count = 0; | 980 | count = 0; |
978 | int i = 0; | 981 | i = 0; |
979 | foreach (InventoryItemBase item in items) | 982 | foreach (InventoryItemBase item in items) |
980 | { | 983 | { |
981 | descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); | 984 | descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); |
@@ -990,14 +993,14 @@ namespace OpenSim.Region.ClientStack | |||
990 | descend.ItemData[i].FolderID = item.parentFolderID; | 993 | descend.ItemData[i].FolderID = item.parentFolderID; |
991 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 994 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
992 | descend.ItemData[i].GroupMask = 0; | 995 | descend.ItemData[i].GroupMask = 0; |
993 | descend.ItemData[i].InvType = (sbyte) item.invType; | 996 | descend.ItemData[i].InvType = (sbyte)item.invType; |
994 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); | 997 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); |
995 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 998 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
996 | descend.ItemData[i].OwnerID = item.avatarID; | 999 | descend.ItemData[i].OwnerID = item.avatarID; |
997 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 1000 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
998 | descend.ItemData[i].SalePrice = 0; | 1001 | descend.ItemData[i].SalePrice = 0; |
999 | descend.ItemData[i].SaleType = 0; | 1002 | descend.ItemData[i].SaleType = 0; |
1000 | descend.ItemData[i].Type = (sbyte) item.assetType; | 1003 | descend.ItemData[i].Type = (sbyte)item.assetType; |
1001 | descend.ItemData[i].CRC = | 1004 | descend.ItemData[i].CRC = |
1002 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, | 1005 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, |
1003 | descend.ItemData[i].InvType, descend.ItemData[i].Type, | 1006 | descend.ItemData[i].InvType, descend.ItemData[i].Type, |
@@ -1040,69 +1043,68 @@ namespace OpenSim.Region.ClientStack | |||
1040 | } | 1043 | } |
1041 | 1044 | ||
1042 | //send subfolders | 1045 | //send subfolders |
1043 | if (fetchFolders) | ||
1044 | { | ||
1045 | InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
1046 | 1046 | ||
1047 | if (folders.Count < MAX_ITEMS_PER_PACKET) | 1047 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
1048 | { | ||
1049 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; | ||
1050 | descend.AgentData.Descendents = folders.Count; | ||
1051 | } | ||
1052 | else | ||
1053 | { | ||
1054 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1055 | descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; | ||
1056 | } | ||
1057 | 1048 | ||
1058 | // Not sure if this scenario ever actually occurs, but nonetheless we include the items | 1049 | if (folders.Count < MAX_ITEMS_PER_PACKET) |
1059 | // count even if we're not sending item data for the same reasons as above. | 1050 | { |
1060 | if (!fetchItems) | 1051 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; |
1061 | { | 1052 | descend.AgentData.Descendents = folders.Count; |
1062 | descend.AgentData.Descendents += items.Count; | 1053 | } |
1063 | } | 1054 | else |
1055 | { | ||
1056 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1057 | descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; | ||
1058 | } | ||
1059 | |||
1060 | // Not sure if this scenario ever actually occurs, but nonetheless we include the items | ||
1061 | // count even if we're not sending item data for the same reasons as above. | ||
1062 | if (!fetchItems) | ||
1063 | { | ||
1064 | descend.AgentData.Descendents += items.Count; | ||
1065 | } | ||
1064 | 1066 | ||
1065 | int i = 0; | 1067 | i = 0; |
1066 | int count = 0; | 1068 | count = 0; |
1067 | foreach (InventoryFolderBase folder in folders) | 1069 | foreach (InventoryFolderBase folder in folders) |
1070 | { | ||
1071 | descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); | ||
1072 | descend.FolderData[i].FolderID = folder.folderID; | ||
1073 | descend.FolderData[i].Name = Helpers.StringToField(folder.name); | ||
1074 | descend.FolderData[i].ParentID = folder.parentID; | ||
1075 | descend.FolderData[i].Type = (sbyte)folder.type; | ||
1076 | |||
1077 | i++; | ||
1078 | count++; | ||
1079 | if (i == MAX_ITEMS_PER_PACKET) | ||
1068 | { | 1080 | { |
1069 | descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); | 1081 | OutPacket(descend, ThrottleOutPacketType.Asset); |
1070 | descend.FolderData[i].FolderID = folder.folderID; | ||
1071 | descend.FolderData[i].Name = Helpers.StringToField(folder.name); | ||
1072 | descend.FolderData[i].ParentID = folder.parentID; | ||
1073 | descend.FolderData[i].Type = (sbyte) folder.type; | ||
1074 | 1082 | ||
1075 | i++; | 1083 | if ((folders.Count - count) > 0) |
1076 | count++; | ||
1077 | if (i == MAX_ITEMS_PER_PACKET) | ||
1078 | { | 1084 | { |
1079 | OutPacket(descend, ThrottleOutPacketType.Asset); | 1085 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); |
1080 | 1086 | if ((folders.Count - count) < MAX_ITEMS_PER_PACKET) | |
1081 | if ((folders.Count - count) > 0) | ||
1082 | { | 1087 | { |
1083 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | 1088 | descend.FolderData = |
1084 | if ((folders.Count - count) < MAX_ITEMS_PER_PACKET) | 1089 | new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; |
1085 | { | 1090 | descend.AgentData.Descendents = folders.Count - count; |
1086 | descend.FolderData = | ||
1087 | new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count]; | ||
1088 | descend.AgentData.Descendents = folders.Count - count; | ||
1089 | } | ||
1090 | else | ||
1091 | { | ||
1092 | descend.FolderData = | ||
1093 | new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1094 | descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; | ||
1095 | } | ||
1096 | i = 0; | ||
1097 | } | 1091 | } |
1092 | else | ||
1093 | { | ||
1094 | descend.FolderData = | ||
1095 | new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET]; | ||
1096 | descend.AgentData.Descendents = MAX_ITEMS_PER_PACKET; | ||
1097 | } | ||
1098 | i = 0; | ||
1098 | } | 1099 | } |
1099 | } | 1100 | } |
1101 | } | ||
1100 | 1102 | ||
1101 | if (i < MAX_ITEMS_PER_PACKET) | 1103 | if (i < MAX_ITEMS_PER_PACKET) |
1102 | { | 1104 | { |
1103 | OutPacket(descend, ThrottleOutPacketType.Asset); | 1105 | OutPacket(descend, ThrottleOutPacketType.Asset); |
1104 | } | ||
1105 | } | 1106 | } |
1107 | |||
1106 | } | 1108 | } |
1107 | 1109 | ||
1108 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 1110 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |