aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
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/Framework
parent* Refactor: Renaming item and folder tree search methods to have Find*() pref... (diff)
downloadopensim-SC_OLD-56827894e9fca8d15b84a1f897b24e88c8ab9c29.zip
opensim-SC_OLD-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.gz
opensim-SC_OLD-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.bz2
opensim-SC_OLD-56827894e9fca8d15b84a1f897b24e88c8ab9c29.tar.xz
* Refactor RemoveItem()
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs61
-rw-r--r--OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs1
2 files changed, 51 insertions, 11 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 6a7b6b7..84e42a3 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -35,7 +35,8 @@ using log4net;
35 35
36namespace OpenSim.Framework.Communications.Cache 36namespace OpenSim.Framework.Communications.Cache
37{ 37{
38 //internal delegate void DeleteItemDelegate( 38 internal delegate void DeleteItemDelegate(LLUUID itemID);
39
39 internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); 40 internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID);
40 internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); 41 internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID);
41 internal delegate void PurgeFolderDelegate(LLUUID folderID); 42 internal delegate void PurgeFolderDelegate(LLUUID folderID);
@@ -306,7 +307,10 @@ namespace OpenSim.Framework.Communications.Cache
306 } 307 }
307 308
308 /// <summary> 309 /// <summary>
309 /// Create a folder in this agent's inventory 310 /// Create a folder in this agent's inventory.
311 ///
312 /// If the inventory service has not yet delievered the inventory
313 /// for this user then the request will be queued.
310 /// </summary> 314 /// </summary>
311 /// <param name="parentID"></param> 315 /// <param name="parentID"></param>
312 /// <returns></returns> 316 /// <returns></returns>
@@ -399,10 +403,14 @@ namespace OpenSim.Framework.Communications.Cache
399 /// <summary> 403 /// <summary>
400 /// Handle a client request to update the inventory folder 404 /// Handle a client request to update the inventory folder
401 /// 405 ///
406 /// If the inventory service has not yet delievered the inventory
407 /// for this user then the request will be queued.
408 ///
402 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE 409 /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
403 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, 410 /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
404 /// and needs to be changed. 411 /// and needs to be changed.
405 /// </summary> 412 /// </summary>
413 ///
406 /// <param name="folderID"></param> 414 /// <param name="folderID"></param>
407 /// <param name="type"></param> 415 /// <param name="type"></param>
408 /// <param name="name"></param> 416 /// <param name="name"></param>
@@ -437,7 +445,11 @@ namespace OpenSim.Framework.Communications.Cache
437 445
438 /// <summary> 446 /// <summary>
439 /// Handle an inventory folder move request from the client. 447 /// Handle an inventory folder move request from the client.
448 ///
449 /// If the inventory service has not yet delievered the inventory
450 /// for this user then the request will be queued.
440 /// </summary> 451 /// </summary>
452 ///
441 /// <param name="folderID"></param> 453 /// <param name="folderID"></param>
442 /// <param name="parentID"></param> 454 /// <param name="parentID"></param>
443 public bool MoveFolder(LLUUID folderID, LLUUID parentID) 455 public bool MoveFolder(LLUUID folderID, LLUUID parentID)
@@ -470,7 +482,11 @@ namespace OpenSim.Framework.Communications.Cache
470 482
471 /// <summary> 483 /// <summary>
472 /// This method will delete all the items and folders in the given folder. 484 /// This method will delete all the items and folders in the given folder.
485 ///
486 /// If the inventory service has not yet delievered the inventory
487 /// for this user then the request will be queued.
473 /// </summary> 488 /// </summary>
489 ///
474 /// <param name="folderID"></param> 490 /// <param name="folderID"></param>
475 public bool PurgeFolder(LLUUID folderID) 491 public bool PurgeFolder(LLUUID folderID)
476 { 492 {
@@ -540,23 +556,46 @@ namespace OpenSim.Framework.Communications.Cache
540 556
541 /// <summary> 557 /// <summary>
542 /// Delete an item from the user's inventory 558 /// Delete an item from the user's inventory
559 ///
560 /// If the inventory service has not yet delievered the inventory
561 /// for this user then the request will be queued.
543 /// </summary> 562 /// </summary>
544 /// <param name="userID"></param> 563 /// <param name="itemID"></param>
545 /// <param name="item"></param> 564 /// <returns>
546 /// <returns></returns> 565 /// true on a successful delete or a if the request is queued.
547 public bool DeleteItem(InventoryItemBase item) 566 /// Returns false on an immediate failure
567 /// </returns>
568 public bool DeleteItem(LLUUID itemID)
548 { 569 {
549 bool result = false;
550 if (HasInventory) 570 if (HasInventory)
551 { 571 {
552 result = RootFolder.DeleteItem(item.ID); 572 // XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though
553 if (result) 573 // really only the item id is required.
574 InventoryItemBase item = RootFolder.FindItem(itemID);
575
576 if (null == item)
554 { 577 {
555 m_commsManager.InventoryService.DeleteItem(item); 578 m_log.WarnFormat("[AGENT INVENTORY]: Tried to delete item {0} which does not exist", itemID);
579
580 return false;
581 }
582
583 if (RootFolder.DeleteItem(item.ID))
584 {
585 return m_commsManager.InventoryService.DeleteItem(item);
556 } 586 }
557 } 587 }
588 else
589 {
590 AddRequest(
591 new InventoryRequest(
592 Delegate.CreateDelegate(typeof(DeleteItemDelegate), this, "DeleteItem"),
593 new object[] { itemID }));
594
595 return true;
596 }
558 597
559 return result; 598 return false;
560 } 599 }
561 } 600 }
562 601
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
index 39296eb..af05af3 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolderImpl.cs
@@ -163,6 +163,7 @@ namespace OpenSim.Framework.Communications.Cache
163 } 163 }
164 } 164 }
165 } 165 }
166
166 return found; 167 return found;
167 } 168 }
168 169