diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 298b9ff..7e32086 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -407,6 +407,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
407 | /// <param name="itemId"></param> | 407 | /// <param name="itemId"></param> |
408 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) | 408 | public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) |
409 | { | 409 | { |
410 | InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); | ||
411 | |||
412 | if (itemCopy != null) | ||
413 | recipientClient.SendBulkUpdateInventory(itemCopy); | ||
414 | } | ||
415 | |||
416 | public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) | ||
417 | { | ||
410 | // Retrieve the item from the sender | 418 | // Retrieve the item from the sender |
411 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); | 419 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); |
412 | 420 | ||
@@ -415,7 +423,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
415 | m_log.ErrorFormat( | 423 | m_log.ErrorFormat( |
416 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); | 424 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); |
417 | 425 | ||
418 | return; | 426 | return null; |
419 | } | 427 | } |
420 | 428 | ||
421 | if (senderUserInfo.RootFolder != null) | 429 | if (senderUserInfo.RootFolder != null) |
@@ -427,18 +435,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
427 | if (!ExternalChecks.ExternalChecksBypassPermissions()) | 435 | if (!ExternalChecks.ExternalChecksBypassPermissions()) |
428 | { | 436 | { |
429 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 437 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
430 | return; | 438 | return null; |
431 | } | 439 | } |
432 | 440 | ||
433 | // TODO get recipient's root folder | 441 | // TODO get recipient's root folder |
434 | CachedUserInfo recipientUserInfo | 442 | CachedUserInfo recipientUserInfo |
435 | = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId); | 443 | = CommsManager.UserProfileCacheService.GetUserDetails(recipient); |
436 | 444 | ||
437 | if (recipientUserInfo != null) | 445 | if (recipientUserInfo != null) |
438 | { | 446 | { |
447 | if (!recipientUserInfo.HasReceivedInventory) | ||
448 | CommsManager.UserProfileCacheService.RequestInventoryForUser(recipient); | ||
449 | |||
439 | // Insert a copy of the item into the recipient | 450 | // Insert a copy of the item into the recipient |
440 | InventoryItemBase itemCopy = new InventoryItemBase(); | 451 | InventoryItemBase itemCopy = new InventoryItemBase(); |
441 | itemCopy.Owner = recipientClient.AgentId; | 452 | itemCopy.Owner = recipient; |
442 | itemCopy.Creator = item.Creator; | 453 | itemCopy.Creator = item.Creator; |
443 | itemCopy.ID = UUID.Random(); | 454 | itemCopy.ID = UUID.Random(); |
444 | itemCopy.AssetID = item.AssetID; | 455 | itemCopy.AssetID = item.AssetID; |
@@ -493,14 +504,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
493 | senderUserInfo.DeleteItem(itemId); | 504 | senderUserInfo.DeleteItem(itemId); |
494 | } | 505 | } |
495 | 506 | ||
496 | // Let the recipient client know about this new item | 507 | return itemCopy; |
497 | recipientClient.SendBulkUpdateInventory(itemCopy); | ||
498 | } | 508 | } |
499 | else | 509 | else |
500 | { | 510 | { |
501 | m_log.ErrorFormat( | 511 | m_log.ErrorFormat( |
502 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}", | 512 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0} of item {1}, {2} from {3}", |
503 | recipientClient.Name, recipientClient.AgentId, item.Name, | 513 | recipient, item.Name, |
504 | item.ID, senderId); | 514 | item.ID, senderId); |
505 | } | 515 | } |
506 | } | 516 | } |
@@ -509,14 +519,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
509 | m_log.ErrorFormat( | 519 | m_log.ErrorFormat( |
510 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); | 520 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); |
511 | 521 | ||
512 | return; | 522 | return null; |
513 | } | 523 | } |
514 | } | 524 | } |
515 | else | 525 | else |
516 | { | 526 | { |
517 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); | 527 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); |
518 | return; | 528 | return null; |
519 | } | 529 | } |
530 | return null; | ||
520 | } | 531 | } |
521 | 532 | ||
522 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, | 533 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, |