aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2010-12-03 02:36:13 +0000
committerMelanie2010-12-03 02:36:13 +0000
commit342dc532ec64642d5997f23050a9776f663facdf (patch)
treeb0be3997967aa6e4d79873281f535ad436b841e4 /OpenSim/Region/Framework
parentChange the way sim health reporting reports sim startup (diff)
parentOnly force prim persistence before delete if the prim is the result of an unp... (diff)
downloadopensim-SC_OLD-342dc532ec64642d5997f23050a9776f663facdf.zip
opensim-SC_OLD-342dc532ec64642d5997f23050a9776f663facdf.tar.gz
opensim-SC_OLD-342dc532ec64642d5997f23050a9776f663facdf.tar.bz2
opensim-SC_OLD-342dc532ec64642d5997f23050a9776f663facdf.tar.xz
Merge branch 'master' into careminster-presence-refactor
Also prevent god takes from ending up in Lost and Found
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs164
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs8
7 files changed, 78 insertions, 131 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
index 1a5cb7e..2904ee8 100644
--- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -9,5 +9,6 @@ namespace OpenSim.Region.Framework.Interfaces
9 { 9 {
10 string GetUserName(UUID uuid); 10 string GetUserName(UUID uuid);
11 void AddUser(UUID uuid, string userData); 11 void AddUser(UUID uuid, string userData);
12 void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
12 } 13 }
13} 14}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e6201a8..52e2e83 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -398,6 +398,10 @@ namespace OpenSim.Region.Framework.Scenes
398 398
399 if ((item != null) && (item.Owner == senderId)) 399 if ((item != null) && (item.Owner == senderId))
400 { 400 {
401 IUserManagement uman = RequestModuleInterface<IUserManagement>();
402 if (uman != null)
403 uman.AddUser(item.CreatorIdAsUuid, item.CreatorData);
404
401 if (!Permissions.BypassPermissions()) 405 if (!Permissions.BypassPermissions())
402 { 406 {
403 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) 407 if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 3c2cd9b..0c7b2e8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2059,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
2059 /// <param name="group">Object Id</param> 2059 /// <param name="group">Object Id</param>
2060 /// <param name="silent">Suppress broadcasting changes to other clients.</param> 2060 /// <param name="silent">Suppress broadcasting changes to other clients.</param>
2061 public void DeleteSceneObject(SceneObjectGroup group, bool silent) 2061 public void DeleteSceneObject(SceneObjectGroup group, bool silent)
2062 { 2062 {
2063// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); 2063// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
2064 2064
2065 //SceneObjectPart rootPart = group.GetChildPart(group.UUID); 2065 //SceneObjectPart rootPart = group.GetChildPart(group.UUID);
@@ -2102,7 +2102,7 @@ namespace OpenSim.Region.Framework.Scenes
2102 if (!silent) 2102 if (!silent)
2103 SendKillObject(new List<uint>() { group.LocalId }); 2103 SendKillObject(new List<uint>() { group.LocalId });
2104 2104
2105// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); 2105// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
2106 } 2106 }
2107 2107
2108 /// <summary> 2108 /// <summary>
@@ -2121,9 +2121,12 @@ namespace OpenSim.Region.Framework.Scenes
2121 // Force a database update so that the scene object group ID is accurate. It's possible that the 2121 // Force a database update so that the scene object group ID is accurate. It's possible that the
2122 // group has recently been delinked from another group but that this change has not been persisted 2122 // group has recently been delinked from another group but that this change has not been persisted
2123 // to the DB. 2123 // to the DB.
2124 ForceSceneObjectBackup(so); 2124 // This is an expensive thing to do so only do it if absolutely necessary.
2125 if (so.HasGroupChangedDueToDelink)
2126 ForceSceneObjectBackup(so);
2127
2125 so.DetachFromBackup(); 2128 so.DetachFromBackup();
2126 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID); 2129 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
2127 } 2130 }
2128 2131
2129 // We need to keep track of this state in case this group is still queued for further backup. 2132 // We need to keep track of this state in case this group is still queued for further backup.
@@ -2650,6 +2653,7 @@ namespace OpenSim.Region.Framework.Scenes
2650 } 2653 }
2651 else 2654 else
2652 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName); 2655 m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
2656
2653 } 2657 }
2654 } 2658 }
2655 2659
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bcb715b..896300f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -171,10 +171,19 @@ namespace OpenSim.Region.Framework.Scenes
171 } 171 }
172 } 172 }
173 m_hasGroupChanged = value; 173 m_hasGroupChanged = value;
174
175// m_log.DebugFormat(
176// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
174 } 177 }
175 178
176 get { return m_hasGroupChanged; } 179 get { return m_hasGroupChanged; }
177 } 180 }
181
182 /// <summary>
183 /// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since
184 /// an unlinked group currently has to be persisted to the database before we can perform an unlink operation.
185 /// </summary>
186 public bool HasGroupChangedDueToDelink { get; private set; }
178 187
179 private bool isTimeToPersist() 188 private bool isTimeToPersist()
180 { 189 {
@@ -1622,6 +1631,7 @@ namespace OpenSim.Region.Framework.Scenes
1622 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity; 1631 backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
1623 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem; 1632 backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
1624 HasGroupChanged = false; 1633 HasGroupChanged = false;
1634 HasGroupChangedDueToDelink = false;
1625 1635
1626 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this); 1636 m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
1627 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID); 1637 datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
@@ -2540,8 +2550,9 @@ namespace OpenSim.Region.Framework.Scenes
2540 2550
2541 linkPart.Rezzed = RootPart.Rezzed; 2551 linkPart.Rezzed = RootPart.Rezzed;
2542 2552
2543 //HasGroupChanged = true; 2553 // When we delete a group, we currently have to force persist to the database if the object id has changed
2544 //ScheduleGroupForFullUpdate(); 2554 // (since delete works by deleting all rows which have a given object id)
2555 objectGroup.HasGroupChangedDueToDelink = true;
2545 2556
2546 return objectGroup; 2557 return objectGroup;
2547 } 2558 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8cc2be1..db60ae3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -459,7 +459,10 @@ namespace OpenSim.Region.Framework.Scenes
459 } 459 }
460 } 460 }
461 461
462 public string CreatorData // = <profile url>;<name> 462 /// <summary>
463 /// Data about the creator in the form profile_url;name
464 /// </summary>
465 public string CreatorData
463 { 466 {
464 get { return m_creatorData; } 467 get { return m_creatorData; }
465 set { m_creatorData = value; } 468 set { m_creatorData = value; }
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 1fe31b0..6c13eb5 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -409,12 +409,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
409 #region SOPXmlProcessors 409 #region SOPXmlProcessors
410 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) 410 private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
411 { 411 {
412 obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty); 412 obj.AllowedDrop = Util.ReadBoolean(reader);
413 } 413 }
414 414
415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader) 415 private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
416 { 416 {
417 obj.CreatorID = ReadUUID(reader, "CreatorID"); 417 obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
418 } 418 }
419 419
420 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) 420 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
424 424
425 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) 425 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
426 { 426 {
427 obj.FolderID = ReadUUID(reader, "FolderID"); 427 obj.FolderID = Util.ReadUUID(reader, "FolderID");
428 } 428 }
429 429
430 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader) 430 private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader)
@@ -439,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
439 439
440 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader) 440 private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
441 { 441 {
442 obj.UUID = ReadUUID(reader, "UUID"); 442 obj.UUID = Util.ReadUUID(reader, "UUID");
443 } 443 }
444 444
445 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader) 445 private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
@@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
459 459
460 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader) 460 private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader)
461 { 461 {
462 obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty); 462 obj.PassTouches = Util.ReadBoolean(reader);
463 } 463 }
464 464
465 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader) 465 private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
@@ -474,32 +474,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
474 474
475 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader) 475 private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
476 { 476 {
477 obj.GroupPosition = ReadVector(reader, "GroupPosition"); 477 obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
478 } 478 }
479 479
480 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader) 480 private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
481 { 481 {
482 obj.OffsetPosition = ReadVector(reader, "OffsetPosition"); ; 482 obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
483 } 483 }
484 484
485 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader) 485 private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
486 { 486 {
487 obj.RotationOffset = ReadQuaternion(reader, "RotationOffset"); 487 obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
488 } 488 }
489 489
490 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader) 490 private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
491 { 491 {
492 obj.Velocity = ReadVector(reader, "Velocity"); 492 obj.Velocity = Util.ReadVector(reader, "Velocity");
493 } 493 }
494 494
495 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader) 495 private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
496 { 496 {
497 obj.AngularVelocity = ReadVector(reader, "AngularVelocity"); 497 obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
498 } 498 }
499 499
500 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader) 500 private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
501 { 501 {
502 obj.Acceleration = ReadVector(reader, "Acceleration"); 502 obj.Acceleration = Util.ReadVector(reader, "Acceleration");
503 } 503 }
504 504
505 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader) 505 private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader)
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
553 553
554 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) 554 private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
555 { 555 {
556 obj.Scale = ReadVector(reader, "Scale"); 556 obj.Scale = Util.ReadVector(reader, "Scale");
557 } 557 }
558 558
559 private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader) 559 private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
@@ -563,22 +563,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
563 563
564 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader) 564 private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
565 { 565 {
566 obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation"); 566 obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
567 } 567 }
568 568
569 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader) 569 private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader)
570 { 570 {
571 obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition"); 571 obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
572 } 572 }
573 573
574 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader) 574 private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader)
575 { 575 {
576 obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL"); 576 obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
577 } 577 }
578 578
579 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader) 579 private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader)
580 { 580 {
581 obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL"); 581 obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
582 } 582 }
583 583
584 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader) 584 private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader)
@@ -614,17 +614,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
614 614
615 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader) 615 private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader)
616 { 616 {
617 obj.GroupID = ReadUUID(reader, "GroupID"); 617 obj.GroupID = Util.ReadUUID(reader, "GroupID");
618 } 618 }
619 619
620 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader) 620 private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader)
621 { 621 {
622 obj.OwnerID = ReadUUID(reader, "OwnerID"); 622 obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
623 } 623 }
624 624
625 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader) 625 private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader)
626 { 626 {
627 obj.LastOwnerID = ReadUUID(reader, "LastOwnerID"); 627 obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
628 } 628 }
629 629
630 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader) 630 private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader)
@@ -654,16 +654,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
654 654
655 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader) 655 private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader)
656 { 656 {
657 string value = reader.ReadElementContentAsString("Flags", String.Empty); 657 obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
658 // !!!!! to deal with flags without commas
659 if (value.Contains(" ") && !value.Contains(","))
660 value = value.Replace(" ", ", ");
661 obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value);
662 } 658 }
663 659
664 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader) 660 private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
665 { 661 {
666 obj.CollisionSound = ReadUUID(reader, "CollisionSound"); 662 obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
667 } 663 }
668 664
669 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader) 665 private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader)
@@ -690,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
690 #region TaskInventoryXmlProcessors 686 #region TaskInventoryXmlProcessors
691 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader) 687 private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader)
692 { 688 {
693 item.AssetID = ReadUUID(reader, "AssetID"); 689 item.AssetID = Util.ReadUUID(reader, "AssetID");
694 } 690 }
695 691
696 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader) 692 private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -705,7 +701,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
705 701
706 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader) 702 private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader)
707 { 703 {
708 item.CreatorID = ReadUUID(reader, "CreatorID"); 704 item.CreatorID = Util.ReadUUID(reader, "CreatorID");
709 } 705 }
710 706
711 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) 707 private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
@@ -730,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
730 726
731 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader) 727 private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader)
732 { 728 {
733 item.GroupID = ReadUUID(reader, "GroupID"); 729 item.GroupID = Util.ReadUUID(reader, "GroupID");
734 } 730 }
735 731
736 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader) 732 private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -745,20 +741,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
745 741
746 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader) 742 private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader)
747 { 743 {
748 item.ItemID = ReadUUID(reader, "ItemID"); 744 item.ItemID = Util.ReadUUID(reader, "ItemID");
749 } 745 }
750 746
751 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) 747 private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
752 { 748 {
753 ReadUUID(reader, "OldItemID"); 749 Util.ReadUUID(reader, "OldItemID");
754 // On deserialization, the old item id MUST BE UUID.Zero!!!!! 750 // On deserialization, the old item id MUST BE UUID.Zero!!!!!
755 // Setting this to the saved value will BREAK script persistence! 751 // Setting this to the saved value will BREAK script persistence!
756 // item.OldItemID = ReadUUID(reader, "OldItemID"); 752 // item.OldItemID = Util.ReadUUID(reader, "OldItemID");
757 } 753 }
758 754
759 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) 755 private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
760 { 756 {
761 item.LastOwnerID = ReadUUID(reader, "LastOwnerID"); 757 item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
762 } 758 }
763 759
764 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader) 760 private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
@@ -773,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
773 769
774 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader) 770 private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
775 { 771 {
776 item.OwnerID = ReadUUID(reader, "OwnerID"); 772 item.OwnerID = Util.ReadUUID(reader, "OwnerID");
777 } 773 }
778 774
779 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader) 775 private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -783,17 +779,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
783 779
784 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader) 780 private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader)
785 { 781 {
786 item.ParentID = ReadUUID(reader, "ParentID"); 782 item.ParentID = Util.ReadUUID(reader, "ParentID");
787 } 783 }
788 784
789 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader) 785 private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
790 { 786 {
791 item.ParentPartID = ReadUUID(reader, "ParentPartID"); 787 item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
792 } 788 }
793 789
794 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader) 790 private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
795 { 791 {
796 item.PermsGranter = ReadUUID(reader, "PermsGranter"); 792 item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
797 } 793 }
798 794
799 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader) 795 private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
@@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
808 804
809 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader) 805 private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
810 { 806 {
811 item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty); 807 item.OwnerChanged = Util.ReadBoolean(reader);
812 } 808 }
813 809
814 #endregion 810 #endregion
@@ -922,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
922 918
923 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader) 919 private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader)
924 { 920 {
925 shp.Scale = ReadVector(reader, "Scale"); 921 shp.Scale = Util.ReadVector(reader, "Scale");
926 } 922 }
927 923
928 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader) 924 private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -932,25 +928,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
932 928
933 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader) 929 private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
934 { 930 {
935 string value = reader.ReadElementContentAsString("ProfileShape", String.Empty); 931 shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
936 // !!!!! to deal with flags without commas
937 if (value.Contains(" ") && !value.Contains(","))
938 value = value.Replace(" ", ", ");
939 shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value);
940 } 932 }
941 933
942 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader) 934 private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
943 { 935 {
944 string value = reader.ReadElementContentAsString("HollowShape", String.Empty); 936 shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
945 // !!!!! to deal with flags without commas
946 if (value.Contains(" ") && !value.Contains(","))
947 value = value.Replace(" ", ", ");
948 shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value);
949 } 937 }
950 938
951 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader) 939 private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
952 { 940 {
953 shp.SculptTexture = ReadUUID(reader, "SculptTexture"); 941 shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
954 } 942 }
955 943
956 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader) 944 private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1045 1033
1046 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1034 private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1047 { 1035 {
1048 shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty); 1036 shp.FlexiEntry = Util.ReadBoolean(reader);
1049 } 1037 }
1050 1038
1051 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1039 private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1052 { 1040 {
1053 shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty); 1041 shp.LightEntry = Util.ReadBoolean(reader);
1054 } 1042 }
1055 1043
1056 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader) 1044 private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
1057 { 1045 {
1058 shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty); 1046 shp.SculptEntry = Util.ReadBoolean(reader);
1059 } 1047 }
1060 1048
1061 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader) 1049 private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1220 1208
1221 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options) 1209 static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
1222 { 1210 {
1223 // Older versions of serialization can't cope with commas 1211 // Older versions of serialization can't cope with commas, so we eliminate the commas
1224 if (options.ContainsKey("version")) 1212 writer.WriteElementString(name, flagsStr.Replace(",", ""));
1225 {
1226 float version = 0.5F;
1227 float.TryParse(options["version"].ToString(), out version);
1228 if (version < 0.5)
1229 flagsStr = flagsStr.Replace(",", "");
1230 }
1231
1232 writer.WriteElementString(name, flagsStr);
1233 } 1213 }
1234 1214
1235 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) 1215 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
@@ -1459,66 +1439,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1459 return obj; 1439 return obj;
1460 } 1440 }
1461 1441
1462 static UUID ReadUUID(XmlTextReader reader, string name)
1463 {
1464 UUID id;
1465 string idStr;
1466
1467 reader.ReadStartElement(name);
1468
1469 if (reader.Name == "Guid")
1470 idStr = reader.ReadElementString("Guid");
1471 else // UUID
1472 idStr = reader.ReadElementString("UUID");
1473
1474 UUID.TryParse(idStr, out id);
1475 reader.ReadEndElement();
1476
1477 return id;
1478 }
1479
1480 static Vector3 ReadVector(XmlTextReader reader, string name)
1481 {
1482 Vector3 vec;
1483
1484 reader.ReadStartElement(name);
1485 vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
1486 vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
1487 vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
1488 reader.ReadEndElement();
1489
1490 return vec;
1491 }
1492
1493 static Quaternion ReadQuaternion(XmlTextReader reader, string name)
1494 {
1495 Quaternion quat = new Quaternion();
1496
1497 reader.ReadStartElement(name);
1498 while (reader.NodeType != XmlNodeType.EndElement)
1499 {
1500 switch (reader.Name.ToLower())
1501 {
1502 case "x":
1503 quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1504 break;
1505 case "y":
1506 quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1507 break;
1508 case "z":
1509 quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1510 break;
1511 case "w":
1512 quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
1513 break;
1514 }
1515 }
1516
1517 reader.ReadEndElement();
1518
1519 return quat;
1520 }
1521
1522 static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) 1442 static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
1523 { 1443 {
1524 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1444 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index f57cf98..b84298f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -121,13 +121,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
121 "Not exactly sure what this is asserting..."); 121 "Not exactly sure what this is asserting...");
122 122
123 // Delink part 2 123 // Delink part 2
124 grp1.DelinkFromGroup(part2.LocalId); 124 SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);
125 125
126 if (debugtest) 126 if (debugtest)
127 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset); 127 m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
128 128
129 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink."); 129 Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
130 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero"); 130 Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
131 Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
131 } 132 }
132 133
133 [Test] 134 [Test]
@@ -325,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
325 326
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 327 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart); 328 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true); 329 scene.AddNewSceneObject(sog, true);
329 330
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 331 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
331 // scene backup thread. 332 // scene backup thread.
@@ -333,7 +334,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
333 334
334 // These changes should occur immediately without waiting for a backup pass 335 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); 336 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
337
338 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
336 scene.DeleteSceneObject(groupToDelete, false); 339 scene.DeleteSceneObject(groupToDelete, false);
340 Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
337 341
338 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); 342 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
339 343