mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
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.
This commit is contained in:
@@ -1325,6 +1325,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
}
|
||||
}
|
||||
|
||||
string map = String.Empty;
|
||||
|
||||
if (File.Exists(fn + ".map"))
|
||||
{
|
||||
FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
|
||||
StreamReader msr = new StreamReader(mfs);
|
||||
|
||||
map = msr.ReadToEnd();
|
||||
|
||||
msr.Close();
|
||||
mfs.Close();
|
||||
}
|
||||
|
||||
XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
|
||||
XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
|
||||
|
||||
@@ -1335,21 +1348,116 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||
|
||||
stateData.AppendChild(assemblyData);
|
||||
|
||||
XmlElement mapData = doc.CreateElement("", "LineMap", "");
|
||||
XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
|
||||
|
||||
mapName.Value = fn + ".map";
|
||||
mapData.Attributes.Append(mapName);
|
||||
|
||||
mapData.InnerText = map;
|
||||
|
||||
stateData.AppendChild(mapData);
|
||||
return doc.InnerXml;
|
||||
}
|
||||
|
||||
public bool CanBeDeleted(UUID itemID)
|
||||
{
|
||||
IScriptInstance instance = GetInstance(itemID);
|
||||
if (instance == null)
|
||||
return true;
|
||||
|
||||
return instance.CanBeDeleted();
|
||||
}
|
||||
|
||||
private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetXMLState(UUID itemID, string xml)
|
||||
{
|
||||
if (xml == String.Empty)
|
||||
return;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
|
||||
try
|
||||
{
|
||||
doc.LoadXml(xml);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
|
||||
return;
|
||||
}
|
||||
|
||||
XmlNodeList rootL = doc.GetElementsByTagName("State");
|
||||
if (rootL.Count < 1)
|
||||
return;
|
||||
|
||||
XmlElement rootE = (XmlElement)rootL[0];
|
||||
|
||||
if (rootE.GetAttribute("UUID") != itemID.ToString())
|
||||
return;
|
||||
|
||||
string assetID = rootE.GetAttribute("Asset");
|
||||
|
||||
XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
|
||||
|
||||
if (stateL.Count != 1)
|
||||
return;
|
||||
|
||||
XmlElement stateE = (XmlElement)stateL[0];
|
||||
|
||||
if (World.m_trustBinaries)
|
||||
{
|
||||
XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
|
||||
|
||||
if (assemL.Count != 1)
|
||||
return;
|
||||
|
||||
XmlElement assemE = (XmlElement)assemL[0];
|
||||
|
||||
string fn = assemE.GetAttribute("Filename");
|
||||
string base64 = assemE.InnerText;
|
||||
|
||||
string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||
path = Path.Combine(path, fn);
|
||||
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
Byte[] filedata = Convert.FromBase64String(base64);
|
||||
|
||||
FileStream fs = File.Create(path);
|
||||
fs.Write(filedata, 0, filedata.Length);
|
||||
fs.Close();
|
||||
|
||||
fs = File.Create(path + ".text");
|
||||
StreamWriter sw = new StreamWriter(fs);
|
||||
|
||||
sw.Write(base64);
|
||||
|
||||
sw.Close();
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||
statepath = Path.Combine(statepath, itemID.ToString() + ".state");
|
||||
|
||||
FileStream sfs = File.Create(statepath);
|
||||
StreamWriter ssw = new StreamWriter(sfs);
|
||||
|
||||
ssw.Write(stateE.OuterXml);
|
||||
|
||||
ssw.Close();
|
||||
sfs.Close();
|
||||
|
||||
XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
|
||||
|
||||
XmlElement mapE = (XmlElement)mapL[0];
|
||||
|
||||
string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
|
||||
mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
|
||||
|
||||
FileStream mfs = File.Create(mappath);
|
||||
StreamWriter msw = new StreamWriter(sfs);
|
||||
|
||||
msw.Write(mapE.InnerText);
|
||||
|
||||
msw.Close();
|
||||
mfs.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user