aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorMelanie2009-11-26 17:03:09 +0000
committerMelanie2009-11-26 17:03:09 +0000
commit9d63f90467dbc60622a49f564a56fdd20de90f51 (patch)
tree277a246a036dfe70204d10f0d86140b2e8a3b901 /OpenSim/Region/ScriptEngine
parentRemove the old remoting-type interregion code for prim/script crossing (diff)
downloadopensim-SC_OLD-9d63f90467dbc60622a49f564a56fdd20de90f51.zip
opensim-SC_OLD-9d63f90467dbc60622a49f564a56fdd20de90f51.tar.gz
opensim-SC_OLD-9d63f90467dbc60622a49f564a56fdd20de90f51.tar.bz2
opensim-SC_OLD-9d63f90467dbc60622a49f564a56fdd20de90f51.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs5
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs124
3 files changed, 116 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f49aea8..ae148a9 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -96,7 +96,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
96 UUID GetDetectID(int idx); 96 UUID GetDetectID(int idx);
97 void SaveState(string assembly); 97 void SaveState(string assembly);
98 void DestroyScriptInstance(); 98 void DestroyScriptInstance();
99 bool CanBeDeleted();
100 99
101 IScriptApi GetApi(string name); 100 IScriptApi GetApi(string name);
102 101
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 41b5d49..5c5d57e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -1011,10 +1011,5 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1011 { 1011 {
1012 get { return m_RegionID; } 1012 get { return m_RegionID; }
1013 } 1013 }
1014
1015 public bool CanBeDeleted()
1016 {
1017 return true;
1018 }
1019 } 1014 }
1020} 1015}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 0a9af2c..b099177 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1325,6 +1325,19 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1325 } 1325 }
1326 } 1326 }
1327 1327
1328 string map = String.Empty;
1329
1330 if (File.Exists(fn + ".map"))
1331 {
1332 FileStream mfs = File.Open(fn + ".map", FileMode.Open, FileAccess.Read);
1333 StreamReader msr = new StreamReader(mfs);
1334
1335 map = msr.ReadToEnd();
1336
1337 msr.Close();
1338 mfs.Close();
1339 }
1340
1328 XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); 1341 XmlElement assemblyData = doc.CreateElement("", "Assembly", "");
1329 XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); 1342 XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", "");
1330 1343
@@ -1335,21 +1348,116 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1335 1348
1336 stateData.AppendChild(assemblyData); 1349 stateData.AppendChild(assemblyData);
1337 1350
1338 return doc.InnerXml; 1351 XmlElement mapData = doc.CreateElement("", "LineMap", "");
1339 } 1352 XmlAttribute mapName = doc.CreateAttribute("", "Filename", "");
1340 1353
1341 public bool CanBeDeleted(UUID itemID) 1354 mapName.Value = fn + ".map";
1342 { 1355 mapData.Attributes.Append(mapName);
1343 IScriptInstance instance = GetInstance(itemID);
1344 if (instance == null)
1345 return true;
1346 1356
1347 return instance.CanBeDeleted(); 1357 mapData.InnerText = map;
1358
1359 stateData.AppendChild(mapData);
1360 return doc.InnerXml;
1348 } 1361 }
1349 1362
1350 private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) 1363 private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled)
1351 { 1364 {
1352 return false; 1365 return false;
1353 } 1366 }
1367
1368 public void SetXMLState(UUID itemID, string xml)
1369 {
1370 if (xml == String.Empty)
1371 return;
1372
1373 XmlDocument doc = new XmlDocument();
1374
1375 try
1376 {
1377 doc.LoadXml(xml);
1378 }
1379 catch (Exception)
1380 {
1381 m_log.Error("[XEngine]: Exception decoding XML data from region transfer");
1382 return;
1383 }
1384
1385 XmlNodeList rootL = doc.GetElementsByTagName("State");
1386 if (rootL.Count < 1)
1387 return;
1388
1389 XmlElement rootE = (XmlElement)rootL[0];
1390
1391 if (rootE.GetAttribute("UUID") != itemID.ToString())
1392 return;
1393
1394 string assetID = rootE.GetAttribute("Asset");
1395
1396 XmlNodeList stateL = rootE.GetElementsByTagName("ScriptState");
1397
1398 if (stateL.Count != 1)
1399 return;
1400
1401 XmlElement stateE = (XmlElement)stateL[0];
1402
1403 if (World.m_trustBinaries)
1404 {
1405 XmlNodeList assemL = rootE.GetElementsByTagName("Assembly");
1406
1407 if (assemL.Count != 1)
1408 return;
1409
1410 XmlElement assemE = (XmlElement)assemL[0];
1411
1412 string fn = assemE.GetAttribute("Filename");
1413 string base64 = assemE.InnerText;
1414
1415 string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1416 path = Path.Combine(path, fn);
1417
1418 if (!File.Exists(path))
1419 {
1420 Byte[] filedata = Convert.FromBase64String(base64);
1421
1422 FileStream fs = File.Create(path);
1423 fs.Write(filedata, 0, filedata.Length);
1424 fs.Close();
1425
1426 fs = File.Create(path + ".text");
1427 StreamWriter sw = new StreamWriter(fs);
1428
1429 sw.Write(base64);
1430
1431 sw.Close();
1432 fs.Close();
1433 }
1434 }
1435
1436 string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1437 statepath = Path.Combine(statepath, itemID.ToString() + ".state");
1438
1439 FileStream sfs = File.Create(statepath);
1440 StreamWriter ssw = new StreamWriter(sfs);
1441
1442 ssw.Write(stateE.OuterXml);
1443
1444 ssw.Close();
1445 sfs.Close();
1446
1447 XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
1448
1449 XmlElement mapE = (XmlElement)mapL[0];
1450
1451 string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString());
1452 mappath = Path.Combine(mappath, mapE.GetAttribute("Filename"));
1453
1454 FileStream mfs = File.Create(mappath);
1455 StreamWriter msw = new StreamWriter(sfs);
1456
1457 msw.Write(mapE.InnerText);
1458
1459 msw.Close();
1460 mfs.Close();
1461 }
1354 } 1462 }
1355} 1463}