diff options
author | Melanie | 2009-08-15 19:00:56 +0100 |
---|---|---|
committer | Melanie | 2009-08-15 19:00:56 +0100 |
commit | 973be659459c577433b831c451ff07048aa078be (patch) | |
tree | 887f0586edbb936cca2fb8381699d921a2299492 /OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
parent | Changed FromAssetID to FromItemID (diff) | |
download | opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.zip opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.gz opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.bz2 opensim-SC_OLD-973be659459c577433b831c451ff07048aa078be.tar.xz |
Merge branch 'master' of ../opensim-diva/ into inventory-connector
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 158 |
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 113918d..bcc9bcb 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.GetItem(new InventoryItemBase(itemID)); |
386 | 386 | ||
387 | if (null == userProfile) | 387 | if (item != null) |
388 | { | ||
389 | m_log.ErrorFormat( | ||
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 | { | 388 | { |
397 | InventoryItemBase item = null; | 389 | remoteClient.SendInventoryItemDetails(ownerID, item); |
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> |
@@ -435,23 +417,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
435 | return; | 417 | return; |
436 | } | 418 | } |
437 | 419 | ||
438 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 420 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); |
439 | |||
440 | if (null == userProfile) | ||
441 | { | ||
442 | m_log.ErrorFormat( | ||
443 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
444 | remoteClient.Name, remoteClient.AgentId); | ||
445 | return; | ||
446 | } | ||
447 | |||
448 | userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems); | ||
449 | } | 421 | } |
450 | 422 | ||
451 | /// <summary> | 423 | /// <summary> |
452 | /// Handle the caps inventory descendents fetch. | 424 | /// Handle the caps inventory descendents fetch. |
453 | /// | 425 | /// |
454 | /// 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?? | ||
455 | /// </summary> | 428 | /// </summary> |
456 | /// <param name="agentID"></param> | 429 | /// <param name="agentID"></param> |
457 | /// <param name="folderID"></param> | 430 | /// <param name="folderID"></param> |
@@ -477,59 +450,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
477 | { | 450 | { |
478 | return fold.RequestListOfItems(); | 451 | return fold.RequestListOfItems(); |
479 | } | 452 | } |
480 | |||
481 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
482 | |||
483 | if (null == userProfile) | ||
484 | { | ||
485 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); | ||
486 | return null; | ||
487 | } | ||
488 | |||
489 | // XXX: When a client crosses into a scene, their entire inventory is fetched | ||
490 | // asynchronously. If the client makes a request before the inventory is received, we need | ||
491 | // to give the inventory a chance to come in. | ||
492 | // | ||
493 | // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad | ||
494 | // in CAPS as doing this with the udp request, since here it won't hold up other packets. | ||
495 | // In fact, here we'll be generous and try for longer. | ||
496 | if (!userProfile.HasReceivedInventory) | ||
497 | { | ||
498 | int attempts = 0; | ||
499 | while (attempts++ < 30) | ||
500 | { | ||
501 | m_log.DebugFormat( | ||
502 | "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", | ||
503 | attempts, folderID, agentID); | ||
504 | |||
505 | Thread.Sleep(2000); | ||
506 | 453 | ||
507 | if (userProfile.HasReceivedInventory) | 454 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
508 | { | 455 | return contents.Items; |
509 | break; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | 456 | ||
514 | if (userProfile.HasReceivedInventory) | ||
515 | { | ||
516 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
517 | { | ||
518 | return fold.RequestListOfItems(); | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | m_log.WarnFormat( | ||
523 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", | ||
524 | folderID, agentID); | ||
525 | return null; | ||
526 | } | ||
527 | } | ||
528 | else | ||
529 | { | ||
530 | m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID); | ||
531 | return null; | ||
532 | } | ||
533 | } | 457 | } |
534 | 458 | ||
535 | /// <summary> | 459 | /// <summary> |
@@ -543,19 +467,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
543 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, | 467 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, |
544 | string folderName, UUID parentID) | 468 | string folderName, UUID parentID) |
545 | { | 469 | { |
546 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 470 | InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1); |
547 | 471 | if (!InventoryService.AddFolder(folder)) | |
548 | if (null == userProfile) | ||
549 | { | ||
550 | m_log.ErrorFormat( | ||
551 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
552 | remoteClient.Name, remoteClient.AgentId); | ||
553 | return; | ||
554 | } | ||
555 | |||
556 | if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) | ||
557 | { | 472 | { |
558 | m_log.ErrorFormat( | 473 | m_log.WarnFormat( |
559 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", | 474 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", |
560 | remoteClient.Name, remoteClient.AgentId); | 475 | remoteClient.Name, remoteClient.AgentId); |
561 | } | 476 | } |
@@ -598,36 +513,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
598 | } | 513 | } |
599 | } | 514 | } |
600 | 515 | ||
601 | /// <summary> | ||
602 | /// Handle an inventory folder move request from the client. | ||
603 | /// </summary> | ||
604 | /// <param name="remoteClient"></param> | ||
605 | /// <param name="folderID"></param> | ||
606 | /// <param name="parentID"></param> | ||
607 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | 516 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
608 | { | 517 | { |
609 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
610 | |||
611 | if (null == userProfile) | ||
612 | { | ||
613 | m_log.ErrorFormat( | ||
614 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
615 | remoteClient.Name, remoteClient.AgentId); | ||
616 | return; | ||
617 | } | ||
618 | |||
619 | if (!userProfile.MoveFolder(folderID, parentID)) | ||
620 | { | ||
621 | m_log.ErrorFormat( | ||
622 | "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", | ||
623 | folderID, parentID, remoteClient.Name); | ||
624 | } | ||
625 | } | ||
626 | |||
627 | public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID) | ||
628 | { | ||
629 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 518 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
630 | folder = InventoryService.QueryFolder(folder); | 519 | folder = InventoryService.GetFolder(folder); |
631 | if (folder != null) | 520 | if (folder != null) |
632 | { | 521 | { |
633 | folder.ParentID = parentID; | 522 | folder.ParentID = parentID; |
@@ -647,27 +536,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | /// </summary> | 536 | /// </summary> |
648 | /// <param name="remoteClient"></param> | 537 | /// <param name="remoteClient"></param> |
649 | /// <param name="folderID"></param> | 538 | /// <param name="folderID"></param> |
650 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | ||
651 | { | ||
652 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
653 | |||
654 | if (null == userProfile) | ||
655 | { | ||
656 | m_log.ErrorFormat( | ||
657 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
658 | remoteClient.Name, remoteClient.AgentId); | ||
659 | return; | ||
660 | } | ||
661 | |||
662 | if (!userProfile.PurgeFolder(folderID)) | ||
663 | { | ||
664 | m_log.ErrorFormat( | ||
665 | "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", | ||
666 | remoteClient.Name, remoteClient.AgentId); | ||
667 | } | ||
668 | } | ||
669 | 539 | ||
670 | public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) | 540 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) |
671 | { | 541 | { |
672 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 542 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
673 | 543 | ||