aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs21
-rw-r--r--OpenSim/Framework/IClientAPI.cs4
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs244
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs6
4 files changed, 161 insertions, 114 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index bf7f5c1..6a7be78 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -176,11 +176,14 @@ namespace OpenSim.Framework.Communications.Cache
176 public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, 176 public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
177 bool fetchFolders, bool fetchItems, int sortOrder) 177 bool fetchFolders, bool fetchItems, int sortOrder)
178 { 178 {
179 // XXX We're not handling sortOrder yet!
180
179 InventoryFolderImpl fold = null; 181 InventoryFolderImpl fold = null;
180 if (folderID == libraryRoot.folderID) 182 if (folderID == libraryRoot.folderID)
181 { 183 {
182 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, 184 remoteClient.SendInventoryFolderDetails(
183 libraryRoot.RequestListOfItems(), libraryRoot.RequestListOfFolders(), libraryRoot.SubFoldersCount); 185 libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(),
186 libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
184 187
185 return; 188 return;
186 } 189 }
@@ -188,7 +191,9 @@ namespace OpenSim.Framework.Communications.Cache
188 if ((fold = libraryRoot.HasSubFolder(folderID)) != null) 191 if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
189 { 192 {
190 System.Console.WriteLine("fetching librarysubfolder"); 193 System.Console.WriteLine("fetching librarysubfolder");
191 remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); 194 remoteClient.SendInventoryFolderDetails(
195 libraryRoot.agentID, folderID, fold.RequestListOfItems(),
196 fold.RequestListOfFolders(), fetchFolders, fetchItems);
192 197
193 return; 198 return;
194 } 199 }
@@ -203,15 +208,19 @@ namespace OpenSim.Framework.Communications.Cache
203 System.Console.Write("fetching root folder"); 208 System.Console.Write("fetching root folder");
204 if (fetchItems) 209 if (fetchItems)
205 { 210 {
206 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, 211 remoteClient.SendInventoryFolderDetails(
207 userProfile.RootFolder.RequestListOfItems(), userProfile.RootFolder.RequestListOfFolders(), userProfile.RootFolder.SubFoldersCount); 212 remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
213 userProfile.RootFolder.RequestListOfFolders(),
214 fetchFolders, fetchItems);
208 } 215 }
209 } 216 }
210 else 217 else
211 { 218 {
212 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null) 219 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
213 { 220 {
214 remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, fold.RequestListOfItems(), fold.RequestListOfFolders(), fold.SubFoldersCount); 221 remoteClient.SendInventoryFolderDetails(
222 remoteClient.AgentId, folderID, fold.RequestListOfItems(),
223 fold.RequestListOfFolders(), fetchFolders, fetchItems);
215 return; 224 return;
216 } 225 }
217 } 226 }
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 41afe27..8ba161a 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -540,7 +540,9 @@ namespace OpenSim.Framework
540 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, 540 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
541 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity); 541 LLQuaternion rotation, LLVector3 velocity, LLVector3 rotationalvelocity);
542 542
543 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount); 543 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items,
544 List<InventoryFolderBase> folders, bool fetchFolders,
545 bool fetchItems);
544 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item); 546 void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item);
545 547
546 /// <summary> 548 /// <summary>
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
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 4722c13..b31784e 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -323,7 +323,11 @@ namespace SimpleApp
323 { 323 {
324 } 324 }
325 325
326 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) 326 public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID,
327 List<InventoryItemBase> items,
328 List<InventoryFolderBase> folders,
329 bool fetchFolders,
330 bool fetchItems)
327 { 331 {
328 } 332 }
329 333