From 98ba079e95ef0c967f138ac49c5e8f3c0961c848 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 16 Nov 2010 01:33:24 +0100
Subject: Diva needs a spanking! Serializing OldItemID breaks script state
persistence in agent inventory.
---
.../Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 7f37878..fb4ef28 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -735,7 +735,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
{
- item.OldItemID = ReadUUID(reader, "OldItemID");
+ ReadUUID(reader, "OldItemID");
+ // On deserialization, the old item id MUST BE UUID.Zero!!!!!
+ // Setting this to the saved value will BREAK script persistence!
+ // item.OldItemID = ReadUUID(reader, "OldItemID");
}
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
--
cgit v1.1
From 7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 16 Nov 2010 21:01:56 +0000
Subject: Change the way attachments are persisted. Editing a worn attachment
will now save properly, as will the results of a resizer script working.
Attachment positions are no longer saved on each move, but instead are saved
once on logout. Attachment script states are saved as part of the attachment
now when detaching.
---
.../Framework/Interfaces/IAttachmentsModule.cs | 21 ++++++++----
.../Framework/Interfaces/IEntityInventory.cs | 1 +
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 ++++++---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 6 ++--
.../Framework/Scenes/SceneObjectPartInventory.cs | 40 ++++++++++++----------
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 +++++++++++
7 files changed, 76 insertions(+), 33 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 24e481b..b3576c5 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -122,11 +122,20 @@ namespace OpenSim.Region.Framework.Interfaces
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
///
- /// Update the position of an attachment
+ /// Update the user inventory with a changed attachment
///
- ///
- ///
- ///
- void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
+ ///
+ /// A
+ ///
+ ///
+ /// A
+ ///
+ ///
+ /// A
+ ///
+ ///
+ /// A
+ ///
+ void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID);
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2e6faa0..64664ab 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// false if the item did not exist, true if the update occurred successfully
bool UpdateInventoryItem(TaskInventoryItem item);
bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents);
+ bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged);
///
/// Remove an item from this entity's inventory
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a4cc66d..96a9f99 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3152,7 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes
List regions = new List(avatar.KnownChildRegionHandles);
regions.Remove(RegionInfo.RegionHandle);
m_sceneGridService.SendCloseChildAgentConnections(agentID, regions);
-
}
m_eventManager.TriggerClientClosed(agentID, this);
}
@@ -3164,6 +3163,9 @@ namespace OpenSim.Region.Framework.Scenes
m_eventManager.TriggerOnRemovePresence(agentID);
+ if (avatar != null && (!avatar.IsChildAgent))
+ avatar.SaveChangedAttachments();
+
ForEachClient(
delegate(IClientAPI client)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 24d7334..032c859 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
protected internal bool AddRestoredSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates)
{
- if (!alreadyPersisted)
+ if (attachToBackup && (!alreadyPersisted))
{
sceneObject.ForceInventoryPersistence();
sceneObject.HasGroupChanged = true;
@@ -282,8 +282,10 @@ namespace OpenSim.Region.Framework.Scenes
///
protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
- // Ensure that we persist this new scene object
- sceneObject.HasGroupChanged = true;
+ // Ensure that we persist this new scene object if it's not an
+ // attachment
+ if (attachToBackup)
+ sceneObject.HasGroupChanged = true;
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
}
@@ -1279,8 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes
{
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{
- if (m_parentScene.AttachmentsModule != null)
- m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
+ // Set the new attachment point data in the object
+ byte attachmentPoint = group.GetAttachmentPoint();
+ group.UpdateGroupPosition(pos);
+ group.RootPart.IsAttachment = false;
+ group.AbsolutePosition = group.RootPart.AttachedPos;
+ group.SetAttachmentPoint(attachmentPoint);
+ group.HasGroupChanged = true;
}
else
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5f00f84..c2810b2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -491,13 +491,15 @@ namespace OpenSim.Region.Framework.Scenes
XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState");
if (nodes.Count > 0)
{
- m_savedScriptState = new Dictionary();
+ if (m_savedScriptState == null)
+ m_savedScriptState = new Dictionary();
foreach (XmlNode node in nodes)
{
if (node.Attributes["UUID"] != null)
{
UUID itemid = new UUID(node.Attributes["UUID"].Value);
- m_savedScriptState.Add(itemid, node.InnerXml);
+ if (itemid != UUID.Zero)
+ m_savedScriptState[itemid] = node.InnerXml;
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 0c5e62d..6a204c3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -127,8 +127,6 @@ namespace OpenSim.Region.Framework.Scenes
if (0 == m_items.Count)
return;
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
IList items = GetInventoryItems();
m_items.Clear();
@@ -144,17 +142,6 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (Items)
{
- if (Items.Count == 0)
- {
- return;
- }
-
- HasInventoryChanged = true;
- if (m_part.ParentGroup != null)
- {
- m_part.ParentGroup.HasGroupChanged = true;
- }
-
IList items = new List(Items.Values);
Items.Clear();
@@ -208,8 +195,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
+ // Don't let this set the HasGroupChanged flag for attachments
+ // as this happens during rez and we don't want a new asset
+ // for each attachment each time
+ if (!m_part.ParentGroup.RootPart.IsAttachment)
+ {
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ }
+
List items = GetInventoryItems();
foreach (TaskInventoryItem item in items)
{
@@ -674,13 +668,19 @@ namespace OpenSim.Region.Framework.Scenes
/// false if the item did not exist, true if the update occurred successfully
public bool UpdateInventoryItem(TaskInventoryItem item)
{
- return UpdateInventoryItem(item, true);
+ return UpdateInventoryItem(item, true, true);
}
public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents)
{
+ return UpdateInventoryItem(item, fireScriptEvents, true);
+ }
+
+ public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged)
+ {
TaskInventoryItem it = GetInventoryItem(item.ItemID);
if (it != null)
+
{
item.ParentID = m_part.UUID;
item.ParentPartID = m_part.UUID;
@@ -702,9 +702,11 @@ namespace OpenSim.Region.Framework.Scenes
if (fireScriptEvents)
m_part.TriggerScriptChangedEvent(Changed.INVENTORY);
-
- HasInventoryChanged = true;
- m_part.ParentGroup.HasGroupChanged = true;
+ if (considerChanged)
+ {
+ HasInventoryChanged = true;
+ m_part.ParentGroup.HasGroupChanged = true;
+ }
return true;
}
else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 34d1c39..bfc1bd6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3746,5 +3746,25 @@ namespace OpenSim.Region.Framework.Scenes
m_reprioritization_called = false;
}
}
+
+ public void SaveChangedAttachments()
+ {
+ // Need to copy this list because DetachToInventoryPrep mods it
+ List attachments = new List(Attachments.ToArray());
+
+ IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule;
+ if (attachmentsModule != null)
+ {
+ foreach (SceneObjectGroup grp in attachments)
+ {
+ if (grp.HasGroupChanged) // Resizer scripts?
+ {
+ grp.DetachToInventoryPrep();
+ attachmentsModule.UpdateKnownItem(ControllingClient,
+ grp, grp.GetFromItemID(), grp.OwnerID);
+ }
+ }
+ }
+ }
}
}
--
cgit v1.1
From 390c3a3b6fa62e05c7b90908ac7ef0e40f545048 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 16 Nov 2010 22:26:07 +0100
Subject: Prevent leftover attachments from clogging up the pipes
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bfc1bd6..db69093 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3759,9 +3759,12 @@ namespace OpenSim.Region.Framework.Scenes
{
if (grp.HasGroupChanged) // Resizer scripts?
{
- grp.DetachToInventoryPrep();
+ grp.RootPart.IsAttachment = false;
+ grp.AbsolutePosition = grp.RootPart.AttachedPos;
+// grp.DetachToInventoryPrep();
attachmentsModule.UpdateKnownItem(ControllingClient,
grp, grp.GetFromItemID(), grp.OwnerID);
+ grp.RootPart.IsAttachment = true;
}
}
}
--
cgit v1.1
From 6a9ae9e7cb71d79e9ec06cf25009e8bf45850dd1 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sun, 21 Nov 2010 13:16:52 -0800
Subject: 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.
---
.../Region/Framework/Interfaces/IUserManagement.cs | 13 ++++++
.../Framework/Scenes/Scene.PacketHandlers.cs | 16 -------
OpenSim/Region/Framework/Scenes/Scene.cs | 36 ++-------------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 51 ++++++++++++++++++++++
.../Scenes/Serialization/SceneObjectSerializer.cs | 21 +++++++++
5 files changed, 89 insertions(+), 48 deletions(-)
create mode 100644 OpenSim/Region/Framework/Interfaces/IUserManagement.cs
(limited to 'OpenSim/Region/Framework')
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 @@
+using System;
+using System.Collections.Generic;
+
+using OpenMetaverse;
+
+namespace OpenSim.Region.Framework.Interfaces
+{
+ public interface IUserManagement
+ {
+ string GetUserName(UUID uuid);
+ void AddUser(UUID uuid, string userData);
+ }
+}
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
);
}
- public void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client)
- {
- if (LibraryService != null && (LibraryService.LibraryRootFolder.Owner == uuid))
- {
- remote_client.SendNameReply(uuid, "Mr", "OpenSim");
- }
- else
- {
- string[] names = GetUserNames(uuid);
- if (names.Length == 2)
- {
- remote_client.SendNameReply(uuid, names[0], names[1]);
- }
-
- }
- }
///
/// 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
private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles;
+ private Dictionary m_UserNamesCache = new Dictionary();
+
#endregion Fields
#region Properties
@@ -792,36 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
return m_simulatorVersion;
}
- public string[] GetUserNames(UUID uuid)
- {
- string[] returnstring = new string[0];
-
- UserAccount account = UserAccountService.GetUserAccount(RegionInfo.ScopeID, uuid);
-
- if (account != null)
- {
- returnstring = new string[2];
- returnstring[0] = account.FirstName;
- returnstring[1] = account.LastName;
- }
-
- return returnstring;
- }
-
- public string GetUserName(UUID uuid)
- {
- string[] names = GetUserNames(uuid);
- if (names.Length == 2)
- {
- string firstname = names[0];
- string lastname = names[1];
-
- return firstname + " " + lastname;
-
- }
- return "(hippos)";
- }
-
///
/// Another region is up.
///
@@ -2808,7 +2780,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientGridEvents(IClientAPI client)
{
- client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
+ //client.OnNameFromUUIDRequest += HandleUUIDNameRequest;
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
client.OnAvatarPickerRequest += ProcessAvatarPickerRequest;
client.OnSetStartLocationRequest += SetHomeRezPoint;
@@ -2935,7 +2907,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void UnSubscribeToClientGridEvents(IClientAPI client)
{
- client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
+ //client.OnNameFromUUIDRequest -= HandleUUIDNameRequest;
client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest;
client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest;
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
private DateTime m_expires;
private DateTime m_rezzed;
private bool m_createSelected = false;
+ private string m_creatorData = string.Empty;
public UUID CreatorID
{
@@ -448,6 +449,56 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public string CreatorData
+ {
+ get { return m_creatorData; }
+ set { m_creatorData = value; }
+ }
+
+ public string CreatorIdentification
+ {
+ get
+ {
+ if (m_creatorData != null && m_creatorData != string.Empty)
+ return _creatorID.ToString() + ';' + m_creatorData;
+ else
+ return _creatorID.ToString();
+ }
+ set
+ {
+ if ((value == null) || (value != null && value == string.Empty))
+ {
+ m_creatorData = string.Empty;
+ return;
+ }
+
+ if (!value.Contains(";")) // plain UUID
+ {
+ UUID uuid = UUID.Zero;
+ UUID.TryParse(value, out uuid);
+ _creatorID = uuid;
+ }
+ else // [;[;name]]
+ {
+ string name = "Unknown User";
+ string[] parts = value.Split(';');
+ if (parts.Length >= 1)
+ {
+ UUID uuid = UUID.Zero;
+ UUID.TryParse(parts[0], out uuid);
+ _creatorID = uuid;
+ }
+ if (parts.Length >= 2)
+ m_creatorData = parts[1];
+ if (parts.Length >= 3)
+ name = parts[2];
+
+ m_creatorData += ';' + name;
+
+ }
+ }
+ }
+
///
/// A relic from when we we thought that prims contained folder objects. In
/// 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;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Scenes.Serialization
@@ -46,6 +47,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public class SceneObjectSerializer
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
+ private static IUserManagement m_UserManagement;
///
/// Deserialize a scene object from the original xml format
@@ -270,6 +273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region SOPXmlProcessors initialization
m_SOPXmlProcessors.Add("AllowedDrop", ProcessAllowedDrop);
m_SOPXmlProcessors.Add("CreatorID", ProcessCreatorID);
+ m_SOPXmlProcessors.Add("CreatorData", ProcessCreatorData);
m_SOPXmlProcessors.Add("FolderID", ProcessFolderID);
m_SOPXmlProcessors.Add("InventorySerial", ProcessInventorySerial);
m_SOPXmlProcessors.Add("TaskInventory", ProcessTaskInventory);
@@ -412,6 +416,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
obj.CreatorID = ReadUUID(reader, "CreatorID");
}
+ private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
+ {
+ obj.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
+ }
+
private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
{
obj.FolderID = ReadUUID(reader, "FolderID");
@@ -1077,7 +1086,19 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower());
+
WriteUUID(writer, "CreatorID", sop.CreatorID, options);
+
+ if (sop.CreatorData != null && sop.CreatorData != string.Empty)
+ writer.WriteElementString("CreatorData", sop.CreatorData);
+ else if (options.ContainsKey("profile"))
+ {
+ if (m_UserManagement == null)
+ m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface();
+ string name = m_UserManagement.GetUserName(sop.CreatorID);
+ writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + sop.CreatorID + ";" + name);
+ }
+
WriteUUID(writer, "FolderID", sop.FolderID, options);
writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());
--
cgit v1.1
From c617d658dda92ad97de678d477a98c3df0659303 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Sun, 21 Nov 2010 17:19:24 -0800
Subject: Added creator info across the board -- TaskInventoryItems and
InventoryItems themselves. Tested. Seems to be working, main tests pass.
Nothing done for IARs or HG transfers yet -- this only works for OARs for the
time being. New migration in inventory table in order to make CreatorID
varchar(255).
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 20 ++++++++++++-------
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 7 ++++++-
.../Scenes/Serialization/SceneObjectSerializer.cs | 23 ++++++++++++++++++++--
3 files changed, 40 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 4cc797b..a29b7f1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -426,6 +426,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase itemCopy = new InventoryItemBase();
itemCopy.Owner = recipient;
itemCopy.CreatorId = item.CreatorId;
+ itemCopy.CreatorData = item.CreatorData;
itemCopy.ID = UUID.Random();
itemCopy.AssetID = item.AssetID;
itemCopy.Description = item.Description;
@@ -699,13 +700,13 @@ namespace OpenSim.Region.Framework.Scenes
if (remoteClient.AgentId == oldAgentID)
{
CreateNewInventoryItem(
- remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
+ remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
else
{
CreateNewInventoryItem(
- remoteClient, item.CreatorId, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
+ remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
}
}
@@ -755,11 +756,11 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID,
+ private void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID,
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
{
CreateNewInventoryItem(
- remoteClient, creatorID, folderID, name, flags, callbackID, asset, invType,
+ remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
}
@@ -774,12 +775,13 @@ namespace OpenSim.Region.Framework.Scenes
///
///
private void CreateNewInventoryItem(
- IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
+ IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{
InventoryItemBase item = new InventoryItemBase();
item.Owner = remoteClient.AgentId;
item.CreatorId = creatorID;
+ item.CreatorData = creatorData;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
item.Description = asset.Description;
@@ -859,7 +861,7 @@ namespace OpenSim.Region.Framework.Scenes
AssetBase asset = CreateAsset(name, description, assetType, data, remoteClient.AgentId);
AssetService.Store(asset);
- CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
+ CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
}
else
{
@@ -901,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes
asset.Description = description;
CreateNewInventoryItem(
- remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType,
+ remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
}
@@ -1025,6 +1027,7 @@ namespace OpenSim.Region.Framework.Scenes
agentItem.ID = UUID.Random();
agentItem.CreatorId = taskItem.CreatorID.ToString();
+ agentItem.CreatorData = taskItem.CreatorData;
agentItem.Owner = destAgent;
agentItem.AssetID = taskItem.AssetID;
agentItem.Description = taskItem.Description;
@@ -1226,6 +1229,7 @@ namespace OpenSim.Region.Framework.Scenes
destTaskItem.ItemID = UUID.Random();
destTaskItem.CreatorID = srcTaskItem.CreatorID;
+ destTaskItem.CreatorData = srcTaskItem.CreatorData;
destTaskItem.AssetID = srcTaskItem.AssetID;
destTaskItem.GroupID = destPart.GroupID;
destTaskItem.OwnerID = destPart.OwnerID;
@@ -1638,6 +1642,7 @@ namespace OpenSim.Region.Framework.Scenes
destTaskItem.ItemID = UUID.Random();
destTaskItem.CreatorID = srcTaskItem.CreatorID;
+ destTaskItem.CreatorData = srcTaskItem.CreatorData;
destTaskItem.AssetID = srcTaskItem.AssetID;
destTaskItem.GroupID = destPart.GroupID;
destTaskItem.OwnerID = destPart.OwnerID;
@@ -1844,6 +1849,7 @@ namespace OpenSim.Region.Framework.Scenes
InventoryItemBase item = new InventoryItemBase();
item.CreatorId = grp.RootPart.CreatorID.ToString();
+ item.CreatorData = grp.RootPart.CreatorData;
item.Owner = remoteClient.AgentId;
item.ID = UUID.Random();
item.AssetID = asset.FullID;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6d5a53a..2155e26 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -449,12 +449,17 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public string CreatorData
+ public string CreatorData // = ;
{
get { return m_creatorData; }
set { m_creatorData = value; }
}
+ ///
+ /// Used by the DB layer to retrieve / store the entire user identification.
+ /// The identification can either be a simple UUID or a string of the form
+ /// uuid[;profile_url[;name]]
+ ///
public string CreatorIdentification
{
get
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index fceeafa..9cf5a39 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -331,6 +331,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_TaskInventoryXmlProcessors.Add("BasePermissions", ProcessTIBasePermissions);
m_TaskInventoryXmlProcessors.Add("CreationDate", ProcessTICreationDate);
m_TaskInventoryXmlProcessors.Add("CreatorID", ProcessTICreatorID);
+ m_TaskInventoryXmlProcessors.Add("CreatorData", ProcessTICreatorData);
m_TaskInventoryXmlProcessors.Add("Description", ProcessTIDescription);
m_TaskInventoryXmlProcessors.Add("EveryonePermissions", ProcessTIEveryonePermissions);
m_TaskInventoryXmlProcessors.Add("Flags", ProcessTIFlags);
@@ -707,6 +708,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
item.CreatorID = ReadUUID(reader, "CreatorID");
}
+ private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
+ {
+ item.CreatorData = reader.ReadElementContentAsString("CreatorData", String.Empty);
+ }
+
private static void ProcessTIDescription(TaskInventoryItem item, XmlTextReader reader)
{
item.Description = reader.ReadElementContentAsString("Description", String.Empty);
@@ -1102,7 +1108,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteUUID(writer, "FolderID", sop.FolderID, options);
writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());
- WriteTaskInventory(writer, sop.TaskInventory, options);
+ WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene);
WriteUUID(writer, "UUID", sop.UUID, options);
writer.WriteElementString("LocalId", sop.LocalId.ToString());
@@ -1226,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString(name, flagsStr);
}
- static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options)
+ static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene)
{
if (tinv.Count > 0) // otherwise skip this
{
@@ -1239,7 +1245,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteUUID(writer, "AssetID", item.AssetID, options);
writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
writer.WriteElementString("CreationDate", item.CreationDate.ToString());
+
+
WriteUUID(writer, "CreatorID", item.CreatorID, options);
+
+ if (item.CreatorData != null && item.CreatorData != string.Empty)
+ writer.WriteElementString("CreatorData", item.CreatorData);
+ else if (options.ContainsKey("profile"))
+ {
+ if (m_UserManagement == null)
+ m_UserManagement = scene.RequestModuleInterface();
+ string name = m_UserManagement.GetUserName(item.CreatorID);
+ writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + item.CreatorID + ";" + name);
+ }
+
writer.WriteElementString("Description", item.Description);
writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
writer.WriteElementString("Flags", item.Flags.ToString());
--
cgit v1.1