diff options
author | Justin Clark-Casey (justincc) | 2011-05-17 21:49:38 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-05-17 22:31:16 +0100 |
commit | 491279f99afc65860d44765ee7829c7dd5e4e38e (patch) | |
tree | 3237395646d9fd92b2424df31bc8f6e8109c7f48 /OpenSim/Services/InventoryService | |
parent | don't throw a null reference if an inventory link target doesn't exist when w... (diff) | |
download | opensim-SC_OLD-491279f99afc65860d44765ee7829c7dd5e4e38e.zip opensim-SC_OLD-491279f99afc65860d44765ee7829c7dd5e4e38e.tar.gz opensim-SC_OLD-491279f99afc65860d44765ee7829c7dd5e4e38e.tar.bz2 opensim-SC_OLD-491279f99afc65860d44765ee7829c7dd5e4e38e.tar.xz |
Allow item links to be deleted even when other deletes and purges are disabled.
If these links are not deleted, then they will build up in the player's inventory until they can no longer log in.
Accidental deletion of links due to bugs or other causes is potentially inconvenient but on a par with items being
accidentally moved. When a link is deleted, the target of the link is never touched.
This is a general solution that accounts for the use of links anywhere in the user's inventory.
Diffstat (limited to 'OpenSim/Services/InventoryService')
-rw-r--r-- | OpenSim/Services/InventoryService/XInventoryService.cs | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0af35c8..a094a02 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -411,12 +411,30 @@ namespace OpenSim.Services.InventoryService | |||
411 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 411 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
412 | { | 412 | { |
413 | if (!m_AllowDelete) | 413 | if (!m_AllowDelete) |
414 | return false; | 414 | { |
415 | 415 | // We must still allow links and links to folders to be deleted, otherwise they will build up | |
416 | // Just use the ID... *facepalms* | 416 | // in the player's inventory until they can no longer log in. Deletions of links due to code bugs or |
417 | // | 417 | // similar is inconvenient but on a par with accidental movement of items. The original item is never |
418 | foreach (UUID id in itemIDs) | 418 | // touched. |
419 | m_Database.DeleteItems("inventoryID", id.ToString()); | 419 | foreach (UUID id in itemIDs) |
420 | { | ||
421 | if (!m_Database.DeleteItems( | ||
422 | new string[] { "inventoryID", "assetType" }, | ||
423 | new string[] { id.ToString(), ((sbyte)AssetType.Link).ToString() })); | ||
424 | { | ||
425 | m_Database.DeleteItems( | ||
426 | new string[] { "inventoryID", "assetType" }, | ||
427 | new string[] { id.ToString(), ((sbyte)AssetType.LinkFolder).ToString() }); | ||
428 | } | ||
429 | } | ||
430 | } | ||
431 | else | ||
432 | { | ||
433 | // Just use the ID... *facepalms* | ||
434 | // | ||
435 | foreach (UUID id in itemIDs) | ||
436 | m_Database.DeleteItems("inventoryID", id.ToString()); | ||
437 | } | ||
420 | 438 | ||
421 | return true; | 439 | return true; |
422 | } | 440 | } |