diff options
author | Melanie | 2011-05-13 12:05:46 +0100 |
---|---|---|
committer | Melanie | 2011-05-13 12:05:46 +0100 |
commit | 75d4956ee58340adca06d2ad602e2cd87b2e5943 (patch) | |
tree | 8203a626b75a7926bcffe8044847724fd53dae40 /OpenSim/Region/Framework | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.zip opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.gz opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.bz2 opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 56 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 4 |
2 files changed, 56 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dfb5846..1c30a35 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -907,11 +907,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
907 | } | 907 | } |
908 | } | 908 | } |
909 | 909 | ||
910 | /// <summary> | ||
911 | /// Link an inventory item to an existing item. | ||
912 | /// </summary> | ||
913 | /// <remarks> | ||
914 | /// The linkee item id is placed in the asset id slot. This appears to be what the viewer expects when | ||
915 | /// it receives inventory information. | ||
916 | /// </remarks> | ||
917 | /// <param name="remoteClient"></param> | ||
918 | /// <param name="transActionID"></param> | ||
919 | /// <param name="folderID"></param> | ||
920 | /// <param name="callbackID"></param> | ||
921 | /// <param name="description"></param> | ||
922 | /// <param name="name"></param> | ||
923 | /// <param name="invType"></param> | ||
924 | /// <param name="type">/param> | ||
925 | /// <param name="olditemID"></param> | ||
910 | private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, | 926 | private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, |
911 | uint callbackID, string description, string name, | 927 | uint callbackID, string description, string name, |
912 | sbyte invType, sbyte type, UUID olditemID) | 928 | sbyte invType, sbyte type, UUID olditemID) |
913 | { | 929 | { |
914 | m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID); | 930 | m_log.DebugFormat( |
931 | "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | ||
932 | remoteClient.Name, name, folderID, olditemID); | ||
915 | 933 | ||
916 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 934 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
917 | return; | 935 | return; |
@@ -919,7 +937,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
919 | ScenePresence presence; | 937 | ScenePresence presence; |
920 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | 938 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) |
921 | { | 939 | { |
922 | // byte[] data = null; | 940 | bool linkAlreadyExists = false; |
941 | List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); | ||
942 | foreach (InventoryItemBase item in existingItems) | ||
943 | if (item.AssetID == olditemID) | ||
944 | linkAlreadyExists = true; | ||
945 | |||
946 | if (linkAlreadyExists) | ||
947 | { | ||
948 | m_log.WarnFormat( | ||
949 | "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", | ||
950 | remoteClient.Name, name, folderID, olditemID); | ||
951 | |||
952 | return; | ||
953 | } | ||
923 | 954 | ||
924 | AssetBase asset = new AssetBase(); | 955 | AssetBase asset = new AssetBase(); |
925 | asset.FullID = olditemID; | 956 | asset.FullID = olditemID; |
@@ -1370,11 +1401,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1370 | InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); | 1401 | InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); |
1371 | containingFolder = InventoryService.GetFolder(containingFolder); | 1402 | containingFolder = InventoryService.GetFolder(containingFolder); |
1372 | 1403 | ||
1373 | //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", | 1404 | // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", |
1374 | // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); | 1405 | // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); |
1375 | 1406 | ||
1376 | if (containingFolder != null && containingFolder != null) | 1407 | if (containingFolder != null && containingFolder != null) |
1408 | { | ||
1409 | // If the folder requested contains links, then we need to send those folders first, otherwise the links | ||
1410 | // will be broken in the viewer. | ||
1411 | HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>(); | ||
1412 | foreach (InventoryItemBase item in contents.Items) | ||
1413 | { | ||
1414 | if (item.AssetType == (int)AssetType.Link) | ||
1415 | { | ||
1416 | InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); | ||
1417 | linkedItemFolderIdsToSend.Add(linkedItem.Folder); | ||
1418 | } | ||
1419 | } | ||
1420 | |||
1421 | foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) | ||
1422 | SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); | ||
1423 | |||
1377 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); | 1424 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); |
1425 | } | ||
1378 | } | 1426 | } |
1379 | 1427 | ||
1380 | /// <summary> | 1428 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ab567fb..e2d7208 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -499,6 +499,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
499 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, | 499 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, |
500 | bool fetchFolders, bool fetchItems, int sortOrder) | 500 | bool fetchFolders, bool fetchItems, int sortOrder) |
501 | { | 501 | { |
502 | // m_log.DebugFormat( | ||
503 | // "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}", | ||
504 | // remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder); | ||
505 | |||
502 | if (folderID == UUID.Zero) | 506 | if (folderID == UUID.Zero) |
503 | return; | 507 | return; |
504 | 508 | ||