diff options
author | Brian McBee | 2007-12-15 04:57:14 +0000 |
---|---|---|
committer | Brian McBee | 2007-12-15 04:57:14 +0000 |
commit | 8a8c89a0f32b528bd588715bdbfc875c852e7187 (patch) | |
tree | b46cb20d03dfdb21a5cbdfa514a8e745070a3713 /OpenSim/Region | |
parent | Set svn:eol-style. Cleaned up set-eol-style.sh a bit. (diff) | |
download | opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.zip opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.gz opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.bz2 opensim-SC_OLD-8a8c89a0f32b528bd588715bdbfc875c852e7187.tar.xz |
Grid Inventory feature upgrade: renaming folders should now be correct, subfolders work, moving folders works.
Tested only in MYSQL, but may work in MSSQL and sqlite.
Probably not working in standalone mode.
Diffstat (limited to 'OpenSim/Region')
5 files changed, 78 insertions, 4 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 0514df5..1746db8 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -502,6 +502,7 @@ namespace OpenSim.Region.ClientStack | |||
502 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | 502 | public event CreateNewInventoryItem OnCreateNewInventoryItem; |
503 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 503 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
504 | public event UpdateInventoryFolder OnUpdateInventoryFolder; | 504 | public event UpdateInventoryFolder OnUpdateInventoryFolder; |
505 | public event MoveInventoryFolder OnMoveInventoryFolder; | ||
505 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 506 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
506 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; | 507 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; |
507 | public event FetchInventory OnFetchInventory; | 508 | public event FetchInventory OnFetchInventory; |
@@ -892,7 +893,7 @@ namespace OpenSim.Region.ClientStack | |||
892 | /// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since | 893 | /// <param name="subFoldersCount">The number of subfolders contained in the given folder. This is necessary since |
893 | /// the client is expecting inventory packets which incorporate this number into the descendents field, even though | 894 | /// the client is expecting inventory packets which incorporate this number into the descendents field, even though |
894 | /// we send back no details of the folders themselves (only the items).</param> | 895 | /// we send back no details of the folders themselves (only the items).</param> |
895 | public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount) | 896 | public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) |
896 | { | 897 | { |
897 | Encoding enc = Encoding.ASCII; | 898 | Encoding enc = Encoding.ASCII; |
898 | uint FULL_MASK_PERMISSIONS = 2147483647; | 899 | uint FULL_MASK_PERMISSIONS = 2147483647; |
@@ -931,14 +932,14 @@ namespace OpenSim.Region.ClientStack | |||
931 | descend.ItemData[i].FolderID = item.parentFolderID; | 932 | descend.ItemData[i].FolderID = item.parentFolderID; |
932 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); | 933 | descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); |
933 | descend.ItemData[i].GroupMask = 0; | 934 | descend.ItemData[i].GroupMask = 0; |
934 | descend.ItemData[i].InvType = (sbyte) item.invType; | 935 | descend.ItemData[i].InvType = (sbyte)item.invType; |
935 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); | 936 | descend.ItemData[i].Name = Helpers.StringToField(item.inventoryName); |
936 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; | 937 | descend.ItemData[i].NextOwnerMask = item.inventoryNextPermissions; |
937 | descend.ItemData[i].OwnerID = item.avatarID; | 938 | descend.ItemData[i].OwnerID = item.avatarID; |
938 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; | 939 | descend.ItemData[i].OwnerMask = item.inventoryCurrentPermissions; |
939 | descend.ItemData[i].SalePrice = 0; | 940 | descend.ItemData[i].SalePrice = 0; |
940 | descend.ItemData[i].SaleType = 0; | 941 | descend.ItemData[i].SaleType = 0; |
941 | descend.ItemData[i].Type = (sbyte) item.assetType; | 942 | descend.ItemData[i].Type = (sbyte)item.assetType; |
942 | descend.ItemData[i].CRC = | 943 | descend.ItemData[i].CRC = |
943 | 944 | ||
944 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, | 945 | Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType, |
@@ -976,6 +977,47 @@ namespace OpenSim.Region.ClientStack | |||
976 | { | 977 | { |
977 | OutPacket(descend, ThrottleOutPacketType.Asset); | 978 | OutPacket(descend, ThrottleOutPacketType.Asset); |
978 | } | 979 | } |
980 | |||
981 | //send subfolders | ||
982 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
983 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count]; | ||
984 | i = 0; | ||
985 | count = 0; | ||
986 | foreach (InventoryFolderBase folder in folders) | ||
987 | { | ||
988 | descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock(); | ||
989 | descend.FolderData[i].FolderID = folder.folderID; | ||
990 | descend.FolderData[i].Name = Helpers.StringToField(folder.name); | ||
991 | descend.FolderData[i].ParentID = folder.parentID; | ||
992 | descend.FolderData[i].Type = (sbyte)folder.type; | ||
993 | i++; | ||
994 | count++; | ||
995 | if (i == 40) | ||
996 | { | ||
997 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
998 | |||
999 | if ((folders.Count - count) > 0) | ||
1000 | { | ||
1001 | descend = CreateInventoryDescendentsPacket(ownerID, folderID); | ||
1002 | if ((folders.Count - count) < 40) | ||
1003 | { | ||
1004 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[items.Count - count]; | ||
1005 | descend.AgentData.Descendents = folders.Count - count; | ||
1006 | } | ||
1007 | else | ||
1008 | { | ||
1009 | descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[40]; | ||
1010 | descend.AgentData.Descendents = 40; | ||
1011 | } | ||
1012 | i = 0; | ||
1013 | } | ||
1014 | } | ||
1015 | } | ||
1016 | |||
1017 | if (i < 40) | ||
1018 | { | ||
1019 | OutPacket(descend, ThrottleOutPacketType.Asset); | ||
1020 | } | ||
979 | } | 1021 | } |
980 | 1022 | ||
981 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) | 1023 | private InventoryDescendentsPacket CreateInventoryDescendentsPacket(LLUUID ownerID, LLUUID folderID) |
@@ -2821,6 +2863,17 @@ namespace OpenSim.Region.ClientStack | |||
2821 | } | 2863 | } |
2822 | } | 2864 | } |
2823 | break; | 2865 | break; |
2866 | case PacketType.MoveInventoryFolder: | ||
2867 | if (OnMoveInventoryFolder != null) | ||
2868 | { | ||
2869 | MoveInventoryFolderPacket invFolder = (MoveInventoryFolderPacket)Pack; | ||
2870 | for (int i = 0; i < invFolder.InventoryData.Length; i++) | ||
2871 | { | ||
2872 | OnMoveInventoryFolder(this, invFolder.InventoryData[i].FolderID, | ||
2873 | invFolder.InventoryData[i].ParentID); | ||
2874 | } | ||
2875 | } | ||
2876 | break; | ||
2824 | case PacketType.CreateInventoryItem: | 2877 | case PacketType.CreateInventoryItem: |
2825 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; | 2878 | CreateInventoryItemPacket createItem = (CreateInventoryItemPacket) Pack; |
2826 | if (OnCreateNewInventoryItem != null) | 2879 | if (OnCreateNewInventoryItem != null) |
@@ -3267,6 +3320,10 @@ namespace OpenSim.Region.ClientStack | |||
3267 | // TODO: handle this packet | 3320 | // TODO: handle this packet |
3268 | MainLog.Instance.Warn("CLIENT", "unhandled RequestRegionInfo packet"); | 3321 | MainLog.Instance.Warn("CLIENT", "unhandled RequestRegionInfo packet"); |
3269 | break; | 3322 | break; |
3323 | case PacketType.InventoryDescendents: | ||
3324 | // TODO: handle this packet | ||
3325 | MainLog.Instance.Warn("CLIENT", "unhandled InventoryDescent packet"); | ||
3326 | break; | ||
3270 | default: | 3327 | default: |
3271 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); | 3328 | MainLog.Instance.Warn("CLIENT", "unhandled packet " + Pack.ToString()); |
3272 | break; | 3329 | break; |
diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index e82d267..08bd850 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs | |||
@@ -68,6 +68,11 @@ namespace OpenSim.Region.Communications.Local | |||
68 | AddFolder(folder); | 68 | AddFolder(folder); |
69 | } | 69 | } |
70 | 70 | ||
71 | public override void MoveExistingInventoryFolder(InventoryFolderBase folder) | ||
72 | { | ||
73 | MoveFolder(folder); | ||
74 | } | ||
75 | |||
71 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 76 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
72 | { | 77 | { |
73 | AddItem(item); | 78 | AddItem(item); |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index d45e150..4f5d9ab 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -126,6 +126,16 @@ namespace OpenSim.Region.Communications.OGS1 | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
130 | { | ||
131 | try | ||
132 | { | ||
133 | RestObjectPoster.BeginPostObject<InventoryFolderBase>(_inventoryServerUrl + "/MoveFolder/", folder); | ||
134 | } | ||
135 | catch (Exception) | ||
136 | { | ||
137 | } | ||
138 | } | ||
129 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | 139 | public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) |
130 | { | 140 | { |
131 | try | 141 | try |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 59548a2..aad977a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1102,6 +1102,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1102 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 1102 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
1103 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; | 1103 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; |
1104 | client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; | 1104 | client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; |
1105 | client.OnMoveInventoryFolder += CommsManager.UserProfileCacheService.HandleMoveInventoryFolder; | ||
1105 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; | 1106 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; |
1106 | client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; | 1107 | client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; |
1107 | client.OnRequestTaskInventory += RequestTaskInventory; | 1108 | client.OnRequestTaskInventory += RequestTaskInventory; |
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 9864074..9b2cdda 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | |||
@@ -108,6 +108,7 @@ namespace SimpleApp | |||
108 | public event CreateNewInventoryItem OnCreateNewInventoryItem; | 108 | public event CreateNewInventoryItem OnCreateNewInventoryItem; |
109 | public event CreateInventoryFolder OnCreateNewInventoryFolder; | 109 | public event CreateInventoryFolder OnCreateNewInventoryFolder; |
110 | public event UpdateInventoryFolder OnUpdateInventoryFolder; | 110 | public event UpdateInventoryFolder OnUpdateInventoryFolder; |
111 | public event MoveInventoryFolder OnMoveInventoryFolder; | ||
111 | public event FetchInventoryDescendents OnFetchInventoryDescendents; | 112 | public event FetchInventoryDescendents OnFetchInventoryDescendents; |
112 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; | 113 | public event PurgeInventoryDescendents OnPurgeInventoryDescendents; |
113 | public event FetchInventory OnFetchInventory; | 114 | public event FetchInventory OnFetchInventory; |
@@ -317,7 +318,7 @@ namespace SimpleApp | |||
317 | { | 318 | { |
318 | } | 319 | } |
319 | 320 | ||
320 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, int subFoldersCount) | 321 | public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int subFoldersCount) |
321 | { | 322 | { |
322 | } | 323 | } |
323 | 324 | ||