From 9d63f90467dbc60622a49f564a56fdd20de90f51 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Thu, 26 Nov 2009 17:03:09 +0000
Subject: Remove the old (Remoting) region crossing code. Fix the new code to
pass script state and assembly again properly. Reintroduce respecting tht
TrustBinaries flag. Changes the interregion protocol! No version bump because
it was broken anyway, so with a version mismatch it will simply stay broken,
but not crash. Region corssing still doesn't work because there is still
monkey business with both rezzed prims being pushed across a border and
attached prims when walking across a border. Teleport is untested by may
work.
---
.../Framework/Interfaces/IEntityInventory.cs | 2 -
.../Region/Framework/Interfaces/IScriptModule.cs | 2 +-
.../Scenes/AsyncSceneObjectGroupDeleter.cs | 5 --
OpenSim/Region/Framework/Scenes/Scene.cs | 2 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 99 ++++++++--------------
.../Region/Framework/Scenes/SceneObjectGroup.cs | 11 ---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 --
.../Framework/Scenes/SceneObjectPartInventory.cs | 25 ------
8 files changed, 37 insertions(+), 114 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2998f45..89a45da 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -191,7 +191,5 @@ namespace OpenSim.Region.Framework.Interfaces
/// A
///
Dictionary GetScriptStates();
-
- bool CanBeDeleted();
}
}
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 72bb0f0..f11e571 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
string ScriptEngineName { get; }
string GetXMLState(UUID itemID);
- bool CanBeDeleted(UUID itemID);
+ void SetXMLState(UUID itemID, string xml);
bool PostScriptEvent(UUID itemID, string name, Object[] args);
bool PostObjectEvent(UUID itemID, string name, Object[] args);
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5b571c7..9a7863b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
if (left > 0)
{
x = m_inventoryDeletes.Dequeue();
- if (!x.objectGroup.CanBeDeleted())
- {
- m_inventoryDeletes.Enqueue(x);
- return true;
- }
m_log.DebugFormat(
"[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0ee818d..eb8567f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes
startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
m_persistAfter *= 10000000;
- m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
+ m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
IConfig packetConfig = m_config.Configs["PacketPool"];
if (packetConfig != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 9a6f2b8..5a06bdb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -351,12 +351,29 @@ namespace OpenSim.Region.Framework.Scenes
return xmldoc.InnerXml;
}
- public void SetState(string objXMLData, UUID RegionID)
+ public void SetState(string objXMLData, IScene ins)
{
-m_log.Debug("SetState called with " + objXMLData);
+ if (!(ins is Scene))
+ return;
+
+ Scene s = (Scene)ins;
+
if (objXMLData == String.Empty)
return;
+ IScriptModule scriptModule = null;
+
+ foreach (IScriptModule sm in s.RequestModuleInterfaces())
+ {
+ if (sm.ScriptEngineName == s.DefaultScriptEngine)
+ scriptModule = sm;
+ else if (scriptModule == null)
+ scriptModule = sm;
+ }
+
+ if (scriptModule == null)
+ return;
+
XmlDocument doc = new XmlDocument();
try
{
@@ -374,69 +391,23 @@ m_log.Debug("SetState called with " + objXMLData);
}
XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
- if (rootL.Count == 1)
+ if (rootL.Count != 1)
+ return;
+
+ XmlElement rootE = (XmlElement)rootL[0];
+
+ XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
+ if (dataL.Count != 1)
+ return;
+
+ XmlElement dataE = (XmlElement)dataL[0];
+
+ foreach (XmlNode n in dataE.ChildNodes)
{
- XmlNode rootNode = rootL[0];
- if (rootNode != null)
- {
- XmlNodeList partL = rootNode.ChildNodes;
-
- foreach (XmlNode part in partL)
- {
- XmlNodeList nodeL = part.ChildNodes;
-
- switch (part.Name)
- {
- case "Assemblies":
- foreach (XmlNode asm in nodeL)
- {
- string fn = asm.Attributes.GetNamedItem("Filename").Value;
-
- Byte[] filedata = Convert.FromBase64String(asm.InnerText);
- string path = Path.Combine("ScriptEngines", RegionID.ToString());
- path = Path.Combine(path, fn);
-
- if (!File.Exists(path))
- {
- FileStream fs = File.Create(path);
- fs.Write(filedata, 0, filedata.Length);
- fs.Close();
-
- Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
- fs = File.Create(path+".text");
- fs.Write(textbytes, 0, textbytes.Length);
- fs.Close();
- }
- }
- break;
- case "ScriptStates":
- foreach (XmlNode st in nodeL)
- {
- string id = st.Attributes.GetNamedItem("UUID").Value;
- UUID uuid = new UUID(id);
- XmlNode state = st.ChildNodes[0];
-
- XmlDocument sdoc = new XmlDocument();
- XmlNode sxmlnode = sdoc.CreateNode(
- XmlNodeType.XmlDeclaration,
- "", "");
- sdoc.AppendChild(sxmlnode);
-
- XmlNode newnode = sdoc.ImportNode(state, true);
- sdoc.AppendChild(newnode);
-
- string spath = Path.Combine("ScriptEngines", RegionID.ToString());
- spath = Path.Combine(spath, uuid.ToString());
- FileStream sfs = File.Create(spath + ".state");
- System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
- Byte[] buf = enc.GetBytes(sdoc.InnerXml);
- sfs.Write(buf, 0, buf.Length);
- sfs.Close();
- }
- break;
- }
- }
- }
+ XmlElement stateE = (XmlElement)n;
+ UUID itemID = new UUID(stateE.GetAttribute("UUID"));
+
+ scriptModule.SetXMLState(itemID, n.OuterXml);
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bcc9b37..6ec2a01 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3341,17 +3341,6 @@ namespace OpenSim.Region.Framework.Scenes
}
#endregion
- public bool CanBeDeleted()
- {
- foreach (SceneObjectPart part in Children.Values)
- {
- if (!part.CanBeDeleted())
- return false;
- }
-
- return true;
- }
-
public double GetUpdatePriority(IClientAPI client)
{
switch (Scene.UpdatePrioritizationScheme)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6f1b458..b6916f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ApplyNextOwnerPermissions();
}
-
- public bool CanBeDeleted()
- {
- return Inventory.CanBeDeleted();
- }
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7f49ced..7a0d7b7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -886,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
}
return ret;
}
-
- public bool CanBeDeleted()
- {
- if (!ContainsScripts())
- return true;
-
- IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces();
-
- if (engines == null) // No engine at all
- return true;
-
- foreach (TaskInventoryItem item in m_items.Values)
- {
- if (item.InvType == (int)InventoryType.LSL)
- {
- foreach (IScriptModule e in engines)
- {
- if (!e.CanBeDeleted(item.ItemID))
- return false;
- }
- }
- }
-
- return true;
- }
}
}
--
cgit v1.1