aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs53
1 files changed, 44 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 1417a19..f52654f 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -148,9 +148,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
148 148
149 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 149 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
150 { 150 {
151// m_log.DebugFormat( 151 m_log.DebugFormat(
152// "[INVENTORY TRANSFER]: {0} IM type received from {1}", 152 "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}",
153// (InstantMessageDialog)im.dialog, client.Name); 153 (InstantMessageDialog)im.dialog, client.Name,
154 im.fromAgentID, im.fromAgentName, im.toAgentID);
154 155
155 Scene scene = FindClientScene(client.AgentId); 156 Scene scene = FindClientScene(client.AgentId);
156 157
@@ -450,23 +451,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
450 /// <summary> 451 /// <summary>
451 /// 452 ///
452 /// </summary> 453 /// </summary>
453 /// <param name="msg"></param> 454 /// <param name="im"></param>
454 private void OnGridInstantMessage(GridInstantMessage msg) 455 private void OnGridInstantMessage(GridInstantMessage im)
455 { 456 {
457 // Check if it's a type of message that we should handle
458 if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered)
459 || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted)
460 || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined)
461 || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined)))
462 return;
463
464 m_log.DebugFormat(
465 "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}",
466 (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID);
467
456 // Check if this is ours to handle 468 // Check if this is ours to handle
457 // 469 //
458 Scene scene = FindClientScene(new UUID(msg.toAgentID)); 470 Scene scene = FindClientScene(new UUID(im.toAgentID));
459 471
460 if (scene == null) 472 if (scene == null)
461 return; 473 return;
462 474
463 // Find agent to deliver to 475 // Find agent to deliver to
464 // 476 //
465 ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); 477 ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
466 478
467 // Just forward to local handling 479 if (user != null)
468 OnInstantMessage(user.ControllingClient, msg); 480 {
481 user.ControllingClient.SendInstantMessage(im);
469 482
483 if (im.dialog == (byte)InstantMessageDialog.InventoryOffered)
484 {
485 AssetType assetType = (AssetType)im.binaryBucket[0];
486 UUID inventoryID = new UUID(im.binaryBucket, 1);
487
488 IInventoryService invService = scene.InventoryService;
489 InventoryNodeBase node = null;
490 if (AssetType.Folder == assetType)
491 {
492 InventoryFolderBase folder = new InventoryFolderBase(inventoryID, new UUID(im.toAgentID));
493 node = invService.GetFolder(folder);
494 }
495 else
496 {
497 InventoryItemBase item = new InventoryItemBase(inventoryID, new UUID(im.toAgentID));
498 node = invService.GetItem(item);
499 }
500
501 if (node != null)
502 user.ControllingClient.SendBulkUpdateInventory(node);
503 }
504 }
470 } 505 }
471 } 506 }
472} 507}