aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOren Hurvitz2013-10-31 13:02:57 +0200
committerOren Hurvitz2014-03-24 18:00:59 +0100
commit89945f8829dcc1ee889aad1bafd1d6c2938a6cc7 (patch)
tree2669a438a473f6b58fd59b10a635662709435bac
parentWhen updating the CreatorId of an inventory item, automatically update the Cr... (diff)
downloadopensim-SC_OLD-89945f8829dcc1ee889aad1bafd1d6c2938a6cc7.zip
opensim-SC_OLD-89945f8829dcc1ee889aad1bafd1d6c2938a6cc7.tar.gz
opensim-SC_OLD-89945f8829dcc1ee889aad1bafd1d6c2938a6cc7.tar.bz2
opensim-SC_OLD-89945f8829dcc1ee889aad1bafd1d6c2938a6cc7.tar.xz
Refactored: ExternalRepresentationUtils should be the only place where the "CreatorData" field is calculated, to ensure uniformity
Resolves http://opensimulator.org/mantis/view.php?id=6933
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs16
-rw-r--r--OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs3
-rw-r--r--OpenSim/Framework/Util.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs4
4 files changed, 24 insertions, 8 deletions
diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
index c56f213..db46ea8 100644
--- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
+++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -161,7 +161,7 @@ namespace OpenSim.Framework.Serialization.External
161 if (!hasCreatorData && creator != null) 161 if (!hasCreatorData && creator != null)
162 { 162 {
163 XmlElement creatorData = doc.CreateElement("CreatorData"); 163 XmlElement creatorData = doc.CreateElement("CreatorData");
164 creatorData.InnerText = homeURL + ";" + creator.FirstName + " " + creator.LastName; 164 creatorData.InnerText = CalcCreatorData(homeURL, creator.FirstName + " " + creator.LastName);
165 sop.AppendChild(creatorData); 165 sop.AppendChild(creatorData);
166 } 166 }
167 } 167 }
@@ -172,5 +172,15 @@ namespace OpenSim.Framework.Serialization.External
172 return wr.ToString(); 172 return wr.ToString();
173 } 173 }
174 } 174 }
175
176 public static string CalcCreatorData(string homeURL, string name)
177 {
178 return homeURL + ";" + name;
179 }
180
181 internal static string CalcCreatorData(string homeURL, UUID uuid, string name)
182 {
183 return homeURL + "/" + uuid + ";" + name;
184 }
175 } 185 }
176} \ No newline at end of file 186}
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
index f2a6b8b..135cefb 100644
--- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
+++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs
@@ -286,7 +286,8 @@ namespace OpenSim.Framework.Serialization.External
286 UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid); 286 UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid);
287 if (account != null) 287 if (account != null)
288 { 288 {
289 writer.WriteElementString("CreatorData", (string)options["home"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName); 289 string creatorData = ExternalRepresentationUtils.CalcCreatorData((string)options["home"], inventoryItem.CreatorIdAsUuid, account.FirstName + " " + account.LastName);
290 writer.WriteElementString("CreatorData", creatorData);
290 } 291 }
291 writer.WriteElementString("CreatorID", inventoryItem.CreatorId); 292 writer.WriteElementString("CreatorID", inventoryItem.CreatorId);
292 } 293 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 5805dc8..c2c9698 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2250,10 +2250,15 @@ namespace OpenSim.Framework
2250 { 2250 {
2251 string[] parts = firstName.Split(new char[] { '.' }); 2251 string[] parts = firstName.Split(new char[] { '.' });
2252 if (parts.Length == 2) 2252 if (parts.Length == 2)
2253 return id.ToString() + ";" + agentsURI + ";" + parts[0] + " " + parts[1]; 2253 return CalcUniversalIdentifier(id, agentsURI, parts[0] + " " + parts[1]);
2254 } 2254 }
2255 return id.ToString() + ";" + agentsURI + ";" + firstName + " " + lastName; 2255
2256 return CalcUniversalIdentifier(id, agentsURI, firstName + " " + lastName);
2257 }
2256 2258
2259 private static string CalcUniversalIdentifier(UUID id, string agentsURI, string name)
2260 {
2261 return id.ToString() + ";" + agentsURI + ";" + name;
2257 } 2262 }
2258 2263
2259 /// <summary> 2264 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index f07dee9..4deca00 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1230,7 +1230,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1230 if (m_UserManagement == null) 1230 if (m_UserManagement == null)
1231 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>(); 1231 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1232 string name = m_UserManagement.GetUserName(sop.CreatorID); 1232 string name = m_UserManagement.GetUserName(sop.CreatorID);
1233 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1233 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1234 } 1234 }
1235 1235
1236 WriteUUID(writer, "FolderID", sop.FolderID, options); 1236 WriteUUID(writer, "FolderID", sop.FolderID, options);
@@ -1403,7 +1403,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1403 if (m_UserManagement == null) 1403 if (m_UserManagement == null)
1404 m_UserManagement = scene.RequestModuleInterface<IUserManagement>(); 1404 m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
1405 string name = m_UserManagement.GetUserName(item.CreatorID); 1405 string name = m_UserManagement.GetUserName(item.CreatorID);
1406 writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name); 1406 writer.WriteElementString("CreatorData", ExternalRepresentationUtils.CalcCreatorData((string)options["home"], name));
1407 } 1407 }
1408 1408
1409 writer.WriteElementString("Description", item.Description); 1409 writer.WriteElementString("Description", item.Description);