aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs158
1 files changed, 14 insertions, 144 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 1a7f8f8..3dfe4fe 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -405,31 +405,13 @@ namespace OpenSim.Region.Framework.Scenes
405 return; 405 return;
406 } 406 }
407 407
408 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 408 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
409 409
410 if (null == userProfile) 410 if (item != null)
411 {
412 m_log.ErrorFormat(
413 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
414 remoteClient.Name, remoteClient.AgentId);
415 return;
416 }
417
418 if (userProfile.HasReceivedInventory)
419 { 411 {
420 InventoryItemBase item = null; 412 remoteClient.SendInventoryItemDetails(ownerID, item);
421 if (userProfile.RootFolder == null)
422 m_log.ErrorFormat(
423 "[AGENT INVENTORY]: User {0} {1} does not have a root folder.",
424 remoteClient.Name, remoteClient.AgentId);
425 else
426 item = userProfile.RootFolder.FindItem(itemID);
427
428 if (item != null)
429 {
430 remoteClient.SendInventoryItemDetails(ownerID, item);
431 }
432 } 413 }
414 // else shouldn't we send an alert message?
433 } 415 }
434 416
435 /// <summary> 417 /// <summary>
@@ -458,23 +440,14 @@ namespace OpenSim.Region.Framework.Scenes
458 return; 440 return;
459 } 441 }
460 442
461 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 443 SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
462
463 if (null == userProfile)
464 {
465 m_log.ErrorFormat(
466 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
467 remoteClient.Name, remoteClient.AgentId);
468 return;
469 }
470
471 userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems);
472 } 444 }
473 445
474 /// <summary> 446 /// <summary>
475 /// Handle the caps inventory descendents fetch. 447 /// Handle the caps inventory descendents fetch.
476 /// 448 ///
477 /// Since the folder structure is sent to the client on login, I believe we only need to handle items. 449 /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
450 /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
478 /// </summary> 451 /// </summary>
479 /// <param name="agentID"></param> 452 /// <param name="agentID"></param>
480 /// <param name="folderID"></param> 453 /// <param name="folderID"></param>
@@ -500,59 +473,10 @@ namespace OpenSim.Region.Framework.Scenes
500 { 473 {
501 return fold.RequestListOfItems(); 474 return fold.RequestListOfItems();
502 } 475 }
503
504 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID);
505
506 if (null == userProfile)
507 {
508 m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID);
509 return null;
510 }
511
512 // XXX: When a client crosses into a scene, their entire inventory is fetched
513 // asynchronously. If the client makes a request before the inventory is received, we need
514 // to give the inventory a chance to come in.
515 //
516 // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
517 // in CAPS as doing this with the udp request, since here it won't hold up other packets.
518 // In fact, here we'll be generous and try for longer.
519 if (!userProfile.HasReceivedInventory)
520 {
521 int attempts = 0;
522 while (attempts++ < 30)
523 {
524 m_log.DebugFormat(
525 "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
526 attempts, folderID, agentID);
527
528 Thread.Sleep(2000);
529 476
530 if (userProfile.HasReceivedInventory) 477 InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
531 { 478 return contents.Items;
532 break;
533 }
534 }
535 }
536 479
537 if (userProfile.HasReceivedInventory)
538 {
539 if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
540 {
541 return fold.RequestListOfItems();
542 }
543 else
544 {
545 m_log.WarnFormat(
546 "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
547 folderID, agentID);
548 return null;
549 }
550 }
551 else
552 {
553 m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID);
554 return null;
555 }
556 } 480 }
557 481
558 /// <summary> 482 /// <summary>
@@ -566,19 +490,10 @@ namespace OpenSim.Region.Framework.Scenes
566 public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, 490 public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType,
567 string folderName, UUID parentID) 491 string folderName, UUID parentID)
568 { 492 {
569 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 493 InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1);
570 494 if (!InventoryService.AddFolder(folder))
571 if (null == userProfile)
572 {
573 m_log.ErrorFormat(
574 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
575 remoteClient.Name, remoteClient.AgentId);
576 return;
577 }
578
579 if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID))
580 { 495 {
581 m_log.ErrorFormat( 496 m_log.WarnFormat(
582 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", 497 "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
583 remoteClient.Name, remoteClient.AgentId); 498 remoteClient.Name, remoteClient.AgentId);
584 } 499 }
@@ -621,36 +536,10 @@ namespace OpenSim.Region.Framework.Scenes
621 } 536 }
622 } 537 }
623 538
624 /// <summary>
625 /// Handle an inventory folder move request from the client.
626 /// </summary>
627 /// <param name="remoteClient"></param>
628 /// <param name="folderID"></param>
629 /// <param name="parentID"></param>
630 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 539 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
631 { 540 {
632 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
633
634 if (null == userProfile)
635 {
636 m_log.ErrorFormat(
637 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
638 remoteClient.Name, remoteClient.AgentId);
639 return;
640 }
641
642 if (!userProfile.MoveFolder(folderID, parentID))
643 {
644 m_log.ErrorFormat(
645 "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
646 folderID, parentID, remoteClient.Name);
647 }
648 }
649
650 public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
651 {
652 InventoryFolderBase folder = new InventoryFolderBase(folderID); 541 InventoryFolderBase folder = new InventoryFolderBase(folderID);
653 folder = InventoryService.QueryFolder(folder); 542 folder = InventoryService.GetFolder(folder);
654 if (folder != null) 543 if (folder != null)
655 { 544 {
656 folder.ParentID = parentID; 545 folder.ParentID = parentID;
@@ -670,27 +559,8 @@ namespace OpenSim.Region.Framework.Scenes
670 /// </summary> 559 /// </summary>
671 /// <param name="remoteClient"></param> 560 /// <param name="remoteClient"></param>
672 /// <param name="folderID"></param> 561 /// <param name="folderID"></param>
673 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
674 {
675 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
676
677 if (null == userProfile)
678 {
679 m_log.ErrorFormat(
680 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
681 remoteClient.Name, remoteClient.AgentId);
682 return;
683 }
684
685 if (!userProfile.PurgeFolder(folderID))
686 {
687 m_log.ErrorFormat(
688 "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
689 remoteClient.Name, remoteClient.AgentId);
690 }
691 }
692 562
693 public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) 563 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
694 { 564 {
695 InventoryFolderBase folder = new InventoryFolderBase(folderID); 565 InventoryFolderBase folder = new InventoryFolderBase(folderID);
696 566