From 56827894e9fca8d15b84a1f897b24e88c8ab9c29 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sat, 3 May 2008 23:23:46 +0000
Subject: * Refactor RemoveItem()
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 37 ++++++++++++----------
1 file changed, 20 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 7cce216..490457d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -467,6 +467,14 @@ namespace OpenSim.Region.Environment.Scenes
return asset;
}
+ ///
+ /// Move an item within the agent's inventory.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
string newName)
{
@@ -474,6 +482,7 @@ namespace OpenSim.Region.Environment.Scenes
"[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
+
if (userInfo == null)
{
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
@@ -491,7 +500,8 @@ namespace OpenSim.Region.Environment.Scenes
item.Name = newName;
}
item.Folder = folderID;
- userInfo.DeleteItem(item);
+
+ userInfo.DeleteItem(item.ID);
// TODO: preserve current permissions?
AddInventoryItem(remoteClient, item);
@@ -616,6 +626,11 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ ///
+ /// Remove an inventory item for the client's inventory
+ ///
+ ///
+ ///
private void RemoveInventoryItem(IClientAPI remoteClient, LLUUID itemID)
{
CachedUserInfo userInfo
@@ -623,26 +638,14 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo == null)
{
- m_log.ErrorFormat(
- "[AGENT INVENTORY]: Failed to find user {0} {1} to remove inventory item {2}",
+ m_log.WarnFormat(
+ "[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}",
remoteClient.Name, remoteClient.AgentId, itemID);
return;
}
- // is going through the root folder really the best way?
- // this triggers a tree walk to find and remove the item. 8-(
- // since this only happens in Trash (in theory) shouldn't we grab
- // the trash folder directly instead of RootFolder?
- if (userInfo.RootFolder != null)
- {
- InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
-
- if (item != null)
- {
- userInfo.DeleteItem(item);
- }
- }
+ userInfo.DeleteItem(itemID);
}
///
@@ -658,7 +661,7 @@ namespace OpenSim.Region.Environment.Scenes
if (userInfo == null)
{
- m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
+ m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
return;
}
--
cgit v1.1