diff options
author | Diva Canto | 2009-08-13 11:30:29 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-13 11:30:29 -0700 |
commit | 6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75 (patch) | |
tree | 82b2f99cb17b12d2bae173e33065170200b49eae /OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.zip opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.gz opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.bz2 opensim-SC-6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75.tar.xz |
Inventory redirects from CachedUserInfo to InventoryService COMPLETE!
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 129 |
1 files changed, 9 insertions, 120 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ba858ed..e2debe5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -382,31 +382,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | return; | 382 | return; |
383 | } | 383 | } |
384 | 384 | ||
385 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 385 | InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID)); |
386 | 386 | ||
387 | if (null == userProfile) | 387 | if (item != null) |
388 | { | 388 | { |
389 | m_log.ErrorFormat( | 389 | remoteClient.SendInventoryItemDetails(ownerID, item); |
390 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
391 | remoteClient.Name, remoteClient.AgentId); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | if (userProfile.HasReceivedInventory) | ||
396 | { | ||
397 | InventoryItemBase item = null; | ||
398 | if (userProfile.RootFolder == null) | ||
399 | m_log.ErrorFormat( | ||
400 | "[AGENT INVENTORY]: User {0} {1} does not have a root folder.", | ||
401 | remoteClient.Name, remoteClient.AgentId); | ||
402 | else | ||
403 | item = userProfile.RootFolder.FindItem(itemID); | ||
404 | |||
405 | if (item != null) | ||
406 | { | ||
407 | remoteClient.SendInventoryItemDetails(ownerID, item); | ||
408 | } | ||
409 | } | 390 | } |
391 | // else shouldn't we send an alert message? | ||
410 | } | 392 | } |
411 | 393 | ||
412 | /// <summary> | 394 | /// <summary> |
@@ -442,6 +424,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
442 | /// Handle the caps inventory descendents fetch. | 424 | /// Handle the caps inventory descendents fetch. |
443 | /// | 425 | /// |
444 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. | 426 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. |
427 | /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime?? | ||
445 | /// </summary> | 428 | /// </summary> |
446 | /// <param name="agentID"></param> | 429 | /// <param name="agentID"></param> |
447 | /// <param name="folderID"></param> | 430 | /// <param name="folderID"></param> |
@@ -467,59 +450,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
467 | { | 450 | { |
468 | return fold.RequestListOfItems(); | 451 | return fold.RequestListOfItems(); |
469 | } | 452 | } |
470 | |||
471 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
472 | |||
473 | if (null == userProfile) | ||
474 | { | ||
475 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); | ||
476 | return null; | ||
477 | } | ||
478 | |||
479 | // XXX: When a client crosses into a scene, their entire inventory is fetched | ||
480 | // asynchronously. If the client makes a request before the inventory is received, we need | ||
481 | // to give the inventory a chance to come in. | ||
482 | // | ||
483 | // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad | ||
484 | // in CAPS as doing this with the udp request, since here it won't hold up other packets. | ||
485 | // In fact, here we'll be generous and try for longer. | ||
486 | if (!userProfile.HasReceivedInventory) | ||
487 | { | ||
488 | int attempts = 0; | ||
489 | while (attempts++ < 30) | ||
490 | { | ||
491 | m_log.DebugFormat( | ||
492 | "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", | ||
493 | attempts, folderID, agentID); | ||
494 | 453 | ||
495 | Thread.Sleep(2000); | 454 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
496 | 455 | return contents.Items; | |
497 | if (userProfile.HasReceivedInventory) | ||
498 | { | ||
499 | break; | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | 456 | ||
504 | if (userProfile.HasReceivedInventory) | ||
505 | { | ||
506 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
507 | { | ||
508 | return fold.RequestListOfItems(); | ||
509 | } | ||
510 | else | ||
511 | { | ||
512 | m_log.WarnFormat( | ||
513 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", | ||
514 | folderID, agentID); | ||
515 | return null; | ||
516 | } | ||
517 | } | ||
518 | else | ||
519 | { | ||
520 | m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID); | ||
521 | return null; | ||
522 | } | ||
523 | } | 457 | } |
524 | 458 | ||
525 | /// <summary> | 459 | /// <summary> |
@@ -579,34 +513,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
579 | } | 513 | } |
580 | } | 514 | } |
581 | 515 | ||
582 | /// <summary> | ||
583 | /// Handle an inventory folder move request from the client. | ||
584 | /// </summary> | ||
585 | /// <param name="remoteClient"></param> | ||
586 | /// <param name="folderID"></param> | ||
587 | /// <param name="parentID"></param> | ||
588 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | 516 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
589 | { | 517 | { |
590 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
591 | |||
592 | if (null == userProfile) | ||
593 | { | ||
594 | m_log.ErrorFormat( | ||
595 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
596 | remoteClient.Name, remoteClient.AgentId); | ||
597 | return; | ||
598 | } | ||
599 | |||
600 | if (!userProfile.MoveFolder(folderID, parentID)) | ||
601 | { | ||
602 | m_log.ErrorFormat( | ||
603 | "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", | ||
604 | folderID, parentID, remoteClient.Name); | ||
605 | } | ||
606 | } | ||
607 | |||
608 | public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID) | ||
609 | { | ||
610 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 518 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
611 | folder = InventoryService.QueryFolder(folder); | 519 | folder = InventoryService.QueryFolder(folder); |
612 | if (folder != null) | 520 | if (folder != null) |
@@ -628,27 +536,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
628 | /// </summary> | 536 | /// </summary> |
629 | /// <param name="remoteClient"></param> | 537 | /// <param name="remoteClient"></param> |
630 | /// <param name="folderID"></param> | 538 | /// <param name="folderID"></param> |
631 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | ||
632 | { | ||
633 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
634 | |||
635 | if (null == userProfile) | ||
636 | { | ||
637 | m_log.ErrorFormat( | ||
638 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
639 | remoteClient.Name, remoteClient.AgentId); | ||
640 | return; | ||
641 | } | ||
642 | 539 | ||
643 | if (!userProfile.PurgeFolder(folderID)) | 540 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) |
644 | { | ||
645 | m_log.ErrorFormat( | ||
646 | "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", | ||
647 | remoteClient.Name, remoteClient.AgentId); | ||
648 | } | ||
649 | } | ||
650 | |||
651 | public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) | ||
652 | { | 541 | { |
653 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 542 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
654 | 543 | ||