<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FWalkthroughs%2FAvatar_Removes_From_Inventory</id>
	<title>OpenSimulator Internals/Walkthroughs/Avatar Removes From Inventory - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://osimdev.org/wiki/index.php?action=history&amp;feed=atom&amp;title=OpenSimulator_Internals%2FWalkthroughs%2FAvatar_Removes_From_Inventory"/>
	<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Removes_From_Inventory&amp;action=history"/>
	<updated>2026-08-04T15:37:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Removes_From_Inventory&amp;diff=89&amp;oldid=prev</id>
		<title>Jwbshaw: first</title>
		<link rel="alternate" type="text/html" href="http://osimdev.org/wiki/index.php?title=OpenSimulator_Internals/Walkthroughs/Avatar_Removes_From_Inventory&amp;diff=89&amp;oldid=prev"/>
		<updated>2026-07-07T13:15:48Z</updated>

		<summary type="html">&lt;p&gt;first&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= OpenSimulator Internals/Walkthroughs/Avatar Removes From Inventory =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
Traces what happens when an avatar deletes an item from inventory, moves it to trash, or purges the trash folder. Also covers the Return Object path (estate/parcel manager returning an object to owner&amp;#039;s Lost and Found).&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 1: Delete Item (Move to Trash) ==&lt;br /&gt;
&lt;br /&gt;
Avatar selects an item and deletes it (moves to Trash folder).&lt;br /&gt;
&lt;br /&gt;
=== 1. Client Sends RemoveInventoryItem ===&lt;br /&gt;
&lt;br /&gt;
 OpenSim/Region/Framework/Scenes/Scene.cs -- RemoveInventoryItem()&lt;br /&gt;
&lt;br /&gt;
# Viewer sends RemoveInventoryItem packet.&lt;br /&gt;
# Scene.RemoveInventoryItem() calls InventoryService.DeleteItems(agentID, [itemID]) if permitted.&lt;br /&gt;
&lt;br /&gt;
Wait -- DeleteItems moves to trash in v2 protocol or deletes directly depending on implementation. In OpenSim&amp;#039;s XInventoryService, DeleteItems() marks the item deleted (moves to system trash folder or removes depending on config).&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* inventoryitems -- UPDATE or DELETE depending on server config&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 2: Purge Folder (Empty Trash) ==&lt;br /&gt;
&lt;br /&gt;
Avatar right-clicks Trash folder and selects Empty Trash.&lt;br /&gt;
&lt;br /&gt;
=== 1. Client Sends PurgeInventoryDescendents ===&lt;br /&gt;
&lt;br /&gt;
# Viewer sends PurgeInventoryDescendents packet with folderID = Trash folder UUID.&lt;br /&gt;
# Scene.HandlePurgeInventoryDescendents() calls InventoryService.PurgeFolder(folder).&lt;br /&gt;
# ROBUST XInventoryService: deletes all items and subfolders recursively from inventoryitems and inventoryfolders tables.&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* inventoryitems -- DELETE: all items in folder and subfolders&lt;br /&gt;
* inventoryfolders -- DELETE: all subfolders (not the trash folder itself)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 3: Delete Object from World (DeRez to Trash) ==&lt;br /&gt;
&lt;br /&gt;
Avatar right-clicks object in world and selects Delete (not Take).&lt;br /&gt;
&lt;br /&gt;
=== 1. Client Sends DeRezObject with action=Delete ===&lt;br /&gt;
&lt;br /&gt;
 BasicInventoryAccessModule -- CopyToInventory(DeRezAction.Delete)&lt;br /&gt;
&lt;br /&gt;
# If deleting own object: destination folder = Trash (FolderType.Trash).&lt;br /&gt;
# If deleting another&amp;#039;s object (estate manager): destination = owner&amp;#039;s Lost and Found (FolderType.LostAndFound).&lt;br /&gt;
# CopyBundleToInventory() runs: serialises object, creates asset, inserts inventory item in appropriate folder.&lt;br /&gt;
# Scene.DeleteSceneObject() removes object from scene and region storage.&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* assets -- INSERT: serialised object XML&lt;br /&gt;
* inventoryitems -- INSERT: item in Trash or LostAndFound&lt;br /&gt;
* prims/primshapes/primitems -- DELETE: object removed from region&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Case 4: Return Object (Parcel/Estate Manager) ==&lt;br /&gt;
&lt;br /&gt;
Estate manager or parcel owner returns an object to its owner&amp;#039;s inventory.&lt;br /&gt;
&lt;br /&gt;
=== 1. Return Triggered ===&lt;br /&gt;
&lt;br /&gt;
 OpenSim/Region/Framework/Scenes/Scene.cs -- returnObjects()&lt;br /&gt;
&lt;br /&gt;
# Parcel manager calls returnObjects() for objects on the parcel.&lt;br /&gt;
# Calls IInventoryAccessModule.CopyToInventory(DeRezAction.Return, UUID.Zero, objlist, null, false).&lt;br /&gt;
#* remoteClient is null -- return is server-initiated.&lt;br /&gt;
#* Destination folder: owner&amp;#039;s Lost and Found (FolderType.LostAndFound).&lt;br /&gt;
# AddPermissions() with null remoteClient: same-owner path, perms preserved.&lt;br /&gt;
# Asset created, item inserted.&lt;br /&gt;
# Scene.AddReturn() queues a notification message to the owner.&lt;br /&gt;
# Scene.DeleteSceneObject() removes from scene.&lt;br /&gt;
&lt;br /&gt;
On next backup cycle, Scene.Backup() processes m_returns:&lt;br /&gt;
* Sends GridInstantMessage to the owner: &amp;quot;Your object X was returned from parcel Y in region Z due to [reason].&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; DB writes:&lt;br /&gt;
* assets -- INSERT: serialised object XML&lt;br /&gt;
* inventoryitems -- INSERT: item in Lost and Found&lt;br /&gt;
* prims/primshapes/primitems -- DELETE&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Summary: DB Tables Touched ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Case !! Table !! Operation&lt;br /&gt;
|-&lt;br /&gt;
| Delete item || inventoryitems || UPDATE/DELETE&lt;br /&gt;
|-&lt;br /&gt;
| Purge folder || inventoryitems, inventoryfolders || DELETE recursive&lt;br /&gt;
|-&lt;br /&gt;
| Delete object || assets, inventoryitems || INSERT; prims DELETE&lt;br /&gt;
|-&lt;br /&gt;
| Return object || assets, inventoryitems || INSERT; prims DELETE&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs]]&lt;br /&gt;
* [[OpenSimulator Internals/Code Map/InventoryAccessModule]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Avatar Acquires Inventory]]&lt;br /&gt;
* [[OpenSimulator Internals/Walkthroughs/Avatar Derezzes Object]]&lt;/div&gt;</summary>
		<author><name>Jwbshaw</name></author>
	</entry>
</feed>