diff options
author | Justin Clark-Casey (justincc) | 2011-05-19 00:51:14 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-05-19 00:51:14 +0100 |
commit | bdd7849094996392417ea3e5080578a04b69afac (patch) | |
tree | f36e58f246f11eeae87dcb6cd352cdbe3f91a183 /OpenSim/Services/InventoryService | |
parent | Accidentally committed too early (diff) | |
download | opensim-SC-bdd7849094996392417ea3e5080578a04b69afac.zip opensim-SC-bdd7849094996392417ea3e5080578a04b69afac.tar.gz opensim-SC-bdd7849094996392417ea3e5080578a04b69afac.tar.bz2 opensim-SC-bdd7849094996392417ea3e5080578a04b69afac.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 | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 0af35c8..2282ee8 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -393,6 +393,10 @@ namespace OpenSim.Services.InventoryService | |||
393 | 393 | ||
394 | public virtual bool UpdateItem(InventoryItemBase item) | 394 | public virtual bool UpdateItem(InventoryItemBase item) |
395 | { | 395 | { |
396 | if (!m_AllowDelete) | ||
397 | if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder) | ||
398 | return false; | ||
399 | |||
396 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | 400 | return m_Database.StoreItem(ConvertFromOpenSim(item)); |
397 | } | 401 | } |
398 | 402 | ||
@@ -411,12 +415,30 @@ namespace OpenSim.Services.InventoryService | |||
411 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) | 415 | public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) |
412 | { | 416 | { |
413 | if (!m_AllowDelete) | 417 | if (!m_AllowDelete) |
414 | return false; | 418 | { |
415 | 419 | // We must still allow links and links to folders to be deleted, otherwise they will build up | |
416 | // Just use the ID... *facepalms* | 420 | // in the player's inventory until they can no longer log in. Deletions of links due to code bugs or |
417 | // | 421 | // similar is inconvenient but on a par with accidental movement of items. The original item is never |
418 | foreach (UUID id in itemIDs) | 422 | // touched. |
419 | m_Database.DeleteItems("inventoryID", id.ToString()); | 423 | foreach (UUID id in itemIDs) |
424 | { | ||
425 | if (!m_Database.DeleteItems( | ||
426 | new string[] { "inventoryID", "assetType" }, | ||
427 | new string[] { id.ToString(), ((sbyte)AssetType.Link).ToString() })); | ||
428 | { | ||
429 | m_Database.DeleteItems( | ||
430 | new string[] { "inventoryID", "assetType" }, | ||
431 | new string[] { id.ToString(), ((sbyte)AssetType.LinkFolder).ToString() }); | ||
432 | } | ||
433 | } | ||
434 | } | ||
435 | else | ||
436 | { | ||
437 | // Just use the ID... *facepalms* | ||
438 | // | ||
439 | foreach (UUID id in itemIDs) | ||
440 | m_Database.DeleteItems("inventoryID", id.ToString()); | ||
441 | } | ||
420 | 442 | ||
421 | return true; | 443 | return true; |
422 | } | 444 | } |