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 || else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{ {
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
IInventoryService invService = scene.InventoryService; IInventoryService invService = scene.InventoryService;
@ -306,26 +305,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_TransferModule.SendInstantMessage(im, delegate(bool success) {}); 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) else if (im.dialog == (byte) InstantMessageDialog.TaskInventoryAccepted)
{ {
UUID destinationFolderID = UUID.Zero; UUID destinationFolderID = UUID.Zero;
if (im.binaryBucket != null && im.binaryBucket.Length >= 16) if (im.binaryBucket != null && im.binaryBucket.Length >= 16)
{
destinationFolderID = new UUID(im.binaryBucket, 0); destinationFolderID = new UUID(im.binaryBucket, 0);
}
IInventoryService invService = scene.InventoryService;
InventoryFolderBase destinationFolder = null;
if (destinationFolderID != UUID.Zero) if (destinationFolderID != UUID.Zero)
{ destinationFolder = invService.GetFolder(client.AgentId, destinationFolderID);
InventoryFolderBase destinationFolder = new InventoryFolderBase(destinationFolderID, client.AgentId);
IInventoryService invService = scene.InventoryService;
if(destinationFolder != null)
{
UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID); InventoryItemBase item = invService.GetItem(client.AgentId, inventoryID);
@ -334,11 +327,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (item != null) // It's an item if (item != null) // It's an item
{ {
previousParentFolderID = item.Folder; if(item.Folder != destinationFolderID)
item.Folder = destinationFolderID; {
previousParentFolderID = item.Folder;
item.Folder = destinationFolderID;
invService.DeleteItems(item.Owner, new List<UUID>() { item.ID }); invService.DeleteItems(item.Owner, new List<UUID>() { item.ID });
scene.AddInventoryItem(client, item); scene.AddInventoryItem(client, item);
}
} }
else else
{ {
@ -346,9 +342,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
if (folder != null) // It's a folder if (folder != null) // It's a folder
{ {
previousParentFolderID = folder.ParentID; if(folder.ParentID != destinationFolderID)
folder.ParentID = destinationFolderID; {
invService.MoveFolder(folder); previousParentFolderID = folder.ParentID;
folder.ParentID = destinationFolderID;
invService.MoveFolder(folder);
}
} }
} }