aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs4
-rw-r--r--OpenSim/Data/MySQL/Resources/RegionStore.migrations8
-rw-r--r--OpenSim/Region/Application/OpenSim.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs297
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml1
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs21
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs8
-rw-r--r--OpenSim/Region/Framework/Interfaces/IUserManagement.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs36
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs51
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs21
14 files changed, 434 insertions, 56 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index ae78814..f630dc1 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -1090,7 +1090,7 @@ namespace OpenSim.Data.MySQL
1090 1090
1091 // depending on the MySQL connector version, CHAR(36) may be already converted to Guid! 1091 // depending on the MySQL connector version, CHAR(36) may be already converted to Guid!
1092 prim.UUID = DBGuid.FromDB(row["UUID"]); 1092 prim.UUID = DBGuid.FromDB(row["UUID"]);
1093 prim.CreatorID = DBGuid.FromDB(row["CreatorID"]); 1093 prim.CreatorIdentification = (string)row["CreatorID"];
1094 prim.OwnerID = DBGuid.FromDB(row["OwnerID"]); 1094 prim.OwnerID = DBGuid.FromDB(row["OwnerID"]);
1095 prim.GroupID = DBGuid.FromDB(row["GroupID"]); 1095 prim.GroupID = DBGuid.FromDB(row["GroupID"]);
1096 prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]); 1096 prim.LastOwnerID = DBGuid.FromDB(row["LastOwnerID"]);
@@ -1453,7 +1453,7 @@ namespace OpenSim.Data.MySQL
1453 cmd.Parameters.AddWithValue("TouchName", prim.TouchName); 1453 cmd.Parameters.AddWithValue("TouchName", prim.TouchName);
1454 // permissions 1454 // permissions
1455 cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags); 1455 cmd.Parameters.AddWithValue("ObjectFlags", (uint)prim.Flags);
1456 cmd.Parameters.AddWithValue("CreatorID", prim.CreatorID.ToString()); 1456 cmd.Parameters.AddWithValue("CreatorID", prim.CreatorIdentification.ToString());
1457 cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString()); 1457 cmd.Parameters.AddWithValue("OwnerID", prim.OwnerID.ToString());
1458 cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString()); 1458 cmd.Parameters.AddWithValue("GroupID", prim.GroupID.ToString());
1459 cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString()); 1459 cmd.Parameters.AddWithValue("LastOwnerID", prim.LastOwnerID.ToString());
diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
index 1405207..364c4d3 100644
--- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations
+++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations
@@ -817,3 +817,11 @@ ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
817ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; 817ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
818ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; 818ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
819COMMIT; 819COMMIT;
820
821:VERSION 37 #---------------------
822
823BEGIN;
824
825ALTER TABLE `prims` MODIFY COLUMN `CreatorID` VARCHAR(255) NOT NULL DEFAULT '';
826
827COMMIT;
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index dd2e859..6127c2d 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -265,9 +265,10 @@ namespace OpenSim
265 LoadOar); 265 LoadOar);
266 266
267 m_console.Commands.AddCommand("region", false, "save oar", 267 m_console.Commands.AddCommand("region", false, "save oar",
268 "save oar [-v|--version=N] [<OAR path>]", 268 "save oar [-v|--version=N] [-p|--profile=url] [<OAR path>]",
269 "Save a region's data to an OAR archive.", 269 "Save a region's data to an OAR archive.",
270 "-v|--version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine 270 "-v|--version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine
271 + "-p|--profile=url adds the url of the profile service to the saved user information" + Environment.NewLine
271 + "The OAR path must be a filesystem path." 272 + "The OAR path must be a filesystem path."
272 + " If this is not given then the oar is saved to region.oar in the current directory.", 273 + " If this is not given then the oar is saved to region.oar in the current directory.",
273 SaveOar); 274 SaveOar);
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 25322a1..a5fcb49 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -115,10 +115,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
115 // Try to find the avatar wielding the killing object 115 // Try to find the avatar wielding the killing object
116 killingAvatar = deadAvatar.Scene.GetScenePresence(part.OwnerID); 116 killingAvatar = deadAvatar.Scene.GetScenePresence(part.OwnerID);
117 if (killingAvatar == null) 117 if (killingAvatar == null)
118 deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, deadAvatar.Scene.GetUserName(part.OwnerID)); 118 {
119 IUserManagement userManager = deadAvatar.Scene.RequestModuleInterface<IUserManagement>();
120 string userName = "Unkown User";
121 if (userManager != null)
122 userName = userManager.GetUserName(part.OwnerID);
123 deadAvatarMessage = String.Format("You impaled yourself on {0} owned by {1}!", part.Name, userName);
124 }
119 else 125 else
120 { 126 {
121// killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name); 127 // killingAvatarMessage = String.Format("You fragged {0}!", deadAvatar.Name);
122 deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name); 128 deadAvatarMessage = String.Format("You got killed by {0}!", killingAvatar.Name);
123 } 129 }
124 } 130 }
diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
new file mode 100644
index 0000000..88ed763
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs
@@ -0,0 +1,297 @@
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.Reflection;
31
32using OpenSim.Framework;
33
34using OpenSim.Region.Framework;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38
39using OpenMetaverse;
40using log4net;
41using Nini.Config;
42
43namespace OpenSim.Region.CoreModules.Framework.UserManagement
44{
45 struct UserData
46 {
47 public UUID Id;
48 public string FirstName;
49 public string LastName;
50 public string ProfileURL;
51 }
52
53 public class UserManagementModule : ISharedRegionModule, IUserManagement
54 {
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56
57 private List<Scene> m_Scenes = new List<Scene>();
58
59 // The cache
60 Dictionary<UUID, UserData> m_UserCache = new Dictionary<UUID, UserData>();
61
62 #region ISharedRegionModule
63
64 public void Initialise(IConfigSource config)
65 {
66 //m_Enabled = config.Configs["Modules"].GetBoolean("LibraryModule", m_Enabled);
67 //if (m_Enabled)
68 //{
69 // IConfig libConfig = config.Configs["LibraryService"];
70 // if (libConfig != null)
71 // {
72 // string dllName = libConfig.GetString("LocalServiceModule", string.Empty);
73 // m_log.Debug("[LIBRARY MODULE]: Library service dll is " + dllName);
74 // if (dllName != string.Empty)
75 // {
76 // Object[] args = new Object[] { config };
77 // m_Library = ServerUtils.LoadPlugin<ILibraryService>(dllName, args);
78 // }
79 // }
80 //}
81 }
82
83 public bool IsSharedModule
84 {
85 get { return true; }
86 }
87
88 public string Name
89 {
90 get { return "UserManagement Module"; }
91 }
92
93 public Type ReplaceableInterface
94 {
95 get { return null; }
96 }
97
98 public void AddRegion(Scene scene)
99 {
100 m_Scenes.Add(scene);
101
102 scene.RegisterModuleInterface<IUserManagement>(this);
103 scene.EventManager.OnNewClient += new EventManager.OnNewClientDelegate(EventManager_OnNewClient);
104 }
105
106 public void RemoveRegion(Scene scene)
107 {
108 scene.UnregisterModuleInterface<IUserManagement>(this);
109 m_Scenes.Remove(scene);
110 }
111
112 public void RegionLoaded(Scene scene)
113 {
114 }
115
116 public void PostInitialise()
117 {
118 foreach (Scene s in m_Scenes)
119 {
120 // let's sniff all the user names referenced by objects in the scene
121 m_log.DebugFormat("[USER MANAGEMENT MODULE]: Caching creators' data from {0} ({1} objects)...", s.RegionInfo.RegionName, s.GetEntities().Length);
122 s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); });
123 }
124 }
125
126 public void Close()
127 {
128 m_Scenes.Clear();
129 m_UserCache.Clear();
130 }
131
132 #endregion ISharedRegionModule
133
134
135 #region Event Handlers
136
137 void EventManager_OnNewClient(IClientAPI client)
138 {
139 client.OnNameFromUUIDRequest += new UUIDNameRequest(HandleUUIDNameRequest);
140 }
141
142 void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
143 {
144 if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid))
145 {
146 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
147 }
148 else
149 {
150 string[] names = GetUserNames(uuid);
151 if (names.Length == 2)
152 {
153 remote_client.SendNameReply(uuid, names[0], names[1]);
154 }
155
156 }
157 }
158
159 #endregion Event Handlers
160
161 private void CacheCreators(SceneObjectGroup sog)
162 {
163 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: processing {0} {1}; {2}", sog.RootPart.Name, sog.RootPart.CreatorData, sog.RootPart.CreatorIdentification);
164 AddUser(sog.RootPart.CreatorID, sog.RootPart.CreatorData);
165
166 foreach (SceneObjectPart sop in sog.Parts)
167 AddUser(sop.CreatorID, sop.CreatorData);
168 }
169
170
171 private string[] GetUserNames(UUID uuid)
172 {
173 string[] returnstring = new string[2];
174
175 if (m_UserCache.ContainsKey(uuid))
176 {
177 returnstring[0] = m_UserCache[uuid].FirstName;
178 returnstring[1] = m_UserCache[uuid].LastName;
179 return returnstring;
180 }
181
182 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, uuid);
183
184 if (account != null)
185 {
186 returnstring[0] = account.FirstName;
187 returnstring[1] = account.LastName;
188
189 UserData user = new UserData();
190 user.FirstName = account.FirstName;
191 user.LastName = account.LastName;
192
193 lock (m_UserCache)
194 m_UserCache[uuid] = user;
195 }
196 else
197 {
198 returnstring[0] = "Unknown";
199 returnstring[1] = "User";
200 }
201
202 return returnstring;
203 }
204
205 #region IUserManagement
206
207 public string GetUserName(UUID uuid)
208 {
209 string[] names = GetUserNames(uuid);
210 if (names.Length == 2)
211 {
212 string firstname = names[0];
213 string lastname = names[1];
214
215 return firstname + " " + lastname;
216
217 }
218 return "(hippos)";
219 }
220
221 public void AddUser(UUID id, string creatorData)
222 {
223 if (m_UserCache.ContainsKey(id))
224 return;
225
226 UserData user = new UserData();
227 user.Id = id;
228
229 if (creatorData != null && creatorData != string.Empty)
230 {
231 //creatorData = <endpoint>;<name>
232
233 string[] parts = creatorData.Split(';');
234 if (parts.Length >= 1)
235 {
236 user.ProfileURL = parts[0];
237 try
238 {
239 Uri uri = new Uri(parts[0]);
240 user.LastName = "@" + uri.Authority;
241 }
242 catch
243 {
244 m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]);
245 user.LastName = "@unknown";
246 }
247 }
248 if (parts.Length >= 2)
249 user.FirstName = parts[1].Replace(' ', '.');
250 }
251 else
252 {
253 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id);
254 user.FirstName = account.FirstName;
255 user.LastName = account.LastName;
256 // user.ProfileURL = we should initialize this to the default
257 }
258
259 lock (m_UserCache)
260 m_UserCache[id] = user;
261
262 //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
263 }
264
265 //public void AddUser(UUID uuid, string userData)
266 //{
267 // if (m_UserCache.ContainsKey(uuid))
268 // return;
269
270 // UserData user = new UserData();
271 // user.Id = uuid;
272
273 // // userData = <profile url>;<name>
274 // string[] parts = userData.Split(';');
275 // if (parts.Length >= 1)
276 // user.ProfileURL = parts[0].Trim();
277 // if (parts.Length >= 2)
278 // {
279 // string[] name = parts[1].Trim().Split(' ');
280 // if (name.Length >= 1)
281 // user.FirstName = name[0];
282 // if (name.Length >= 2)
283 // user.LastName = name[1];
284 // else
285 // user.LastName = "?";
286 // }
287
288 // lock (m_UserCache)
289 // m_UserCache.Add(uuid, user);
290
291 // m_log.DebugFormat("[USER MANAGEMENT MODULE]: Added user {0} {1} {2} {3}", user.Id, user.FirstName, user.LastName, user.ProfileURL);
292
293 //}
294
295 #endregion IUserManagement
296 }
297}
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index df23eac..cfa4109 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -8,6 +8,7 @@
8 </Dependencies> 8 </Dependencies>
9 9
10 <Extension path = "/OpenSim/RegionModules"> 10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="UserManagementModule" type="OpenSim.Region.CoreModules.Framework.UserManagement.UserManagementModule" />
11 <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" /> 12 <RegionModule id="EntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.EntityTransferModule" />
12 <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" /> 13 <RegionModule id="HGEntityTransferModule" type="OpenSim.Region.CoreModules.Framework.EntityTransfer.HGEntityTransferModule" />
13 <RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" /> 14 <RegionModule id="InventoryAccessModule" type="OpenSim.Region.CoreModules.Framework.InventoryAccess.BasicInventoryAccessModule" />
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index d5d4468..b7fa799 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -78,6 +78,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
78 /// </summary> 78 /// </summary>
79 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); 79 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>();
80 80
81 private IUserManagement m_UserMan;
82 private IUserManagement UserManager
83 {
84 get
85 {
86 if (m_UserMan == null)
87 {
88 m_UserMan = m_scene.RequestModuleInterface<IUserManagement>();
89 }
90 return m_UserMan;
91 }
92 }
93
81 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) 94 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
82 { 95 {
83 m_scene = scene; 96 m_scene = scene;
@@ -251,8 +264,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
251 264
252 foreach (SceneObjectPart part in sceneObject.Parts) 265 foreach (SceneObjectPart part in sceneObject.Parts)
253 { 266 {
254 if (!ResolveUserUuid(part.CreatorID)) 267 if (part.CreatorData == null || part.CreatorData == string.Empty)
255 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 268 {
269 if (!ResolveUserUuid(part.CreatorID))
270 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
271 }
272 UserManager.AddUser(part.CreatorID, part.CreatorData);
256 273
257 if (!ResolveUserUuid(part.OwnerID)) 274 if (!ResolveUserUuid(part.OwnerID))
258 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; 275 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index e0ad71e..358d0a7 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -126,6 +126,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
126 126
127 OptionSet ops = new OptionSet(); 127 OptionSet ops = new OptionSet();
128 ops.Add("v|version=", delegate(string v) { options["version"] = v; }); 128 ops.Add("v|version=", delegate(string v) { options["version"] = v; });
129 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
129 130
130 List<string> mainParams = ops.Parse(cmdparams); 131 List<string> mainParams = ops.Parse(cmdparams);
131 132
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 6844c60..622fc08 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -771,8 +771,14 @@ namespace OpenSim.Region.CoreModules.World.Estate
771 for (int i = 0; i < uuidarr.Length; i++) 771 for (int i = 0; i < uuidarr.Length; i++)
772 { 772 {
773 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); 773 // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]);
774 m_scene.GetUserName(uuidarr[i]); 774
775 IUserManagement userManager = m_scene.RequestModuleInterface<IUserManagement>();
776 string userName = "Unkown User";
777 if (userManager != null)
778 userName = userManager.GetUserName(uuidarr[i]);
779
775 // we drop it. It gets cached though... so we're ready for the next request. 780 // we drop it. It gets cached though... so we're ready for the next request.
781 // diva commnent 11/21/2010: uh?!? wft?
776 } 782 }
777 } 783 }
778 #endregion 784 #endregion
diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
new file mode 100644
index 0000000..1a5cb7e
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs
@@ -0,0 +1,13 @@
1using System;
2using System.Collections.Generic;
3
4using OpenMetaverse;
5
6namespace OpenSim.Region.Framework.Interfaces
7{
8 public interface IUserManagement
9 {
10 string GetUserName(UUID uuid);
11 void AddUser(UUID uuid, string userData);
12 }
13}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 21c36d3..ab567fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -462,22 +462,6 @@ namespace OpenSim.Region.Framework.Scenes
462 ); 462 );
463 } 463 }
464 464
465 public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
466 {
467 if (LibraryService != null && (LibraryService.LibraryRootFolder.Owner == uuid))
468 {
469 remote_client.SendNameReply(uuid, "Mr", "OpenSim");
470 }
471 else
472 {
473 string[] names = GetUserNames(uuid);
474 if (names.Length == 2)
475 {
476 remote_client.SendNameReply(uuid, names[0], names[1]);
477 }
478
479 }
480 }
481 465
482 /// <summary> 466 /// <summary>
483 /// Handle a fetch inventory request from the client 467 /// Handle a fetch inventory request from the client
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 96a9f99..4fc2cbc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -185,6 +185,8 @@ namespace OpenSim.Region.Framework.Scenes
185 private Timer m_mapGenerationTimer = new Timer(); 185 private Timer m_mapGenerationTimer = new Timer();
186 private bool m_generateMaptiles; 186 private bool m_generateMaptiles;
187 187
188 private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>();
189
188 #endregion Fields 190 #endregion Fields
189 191
190 #region Properties 192 #region Properties
@@ -792,36 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
792 return m_simulatorVersion; 794 return m_simulatorVersion;
793 } 795 }
794 796
795 public string[] GetUserNames(UUID uuid)
796 {
797 string[] returnstring = new string[0];
798
799 UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid);
800
801 if (account != null)
802 {
803 returnstring = new string[2];
804 returnstring[0] = account.FirstName;
805 returnstring[1] = account.LastName;
806 }
807
808 return returnstring;
809 }
810
811 public string GetUserName(UUID uuid)
812 {
813 string[] names = GetUserNames(uuid);
814 if (names.Length == 2)
815 {
816 string firstname = names[0];
817 string lastname = names[1];
818
819 return firstname + " " + lastname;
820
821 }
822 return "(hippos)";
823 }
824
825 /// <summary> 797 /// <summary>
826 /// Another region is up. 798 /// Another region is up.
827 /// 799 ///
@@ -2808,7 +2780,7 @@ namespace OpenSim.Region.Framework.Scenes
2808 2780
2809 public virtual void SubscribeToClientGridEvents(IClientAPI client) 2781 public virtual void SubscribeToClientGridEvents(IClientAPI client)
2810 { 2782 {
2811 client.OnNameFromUUIDRequest += HandleUUIDNameRequest; 2783 //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
2812 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; 2784 client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
2813 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; 2785 client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
2814 client.OnSetStartLocationRequest += SetHomeRezPoint; 2786 client.OnSetStartLocationRequest += SetHomeRezPoint;
@@ -2935,7 +2907,7 @@ namespace OpenSim.Region.Framework.Scenes
2935 2907
2936 public virtual void UnSubscribeToClientGridEvents(IClientAPI client) 2908 public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
2937 { 2909 {
2938 client.OnNameFromUUIDRequest -= HandleUUIDNameRequest; 2910 //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
2939 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; 2911 client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
2940 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; 2912 client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
2941 client.OnSetStartLocationRequest -= SetHomeRezPoint; 2913 client.OnSetStartLocationRequest -= SetHomeRezPoint;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index f164201..6d5a53a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -435,6 +435,7 @@ namespace OpenSim.Region.Framework.Scenes
435 private DateTime m_expires; 435 private DateTime m_expires;
436 private DateTime m_rezzed; 436 private DateTime m_rezzed;
437 private bool m_createSelected = false; 437 private bool m_createSelected = false;
438 private string m_creatorData = string.Empty;
438 439
439 public UUID CreatorID 440 public UUID CreatorID
440 { 441 {
@@ -448,6 +449,56 @@ namespace OpenSim.Region.Framework.Scenes
448 } 449 }
449 } 450 }
450 451
452 public string CreatorData
453 {
454 get { return m_creatorData; }
455 set { m_creatorData = value; }
456 }
457
458 public string CreatorIdentification
459 {
460 get
461 {
462 if (m_creatorData != null && m_creatorData != string.Empty)
463 return _creatorID.ToString() + ';' + m_creatorData;
464 else
465 return _creatorID.ToString();
466 }
467 set
468 {
469 if ((value == null) || (value != null && value == string.Empty))
470 {
471 m_creatorData = string.Empty;
472 return;
473 }
474
475 if (!value.Contains(";")) // plain UUID
476 {
477 UUID uuid = UUID.Zero;
478 UUID.TryParse(value, out uuid);
479 _creatorID = uuid;
480 }
481 else // <uuid>[;<endpoint>[;name]]
482 {
483 string name = "Unknown User";
484 string[] parts = value.Split(';');
485 if (parts.Length >= 1)
486 {
487 UUID uuid = UUID.Zero;
488 UUID.TryParse(parts[0], out uuid);
489 _creatorID = uuid;
490 }
491 if (parts.Length >= 2)
492 m_creatorData = parts[1];
493 if (parts.Length >= 3)
494 name = parts[2];
495
496 m_creatorData += ';' + name;
497
498 }
499 }
500 }
501
451 /// <summary> 502 /// <summary>
452 /// A relic from when we we thought that prims contained folder objects. In 503 /// A relic from when we we thought that prims contained folder objects. In
453 /// reality, prim == folder 504 /// reality, prim == folder
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index fb4ef28..fceeafa 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -34,6 +34,7 @@ using System.Xml;
34using log4net; 34using log4net;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
38 39
39namespace OpenSim.Region.Framework.Scenes.Serialization 40namespace 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);
@@ -412,6 +416,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
412 obj.CreatorID = ReadUUID(reader, "CreatorID"); 416 obj.CreatorID = ReadUUID(reader, "CreatorID");
413 } 417 }
414 418
419 private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
420 {
421 obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
422 }
423
415 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader) 424 private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
416 { 425 {
417 obj.FolderID = ReadUUID(reader, "FolderID"); 426 obj.FolderID = ReadUUID(reader, "FolderID");
@@ -1077,7 +1086,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1077 writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); 1086 writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
1078 1087
1079 writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower()); 1088 writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower());
1089
1080 WriteUUID(writer, "CreatorID", sop.CreatorID, options); 1090 WriteUUID(writer, "CreatorID", sop.CreatorID, options);
1091
1092 if (sop.CreatorData != null && sop.CreatorData != string.Empty)
1093 writer.WriteElementString("CreatorData", sop.CreatorData);
1094 else if (options.ContainsKey("profile"))
1095 {
1096 if (m_UserManagement == null)
1097 m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
1098 string name = m_UserManagement.GetUserName(sop.CreatorID);
1099 writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name);
1100 }
1101
1081 WriteUUID(writer, "FolderID", sop.FolderID, options); 1102 WriteUUID(writer, "FolderID", sop.FolderID, options);
1082 writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString()); 1103 writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());
1083 1104