diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Serialization')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index dfc69d8..1fe31b0 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); |
@@ -1077,11 +1092,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1077 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); | 1092 | writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); |
1078 | 1093 | ||
1079 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); | 1094 | writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); |
1095 | |||
1080 | 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 | |||
1081 | WriteUUID(writer, "FolderID", sop.FolderID, options); | 1108 | WriteUUID(writer, "FolderID", sop.FolderID, options); |
1082 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); | 1109 | writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); |
1083 | 1110 | ||
1084 | WriteTaskInventory(writer, sop.TaskInventory, options); | 1111 | WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene); |
1085 | 1112 | ||
1086 | WriteUUID(writer, "UUID", sop.UUID, options); | 1113 | WriteUUID(writer, "UUID", sop.UUID, options); |
1087 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); | 1114 | writer.WriteElementString("LocalId", sop.LocalId.ToString()); |
@@ -1205,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1205 | writer.WriteElementString(name, flagsStr); | 1232 | writer.WriteElementString(name, flagsStr); |
1206 | } | 1233 | } |
1207 | 1234 | ||
1208 | 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) |
1209 | { | 1236 | { |
1210 | if (tinv.Count > 0) // otherwise skip this | 1237 | if (tinv.Count > 0) // otherwise skip this |
1211 | { | 1238 | { |
@@ -1218,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
1218 | WriteUUID(writer, "AssetID", item.AssetID, options); | 1245 | WriteUUID(writer, "AssetID", item.AssetID, options); |
1219 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); | 1246 | writer.WriteElementString("BasePermissions", item.BasePermissions.ToString()); |
1220 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); | 1247 | writer.WriteElementString("CreationDate", item.CreationDate.ToString()); |
1248 | |||
1249 | |||
1221 | 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 | |||
1222 | writer.WriteElementString("Description", item.Description); | 1262 | writer.WriteElementString("Description", item.Description); |
1223 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); | 1263 | writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString()); |
1224 | writer.WriteElementString("Flags", item.Flags.ToString()); | 1264 | writer.WriteElementString("Flags", item.Flags.ToString()); |