diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 242 |
1 files changed, 1 insertions, 241 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index d85a996..0f422ae 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -411,36 +411,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
411 | 411 | ||
412 | #endregion | 412 | #endregion |
413 | 413 | ||
414 | // COMPLETE FAIL | ||
415 | //private void RemoveRootFolderContents(IClientAPI client) | ||
416 | //{ | ||
417 | // InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
418 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}, version {1}", client.AgentId, root.Version); | ||
419 | // InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
420 | |||
421 | // List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | ||
422 | // foreach (InventoryFolderBase f in content.Folders) | ||
423 | // { | ||
424 | // if (f.Type == (short)AssetType.TrashFolder || f.Type == (short)AssetType.Landmark || | ||
425 | // f.Type == (short)AssetType.FavoriteFolder || f.Type == (short)AssetType.CurrentOutfitFolder) | ||
426 | // { | ||
427 | // // Don't remove these because the viewer refuses to exist without them | ||
428 | // // and immediately sends a request to create them again, which makes things | ||
429 | // // very confusing in the viewer. | ||
430 | // // Just change their names | ||
431 | // f.Name = "Home " + f.Name + " (Unavailable)"; | ||
432 | // keep.Add(f); | ||
433 | // } | ||
434 | // else | ||
435 | // { | ||
436 | // m_log.DebugFormat("[RRR]: Name={0}, Version={1}, Type={2}, PfolderID={3}", f.Name, f.Version, f.Type, f.ParentID); | ||
437 | // } | ||
438 | // } | ||
439 | |||
440 | |||
441 | // client.SendInventoryFolderDetails(client.AgentId, root.ID, new List<InventoryItemBase>(), keep, root.Version + 1, true, true); | ||
442 | //} | ||
443 | |||
444 | private void RemoveRootFolderContents(IClientAPI client) | 414 | private void RemoveRootFolderContents(IClientAPI client) |
445 | { | 415 | { |
446 | // TODO tell the viewer to remove the root folder's content | 416 | // TODO tell the viewer to remove the root folder's content |
@@ -473,31 +443,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
473 | foreach (InventoryItemBase it in content.Items) | 443 | foreach (InventoryItemBase it in content.Items) |
474 | it.Name = it.Name + " (Unavailable)"; ; | 444 | it.Name = it.Name + " (Unavailable)"; ; |
475 | 445 | ||
476 | // next, add the subfolders and items of the keep folders | 446 | // Send the new names |
477 | //foreach (InventoryFolderBase f in keep) | ||
478 | //{ | ||
479 | // InventoryCollection c = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, f.ID); | ||
480 | // foreach (InventoryFolderBase sf in c.Folders) | ||
481 | // { | ||
482 | // m_log.DebugFormat("[RRR]: Name={0}, Version={1}, Type={2}, PfolderID={3}", f.Name, f.Version, f.Type, f.ParentID); | ||
483 | // fids.Add(sf.ID); | ||
484 | // } | ||
485 | // foreach (InventoryItemBase it in c.Items) | ||
486 | // iids.Add(it.ID); | ||
487 | //} | ||
488 | |||
489 | //inv.SendRemoveInventoryFolders(fids.ToArray()); | ||
490 | |||
491 | // Increase the version number | ||
492 | //root.Version += 1; | ||
493 | //m_Scenes[0].InventoryService.UpdateFolder(root); | ||
494 | //foreach (InventoryFolderBase f in keep) | ||
495 | //{ | ||
496 | // f.Version += 1; | ||
497 | // m_Scenes[0].InventoryService.UpdateFolder(f); | ||
498 | //} | ||
499 | |||
500 | // Send the new names and versions | ||
501 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); | 447 | inv.SendBulkUpdateInventory(keep.ToArray(), content.Items.ToArray()); |
502 | 448 | ||
503 | } | 449 | } |
@@ -505,133 +451,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
505 | } | 451 | } |
506 | } | 452 | } |
507 | 453 | ||
508 | private void RemoveRootFolderContents2(IClientAPI client) | ||
509 | { | ||
510 | // TODO tell the viewer to remove the root folder's content | ||
511 | if (client is IClientCore) | ||
512 | { | ||
513 | IClientCore core = (IClientCore)client; | ||
514 | IClientInventory inv; | ||
515 | |||
516 | if (core.TryGet<IClientInventory>(out inv)) | ||
517 | { | ||
518 | InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
519 | if (root != null) | ||
520 | { | ||
521 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing root inventory for user {0}", client.Name); | ||
522 | InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
523 | List<UUID> fids = new List<UUID>(); | ||
524 | List<UUID> iids = new List<UUID>(); | ||
525 | List<InventoryFolderBase> keep = new List<InventoryFolderBase>(); | ||
526 | |||
527 | foreach (InventoryFolderBase f in content.Folders) | ||
528 | { | ||
529 | if (f.Type == (short)AssetType.TrashFolder || f.Type == (short)AssetType.Landmark || | ||
530 | f.Type == (short)AssetType.FavoriteFolder || f.Type == (short)AssetType.CurrentOutfitFolder) | ||
531 | { | ||
532 | // Don't remove these because the viewer refuses to exist without them | ||
533 | // and immediately sends a request to create them again, which makes things | ||
534 | // very confusing in the viewer. | ||
535 | // Just change their names | ||
536 | f.Name = "Home " + f.Name + " (Unavailable)"; | ||
537 | keep.Add(f); | ||
538 | } | ||
539 | else | ||
540 | { | ||
541 | m_log.DebugFormat("[RRR]: Name={0}, Version={1}, Type={2}, PfolderID={3}", f.Name, f.Version, f.Type, f.ParentID); | ||
542 | fids.Add(f.ID); | ||
543 | } | ||
544 | } | ||
545 | |||
546 | foreach (InventoryItemBase it in content.Items) | ||
547 | iids.Add(it.ID); | ||
548 | |||
549 | // next, add the subfolders and items of the keep folders | ||
550 | foreach (InventoryFolderBase f in keep) | ||
551 | { | ||
552 | InventoryCollection c = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, f.ID); | ||
553 | foreach (InventoryFolderBase sf in c.Folders) | ||
554 | { | ||
555 | m_log.DebugFormat("[RRR]: Name={0}, Version={1}, Type={2}, PfolderID={3}", f.Name, f.Version, f.Type, f.ParentID); | ||
556 | fids.Add(sf.ID); | ||
557 | } | ||
558 | foreach (InventoryItemBase it in c.Items) | ||
559 | iids.Add(it.ID); | ||
560 | } | ||
561 | |||
562 | inv.SendRemoveInventoryFolders(fids.ToArray()); | ||
563 | inv.SendRemoveInventoryItems(iids.ToArray()); | ||
564 | |||
565 | // Increase the version number | ||
566 | root.Version += 1; | ||
567 | m_Scenes[0].InventoryService.UpdateFolder(root); | ||
568 | //foreach (InventoryFolderBase f in keep) | ||
569 | //{ | ||
570 | // f.Version += 1; | ||
571 | // m_Scenes[0].InventoryService.UpdateFolder(f); | ||
572 | //} | ||
573 | |||
574 | // Send the new names and versions | ||
575 | inv.SendBulkUpdateInventory(keep.ToArray(), new InventoryItemBase[0]); | ||
576 | |||
577 | } | ||
578 | } | ||
579 | } | ||
580 | } | ||
581 | |||
582 | private void RemoveSuitcaseFolderContents(IClientAPI client) | 454 | private void RemoveSuitcaseFolderContents(IClientAPI client) |
583 | { | 455 | { |
584 | return; | ||
585 | |||
586 | //// TODO tell the viewer to remove the suitcase folder's content | ||
587 | //if (client is IClientCore) | ||
588 | //{ | ||
589 | // IClientCore core = (IClientCore)client; | ||
590 | // IClientInventory inv; | ||
591 | |||
592 | // if (core.TryGet<IClientInventory>(out inv)) | ||
593 | // { | ||
594 | // InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
595 | // if (root != null) | ||
596 | // { | ||
597 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Removing suitcase inventory for user {0}", client.Name); | ||
598 | // InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
599 | // List<UUID> fids = new List<UUID>(); | ||
600 | // List<UUID> iids = new List<UUID>(); | ||
601 | |||
602 | // if (content.Folders.Count == 0) | ||
603 | // m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: no subfolders???"); | ||
604 | // foreach (InventoryFolderBase f in content.Folders) | ||
605 | // { | ||
606 | // m_log.DebugFormat("[RRR]: Name={0}, Version={1}, Type={2}, PfolderID={3}", f.Name, f.Version, f.Type, f.ParentID); | ||
607 | // fids.Add(f.ID); | ||
608 | // } | ||
609 | |||
610 | // foreach (InventoryItemBase it in content.Items) | ||
611 | // iids.Add(it.ID); | ||
612 | |||
613 | // inv.SendRemoveInventoryFolders(fids.ToArray()); | ||
614 | // inv.SendRemoveInventoryItems(iids.ToArray()); | ||
615 | |||
616 | // // Increase the version number | ||
617 | // root.Version += 1; | ||
618 | // m_Scenes[0].InventoryService.UpdateFolder(root); | ||
619 | // } | ||
620 | // } | ||
621 | //} | ||
622 | } | 456 | } |
623 | 457 | ||
624 | private void RestoreRootFolderContents(IClientAPI client) | 458 | private void RestoreRootFolderContents(IClientAPI client) |
625 | { | 459 | { |
626 | // This works! | ||
627 | //InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
628 | //client.SendBulkUpdateInventory(root); | ||
629 | |||
630 | // SORTA KINDA some items are missing... | ||
631 | //InventoryCollection userInventory = m_Scenes[0].InventoryService.GetUserInventory(client.AgentId); | ||
632 | //InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
633 | //client.SendBulkUpdateInventory(root); | ||
634 | |||
635 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root folder"); | 460 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root folder"); |
636 | if (client is IClientCore) | 461 | if (client is IClientCore) |
637 | { | 462 | { |
@@ -646,75 +471,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
646 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); | 471 | inv.SendBulkUpdateInventory(content.Folders.ToArray(), content.Items.ToArray()); |
647 | } | 472 | } |
648 | } | 473 | } |
649 | |||
650 | // ATTEMPT # 3 -- STILL DOESN'T WORK! | ||
651 | //if (client is IClientCore) | ||
652 | //{ | ||
653 | // IClientCore core = (IClientCore)client; | ||
654 | // IClientInventory inv; | ||
655 | |||
656 | // if (core.TryGet<IClientInventory>(out inv)) | ||
657 | // { | ||
658 | // InventoryCollection userInventory = m_Scenes[0].InventoryService.GetUserInventory(client.AgentId); | ||
659 | // if (userInventory != null) | ||
660 | // { | ||
661 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
662 | // foreach (InventoryFolderBase f in userInventory.Folders) | ||
663 | // m_log.DebugFormat("[AAA]: FOLDER {0} {1} {2} {3} {4}", f.Name, f.Type, f.Version, f.ID, f.ParentID); | ||
664 | // foreach (InventoryItemBase f in userInventory.Items) | ||
665 | // m_log.DebugFormat("[AAA]: ITEM {0} {1} {2}", f.Name, f.ID, f.Folder); | ||
666 | // inv.SendBulkUpdateInventory(userInventory.Folders.ToArray(), userInventory.Items.ToArray()); | ||
667 | // } | ||
668 | // else | ||
669 | // m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to retrieve inventory for user {0}", client.AgentId); | ||
670 | // } | ||
671 | //} | ||
672 | |||
673 | |||
674 | // ATTEMPT #2 -- BETTER THAN 1, BUT STILL DOES NOT WORK WELL | ||
675 | //if (client is IClientCore) | ||
676 | //{ | ||
677 | // IClientCore core = (IClientCore)client; | ||
678 | // IClientInventory inv; | ||
679 | |||
680 | // if (core.TryGet<IClientInventory>(out inv)) | ||
681 | // { | ||
682 | // List<InventoryFolderBase> skel = m_Scenes[0].InventoryService.GetInventorySkeleton(client.AgentId); | ||
683 | // if (skel != null) | ||
684 | // { | ||
685 | // m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Restoring root inventory for user {0}", client.AgentId); | ||
686 | // foreach (InventoryFolderBase f in skel) | ||
687 | // m_log.DebugFormat("[AAA]: {0} {1} {2} {3} {4}", f.Name, f.Type, f.Version, f.ID, f.ParentID); | ||
688 | // inv.SendBulkUpdateInventory(skel.ToArray(), new InventoryItemBase[0]); | ||
689 | // } | ||
690 | // else | ||
691 | // m_log.WarnFormat("[HG ENTITY TRANSFER MODULE]: Unable to retrieve skeleton for user {0}", client.AgentId); | ||
692 | |||
693 | // ATTEMPT #1 -- DOES NOT WORK | ||
694 | //InventoryFolderBase root = m_Scenes[0].InventoryService.GetRootFolder(client.AgentId); | ||
695 | //if (root != null) | ||
696 | //{ | ||
697 | //InventoryCollection content = m_Scenes[0].InventoryService.GetFolderContent(client.AgentId, root.ID); | ||
698 | //InventoryFolderBase[] folders = new InventoryFolderBase[content.Folders.Count + 1]; | ||
699 | //m_log.DebugFormat("[AAA]: Folder name {0}, id {1}, version {2}, parent {3}", root.Name, root.ID, root.Version, root.ParentID); | ||
700 | //folders[0] = root; | ||
701 | //for (int count = 1; count < content.Folders.Count + 1; count++) | ||
702 | //{ | ||
703 | // folders[count] = content.Folders[count - 1]; | ||
704 | // m_log.DebugFormat("[AAA]: Name={0}, Id={1}, Version={2}, type={3}, folderID={4}", | ||
705 | // folders[count].Name, folders[count].ID, folders[count].Version, folders[count].Type, folders[count].ParentID); | ||
706 | //} | ||
707 | //foreach (InventoryItemBase i in content.Items) | ||
708 | // m_log.DebugFormat("[AAA]: Name={0}, folderID={1}", i.Name, i.Folder); | ||
709 | //inv.SendBulkUpdateInventory(/*content.Folders.ToArray()*/ folders, content.Items.ToArray()); | ||
710 | //} | ||
711 | //} | ||
712 | //} | ||
713 | } | 474 | } |
714 | 475 | ||
715 | private void RestoreSuitcaseFolderContents(IClientAPI client) | 476 | private void RestoreSuitcaseFolderContents(IClientAPI client) |
716 | { | 477 | { |
717 | |||
718 | } | 478 | } |
719 | 479 | ||
720 | private GridRegion MakeRegion(AgentCircuitData aCircuit) | 480 | private GridRegion MakeRegion(AgentCircuitData aCircuit) |