From 704a53fb9bfeb945fa25f7367c631698dea5ae89 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 23 Aug 2010 23:16:48 +0100
Subject: Fix bug in llGiveInventory() where items were disappearing on relog
This was a regression - the code to look up the correct type folder was no longer being called if items were added without a parent folder set
This may have been broken since commit bd49985a on 2010-05-02
---
.../Inventory/LocalInventoryServiceConnector.cs | 22 +++++++++++++++++-----
.../Inventory/RemoteXInventoryServiceConnector.cs | 5 +----
2 files changed, 18 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 3de6e5c..350ad66 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -216,16 +216,28 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.PurgeFolder(folder);
}
- ///
- /// Add a new item to the user's inventory
- ///
- ///
- /// true if the item was successfully added
public bool AddItem(InventoryItemBase item)
{
m_log.DebugFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
item.Name, item.Owner, item.Folder);
+
+ if (UUID.Zero == item.Folder)
+ {
+ InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
+ if (f != null)
+ {
+ item.Folder = f.ID;
+ }
+ else
+ {
+ f = m_InventoryService.GetRootFolder(item.Owner);
+ if (f != null)
+ item.Folder = f.ID;
+ else
+ return false;
+ }
+ }
return m_InventoryService.AddItem(item);
}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index ada26cc..34205e3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -294,9 +294,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetAssetPermissions(userID, assetID);
}
-
#endregion
-
-
}
-}
+}
\ No newline at end of file
--
cgit v1.1