diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7f37878..9cf5a39 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | |||
@@ -34,6 +34,7 @@ using System.Xml; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
38 | 39 | ||
39 | namespace OpenSim.Region.Framework.Scenes.Serialization | 40 | namespace OpenSim.Region.Framework.Scenes.Serialization |
@@ -46,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
46 | public class SceneObjectSerializer | 47 | public class SceneObjectSerializer |
47 | { | 48 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | |||
51 | private static IUserManagement m_UserManagement; | ||
49 | 52 | ||
50 | /// <summary> | 53 | /// <summary> |
51 | /// Deserialize a scene object from the original xml format | 54 | /// Deserialize a scene object from the original xml format |
@@ -270,6 +273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
270 | #region SOPXmlProcessors initialization | 273 | #region SOPXmlProcessors initialization |
271 | m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop); | 274 | m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop); |
272 | m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID); | 275 | m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID); |
276 | m_SOPXmlProcessors.Add("CreatorData", ProcessCreatorData); | ||
273 | m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); | 277 | m_SOPXmlProcessors.Add("FolderID", ProcessFolderID); |
274 | m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); | 278 | m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial); |
275 | m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); | 279 | m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory); |
@@ -327,6 +331,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
327 | m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); | 331 | m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions); |
328 | m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); | 332 | m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate); |
329 | m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); | 333 | m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID); |
334 | m_TaskInventoryXmlProcessors.Add("CreatorData", ProcessTICreatorData); | ||
330 | m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); | 335 | m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription); |
331 | m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); | 336 | m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions); |
332 | m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); | 337 | m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags); |
@@ -412,6 +417,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
412 | obj.CreatorID = ReadUUID(reader, "CreatorID"); | 417 | obj.CreatorID = ReadUUID(reader, "CreatorID"); |
413 | } | 418 | } |
414 | 419 | ||
420 | private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader) | ||
421 | { | ||
422 | obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | ||
423 | } | ||
424 | |||
415 | private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) | 425 | private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) |
416 | { | 426 | { |
417 | obj.FolderID = ReadUUID(reader, "FolderID"); | 427 | obj.FolderID = ReadUUID(reader, "FolderID"); |
@@ -698,6 +708,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
698 | item.CreatorID = ReadUUID(reader, "CreatorID"); | 708 | item.CreatorID = ReadUUID(reader, "CreatorID"); |
699 | } | 709 | } |
700 | 710 | ||
711 | private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader) | ||
712 | { | ||
713 | item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty); | ||
714 | } | ||
715 | |||
701 | private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) | 716 | private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader) |
702 | { | 717 | { |
703 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); | 718 | item.Description = reader.ReadElementContentAsString("Description", String.Empty); |
@@ -735,7 +750,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
735 | 750 | ||
736 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) | 751 | private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) |
737 | { | 752 | { |
738 | item.OldItemID = ReadUUID(reader, "OldItemID"); | 753 | ReadUUID(reader, "OldItemID"); |
754 | // On deserialization, the old item id MUST BE UUID.Zero!!!!! | ||
755 | // Setting this to the saved value will BREAK script persistence! | ||
756 | // item.OldItemID = ReadUUID(reader, "OldItemID"); | ||
739 | } | 757 | } |
740 | 758 | ||
741 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) | 759 | private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) |
@@ -1074,11 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1074 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); | 1092 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); |
1075 | 1093 | ||
1076 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); | 1094 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); |
1095 | |||
1077 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); | 1096 | WriteUUID(writer, "CreatorID", sop.CreatorID, options); |
1097 | |||
1098 | if (sop.CreatorData != null && sop.CreatorData != string.Empty) | ||
1099 | writer.WriteElementString("CreatorData", sop.CreatorData); | ||
1100 | else if (options.ContainsKey("profile")) | ||
1101 | { | ||
1102 | if (m_UserManagement == null) | ||
1103 | m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); | ||
1104 | string name = m_UserManagement.GetUserName(sop.CreatorID); | ||
1105 | writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name); | ||
1106 | } | ||
1107 | |||
1078 | WriteUUID(writer, "FolderID", sop.FolderID, options); | 1108 | WriteUUID(writer, "FolderID", sop.FolderID, options); |
1079 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); | 1109 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); |
1080 | 1110 | ||
1081 | WriteTaskInventory(writer, sop.TaskInventory, options); | 1111 | WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene); |
1082 | 1112 | ||
1083 | WriteUUID(writer, "UUID", sop.UUID, options); | 1113 | WriteUUID(writer, "UUID", sop.UUID, options); |
1084 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); | 1114 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); |
@@ -1202,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1202 | writer.WriteElementString(name, flagsStr); | 1232 | writer.WriteElementString(name, flagsStr); |
1203 | } | 1233 | } |
1204 | 1234 | ||
1205 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options) | 1235 | static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) |
1206 | { | 1236 | { |
1207 | if (tinv.Count > 0) // otherwise skip this | 1237 | if (tinv.Count > 0) // otherwise skip this |
1208 | { | 1238 | { |
@@ -1215,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1215 | WriteUUID(writer, "AssetID", item.AssetID, options); | 1245 | WriteUUID(writer, "AssetID", item.AssetID, options); |
1216 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); | 1246 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); |
1217 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); | 1247 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); |
1248 | |||
1249 | |||
1218 | WriteUUID(writer, "CreatorID", item.CreatorID, options); | 1250 | WriteUUID(writer, "CreatorID", item.CreatorID, options); |
1251 | |||
1252 | if (item.CreatorData != null && item.CreatorData != string.Empty) | ||
1253 | writer.WriteElementString("CreatorData", item.CreatorData); | ||
1254 | else if (options.ContainsKey("profile")) | ||
1255 | { | ||
1256 | if (m_UserManagement == null) | ||
1257 | m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); | ||
1258 | string name = m_UserManagement.GetUserName(item.CreatorID); | ||
1259 | writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name); | ||
1260 | } | ||
1261 | |||
1219 | writer.WriteElementString("Description", item.Description); | 1262 | writer.WriteElementString("Description", item.Description); |
1220 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); | 1263 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); |
1221 | writer.WriteElementString("Flags", item.Flags.ToString()); | 1264 | writer.WriteElementString("Flags", item.Flags.ToString()); |