aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorDiva Canto2010-11-21 13:16:52 -0800
committerDiva Canto2010-11-21 13:16:52 -0800
commit6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1 (patch)
tree6668ec7fc7816fb0fbe3793ac0967504d2f8c5ce /OpenSim/Region/Framework/Scenes
parentFix global region coordinates that are delivered by llRequestSimulatorData. (diff)
downloadopensim-SC_OLD-6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1.zip
opensim-SC_OLD-6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1.tar.gz
opensim-SC_OLD-6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1.tar.bz2
opensim-SC_OLD-6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1.tar.xz
Global creator information working on MySQL DB and on load/save OARs. Creator name properly shown on the viewer as first.last @authority.
New option added to save oar -profile=url. Migration on RegionStore making CreatorID be 255 chars. Moved Handling of user UUID -> name requests to a new module UserManagement/UserManagementModule.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-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
4 files changed, 76 insertions, 48 deletions
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