diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 74 |
1 files changed, 54 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2bf4ea8..d3e414f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.Threading; | 30 | using System.Threading; |
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
@@ -404,7 +405,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
404 | return; | 405 | return; |
405 | } | 406 | } |
406 | 407 | ||
407 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); | 408 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
409 | item = InventoryService.GetItem(item); | ||
408 | 410 | ||
409 | if (item != null) | 411 | if (item != null) |
410 | { | 412 | { |
@@ -439,9 +441,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
439 | return; | 441 | return; |
440 | } | 442 | } |
441 | 443 | ||
444 | // We're going to send the reply async, because there may be | ||
445 | // an enormous quantity of packets -- basically the entire inventory! | ||
446 | // We don't want to block the client thread while all that is happening. | ||
447 | SendInventoryDelegate d = SendInventoryAsync; | ||
448 | d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d); | ||
449 | } | ||
450 | |||
451 | delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); | ||
452 | |||
453 | void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) | ||
454 | { | ||
442 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); | 455 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); |
443 | } | 456 | } |
444 | 457 | ||
458 | void SendInventoryComplete(IAsyncResult iar) | ||
459 | { | ||
460 | } | ||
461 | |||
445 | /// <summary> | 462 | /// <summary> |
446 | /// Handle the caps inventory descendents fetch. | 463 | /// Handle the caps inventory descendents fetch. |
447 | /// | 464 | /// |
@@ -517,27 +534,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | // m_log.DebugFormat( | 534 | // m_log.DebugFormat( |
518 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | 535 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); |
519 | 536 | ||
520 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 537 | InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); |
521 | 538 | folder = InventoryService.GetFolder(folder); | |
522 | if (null == userProfile) | 539 | if (folder != null) |
523 | { | ||
524 | m_log.ErrorFormat( | ||
525 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
526 | remoteClient.Name, remoteClient.AgentId); | ||
527 | return; | ||
528 | } | ||
529 | |||
530 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) | ||
531 | { | 540 | { |
532 | m_log.ErrorFormat( | 541 | folder.Name = name; |
533 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | 542 | folder.Type = (short)type; |
534 | remoteClient.Name, remoteClient.AgentId); | 543 | folder.ParentID = parentID; |
544 | if (!InventoryService.UpdateFolder(folder)) | ||
545 | { | ||
546 | m_log.ErrorFormat( | ||
547 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | ||
548 | remoteClient.Name, remoteClient.AgentId); | ||
549 | } | ||
535 | } | 550 | } |
536 | } | 551 | } |
537 | 552 | ||
538 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | 553 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
539 | { | 554 | { |
540 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 555 | InventoryFolderBase folder = new InventoryFolderBase(folderID, remoteClient.AgentId); |
541 | folder = InventoryService.GetFolder(folder); | 556 | folder = InventoryService.GetFolder(folder); |
542 | if (folder != null) | 557 | if (folder != null) |
543 | { | 558 | { |
@@ -559,15 +574,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | /// <param name="remoteClient"></param> | 574 | /// <param name="remoteClient"></param> |
560 | /// <param name="folderID"></param> | 575 | /// <param name="folderID"></param> |
561 | 576 | ||
577 | delegate void PurgeFolderDelegate(UUID userID, UUID folder); | ||
578 | |||
562 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | 579 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) |
563 | { | 580 | { |
564 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 581 | PurgeFolderDelegate d = PurgeFolderAsync; |
582 | try | ||
583 | { | ||
584 | d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d); | ||
585 | } | ||
586 | catch (Exception e) | ||
587 | { | ||
588 | m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message); | ||
589 | } | ||
590 | } | ||
591 | |||
592 | |||
593 | private void PurgeFolderAsync(UUID userID, UUID folderID) | ||
594 | { | ||
595 | InventoryFolderBase folder = new InventoryFolderBase(folderID, userID); | ||
565 | 596 | ||
566 | if (InventoryService.PurgeFolder(folder)) | 597 | if (InventoryService.PurgeFolder(folder)) |
567 | m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); | 598 | m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); |
568 | else | 599 | else |
569 | m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); | 600 | m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); |
570 | } | 601 | } |
571 | 602 | ||
603 | private void PurgeFolderCompleted(IAsyncResult iar) | ||
604 | { | ||
605 | } | ||
572 | } | 606 | } |
573 | } | 607 | } |