aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
diff options
context:
space:
mode:
authorMelanie2009-11-26 17:03:09 +0000
committerMelanie2009-11-26 17:03:09 +0000
commit9d63f90467dbc60622a49f564a56fdd20de90f51 (patch)
tree277a246a036dfe70204d10f0d86140b2e8a3b901 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
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/Framework/Scenes/SceneObjectGroup.Inventory.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs99
1 files changed, 35 insertions, 64 deletions
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
351 return xmldoc.InnerXml; 351 return xmldoc.InnerXml;
352 } 352 }
353 353
354 public void SetState(string objXMLData, UUID RegionID) 354 public void SetState(string objXMLData, IScene ins)
355 { 355 {
356m_log.Debug("SetState called with " + objXMLData); 356 if (!(ins is Scene))
357 return;
358
359 Scene s = (Scene)ins;
360
357 if (objXMLData == String.Empty) 361 if (objXMLData == String.Empty)
358 return; 362 return;
359 363
364 IScriptModule scriptModule = null;
365
366 foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
367 {
368 if (sm.ScriptEngineName == s.DefaultScriptEngine)
369 scriptModule = sm;
370 else if (scriptModule == null)
371 scriptModule = sm;
372 }
373
374 if (scriptModule == null)
375 return;
376
360 XmlDocument doc = new XmlDocument(); 377 XmlDocument doc = new XmlDocument();
361 try 378 try
362 { 379 {
@@ -374,69 +391,23 @@ m_log.Debug("SetState called with " + objXMLData);
374 } 391 }
375 392
376 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); 393 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
377 if (rootL.Count == 1) 394 if (rootL.Count != 1)
395 return;
396
397 XmlElement rootE = (XmlElement)rootL[0];
398
399 XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
400 if (dataL.Count != 1)
401 return;
402
403 XmlElement dataE = (XmlElement)dataL[0];
404
405 foreach (XmlNode n in dataE.ChildNodes)
378 { 406 {
379 XmlNode rootNode = rootL[0]; 407 XmlElement stateE = (XmlElement)n;
380 if (rootNode != null) 408 UUID itemID = new UUID(stateE.GetAttribute("UUID"));
381 { 409
382 XmlNodeList partL = rootNode.ChildNodes; 410 scriptModule.SetXMLState(itemID, n.OuterXml);
383
384 foreach (XmlNode part in partL)
385 {
386 XmlNodeList nodeL = part.ChildNodes;
387
388 switch (part.Name)
389 {
390 case "Assemblies":
391 foreach (XmlNode asm in nodeL)
392 {
393 string fn = asm.Attributes.GetNamedItem("Filename").Value;
394
395 Byte[] filedata = Convert.FromBase64String(asm.InnerText);
396 string path = Path.Combine("ScriptEngines", RegionID.ToString());
397 path = Path.Combine(path, fn);
398
399 if (!File.Exists(path))
400 {
401 FileStream fs = File.Create(path);
402 fs.Write(filedata, 0, filedata.Length);
403 fs.Close();
404
405 Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
406 fs = File.Create(path+".text");
407 fs.Write(textbytes, 0, textbytes.Length);
408 fs.Close();
409 }
410 }
411 break;
412 case "ScriptStates":
413 foreach (XmlNode st in nodeL)
414 {
415 string id = st.Attributes.GetNamedItem("UUID").Value;
416 UUID uuid = new UUID(id);
417 XmlNode state = st.ChildNodes[0];
418
419 XmlDocument sdoc = new XmlDocument();
420 XmlNode sxmlnode = sdoc.CreateNode(
421 XmlNodeType.XmlDeclaration,
422 "", "");
423 sdoc.AppendChild(sxmlnode);
424
425 XmlNode newnode = sdoc.ImportNode(state, true);
426 sdoc.AppendChild(newnode);
427
428 string spath = Path.Combine("ScriptEngines", RegionID.ToString());
429 spath = Path.Combine(spath, uuid.ToString());
430 FileStream sfs = File.Create(spath + ".state");
431 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
432 Byte[] buf = enc.GetBytes(sdoc.InnerXml);
433 sfs.Write(buf, 0, buf.Length);
434 sfs.Close();
435 }
436 break;
437 }
438 }
439 }
440 } 411 }
441 } 412 }
442 } 413 }