aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/ClientView.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2007-12-21 19:47:45 +0000
committerJustin Clarke Casey2007-12-21 19:47:45 +0000
commit42bc256e4fdd1b978b59fba117a78899b5a25c49 (patch)
treede77069b77bfa31ea3709267affc7a3425617eb6 /OpenSim/Region/ClientStack/ClientView.cs
parent* Fixed UserServer crash when it's passed 00000000000000000000000000 as the U... (diff)
downloadopensim-SC-42bc256e4fdd1b978b59fba117a78899b5a25c49.zip
opensim-SC-42bc256e4fdd1b978b59fba117a78899b5a25c49.tar.gz
opensim-SC-42bc256e4fdd1b978b59fba117a78899b5a25c49.tar.bz2
opensim-SC-42bc256e4fdd1b978b59fba117a78899b5a25c49.tar.xz
Refix bug where inventory textures don't appear in prim edit texture selection box
unless previously expanded in inventory.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs244
1 files changed, 138 insertions, 106 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 34186de..10fd7ae 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -898,136 +898,168 @@ namespace OpenSim.Region.ClientStack
898 898
899 /// <summary> 899 /// <summary>
900 /// Send information about the items contained in a folder to the client. 900 /// Send information about the items contained in a folder to the client.
901 ///
902 /// XXX This method needs some refactoring loving
901 /// </summary> 903 /// </summary>
902 /// <param name="ownerID">The owner of the folder</param> 904 /// <param name="ownerID">The owner of the folder</param>
903 /// <param name="folderID">The id of the folder</param> 905 /// <param name="folderID">The id of the folder</param>
904 /// <param name="items">The items contained in the folder identified by folderID</param> 906 /// <param name="items">The items contained in the folder identified by folderID</param>
905 /// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since 907 /// <param name="fetchFolders">Do we need to send folder information?</param>
906 /// the client is expecting inventory packets which incorporate this number into the descendents field, even though 908 /// <param name="fetchItems">Do we need to send item information?</param>
907 /// we send back no details of the folders themselves (only the items).</param> 909 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
908 public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) 910 List<InventoryFolderBase> folders,
911 bool fetchFolders, bool fetchItems)
909 { 912 {
910 Encoding enc = Encoding.ASCII; 913 Encoding enc = Encoding.ASCII;
911 uint FULL_MASK_PERMISSIONS = 2147483647; 914 uint FULL_MASK_PERMISSIONS = 2147483647;
912 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID); 915
913 916 if (fetchItems)
914 int count = 0;
915 if (items.Count < 40)
916 {
917 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
918 // In the very first packet, also include the sub folders count so that the total descendents the
919 // client receives matches its expectations. Subsequent inventory packets need contain only the count
920 // of the number of items actually in them.
921 descend.AgentData.Descendents = items.Count + subFoldersCount;
922 }
923 else
924 {
925 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40];
926 // In the very first packet, also include the sub folders count so that the total descendents the
927 // client receives matches its expectations. Subsequent inventory packets need contain only the count
928 // of the number of items actually in them.
929 descend.AgentData.Descendents = 40 + subFoldersCount;
930 }
931
932 int i = 0;
933 foreach (InventoryItemBase item in items)
934 { 917 {
935 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); 918 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
936 descend.ItemData[i].ItemID = item.inventoryID; 919
937 descend.ItemData[i].AssetID = item.assetID; 920 if (items.Count < 40)
938 descend.ItemData[i].CreatorID = item.creatorsID;
939 descend.ItemData[i].BaseMask = item.inventoryBasePermissions;
940 descend.ItemData[i].CreationDate = 1000;
941 descend.ItemData[i].Description = Helpers.StringToField(item.inventoryDescription);
942 descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions;
943 descend.ItemData[i].Flags = 1;
944 descend.ItemData[i].FolderID = item.parentFolderID;
945 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
946 descend.ItemData[i].GroupMask = 0;
947 descend.ItemData[i].InvType = (sbyte)item.invType;
948 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
949 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
950 descend.ItemData[i].OwnerID = item.avatarID;
951 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
952 descend.ItemData[i].SalePrice = 0;
953 descend.ItemData[i].SaleType = 0;
954 descend.ItemData[i].Type = (sbyte)item.assetType;
955 descend.ItemData[i].CRC =
956 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
957 descend.ItemData[i].InvType, descend.ItemData[i].Type,
958 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, descend.ItemData[i].SalePrice,
959 descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID,
960 descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, descend.ItemData[i].EveryoneMask,
961 descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask, descend.ItemData[i].GroupMask, item.inventoryCurrentPermissions);
962
963 i++;
964 count++;
965 if (i == 40)
966 { 921 {
967 OutPacket(descend, ThrottleOutPacketType.Asset); 922 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
968 923 descend.AgentData.Descendents = items.Count;
969 if ((items.Count - count) > 0) 924 }
925 else
926 {
927 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40];
928 descend.AgentData.Descendents = 40;
929 }
930
931 // Even if we aren't fetching the folders, we still need to include the folder count
932 // in the total number of descendents. Failure to do so will cause subtle bugs such
933 // as the failure of textures which haven't been expanded in inventory to show up
934 // in the texture prim edit selection panel.
935 if (!fetchFolders)
936 {
937 descend.AgentData.Descendents += folders.Count;
938 }
939
940 int count = 0;
941 int i = 0;
942 foreach (InventoryItemBase item in items)
943 {
944 descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
945 descend.ItemData[i].ItemID = item.inventoryID;
946 descend.ItemData[i].AssetID = item.assetID;
947 descend.ItemData[i].CreatorID = item.creatorsID;
948 descend.ItemData[i].BaseMask = item.inventoryBasePermissions;
949 descend.ItemData[i].CreationDate = 1000;
950 descend.ItemData[i].Description = Helpers.StringToField(item.inventoryDescription);
951 descend.ItemData[i].EveryoneMask = item.inventoryEveryOnePermissions;
952 descend.ItemData[i].Flags = 1;
953 descend.ItemData[i].FolderID = item.parentFolderID;
954 descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000");
955 descend.ItemData[i].GroupMask = 0;
956 descend.ItemData[i].InvType = (sbyte)item.invType;
957 descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName);
958 descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions;
959 descend.ItemData[i].OwnerID = item.avatarID;
960 descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions;
961 descend.ItemData[i].SalePrice = 0;
962 descend.ItemData[i].SaleType = 0;
963 descend.ItemData[i].Type = (sbyte)item.assetType;
964 descend.ItemData[i].CRC =
965 Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
966 descend.ItemData[i].InvType, descend.ItemData[i].Type,
967 descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, descend.ItemData[i].SalePrice,
968 descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID,
969 descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, descend.ItemData[i].EveryoneMask,
970 descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask, descend.ItemData[i].GroupMask, item.inventoryCurrentPermissions);
971
972 i++;
973 count++;
974 if (i == 40)
970 { 975 {
971 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 976 OutPacket(descend, ThrottleOutPacketType.Asset);
972 if ((items.Count - count) < 40) 977
973 { 978 if ((items.Count - count) > 0)
974 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
975 descend.AgentData.Descendents = items.Count - count;
976 }
977 else
978 { 979 {
979 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40]; 980 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
980 descend.AgentData.Descendents = 40; 981 if ((items.Count - count) < 40)
982 {
983 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
984 descend.AgentData.Descendents = items.Count - count;
985 }
986 else
987 {
988 descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[40];
989 descend.AgentData.Descendents = 40;
990 }
991 i = 0;
981 } 992 }
982 i = 0;
983 } 993 }
984 } 994 }
985 } 995
986 996 if (i < 40)
987 if (i < 40) 997 {
988 { 998 OutPacket(descend, ThrottleOutPacketType.Asset);
989 OutPacket(descend, ThrottleOutPacketType.Asset); 999 }
990 } 1000 }
991 1001
992 //send subfolders 1002 //send subfolders
993 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1003 if (fetchFolders)
994 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
995 i = 0;
996 count = 0;
997 foreach (InventoryFolderBase folder in folders)
998 { 1004 {
999 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); 1005 InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1000 descend.FolderData[i].FolderID = folder.folderID; 1006
1001 descend.FolderData[i].Name = Helpers.StringToField(folder.name); 1007 if (folders.Count < 40)
1002 descend.FolderData[i].ParentID = folder.parentID;
1003 descend.FolderData[i].Type = (sbyte)folder.type;
1004 i++;
1005 count++;
1006 if (i == 40)
1007 { 1008 {
1008 OutPacket(descend, ThrottleOutPacketType.Asset); 1009 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
1009 1010 descend.AgentData.Descendents = folders.Count;
1010 if ((folders.Count - count) > 0) 1011 }
1012 else
1013 {
1014 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40];
1015 descend.AgentData.Descendents = 40;
1016 }
1017
1018 // Not sure if this scenario ever actually occurs, but nonetheless we include the items
1019 // count even if we're not sending item data for the same reasons as above.
1020 if (!fetchItems)
1021 {
1022 descend.AgentData.Descendents += items.Count;
1023 }
1024
1025 int i = 0;
1026 int count = 0;
1027 foreach (InventoryFolderBase folder in folders)
1028 {
1029 descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
1030 descend.FolderData[i].FolderID = folder.folderID;
1031 descend.FolderData[i].Name = Helpers.StringToField(folder.name);
1032 descend.FolderData[i].ParentID = folder.parentID;
1033 descend.FolderData[i].Type = (sbyte)folder.type;
1034
1035 i++;
1036 count++;
1037 if (i == 40)
1011 { 1038 {
1012 descend = CreateInventoryDescendentsPacket(ownerID, folderID); 1039 OutPacket(descend, ThrottleOutPacketType.Asset);
1013 if ((folders.Count - count) < 40) 1040
1041 if ((folders.Count - count) > 0)
1014 { 1042 {
1015 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[items.Count - count]; 1043 descend = CreateInventoryDescendentsPacket(ownerID, folderID);
1016 descend.AgentData.Descendents = folders.Count - count; 1044 if ((folders.Count - count) < 40)
1017 } 1045 {
1018 else 1046 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
1019 { 1047 descend.AgentData.Descendents = folders.Count - count;
1020 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40]; 1048 }
1021 descend.AgentData.Descendents = 40; 1049 else
1050 {
1051 descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40];
1052 descend.AgentData.Descendents = 40;
1053 }
1054 i = 0;
1022 } 1055 }
1023 i = 0;
1024 } 1056 }
1025 } 1057 }
1026 } 1058
1027 1059 if (i < 40)
1028 if (i < 40) 1060 {
1029 { 1061 OutPacket(descend, ThrottleOutPacketType.Asset);
1030 OutPacket(descend, ThrottleOutPacketType.Asset); 1062 }
1031 } 1063 }
1032 } 1064 }
1033 1065