aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-23 23:16:48 +0100
committerJustin Clark-Casey (justincc)2010-08-23 23:16:48 +0100
commit704a53fb9bfeb945fa25f7367c631698dea5ae89 (patch)
tree532e4df3b07791e26f96d67be3f32614d9af052b
parentRemove various warnings and improve logging messages. No functional changes. (diff)
downloadopensim-SC_OLD-704a53fb9bfeb945fa25f7367c631698dea5ae89.zip
opensim-SC_OLD-704a53fb9bfeb945fa25f7367c631698dea5ae89.tar.gz
opensim-SC_OLD-704a53fb9bfeb945fa25f7367c631698dea5ae89.tar.bz2
opensim-SC_OLD-704a53fb9bfeb945fa25f7367c631698dea5ae89.tar.xz
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
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs22
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs6
-rw-r--r--OpenSim/Services/Interfaces/IInventoryService.cs7
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs14
5 files changed, 38 insertions, 16 deletions
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
216 return m_InventoryService.PurgeFolder(folder); 216 return m_InventoryService.PurgeFolder(folder);
217 } 217 }
218 218
219 /// <summary>
220 /// Add a new item to the user's inventory
221 /// </summary>
222 /// <param name="item"></param>
223 /// <returns>true if the item was successfully added</returns>
224 public bool AddItem(InventoryItemBase item) 219 public bool AddItem(InventoryItemBase item)
225 { 220 {
226 m_log.DebugFormat( 221 m_log.DebugFormat(
227 "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", 222 "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
228 item.Name, item.Owner, item.Folder); 223 item.Name, item.Owner, item.Folder);
224
225 if (UUID.Zero == item.Folder)
226 {
227 InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
228 if (f != null)
229 {
230 item.Folder = f.ID;
231 }
232 else
233 {
234 f = m_InventoryService.GetRootFolder(item.Owner);
235 if (f != null)
236 item.Folder = f.ID;
237 else
238 return false;
239 }
240 }
229 241
230 return m_InventoryService.AddItem(item); 242 return m_InventoryService.AddItem(item);
231 } 243 }
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
294 return m_RemoteConnector.GetAssetPermissions(userID, assetID); 294 return m_RemoteConnector.GetAssetPermissions(userID, assetID);
295 } 295 }
296 296
297
298 #endregion 297 #endregion
299
300
301 } 298 }
302} 299} \ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b6eddb1..dc43e45 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3844,18 +3844,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3844 if (World.GetScenePresence(destId) != null) 3844 if (World.GetScenePresence(destId) != null)
3845 { 3845 {
3846 // destination is an avatar 3846 // destination is an avatar
3847 InventoryItemBase agentItem = 3847 InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
3848 World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
3849 3848
3850 if (agentItem == null) 3849 if (agentItem == null)
3851 return; 3850 return;
3852 3851
3853 byte[] bucket = new byte[17]; 3852 byte[] bucket = new byte[17];
3854 bucket[0] = (byte)assetType; 3853 bucket[0] = (byte)assetType;
3855 byte[] objBytes = objId.GetBytes(); 3854 byte[] objBytes = agentItem.ID.GetBytes();
3856 Array.Copy(objBytes, 0, bucket, 1, 16); 3855 Array.Copy(objBytes, 0, bucket, 1, 16);
3857 3856
3858 Console.WriteLine("Giving inventory");
3859 GridInstantMessage msg = new GridInstantMessage(World, 3857 GridInstantMessage msg = new GridInstantMessage(World,
3860 m_host.UUID, m_host.Name+", an object owned by "+ 3858 m_host.UUID, m_host.Name+", an object owned by "+
3861 resolveName(m_host.OwnerID)+",", destId, 3859 resolveName(m_host.OwnerID)+",", destId,
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs
index 1b78fb3..d19faed 100644
--- a/OpenSim/Services/Interfaces/IInventoryService.cs
+++ b/OpenSim/Services/Interfaces/IInventoryService.cs
@@ -141,8 +141,11 @@ namespace OpenSim.Services.Interfaces
141 /// <summary> 141 /// <summary>
142 /// Add a new item to the user's inventory 142 /// Add a new item to the user's inventory
143 /// </summary> 143 /// </summary>
144 /// <param name="item"></param> 144 /// <param name="item">
145 /// <returns>true if the item was successfully added</returns> 145 /// The item to be added. If item.FolderID == UUID.Zero then the item is added to the most suitable system
146 /// folder. If there is no suitable folder then the item is added to the user's root inventory folder.
147 /// </param>
148 /// <returns>true if the item was successfully added, false if it was not</returns>
146 bool AddItem(InventoryItemBase item); 149 bool AddItem(InventoryItemBase item);
147 150
148 /// <summary> 151 /// <summary>
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 90a5c22..84306e7 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -219,12 +219,21 @@ namespace OpenSim.Services.InventoryService
219 219
220 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 220 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
221 { 221 {
222// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
223
222 XInventoryFolder[] folders = m_Database.GetFolders( 224 XInventoryFolder[] folders = m_Database.GetFolders(
223 new string[] { "agentID", "type"}, 225 new string[] { "agentID", "type"},
224 new string[] { principalID.ToString(), ((int)type).ToString() }); 226 new string[] { principalID.ToString(), ((int)type).ToString() });
225 227
226 if (folders.Length == 0) 228 if (folders.Length == 0)
229 {
230// m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID);
227 return null; 231 return null;
232 }
233
234// m_log.DebugFormat(
235// "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}",
236// folders[0].folderName, folders[0].folderID, type, principalID);
228 237
229 return ConvertToOpenSim(folders[0]); 238 return ConvertToOpenSim(folders[0]);
230 } 239 }
@@ -235,7 +244,7 @@ namespace OpenSim.Services.InventoryService
235 // connector. So we disregard the principal and look 244 // connector. So we disregard the principal and look
236 // by ID. 245 // by ID.
237 // 246 //
238 m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); 247 m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString());
239 InventoryCollection inventory = new InventoryCollection(); 248 InventoryCollection inventory = new InventoryCollection();
240 inventory.UserID = principalID; 249 inventory.UserID = principalID;
241 inventory.Folders = new List<InventoryFolderBase>(); 250 inventory.Folders = new List<InventoryFolderBase>();
@@ -354,6 +363,9 @@ namespace OpenSim.Services.InventoryService
354 363
355 public virtual bool AddItem(InventoryItemBase item) 364 public virtual bool AddItem(InventoryItemBase item)
356 { 365 {
366// m_log.DebugFormat(
367// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner);
368
357 return m_Database.StoreItem(ConvertFromOpenSim(item)); 369 return m_Database.StoreItem(ConvertFromOpenSim(item));
358 } 370 }
359 371