aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-05-03 23:23:46 +0000
committerJustin Clarke Casey2008-05-03 23:23:46 +0000
commit56827894e9fca8d15b84a1f897b24e88c8ab9c29 (patch)
treedfbd1fc9609a9835e5565bdf6ef89d685d92f9f5 /OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
parent* Refactor: Renaming item and folder tree search methods to have Find*() pref... (diff)
downloadopensim-SC-56827894e9fca8d15b84a1f897b24e88c8ab9c29.zip
opensim-SC-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.gz
opensim-SC-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.bz2
opensim-SC-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.xz
* Refactor RemoveItem()
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs37
1 files changed, 20 insertions, 17 deletions
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
467 return asset; 467 return asset;
468 } 468 }
469 469
470 /// <summary>
471 /// Move an item within the agent's inventory.
472 /// </summary>
473 /// <param name="remoteClient"></param>
474 /// <param name="folderID"></param>
475 /// <param name="itemID"></param>
476 /// <param name="length"></param>
477 /// <param name="newName"></param>
470 public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, 478 public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length,
471 string newName) 479 string newName)
472 { 480 {
@@ -474,6 +482,7 @@ namespace OpenSim.Region.Environment.Scenes
474 "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); 482 "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
475 483
476 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 484 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
485
477 if (userInfo == null) 486 if (userInfo == null)
478 { 487 {
479 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); 488 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
@@ -491,7 +500,8 @@ namespace OpenSim.Region.Environment.Scenes
491 item.Name = newName; 500 item.Name = newName;
492 } 501 }
493 item.Folder = folderID; 502 item.Folder = folderID;
494 userInfo.DeleteItem(item); 503
504 userInfo.DeleteItem(item.ID);
495 505
496 // TODO: preserve current permissions? 506 // TODO: preserve current permissions?
497 AddInventoryItem(remoteClient, item); 507 AddInventoryItem(remoteClient, item);
@@ -616,6 +626,11 @@ namespace OpenSim.Region.Environment.Scenes
616 } 626 }
617 } 627 }
618 628
629 /// <summary>
630 /// Remove an inventory item for the client's inventory
631 /// </summary>
632 /// <param name="remoteClient"></param>
633 /// <param name="itemID"></param>
619 private void RemoveInventoryItem(IClientAPI remoteClient, LLUUID itemID) 634 private void RemoveInventoryItem(IClientAPI remoteClient, LLUUID itemID)
620 { 635 {
621 CachedUserInfo userInfo 636 CachedUserInfo userInfo
@@ -623,26 +638,14 @@ namespace OpenSim.Region.Environment.Scenes
623 638
624 if (userInfo == null) 639 if (userInfo == null)
625 { 640 {
626 m_log.ErrorFormat( 641 m_log.WarnFormat(
627 "[AGENT INVENTORY]: Failed to find user {0} {1} to remove inventory item {2}", 642 "[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}",
628 remoteClient.Name, remoteClient.AgentId, itemID); 643 remoteClient.Name, remoteClient.AgentId, itemID);
629 644
630 return; 645 return;
631 } 646 }
632 647
633 // is going through the root folder really the best way? 648 userInfo.DeleteItem(itemID);
634 // this triggers a tree walk to find and remove the item. 8-(
635 // since this only happens in Trash (in theory) shouldn't we grab
636 // the trash folder directly instead of RootFolder?
637 if (userInfo.RootFolder != null)
638 {
639 InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
640
641 if (item != null)
642 {
643 userInfo.DeleteItem(item);
644 }
645 }
646 } 649 }
647 650
648 /// <summary> 651 /// <summary>
@@ -658,7 +661,7 @@ namespace OpenSim.Region.Environment.Scenes
658 661
659 if (userInfo == null) 662 if (userInfo == null)
660 { 663 {
661 m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); 664 m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
662 return; 665 return;
663 } 666 }
664 667