aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Serialization
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Serialization')
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs87
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs183
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs225
3 files changed, 463 insertions, 32 deletions
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
new file mode 100644
index 0000000..5c0630c
--- /dev/null
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.IO;
30using System.Xml;
31
32using OpenMetaverse;
33using OpenSim.Services.Interfaces;
34
35namespace OpenSim.Framework.Serialization.External
36{
37 public class ExternalRepresentationUtils
38 {
39 public static string RewriteSOP(string xml, string profileURL, IUserAccountService userService, UUID scopeID)
40 {
41 if (xml == string.Empty || profileURL == string.Empty || userService == null)
42 return xml;
43
44 XmlDocument doc = new XmlDocument();
45 doc.LoadXml(xml);
46 XmlNodeList sops = doc.GetElementsByTagName("SceneObjectPart");
47
48 foreach (XmlNode sop in sops)
49 {
50 UserAccount creator = null;
51 bool hasCreatorData = false;
52 XmlNodeList nodes = sop.ChildNodes;
53 foreach (XmlNode node in nodes)
54 {
55 if (node.Name == "CreatorID")
56 {
57 UUID uuid = UUID.Zero;
58 UUID.TryParse(node.InnerText, out uuid);
59 creator = userService.GetUserAccount(scopeID, uuid);
60 }
61 if (node.Name == "CreatorData" && node.InnerText != null && node.InnerText != string.Empty)
62 hasCreatorData = true;
63
64 //if (node.Name == "OwnerID")
65 //{
66 // UserAccount owner = GetUser(node.InnerText);
67 // if (owner != null)
68 // node.InnerText = m_ProfileServiceURL + "/" + node.InnerText + "/" + owner.FirstName + " " + owner.LastName;
69 //}
70 }
71 if (!hasCreatorData && creator != null)
72 {
73 XmlElement creatorData = doc.CreateElement("CreatorData");
74 creatorData.InnerText = profileURL + "/" + creator.PrincipalID + ";" + creator.FirstName + " " + creator.LastName;
75 sop.AppendChild(creatorData);
76 }
77 }
78
79 using (StringWriter wr = new StringWriter())
80 {
81 doc.Save(wr);
82 return wr.ToString();
83 }
84
85 }
86 }
87}
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs
new file mode 100644
index 0000000..7e3dd1b
--- /dev/null
+++ b/OpenSim/Framework/Serialization/External/OspResolver.cs
@@ -0,0 +1,183 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using System.Text;
30using log4net;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Services.Interfaces;
34
35namespace OpenSim.Framework.Serialization
36{
37 /// <summary>
38 /// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
39 /// identifying user profiles or supplying a simple name if no profile is available.
40 /// </summary>
41 public class OspResolver
42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44
45 public const string OSPA_PREFIX = "ospa:";
46 public const string OSPA_NAME_KEY = "n";
47 public const string OSPA_NAME_VALUE_SEPARATOR = " ";
48 public const string OSPA_TUPLE_SEPARATOR = "|";
49 public static readonly char[] OSPA_TUPLE_SEPARATOR_ARRAY = OSPA_TUPLE_SEPARATOR.ToCharArray();
50 public const string OSPA_PAIR_SEPARATOR = "=";
51
52 /// <summary>
53 /// Make an OSPA given a user UUID
54 /// </summary>
55 /// <param name="userId"></param>
56 /// <param name="commsManager"></param>
57 /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns>
58 public static string MakeOspa(UUID userId, IUserAccountService userService)
59 {
60 if (userService == null)
61 {
62 m_log.Warn("[OSP RESOLVER]: UserService is null");
63 return userId.ToString();
64 }
65
66 UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
67 if (account != null)
68 return MakeOspa(account.FirstName, account.LastName);
69
70 return null;
71 }
72
73 /// <summary>
74 /// Make an OSPA given a user name
75 /// </summary>
76 /// <param name="name"></param>
77 /// <returns></returns>
78 public static string MakeOspa(string firstName, string lastName)
79 {
80 return
81 OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
82 }
83
84 /// <summary>
85 /// Resolve an osp string into the most suitable internal OpenSim identifier.
86 /// </summary>
87 ///
88 /// In some cases this will be a UUID if a suitable profile exists on the system. In other cases, this may
89 /// just return the same identifier after creating a temporary profile.
90 ///
91 /// <param name="ospa"></param>
92 /// <param name="commsManager"></param>
93 /// <returns>
94 /// A suitable UUID for use in Second Life client communication. If the string was not a valid ospa, then UUID.Zero
95 /// is returned.
96 /// </returns>
97 public static UUID ResolveOspa(string ospa, IUserAccountService userService)
98 {
99 if (!ospa.StartsWith(OSPA_PREFIX))
100 return UUID.Zero;
101
102// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
103
104 string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
105 string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
106
107 foreach (string tuple in ospaTuples)
108 {
109 int tupleSeparatorIndex = tuple.IndexOf(OSPA_PAIR_SEPARATOR);
110
111 if (tupleSeparatorIndex < 0)
112 {
113 m_log.WarnFormat("[OSP RESOLVER]: Ignoring non-tuple component {0} in OSPA {1}", tuple, ospa);
114 continue;
115 }
116
117 string key = tuple.Remove(tupleSeparatorIndex).Trim();
118 string value = tuple.Substring(tupleSeparatorIndex + 1).Trim();
119
120 if (OSPA_NAME_KEY == key)
121 return ResolveOspaName(value, userService);
122 }
123
124 return UUID.Zero;
125 }
126
127 /// <summary>
128 /// Hash a profile name into a UUID
129 /// </summary>
130 /// <param name="name"></param>
131 /// <returns></returns>
132 public static UUID HashName(string name)
133 {
134 return new UUID(Utils.MD5(Encoding.Unicode.GetBytes(name)), 0);
135 }
136
137 /// <summary>
138 /// Resolve an OSPI name by querying existing persistent user profiles. If there is no persistent user profile
139 /// then a temporary user profile is inserted in the cache.
140 /// </summary>
141 /// <param name="name"></param>
142 /// <param name="commsManager"></param>
143 /// <returns>
144 /// An OpenSim internal identifier for the name given. Returns null if the name was not valid
145 /// </returns>
146 protected static UUID ResolveOspaName(string name, IUserAccountService userService)
147 {
148 if (userService == null)
149 return UUID.Zero;
150
151 int nameSeparatorIndex = name.IndexOf(OSPA_NAME_VALUE_SEPARATOR);
152
153 if (nameSeparatorIndex < 0)
154 {
155 m_log.WarnFormat("[OSP RESOLVER]: Ignoring unseparated name {0}", name);
156 return UUID.Zero;
157 }
158
159 string firstName = name.Remove(nameSeparatorIndex).TrimEnd();
160 string lastName = name.Substring(nameSeparatorIndex + 1).TrimStart();
161
162 UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
163 if (account != null)
164 return account.PrincipalID;
165
166 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
167 /*
168 UserProfileData tempUserProfile = new UserProfileData();
169 tempUserProfile.FirstName = firstName;
170 tempUserProfile.SurName = lastName;
171 tempUserProfile.ID = HashName(tempUserProfile.Name);
172
173 m_log.DebugFormat(
174 "[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
175 commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
176
177 return tempUserProfile.ID;
178 */
179
180 return UUID.Zero;
181 }
182 }
183}
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index 862cc72..d5e84c7 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -26,11 +26,16 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
31using System.Reflection;
30using System.Text; 32using System.Text;
31using System.Xml; 33using System.Xml;
34
35using log4net;
32using OpenMetaverse; 36using OpenMetaverse;
33using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Services.Interfaces;
34 39
35namespace OpenSim.Framework.Serialization.External 40namespace OpenSim.Framework.Serialization.External
36{ 41{
@@ -40,6 +45,141 @@ namespace OpenSim.Framework.Serialization.External
40 /// XXX: Please do not use yet. 45 /// XXX: Please do not use yet.
41 public class UserInventoryItemSerializer 46 public class UserInventoryItemSerializer
42 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader);
51 private static Dictionary<string, InventoryItemXmlProcessor> m_InventoryItemXmlProcessors = new Dictionary<string, InventoryItemXmlProcessor>();
52
53 #region InventoryItemBase Processor initialization
54 static UserInventoryItemSerializer()
55 {
56 m_InventoryItemXmlProcessors.Add("Name", ProcessName);
57 m_InventoryItemXmlProcessors.Add("ID", ProcessID);
58 m_InventoryItemXmlProcessors.Add("InvType", ProcessInvType);
59 m_InventoryItemXmlProcessors.Add("CreatorUUID", ProcessCreatorUUID);
60 m_InventoryItemXmlProcessors.Add("CreatorID", ProcessCreatorID);
61 m_InventoryItemXmlProcessors.Add("CreatorData", ProcessCreatorData);
62 m_InventoryItemXmlProcessors.Add("CreationDate", ProcessCreationDate);
63 m_InventoryItemXmlProcessors.Add("Owner", ProcessOwner);
64 m_InventoryItemXmlProcessors.Add("Description", ProcessDescription);
65 m_InventoryItemXmlProcessors.Add("AssetType", ProcessAssetType);
66 m_InventoryItemXmlProcessors.Add("AssetID", ProcessAssetID);
67 m_InventoryItemXmlProcessors.Add("SaleType", ProcessSaleType);
68 m_InventoryItemXmlProcessors.Add("SalePrice", ProcessSalePrice);
69 m_InventoryItemXmlProcessors.Add("BasePermissions", ProcessBasePermissions);
70 m_InventoryItemXmlProcessors.Add("CurrentPermissions", ProcessCurrentPermissions);
71 m_InventoryItemXmlProcessors.Add("EveryOnePermissions", ProcessEveryOnePermissions);
72 m_InventoryItemXmlProcessors.Add("NextPermissions", ProcessNextPermissions);
73 m_InventoryItemXmlProcessors.Add("Flags", ProcessFlags);
74 m_InventoryItemXmlProcessors.Add("GroupID", ProcessGroupID);
75 m_InventoryItemXmlProcessors.Add("GroupOwned", ProcessGroupOwned);
76 }
77 #endregion
78
79 #region InventoryItemBase Processors
80 private static void ProcessName(InventoryItemBase item, XmlTextReader reader)
81 {
82 item.Name = reader.ReadElementContentAsString("Name", String.Empty);
83 }
84
85 private static void ProcessID(InventoryItemBase item, XmlTextReader reader)
86 {
87 item.ID = Util.ReadUUID(reader, "ID");
88 }
89
90 private static void ProcessInvType(InventoryItemBase item, XmlTextReader reader)
91 {
92 item.InvType = reader.ReadElementContentAsInt("InvType", String.Empty);
93 }
94
95 private static void ProcessCreatorUUID(InventoryItemBase item, XmlTextReader reader)
96 {
97 item.CreatorId = reader.ReadElementContentAsString("CreatorUUID", String.Empty);
98 }
99
100 private static void ProcessCreatorID(InventoryItemBase item, XmlTextReader reader)
101 {
102 // when it exists, this overrides the previous
103 item.CreatorId = reader.ReadElementContentAsString("CreatorID", String.Empty);
104 }
105
106 private static void ProcessCreationDate(InventoryItemBase item, XmlTextReader reader)
107 {
108 item.CreationDate = reader.ReadElementContentAsInt("CreationDate", String.Empty);
109 }
110
111 private static void ProcessOwner(InventoryItemBase item, XmlTextReader reader)
112 {
113 item.Owner = Util.ReadUUID(reader, "Owner");
114 }
115
116 private static void ProcessDescription(InventoryItemBase item, XmlTextReader reader)
117 {
118 item.Description = reader.ReadElementContentAsString("Description", String.Empty);
119 }
120
121 private static void ProcessAssetType(InventoryItemBase item, XmlTextReader reader)
122 {
123 item.AssetType = reader.ReadElementContentAsInt("AssetType", String.Empty);
124 }
125
126 private static void ProcessAssetID(InventoryItemBase item, XmlTextReader reader)
127 {
128 item.AssetID = Util.ReadUUID(reader, "AssetID");
129 }
130
131 private static void ProcessSaleType(InventoryItemBase item, XmlTextReader reader)
132 {
133 item.SaleType = (byte)reader.ReadElementContentAsInt("SaleType", String.Empty);
134 }
135
136 private static void ProcessSalePrice(InventoryItemBase item, XmlTextReader reader)
137 {
138 item.SalePrice = reader.ReadElementContentAsInt("SalePrice", String.Empty);
139 }
140
141 private static void ProcessBasePermissions(InventoryItemBase item, XmlTextReader reader)
142 {
143 item.BasePermissions = (uint)reader.ReadElementContentAsInt("BasePermissions", String.Empty);
144 }
145
146 private static void ProcessCurrentPermissions(InventoryItemBase item, XmlTextReader reader)
147 {
148 item.CurrentPermissions = (uint)reader.ReadElementContentAsInt("CurrentPermissions", String.Empty);
149 }
150
151 private static void ProcessEveryOnePermissions(InventoryItemBase item, XmlTextReader reader)
152 {
153 item.EveryOnePermissions = (uint)reader.ReadElementContentAsInt("EveryOnePermissions", String.Empty);
154 }
155
156 private static void ProcessNextPermissions(InventoryItemBase item, XmlTextReader reader)
157 {
158 item.NextPermissions = (uint)reader.ReadElementContentAsInt("NextPermissions", String.Empty);
159 }
160
161 private static void ProcessFlags(InventoryItemBase item, XmlTextReader reader)
162 {
163 item.Flags = (uint)reader.ReadElementContentAsInt("Flags", String.Empty);
164 }
165
166 private static void ProcessGroupID(InventoryItemBase item, XmlTextReader reader)
167 {
168 item.GroupID = Util.ReadUUID(reader, "GroupID");
169 }
170
171 private static void ProcessGroupOwned(InventoryItemBase item, XmlTextReader reader)
172 {
173 item.GroupOwned = Util.ReadBoolean(reader);
174 }
175
176 private static void ProcessCreatorData(InventoryItemBase item, XmlTextReader reader)
177 {
178 item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
179 }
180
181 #endregion
182
43 /// <summary> 183 /// <summary>
44 /// Deserialize item 184 /// Deserialize item
45 /// </summary> 185 /// </summary>
@@ -60,40 +200,47 @@ namespace OpenSim.Framework.Serialization.External
60 public static InventoryItemBase Deserialize(string serialization) 200 public static InventoryItemBase Deserialize(string serialization)
61 { 201 {
62 InventoryItemBase item = new InventoryItemBase(); 202 InventoryItemBase item = new InventoryItemBase();
63 203
64 StringReader sr = new StringReader(serialization); 204 using (XmlTextReader reader = new XmlTextReader(new StringReader(serialization)))
65 XmlTextReader xtr = new XmlTextReader(sr); 205 {
66 206 reader.ReadStartElement("InventoryItem");
67 xtr.ReadStartElement("InventoryItem"); 207
68 208 string nodeName = string.Empty;
69 item.Name = xtr.ReadElementString("Name"); 209 while (reader.NodeType != XmlNodeType.EndElement)
70 item.ID = UUID.Parse( xtr.ReadElementString("ID")); 210 {
71 item.InvType = Convert.ToInt32( xtr.ReadElementString("InvType")); 211 nodeName = reader.Name;
72 item.CreatorId = xtr.ReadElementString("CreatorUUID"); 212 InventoryItemXmlProcessor p = null;
73 item.CreationDate = Convert.ToInt32( xtr.ReadElementString("CreationDate")); 213 if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p))
74 item.Owner = UUID.Parse( xtr.ReadElementString("Owner")); 214 {
75 item.Description = xtr.ReadElementString("Description"); 215 //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name);
76 item.AssetType = Convert.ToInt32( xtr.ReadElementString("AssetType")); 216 try
77 item.AssetID = UUID.Parse( xtr.ReadElementString("AssetID")); 217 {
78 item.SaleType = Convert.ToByte( xtr.ReadElementString("SaleType")); 218 p(item, reader);
79 item.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice")); 219 }
80 item.BasePermissions = Convert.ToUInt32( xtr.ReadElementString("BasePermissions")); 220 catch (Exception e)
81 item.CurrentPermissions = Convert.ToUInt32( xtr.ReadElementString("CurrentPermissions")); 221 {
82 item.EveryOnePermissions = Convert.ToUInt32( xtr.ReadElementString("EveryOnePermissions")); 222 m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e);
83 item.NextPermissions = Convert.ToUInt32( xtr.ReadElementString("NextPermissions")); 223 if (reader.NodeType == XmlNodeType.EndElement)
84 item.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags")); 224 reader.Read();
85 item.GroupID = UUID.Parse( xtr.ReadElementString("GroupID")); 225 }
86 item.GroupOwned = Convert.ToBoolean(xtr.ReadElementString("GroupOwned")); 226 }
87 227 else
88 xtr.ReadEndElement(); 228 {
89 229 // m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName);
90 xtr.Close(); 230 reader.ReadOuterXml(); // ignore
91 sr.Close(); 231 }
92 232
233 }
234
235 reader.ReadEndElement(); // InventoryItem
236 }
237
238 //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID);
93 return item; 239 return item;
240
94 } 241 }
95 242
96 public static string Serialize(InventoryItemBase inventoryItem) 243 public static string Serialize(InventoryItemBase inventoryItem, Dictionary<string, object> options, IUserAccountService userAccountService)
97 { 244 {
98 StringWriter sw = new StringWriter(); 245 StringWriter sw = new StringWriter();
99 XmlTextWriter writer = new XmlTextWriter(sw); 246 XmlTextWriter writer = new XmlTextWriter(sw);
@@ -112,7 +259,7 @@ namespace OpenSim.Framework.Serialization.External
112 writer.WriteString(inventoryItem.InvType.ToString()); 259 writer.WriteString(inventoryItem.InvType.ToString());
113 writer.WriteEndElement(); 260 writer.WriteEndElement();
114 writer.WriteStartElement("CreatorUUID"); 261 writer.WriteStartElement("CreatorUUID");
115 writer.WriteString(inventoryItem.CreatorId); 262 writer.WriteString(OspResolver.MakeOspa(inventoryItem.CreatorIdAsUuid, userAccountService));
116 writer.WriteEndElement(); 263 writer.WriteEndElement();
117 writer.WriteStartElement("CreationDate"); 264 writer.WriteStartElement("CreationDate");
118 writer.WriteString(inventoryItem.CreationDate.ToString()); 265 writer.WriteString(inventoryItem.CreationDate.ToString());
@@ -156,6 +303,20 @@ namespace OpenSim.Framework.Serialization.External
156 writer.WriteStartElement("GroupOwned"); 303 writer.WriteStartElement("GroupOwned");
157 writer.WriteString(inventoryItem.GroupOwned.ToString()); 304 writer.WriteString(inventoryItem.GroupOwned.ToString());
158 writer.WriteEndElement(); 305 writer.WriteEndElement();
306 if (inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty)
307 writer.WriteElementString("CreatorData", inventoryItem.CreatorData);
308 else if (options.ContainsKey("profile"))
309 {
310 if (userAccountService != null)
311 {
312 UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid);
313 if (account != null)
314 {
315 writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName);
316 }
317 writer.WriteElementString("CreatorID", inventoryItem.CreatorId);
318 }
319 }
159 320
160 writer.WriteEndElement(); 321 writer.WriteEndElement();
161 322