diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 206 |
1 files changed, 48 insertions, 158 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 113918d..fde922f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -109,6 +109,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Invoked when the client requests a prim. | ||
113 | /// </summary> | ||
114 | /// <param name="primLocalID"></param> | ||
115 | /// <param name="remoteClient"></param> | ||
116 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | ||
117 | { | ||
118 | List<EntityBase> EntityList = GetEntities(); | ||
119 | |||
120 | foreach (EntityBase ent in EntityList) | ||
121 | { | ||
122 | if (ent is SceneObjectGroup) | ||
123 | { | ||
124 | if (((SceneObjectGroup)ent).LocalId == primLocalID) | ||
125 | { | ||
126 | ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); | ||
127 | return; | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
112 | /// Invoked when the client selects a prim. | 134 | /// Invoked when the client selects a prim. |
113 | /// </summary> | 135 | /// </summary> |
114 | /// <param name="primLocalID"></param> | 136 | /// <param name="primLocalID"></param> |
@@ -382,31 +404,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | return; | 404 | return; |
383 | } | 405 | } |
384 | 406 | ||
385 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 407 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
386 | 408 | ||
387 | if (null == userProfile) | 409 | if (item != null) |
388 | { | 410 | { |
389 | m_log.ErrorFormat( | 411 | 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 | } | 412 | } |
413 | // else shouldn't we send an alert message? | ||
410 | } | 414 | } |
411 | 415 | ||
412 | /// <summary> | 416 | /// <summary> |
@@ -435,23 +439,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
435 | return; | 439 | return; |
436 | } | 440 | } |
437 | 441 | ||
438 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 442 | 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 | } | 443 | } |
450 | 444 | ||
451 | /// <summary> | 445 | /// <summary> |
452 | /// Handle the caps inventory descendents fetch. | 446 | /// Handle the caps inventory descendents fetch. |
453 | /// | 447 | /// |
454 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. | 448 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. |
449 | /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime?? | ||
455 | /// </summary> | 450 | /// </summary> |
456 | /// <param name="agentID"></param> | 451 | /// <param name="agentID"></param> |
457 | /// <param name="folderID"></param> | 452 | /// <param name="folderID"></param> |
@@ -477,59 +472,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
477 | { | 472 | { |
478 | return fold.RequestListOfItems(); | 473 | return fold.RequestListOfItems(); |
479 | } | 474 | } |
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 | 475 | ||
489 | // XXX: When a client crosses into a scene, their entire inventory is fetched | 476 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
490 | // asynchronously. If the client makes a request before the inventory is received, we need | 477 | return contents.Items; |
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 | |||
507 | if (userProfile.HasReceivedInventory) | ||
508 | { | ||
509 | break; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | 478 | ||
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 | } | 479 | } |
534 | 480 | ||
535 | /// <summary> | 481 | /// <summary> |
@@ -543,19 +489,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
543 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, | 489 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, |
544 | string folderName, UUID parentID) | 490 | string folderName, UUID parentID) |
545 | { | 491 | { |
546 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 492 | InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1); |
547 | 493 | if (!InventoryService.AddFolder(folder)) | |
548 | if (null == userProfile) | ||
549 | { | 494 | { |
550 | m_log.ErrorFormat( | 495 | m_log.WarnFormat( |
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 | { | ||
558 | m_log.ErrorFormat( | ||
559 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", | 496 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", |
560 | remoteClient.Name, remoteClient.AgentId); | 497 | remoteClient.Name, remoteClient.AgentId); |
561 | } | 498 | } |
@@ -580,54 +517,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | // m_log.DebugFormat( | 517 | // m_log.DebugFormat( |
581 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | 518 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); |
582 | 519 | ||
583 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 520 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
584 | 521 | folder = InventoryService.GetFolder(folder); | |
585 | if (null == userProfile) | 522 | if (folder != null) |
586 | { | ||
587 | m_log.ErrorFormat( | ||
588 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
589 | remoteClient.Name, remoteClient.AgentId); | ||
590 | return; | ||
591 | } | ||
592 | |||
593 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) | ||
594 | { | 523 | { |
595 | m_log.ErrorFormat( | 524 | folder.Name = name; |
596 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | 525 | folder.Type = (short)type; |
597 | remoteClient.Name, remoteClient.AgentId); | 526 | folder.ParentID = parentID; |
527 | if (!InventoryService.UpdateFolder(folder)) | ||
528 | { | ||
529 | m_log.ErrorFormat( | ||
530 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | ||
531 | remoteClient.Name, remoteClient.AgentId); | ||
532 | } | ||
598 | } | 533 | } |
599 | } | 534 | } |
600 | 535 | ||
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) | 536 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
608 | { | 537 | { |
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); | 538 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
630 | folder = InventoryService.QueryFolder(folder); | 539 | folder = InventoryService.GetFolder(folder); |
631 | if (folder != null) | 540 | if (folder != null) |
632 | { | 541 | { |
633 | folder.ParentID = parentID; | 542 | folder.ParentID = parentID; |
@@ -647,27 +556,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | /// </summary> | 556 | /// </summary> |
648 | /// <param name="remoteClient"></param> | 557 | /// <param name="remoteClient"></param> |
649 | /// <param name="folderID"></param> | 558 | /// <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 | 559 | ||
662 | if (!userProfile.PurgeFolder(folderID)) | 560 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID 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 | |||
670 | public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) | ||
671 | { | 561 | { |
672 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 562 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
673 | 563 | ||