From ac12ace6f1f837cfe934ddc69438796ad174c84f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 12 May 2011 02:46:13 +0100 Subject: Prevent viewer 2 from creating a duplicate outfit inventory links. I believe this is safe since there is a 1-1 correspondence between link item and worn item (i.e. you can't be wearing the same item at two spots simultaneously in one outfit). This should stop lots of duplicate links being created when viewer 2 is used. However, this doesn't prevent broken inventory links, which I believe is timing related since the effect is not consistent (e.g. keep relogging and the viewer should end up seeing them correctly) . I think we actually see this problem on viewer 1 as well. It might be easier just to implement the Fetch*2 inventory caps which are documented at http://wiki.secondlife.com/wiki/Inventory_API. WebFetch* has been deprecated by Linden Lab since viewer 2.5.1 and according to the sl wiki, "has numerous bugs". --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index cd01a05..523b7f5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -904,11 +904,25 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Link an inventory item to an existing item. + /// + /// + /// + /// + /// + /// + /// + /// + /// /param> + /// private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name, sbyte invType, sbyte type, UUID olditemID) { - m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID); + m_log.DebugFormat( + "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", + remoteClient.Name, name, folderID, olditemID); if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) return; @@ -916,7 +930,20 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence presence; if (TryGetScenePresence(remoteClient.AgentId, out presence)) { -// byte[] data = null; + bool linkAlreadyExists = false; + List existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); + foreach (InventoryItemBase item in existingItems) + if (item.AssetID == olditemID) + linkAlreadyExists = true; + + if (linkAlreadyExists) + { + m_log.WarnFormat( + "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", + remoteClient.Name, name, folderID, olditemID); + + return; + } AssetBase asset = new AssetBase(); asset.FullID = olditemID; -- cgit v1.1