aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs56
1 files changed, 52 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index cd01a05..3bf2c2b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -904,11 +904,29 @@ namespace OpenSim.Region.Framework.Scenes
904 } 904 }
905 } 905 }
906 906
907 /// <summary>
908 /// Link an inventory item to an existing item.
909 /// </summary>
910 /// <remarks>
911 /// The linkee item id is placed in the asset id slot. This appears to be what the viewer expects when
912 /// it receives inventory information.
913 /// </remarks>
914 /// <param name="remoteClient"></param>
915 /// <param name="transActionID"></param>
916 /// <param name="folderID"></param>
917 /// <param name="callbackID"></param>
918 /// <param name="description"></param>
919 /// <param name="name"></param>
920 /// <param name="invType"></param>
921 /// <param name="type">/param>
922 /// <param name="olditemID"></param>
907 private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, 923 private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID,
908 uint callbackID, string description, string name, 924 uint callbackID, string description, string name,
909 sbyte invType, sbyte type, UUID olditemID) 925 sbyte invType, sbyte type, UUID olditemID)
910 { 926 {
911 m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID); 927 m_log.DebugFormat(
928 "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
929 remoteClient.Name, name, folderID, olditemID);
912 930
913 if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) 931 if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
914 return; 932 return;
@@ -916,7 +934,20 @@ namespace OpenSim.Region.Framework.Scenes
916 ScenePresence presence; 934 ScenePresence presence;
917 if (TryGetScenePresence(remoteClient.AgentId, out presence)) 935 if (TryGetScenePresence(remoteClient.AgentId, out presence))
918 { 936 {
919// byte[] data = null; 937 bool linkAlreadyExists = false;
938 List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID);
939 foreach (InventoryItemBase item in existingItems)
940 if (item.AssetID == olditemID)
941 linkAlreadyExists = true;
942
943 if (linkAlreadyExists)
944 {
945 m_log.WarnFormat(
946 "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists",
947 remoteClient.Name, name, folderID, olditemID);
948
949 return;
950 }
920 951
921 AssetBase asset = new AssetBase(); 952 AssetBase asset = new AssetBase();
922 asset.FullID = olditemID; 953 asset.FullID = olditemID;
@@ -1351,11 +1382,28 @@ namespace OpenSim.Region.Framework.Scenes
1351 InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); 1382 InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId);
1352 containingFolder = InventoryService.GetFolder(containingFolder); 1383 containingFolder = InventoryService.GetFolder(containingFolder);
1353 1384
1354 //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", 1385// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
1355 // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); 1386// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
1356 1387
1357 if (containingFolder != null && containingFolder != null) 1388 if (containingFolder != null && containingFolder != null)
1389 {
1390 // If the folder requested contains links, then we need to send those folders first, otherwise the links
1391 // will be broken in the viewer.
1392 HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
1393 foreach (InventoryItemBase item in contents.Items)
1394 {
1395 if (item.AssetType == (int)AssetType.Link)
1396 {
1397 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
1398 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1399 }
1400 }
1401
1402 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
1403 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
1404
1358 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); 1405 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems);
1406 }
1359 } 1407 }
1360 1408
1361 /// <summary> 1409 /// <summary>