Attempt to fix Mantis #6311. Honor a destination folder if one is given

connector_plugin
Melanie 2012-10-02 23:02:01 +01:00
parent 54ec8b197b
commit f1886c449c
1 changed files with 39 additions and 0 deletions

View File

@ -297,6 +297,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
}); });
} }
} }
else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{
UUID destinationFolderID = UUID.Zero;
if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
{
destinationFolderID = new UUID(im.binaryBucket, 0);
}
if (destinationFolderID != UUID.Zero)
{
IInventoryService invService = scene.InventoryService;
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = new InventoryItemBase(inventoryID, client.AgentId);
item = invService.GetItem(item);
InventoryFolderBase folder = null;
if (item != null) // It's an item
{
item.Folder = destinationFolderID;
invService.DeleteItems(item.Owner, new List<UUID>() { item.ID });
scene.AddInventoryItem(client, item);
}
else
{
folder = new InventoryFolderBase(inventoryID, client.AgentId);
folder = invService.GetFolder(folder);
if (folder != null) // It's a folder
{
folder.ParentID = destinationFolderID;
invService.MoveFolder(folder);
}
}
}
}
else if ( else if (
im.dialog == (byte)InstantMessageDialog.InventoryDeclined im.dialog == (byte)InstantMessageDialog.InventoryDeclined
|| im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined) || im.dialog == (byte)InstantMessageDialog.TaskInventoryDeclined)