improve TaskInventoryAccepted (that is also decline)

master
UbitUmarov 2020-02-13 04:58:20 +00:00
parent 0e7c19e181
commit fa4602e048
1 changed files with 19 additions and 20 deletions

View File

@ -260,8 +260,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
});
}
}
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted ||
im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
{
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
IInventoryService invService = scene.InventoryService;
@ -306,26 +305,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_TransferModule.SendInstantMessage(im, delegate(bool success) {});
}
}
// XXX: This code was placed here to try and accomodate RLV which moves given folders named #RLV/~<name>
// to the requested folder, which in this case is #RLV. However, it is the viewer that appears to be
// response from renaming the #RLV/~example folder to ~example. For some reason this is not yet
// happening, possibly because we are not sending the correct inventory update messages with the correct
// transaction IDs
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)
{
InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId);
IInventoryService invService = scene.InventoryService;
InventoryFolderBase destinationFolder = null;
if (destinationFolderID != UUID.Zero)
destinationFolder = invService.GetFolder(client.AgentId, destinationFolderID);
if(destinationFolder != null)
{
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
@ -333,6 +326,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID? previousParentFolderID = null;
if (item != null) // It's an item
{
if(item.Folder != destinationFolderID)
{
previousParentFolderID = item.Folder;
item.Folder = destinationFolderID;
@ -340,17 +335,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
invService.DeleteItems(item.Owner, new List<UUID>() { item.ID });
scene.AddInventoryItem(client, item);
}
}
else
{
folder = invService.GetFolder(client.AgentId, inventoryID);
if (folder != null) // It's a folder
{
if(folder.ParentID != destinationFolderID)
{
previousParentFolderID = folder.ParentID;
folder.ParentID = destinationFolderID;
invService.MoveFolder(folder);
}
}
}
// Tell client about updates to original parent and new parent (this should probably be factored with existing move item/folder code).
if (previousParentFolderID != null)