diff options
author | Justin Clark-Casey (justincc) | 2009-11-26 19:02:41 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-11-26 19:02:41 +0000 |
commit | 377bc27c1fdab6f45135194a53ba17cce1f3388f (patch) | |
tree | 51e2bbc45c30dfceed0311452ad9b30532d7bd13 /OpenSim | |
parent | Bump trunk version number to 0.6.9. (diff) | |
parent | Fix a small bug. Trusted script crossings now work again (diff) | |
download | opensim-SC-377bc27c1fdab6f45135194a53ba17cce1f3388f.zip opensim-SC-377bc27c1fdab6f45135194a53ba17cce1f3388f.tar.gz opensim-SC-377bc27c1fdab6f45135194a53ba17cce1f3388f.tar.bz2 opensim-SC-377bc27c1fdab6f45135194a53ba17cce1f3388f.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to '')
17 files changed, 249 insertions, 468 deletions
diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs index 307c6bc..cd59c63 100644 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ b/OpenSim/Framework/IRegionCommsListener.cs | |||
@@ -32,7 +32,6 @@ namespace OpenSim.Framework | |||
32 | { | 32 | { |
33 | public delegate void ExpectUserDelegate(AgentCircuitData agent); | 33 | public delegate void ExpectUserDelegate(AgentCircuitData agent); |
34 | 34 | ||
35 | public delegate bool ExpectPrimDelegate(UUID primID, string objData, int XMLMethod); | ||
36 | 35 | ||
37 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); | 36 | public delegate void UpdateNeighbours(List<RegionInfo> neighbours); |
38 | 37 | ||
@@ -55,7 +54,6 @@ namespace OpenSim.Framework | |||
55 | public interface IRegionCommsListener | 54 | public interface IRegionCommsListener |
56 | { | 55 | { |
57 | event ExpectUserDelegate OnExpectUser; | 56 | event ExpectUserDelegate OnExpectUser; |
58 | event ExpectPrimDelegate OnExpectPrim; | ||
59 | event GenericCall2 OnExpectChildAgent; | 57 | event GenericCall2 OnExpectChildAgent; |
60 | event AgentCrossing OnAvatarCrossingIntoRegion; | 58 | event AgentCrossing OnAvatarCrossingIntoRegion; |
61 | event PrimCrossing OnPrimCrossingIntoRegion; | 59 | event PrimCrossing OnPrimCrossingIntoRegion; |
diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index 4fc3e01..5147901 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs | |||
@@ -38,6 +38,6 @@ namespace OpenSim.Framework | |||
38 | string ExtraToXmlString(); | 38 | string ExtraToXmlString(); |
39 | void ExtraFromXmlString(string xmlstr); | 39 | void ExtraFromXmlString(string xmlstr); |
40 | string GetStateSnapshot(); | 40 | string GetStateSnapshot(); |
41 | void SetState(string xmlstr, UUID regionID); | 41 | void SetState(string xmlstr, IScene s); |
42 | } | 42 | } |
43 | } | 43 | } |
diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs index 90200d6..718a556 100644 --- a/OpenSim/Framework/RegionCommsListener.cs +++ b/OpenSim/Framework/RegionCommsListener.cs | |||
@@ -43,7 +43,6 @@ namespace OpenSim.Framework | |||
43 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | 43 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; |
44 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; | 44 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; |
45 | private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; | 45 | private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; |
46 | private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; | ||
47 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser | 46 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser |
48 | private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; | 47 | private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; |
49 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; | 48 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; |
@@ -53,7 +52,6 @@ namespace OpenSim.Framework | |||
53 | #region IRegionCommsListener Members | 52 | #region IRegionCommsListener Members |
54 | 53 | ||
55 | public event ExpectUserDelegate OnExpectUser; | 54 | public event ExpectUserDelegate OnExpectUser; |
56 | public event ExpectPrimDelegate OnExpectPrim; | ||
57 | public event GenericCall2 OnExpectChildAgent; | 55 | public event GenericCall2 OnExpectChildAgent; |
58 | public event AgentCrossing OnAvatarCrossingIntoRegion; | 56 | public event AgentCrossing OnAvatarCrossingIntoRegion; |
59 | public event PrimCrossing OnPrimCrossingIntoRegion; | 57 | public event PrimCrossing OnPrimCrossingIntoRegion; |
@@ -95,17 +93,6 @@ namespace OpenSim.Framework | |||
95 | 93 | ||
96 | } | 94 | } |
97 | 95 | ||
98 | public virtual bool TriggerExpectPrim(UUID primID, string objData, int XMLMethod) | ||
99 | { | ||
100 | handlerExpectPrim = OnExpectPrim; | ||
101 | if (handlerExpectPrim != null) | ||
102 | { | ||
103 | handlerExpectPrim(primID, objData, XMLMethod); | ||
104 | return true; | ||
105 | } | ||
106 | return false; | ||
107 | } | ||
108 | |||
109 | public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) | 96 | public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) |
110 | { | 97 | { |
111 | handlerChildAgentUpdate = OnChildAgentUpdate; | 98 | handlerChildAgentUpdate = OnChildAgentUpdate; |
@@ -128,18 +115,6 @@ namespace OpenSim.Framework | |||
128 | return false; | 115 | return false; |
129 | } | 116 | } |
130 | 117 | ||
131 | public virtual bool TriggerExpectPrimCrossing(UUID primID, Vector3 position, | ||
132 | bool isPhysical) | ||
133 | { | ||
134 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; | ||
135 | if (handlerPrimCrossingIntoRegion != null) | ||
136 | { | ||
137 | handlerPrimCrossingIntoRegion(primID, position, isPhysical); | ||
138 | return true; | ||
139 | } | ||
140 | return false; | ||
141 | } | ||
142 | |||
143 | public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) | 118 | public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) |
144 | { | 119 | { |
145 | handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; | 120 | handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index ee809bd..d9f6e33 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs | |||
@@ -263,8 +263,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
263 | { | 263 | { |
264 | // We need to make a local copy of the object | 264 | // We need to make a local copy of the object |
265 | ISceneObject sogClone = sog.CloneForNewScene(); | 265 | ISceneObject sogClone = sog.CloneForNewScene(); |
266 | sogClone.SetState(sog.GetStateSnapshot(), | 266 | sogClone.SetState(sog.GetStateSnapshot(), s); |
267 | s.RegionInfo.RegionID); | ||
268 | return s.IncomingCreateObject(sogClone); | 267 | return s.IncomingCreateObject(sogClone); |
269 | } | 268 | } |
270 | else | 269 | else |
@@ -294,15 +293,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
294 | 293 | ||
295 | #region Misc | 294 | #region Misc |
296 | 295 | ||
297 | public UUID GetRegionID(ulong regionhandle) | 296 | public Scene GetScene(ulong regionhandle) |
298 | { | 297 | { |
299 | foreach (Scene s in m_sceneList) | 298 | foreach (Scene s in m_sceneList) |
300 | { | 299 | { |
301 | if (s.RegionInfo.RegionHandle == regionhandle) | 300 | if (s.RegionInfo.RegionHandle == regionhandle) |
302 | return s.RegionInfo.RegionID; | 301 | return s; |
303 | } | 302 | } |
304 | // ? weird. should not happen | 303 | // ? weird. should not happen |
305 | return m_sceneList[0].RegionInfo.RegionID; | 304 | return m_sceneList[0]; |
306 | } | 305 | } |
307 | 306 | ||
308 | public bool IsLocalRegion(ulong regionhandle) | 307 | public bool IsLocalRegion(ulong regionhandle) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index 696225c..710e3ca 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs | |||
@@ -641,7 +641,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
641 | if (args["extra"] != null) | 641 | if (args["extra"] != null) |
642 | extraStr = args["extra"].AsString(); | 642 | extraStr = args["extra"].AsString(); |
643 | 643 | ||
644 | UUID regionID = m_localBackend.GetRegionID(regionhandle); | 644 | IScene s = m_localBackend.GetScene(regionhandle); |
645 | SceneObjectGroup sog = null; | 645 | SceneObjectGroup sog = null; |
646 | try | 646 | try |
647 | { | 647 | { |
@@ -663,7 +663,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
663 | { | 663 | { |
664 | try | 664 | try |
665 | { | 665 | { |
666 | sog.SetState(stateXmlStr, regionID); | 666 | sog.SetState(stateXmlStr, s); |
667 | } | 667 | } |
668 | catch (Exception ex) | 668 | catch (Exception ex) |
669 | { | 669 | { |
@@ -695,8 +695,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion | |||
695 | if (args["itemid"] != null) | 695 | if (args["itemid"] != null) |
696 | itemID = args["itemid"].AsUUID(); | 696 | itemID = args["itemid"].AsUUID(); |
697 | 697 | ||
698 | //UUID regionID = m_localBackend.GetRegionID(regionhandle); | ||
699 | |||
700 | // This is the meaning of PUT object | 698 | // This is the meaning of PUT object |
701 | bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID); | 699 | bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID); |
702 | 700 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2c906a2..89a45da 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -185,19 +185,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
185 | List<UUID> GetInventoryList(); | 185 | List<UUID> GetInventoryList(); |
186 | 186 | ||
187 | /// <summary> | 187 | /// <summary> |
188 | /// Get the names of the assemblies associated with scripts in this inventory. | ||
189 | /// </summary> | ||
190 | /// <returns></returns> | ||
191 | string[] GetScriptAssemblies(); | ||
192 | |||
193 | /// <summary> | ||
194 | /// Get the xml representing the saved states of scripts in this inventory. | 188 | /// Get the xml representing the saved states of scripts in this inventory. |
195 | /// </summary> | 189 | /// </summary> |
196 | /// <returns> | 190 | /// <returns> |
197 | /// A <see cref="Dictionary`2"/> | 191 | /// A <see cref="Dictionary`2"/> |
198 | /// </returns> | 192 | /// </returns> |
199 | Dictionary<UUID, string> GetScriptStates(); | 193 | Dictionary<UUID, string> GetScriptStates(); |
200 | |||
201 | bool CanBeDeleted(); | ||
202 | } | 194 | } |
203 | } | 195 | } |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index 10835b9..f11e571 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -34,9 +34,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
34 | { | 34 | { |
35 | string ScriptEngineName { get; } | 35 | string ScriptEngineName { get; } |
36 | 36 | ||
37 | string GetAssemblyName(UUID itemID); | ||
38 | string GetXMLState(UUID itemID); | 37 | string GetXMLState(UUID itemID); |
39 | bool CanBeDeleted(UUID itemID); | 38 | void SetXMLState(UUID itemID, string xml); |
40 | 39 | ||
41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 40 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 41 | 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 | |||
131 | if (left > 0) | 131 | if (left > 0) |
132 | { | 132 | { |
133 | x = m_inventoryDeletes.Dequeue(); | 133 | x = m_inventoryDeletes.Dequeue(); |
134 | if (!x.objectGroup.CanBeDeleted()) | ||
135 | { | ||
136 | m_inventoryDeletes.Enqueue(x); | ||
137 | return true; | ||
138 | } | ||
139 | 134 | ||
140 | m_log.DebugFormat( | 135 | m_log.DebugFormat( |
141 | "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); | 136 | "[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 f444e51..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 | |||
618 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); | 618 | startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); |
619 | m_persistAfter *= 10000000; | 619 | m_persistAfter *= 10000000; |
620 | 620 | ||
621 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); | 621 | m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine"); |
622 | 622 | ||
623 | IConfig packetConfig = m_config.Configs["PacketPool"]; | 623 | IConfig packetConfig = m_config.Configs["PacketPool"]; |
624 | if (packetConfig != null) | 624 | if (packetConfig != null) |
@@ -2381,103 +2381,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2381 | return successYN; | 2381 | return successYN; |
2382 | } | 2382 | } |
2383 | 2383 | ||
2384 | /// <summary> | ||
2385 | /// Handle a scene object that is crossing into this region from another. | ||
2386 | /// NOTE: Unused as of 2009-02-09. Soon to be deleted. | ||
2387 | /// </summary> | ||
2388 | /// <param name="regionHandle"></param> | ||
2389 | /// <param name="primID"></param> | ||
2390 | /// <param name="objXMLData"></param> | ||
2391 | /// <param name="XMLMethod"></param> | ||
2392 | /// <returns></returns> | ||
2393 | public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) | ||
2394 | { | ||
2395 | if (XMLMethod == 0) | ||
2396 | { | ||
2397 | m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); | ||
2398 | SceneObjectGroup sceneObject = m_serialiser.DeserializeGroupFromXml2(objXMLData); | ||
2399 | if (sceneObject.IsAttachment) | ||
2400 | sceneObject.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2401 | |||
2402 | return AddSceneObject(sceneObject); | ||
2403 | } | ||
2404 | else if ((XMLMethod == 100) && m_allowScriptCrossings) | ||
2405 | { | ||
2406 | m_log.Warn("[INTERREGION]: Prim state data arrived from a neighbor"); | ||
2407 | |||
2408 | XmlDocument doc = new XmlDocument(); | ||
2409 | doc.LoadXml(objXMLData); | ||
2410 | |||
2411 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); | ||
2412 | if (rootL.Count == 1) | ||
2413 | { | ||
2414 | XmlNode rootNode = rootL[0]; | ||
2415 | if (rootNode != null) | ||
2416 | { | ||
2417 | XmlNodeList partL = rootNode.ChildNodes; | ||
2418 | |||
2419 | foreach (XmlNode part in partL) | ||
2420 | { | ||
2421 | XmlNodeList nodeL = part.ChildNodes; | ||
2422 | |||
2423 | switch (part.Name) | ||
2424 | { | ||
2425 | case "Assemblies": | ||
2426 | foreach (XmlNode asm in nodeL) | ||
2427 | { | ||
2428 | string fn = asm.Attributes.GetNamedItem("Filename").Value; | ||
2429 | |||
2430 | Byte[] filedata = Convert.FromBase64String(asm.InnerText); | ||
2431 | string path = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2432 | path = Path.Combine(path, fn); | ||
2433 | |||
2434 | if (!File.Exists(path)) | ||
2435 | { | ||
2436 | FileStream fs = File.Create(path); | ||
2437 | fs.Write(filedata, 0, filedata.Length); | ||
2438 | fs.Close(); | ||
2439 | } | ||
2440 | } | ||
2441 | break; | ||
2442 | case "ScriptStates": | ||
2443 | foreach (XmlNode st in nodeL) | ||
2444 | { | ||
2445 | string id = st.Attributes.GetNamedItem("UUID").Value; | ||
2446 | UUID uuid = new UUID(id); | ||
2447 | XmlNode state = st.ChildNodes[0]; | ||
2448 | |||
2449 | XmlDocument sdoc = new XmlDocument(); | ||
2450 | XmlNode sxmlnode = sdoc.CreateNode( | ||
2451 | XmlNodeType.XmlDeclaration, | ||
2452 | "", ""); | ||
2453 | sdoc.AppendChild(sxmlnode); | ||
2454 | |||
2455 | XmlNode newnode = sdoc.ImportNode(state, true); | ||
2456 | sdoc.AppendChild(newnode); | ||
2457 | |||
2458 | string spath = Path.Combine("ScriptEngines", RegionInfo.RegionID.ToString()); | ||
2459 | spath = Path.Combine(spath, uuid.ToString()); | ||
2460 | FileStream sfs = File.Create(spath + ".state"); | ||
2461 | ASCIIEncoding enc = new ASCIIEncoding(); | ||
2462 | Byte[] buf = enc.GetBytes(sdoc.InnerXml); | ||
2463 | sfs.Write(buf, 0, buf.Length); | ||
2464 | sfs.Close(); | ||
2465 | } | ||
2466 | break; | ||
2467 | } | ||
2468 | } | ||
2469 | } | ||
2470 | } | ||
2471 | |||
2472 | SceneObjectPart RootPrim = GetSceneObjectPart(primID); | ||
2473 | RootPrim.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 1); | ||
2474 | |||
2475 | return true; | ||
2476 | } | ||
2477 | |||
2478 | return true; | ||
2479 | } | ||
2480 | |||
2481 | public bool IncomingCreateObject(ISceneObject sog) | 2384 | public bool IncomingCreateObject(ISceneObject sog) |
2482 | { | 2385 | { |
2483 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); | 2386 | //m_log.Debug(" >>> IncomingCreateObject <<< " + ((SceneObjectGroup)sog).AbsolutePosition + " deleted? " + ((SceneObjectGroup)sog).IsDeleted); |
@@ -3350,7 +3253,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3350 | m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; | 3253 | m_sceneGridService.OnCloseAgentConnection += IncomingCloseAgent; |
3351 | //m_eventManager.OnRegionUp += OtherRegionUp; | 3254 | //m_eventManager.OnRegionUp += OtherRegionUp; |
3352 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 3255 | //m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
3353 | m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup; | ||
3354 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; | 3256 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar += HandleRemoveKnownRegionsFromAvatar; |
3355 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; | 3257 | m_sceneGridService.OnLogOffUser += HandleLogOffUserFromGrid; |
3356 | m_sceneGridService.KiPrimitive += SendKillObject; | 3258 | m_sceneGridService.KiPrimitive += SendKillObject; |
@@ -3374,7 +3276,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | m_sceneGridService.KiPrimitive -= SendKillObject; | 3276 | m_sceneGridService.KiPrimitive -= SendKillObject; |
3375 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; | 3277 | m_sceneGridService.OnLogOffUser -= HandleLogOffUserFromGrid; |
3376 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; | 3278 | //m_sceneGridService.OnRemoveKnownRegionFromAvatar -= HandleRemoveKnownRegionsFromAvatar; |
3377 | m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup; | ||
3378 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; | 3279 | //m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; |
3379 | //m_eventManager.OnRegionUp -= OtherRegionUp; | 3280 | //m_eventManager.OnRegionUp -= OtherRegionUp; |
3380 | m_sceneGridService.OnExpectUser -= HandleNewUserConnection; | 3281 | m_sceneGridService.OnExpectUser -= HandleNewUserConnection; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 76c6cab..3892769 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -85,7 +85,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
85 | /// <summary> | 85 | /// <summary> |
86 | /// A Prim will arrive shortly | 86 | /// A Prim will arrive shortly |
87 | /// </summary> | 87 | /// </summary> |
88 | public event ExpectPrimDelegate OnExpectPrim; | ||
89 | public event CloseAgentConnection OnCloseAgentConnection; | 88 | public event CloseAgentConnection OnCloseAgentConnection; |
90 | 89 | ||
91 | /// <summary> | 90 | /// <summary> |
@@ -116,7 +115,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
116 | 115 | ||
117 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; | 116 | private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; |
118 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; | 117 | private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser; |
119 | private ExpectPrimDelegate handlerExpectPrim = null; // OnExpectPrim; | ||
120 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; | 118 | private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; |
121 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; | 119 | private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; |
122 | //private RegionUp handlerRegionUp = null; // OnRegionUp; | 120 | //private RegionUp handlerRegionUp = null; // OnRegionUp; |
@@ -147,30 +145,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
147 | /// <exception cref="System.Exception">Thrown if region registration fails.</exception> | 145 | /// <exception cref="System.Exception">Thrown if region registration fails.</exception> |
148 | public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) | 146 | public void RegisterRegion(IInterregionCommsOut comms_out, RegionInfo regionInfos) |
149 | { | 147 | { |
150 | //m_interregionCommsOut = comms_out; | ||
151 | |||
152 | //m_regionInfo = regionInfos; | ||
153 | //m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; | ||
154 | //regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); | ||
155 | |||
156 | //if (regionCommsHost != null) | ||
157 | //{ | ||
158 | // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); | ||
159 | |||
160 | // regionCommsHost.debugRegionName = regionInfos.RegionName; | ||
161 | // regionCommsHost.OnExpectPrim += IncomingPrimCrossing; | ||
162 | // regionCommsHost.OnExpectUser += NewUserConnection; | ||
163 | // regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; | ||
164 | // regionCommsHost.OnCloseAgentConnection += CloseConnection; | ||
165 | // regionCommsHost.OnRegionUp += newRegionUp; | ||
166 | // regionCommsHost.OnChildAgentUpdate += ChildAgentUpdate; | ||
167 | // regionCommsHost.OnLogOffUser += GridLogOffUser; | ||
168 | // regionCommsHost.OnGetLandData += FetchLandData; | ||
169 | //} | ||
170 | //else | ||
171 | //{ | ||
172 | // //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: registered with gridservice and got null"); | ||
173 | //} | ||
174 | } | 148 | } |
175 | 149 | ||
176 | /// <summary> | 150 | /// <summary> |
@@ -179,31 +153,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | /// </summary> | 153 | /// </summary> |
180 | public void Close() | 154 | public void Close() |
181 | { | 155 | { |
182 | |||
183 | //if (regionCommsHost != null) | ||
184 | //{ | ||
185 | // regionCommsHost.OnLogOffUser -= GridLogOffUser; | ||
186 | // regionCommsHost.OnChildAgentUpdate -= ChildAgentUpdate; | ||
187 | // regionCommsHost.OnRegionUp -= newRegionUp; | ||
188 | // regionCommsHost.OnExpectUser -= NewUserConnection; | ||
189 | // regionCommsHost.OnExpectPrim -= IncomingPrimCrossing; | ||
190 | // regionCommsHost.OnAvatarCrossingIntoRegion -= AgentCrossing; | ||
191 | // regionCommsHost.OnCloseAgentConnection -= CloseConnection; | ||
192 | // regionCommsHost.OnGetLandData -= FetchLandData; | ||
193 | |||
194 | // try | ||
195 | // { | ||
196 | // m_commsProvider.GridService.DeregisterRegion(m_regionInfo); | ||
197 | // } | ||
198 | // catch (Exception e) | ||
199 | // { | ||
200 | // m_log.ErrorFormat( | ||
201 | // "[GRID]: Deregistration of region {0} from the grid failed - {1}. Continuing", | ||
202 | // m_regionInfo.RegionName, e); | ||
203 | // } | ||
204 | |||
205 | // regionCommsHost = null; | ||
206 | //} | ||
207 | } | 156 | } |
208 | 157 | ||
209 | #region CommsManager Event handlers | 158 | #region CommsManager Event handlers |
@@ -263,27 +212,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
263 | } | 212 | } |
264 | } | 213 | } |
265 | 214 | ||
266 | /// <summary> | ||
267 | /// We have a new prim from a neighbor | ||
268 | /// </summary> | ||
269 | /// <param name="primID">unique ID for the primative</param> | ||
270 | /// <param name="objXMLData">XML2 encoded data of the primative</param> | ||
271 | /// <param name="XMLMethod">An Int that represents the version of the XMLMethod</param> | ||
272 | /// <returns>True if the prim was accepted, false if it was not</returns> | ||
273 | protected bool IncomingPrimCrossing(UUID primID, String objXMLData, int XMLMethod) | ||
274 | { | ||
275 | handlerExpectPrim = OnExpectPrim; | ||
276 | if (handlerExpectPrim != null) | ||
277 | { | ||
278 | return handlerExpectPrim(primID, objXMLData, XMLMethod); | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | return false; | ||
283 | } | ||
284 | |||
285 | } | ||
286 | |||
287 | protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) | 215 | protected void PrimCrossing(UUID primID, Vector3 position, bool isPhysical) |
288 | { | 216 | { |
289 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; | 217 | handlerPrimCrossingIntoRegion = OnPrimCrossingIntoRegion; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 3cec77f..5a06bdb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -309,26 +309,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | 309 | ||
310 | public string GetStateSnapshot() | 310 | public string GetStateSnapshot() |
311 | { | 311 | { |
312 | //m_log.Debug(" >>> GetStateSnapshot <<<"); | ||
313 | |||
314 | List<string> assemblies = new List<string>(); | ||
315 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); | 312 | Dictionary<UUID, string> states = new Dictionary<UUID, string>(); |
316 | 313 | ||
317 | foreach (SceneObjectPart part in m_parts.Values) | 314 | foreach (SceneObjectPart part in m_parts.Values) |
318 | { | 315 | { |
319 | foreach (string a in part.Inventory.GetScriptAssemblies()) | ||
320 | { | ||
321 | if (a != "" && !assemblies.Contains(a)) | ||
322 | assemblies.Add(a); | ||
323 | } | ||
324 | |||
325 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) | 316 | foreach (KeyValuePair<UUID, string> s in part.Inventory.GetScriptStates()) |
326 | { | ||
327 | states[s.Key] = s.Value; | 317 | states[s.Key] = s.Value; |
328 | } | ||
329 | } | 318 | } |
330 | 319 | ||
331 | if (states.Count < 1 || assemblies.Count < 1) | 320 | if (states.Count < 1) |
332 | return ""; | 321 | return ""; |
333 | 322 | ||
334 | XmlDocument xmldoc = new XmlDocument(); | 323 | XmlDocument xmldoc = new XmlDocument(); |
@@ -342,104 +331,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
342 | 331 | ||
343 | xmldoc.AppendChild(rootElement); | 332 | xmldoc.AppendChild(rootElement); |
344 | 333 | ||
345 | XmlElement wrapper = xmldoc.CreateElement("", "Assemblies", | ||
346 | ""); | ||
347 | 334 | ||
348 | rootElement.AppendChild(wrapper); | 335 | XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates", |
349 | |||
350 | foreach (string assembly in assemblies) | ||
351 | { | ||
352 | string fn = Path.GetFileName(assembly); | ||
353 | if (fn == String.Empty) | ||
354 | continue; | ||
355 | |||
356 | String filedata = String.Empty; | ||
357 | |||
358 | if (File.Exists(assembly+".text")) | ||
359 | { | ||
360 | FileInfo tfi = new FileInfo(assembly+".text"); | ||
361 | |||
362 | if (tfi == null) | ||
363 | continue; | ||
364 | |||
365 | Byte[] tdata = new Byte[tfi.Length]; | ||
366 | |||
367 | try | ||
368 | { | ||
369 | FileStream tfs = File.Open(assembly+".text", FileMode.Open, FileAccess.Read); | ||
370 | tfs.Read(tdata, 0, tdata.Length); | ||
371 | tfs.Close(); | ||
372 | } | ||
373 | catch (Exception e) | ||
374 | { | ||
375 | m_log.DebugFormat("[SOG]: Unable to open script textfile {0}, reason: {1}", assembly+".text", e.Message); | ||
376 | } | ||
377 | |||
378 | filedata = new System.Text.ASCIIEncoding().GetString(tdata); | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | FileInfo fi = new FileInfo(assembly); | ||
383 | |||
384 | if (fi == null) | ||
385 | continue; | ||
386 | |||
387 | Byte[] data = new Byte[fi.Length]; | ||
388 | |||
389 | try | ||
390 | { | ||
391 | FileStream fs = File.Open(assembly, FileMode.Open, FileAccess.Read); | ||
392 | fs.Read(data, 0, data.Length); | ||
393 | fs.Close(); | ||
394 | } | ||
395 | catch (Exception e) | ||
396 | { | ||
397 | m_log.DebugFormat("[SOG]: Unable to open script assembly {0}, reason: {1}", assembly, e.Message); | ||
398 | } | ||
399 | |||
400 | filedata = System.Convert.ToBase64String(data); | ||
401 | } | ||
402 | XmlElement assemblyData = xmldoc.CreateElement("", "Assembly", ""); | ||
403 | XmlAttribute assemblyName = xmldoc.CreateAttribute("", "Filename", ""); | ||
404 | assemblyName.Value = fn; | ||
405 | assemblyData.Attributes.Append(assemblyName); | ||
406 | |||
407 | assemblyData.InnerText = filedata; | ||
408 | |||
409 | wrapper.AppendChild(assemblyData); | ||
410 | } | ||
411 | |||
412 | wrapper = xmldoc.CreateElement("", "ScriptStates", | ||
413 | ""); | 336 | ""); |
414 | 337 | ||
415 | rootElement.AppendChild(wrapper); | 338 | rootElement.AppendChild(wrapper); |
416 | 339 | ||
417 | foreach (KeyValuePair<UUID, string> state in states) | 340 | foreach (KeyValuePair<UUID, string> state in states) |
418 | { | 341 | { |
419 | XmlElement stateData = xmldoc.CreateElement("", "State", ""); | ||
420 | |||
421 | XmlAttribute stateID = xmldoc.CreateAttribute("", "UUID", ""); | ||
422 | stateID.Value = state.Key.ToString(); | ||
423 | stateData.Attributes.Append(stateID); | ||
424 | |||
425 | XmlDocument sdoc = new XmlDocument(); | 342 | XmlDocument sdoc = new XmlDocument(); |
426 | sdoc.LoadXml(state.Value); | 343 | sdoc.LoadXml(state.Value); |
427 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | 344 | XmlNodeList rootL = sdoc.GetElementsByTagName("State"); |
428 | XmlNode rootNode = rootL[0]; | 345 | XmlNode rootNode = rootL[0]; |
429 | 346 | ||
430 | XmlNode newNode = xmldoc.ImportNode(rootNode, true); | 347 | XmlNode newNode = xmldoc.ImportNode(rootNode, true); |
431 | stateData.AppendChild(newNode); | 348 | wrapper.AppendChild(newNode); |
432 | wrapper.AppendChild(stateData); | ||
433 | } | 349 | } |
434 | 350 | ||
435 | return xmldoc.InnerXml; | 351 | return xmldoc.InnerXml; |
436 | } | 352 | } |
437 | 353 | ||
438 | public void SetState(string objXMLData, UUID RegionID) | 354 | public void SetState(string objXMLData, IScene ins) |
439 | { | 355 | { |
356 | if (!(ins is Scene)) | ||
357 | return; | ||
358 | |||
359 | Scene s = (Scene)ins; | ||
360 | |||
440 | if (objXMLData == String.Empty) | 361 | if (objXMLData == String.Empty) |
441 | return; | 362 | return; |
442 | 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 | |||
443 | XmlDocument doc = new XmlDocument(); | 377 | XmlDocument doc = new XmlDocument(); |
444 | try | 378 | try |
445 | { | 379 | { |
@@ -457,69 +391,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | } | 391 | } |
458 | 392 | ||
459 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); | 393 | XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); |
460 | 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) | ||
461 | { | 406 | { |
462 | XmlNode rootNode = rootL[0]; | 407 | XmlElement stateE = (XmlElement)n; |
463 | if (rootNode != null) | 408 | UUID itemID = new UUID(stateE.GetAttribute("UUID")); |
464 | { | 409 | |
465 | XmlNodeList partL = rootNode.ChildNodes; | 410 | scriptModule.SetXMLState(itemID, n.OuterXml); |
466 | |||
467 | foreach (XmlNode part in partL) | ||
468 | { | ||
469 | XmlNodeList nodeL = part.ChildNodes; | ||
470 | |||
471 | switch (part.Name) | ||
472 | { | ||
473 | case "Assemblies": | ||
474 | foreach (XmlNode asm in nodeL) | ||
475 | { | ||
476 | string fn = asm.Attributes.GetNamedItem("Filename").Value; | ||
477 | |||
478 | Byte[] filedata = Convert.FromBase64String(asm.InnerText); | ||
479 | string path = Path.Combine("ScriptEngines", RegionID.ToString()); | ||
480 | path = Path.Combine(path, fn); | ||
481 | |||
482 | if (!File.Exists(path)) | ||
483 | { | ||
484 | FileStream fs = File.Create(path); | ||
485 | fs.Write(filedata, 0, filedata.Length); | ||
486 | fs.Close(); | ||
487 | |||
488 | Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText); | ||
489 | fs = File.Create(path+".text"); | ||
490 | fs.Write(textbytes, 0, textbytes.Length); | ||
491 | fs.Close(); | ||
492 | } | ||
493 | } | ||
494 | break; | ||
495 | case "ScriptStates": | ||
496 | foreach (XmlNode st in nodeL) | ||
497 | { | ||
498 | string id = st.Attributes.GetNamedItem("UUID").Value; | ||
499 | UUID uuid = new UUID(id); | ||
500 | XmlNode state = st.ChildNodes[0]; | ||
501 | |||
502 | XmlDocument sdoc = new XmlDocument(); | ||
503 | XmlNode sxmlnode = sdoc.CreateNode( | ||
504 | XmlNodeType.XmlDeclaration, | ||
505 | "", ""); | ||
506 | sdoc.AppendChild(sxmlnode); | ||
507 | |||
508 | XmlNode newnode = sdoc.ImportNode(state, true); | ||
509 | sdoc.AppendChild(newnode); | ||
510 | |||
511 | string spath = Path.Combine("ScriptEngines", RegionID.ToString()); | ||
512 | spath = Path.Combine(spath, uuid.ToString()); | ||
513 | FileStream sfs = File.Create(spath + ".state"); | ||
514 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
515 | Byte[] buf = enc.GetBytes(sdoc.InnerXml); | ||
516 | sfs.Write(buf, 0, buf.Length); | ||
517 | sfs.Close(); | ||
518 | } | ||
519 | break; | ||
520 | } | ||
521 | } | ||
522 | } | ||
523 | } | 411 | } |
524 | } | 412 | } |
525 | } | 413 | } |
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 | |||
3341 | } | 3341 | } |
3342 | #endregion | 3342 | #endregion |
3343 | 3343 | ||
3344 | public bool CanBeDeleted() | ||
3345 | { | ||
3346 | foreach (SceneObjectPart part in Children.Values) | ||
3347 | { | ||
3348 | if (!part.CanBeDeleted()) | ||
3349 | return false; | ||
3350 | } | ||
3351 | |||
3352 | return true; | ||
3353 | } | ||
3354 | |||
3355 | public double GetUpdatePriority(IClientAPI client) | 3344 | public double GetUpdatePriority(IClientAPI client) |
3356 | { | 3345 | { |
3357 | switch (Scene.UpdatePrioritizationScheme) | 3346 | 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 | |||
3797 | 3797 | ||
3798 | Inventory.ApplyNextOwnerPermissions(); | 3798 | Inventory.ApplyNextOwnerPermissions(); |
3799 | } | 3799 | } |
3800 | |||
3801 | public bool CanBeDeleted() | ||
3802 | { | ||
3803 | return Inventory.CanBeDeleted(); | ||
3804 | } | ||
3805 | } | 3800 | } |
3806 | } | 3801 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f4ca877..7a0d7b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -857,36 +857,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
857 | return ret; | 857 | return ret; |
858 | } | 858 | } |
859 | 859 | ||
860 | public string[] GetScriptAssemblies() | ||
861 | { | ||
862 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
863 | |||
864 | List<string> ret = new List<string>(); | ||
865 | if (engines == null) // No engine at all | ||
866 | return new string[0]; | ||
867 | |||
868 | foreach (TaskInventoryItem item in m_items.Values) | ||
869 | { | ||
870 | if (item.InvType == (int)InventoryType.LSL) | ||
871 | { | ||
872 | foreach (IScriptModule e in engines) | ||
873 | { | ||
874 | if (e != null) | ||
875 | { | ||
876 | string n = e.GetAssemblyName(item.ItemID); | ||
877 | if (n != String.Empty) | ||
878 | { | ||
879 | if (!ret.Contains(n)) | ||
880 | ret.Add(n); | ||
881 | break; | ||
882 | } | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | } | ||
887 | return ret.ToArray(); | ||
888 | } | ||
889 | |||
890 | public Dictionary<UUID, string> GetScriptStates() | 860 | public Dictionary<UUID, string> GetScriptStates() |
891 | { | 861 | { |
892 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | 862 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); |
@@ -916,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
916 | } | 886 | } |
917 | return ret; | 887 | return ret; |
918 | } | 888 | } |
919 | |||
920 | public bool CanBeDeleted() | ||
921 | { | ||
922 | if (!ContainsScripts()) | ||
923 | return true; | ||
924 | |||
925 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
926 | |||
927 | if (engines == null) // No engine at all | ||
928 | return true; | ||
929 | |||
930 | foreach (TaskInventoryItem item in m_items.Values) | ||
931 | { | ||
932 | if (item.InvType == (int)InventoryType.LSL) | ||
933 | { | ||
934 | foreach (IScriptModule e in engines) | ||
935 | { | ||
936 | if (!e.CanBeDeleted(item.ItemID)) | ||
937 | return false; | ||
938 | } | ||
939 | } | ||
940 | } | ||
941 | |||
942 | return true; | ||
943 | } | ||
944 | } | 889 | } |
945 | } | 890 | } |
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 a60c0ba..5584f87 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1245,34 +1245,219 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1245 | } | 1245 | } |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | public string GetAssemblyName(UUID itemID) | ||
1249 | { | ||
1250 | IScriptInstance instance = GetInstance(itemID); | ||
1251 | if (instance == null) | ||
1252 | return ""; | ||
1253 | return instance.GetAssemblyName(); | ||
1254 | } | ||
1255 | |||
1256 | public string GetXMLState(UUID itemID) | 1248 | public string GetXMLState(UUID itemID) |
1257 | { | 1249 | { |
1258 | IScriptInstance instance = GetInstance(itemID); | 1250 | IScriptInstance instance = GetInstance(itemID); |
1259 | if (instance == null) | 1251 | if (instance == null) |
1260 | return ""; | 1252 | return ""; |
1261 | return instance.GetXMLState(); | 1253 | string xml = instance.GetXMLState(); |
1262 | } | ||
1263 | 1254 | ||
1264 | public bool CanBeDeleted(UUID itemID) | 1255 | XmlDocument sdoc = new XmlDocument(); |
1265 | { | 1256 | sdoc.LoadXml(xml); |
1266 | IScriptInstance instance = GetInstance(itemID); | 1257 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); |
1267 | if (instance == null) | 1258 | XmlNode rootNode = rootL[0]; |
1268 | return true; | 1259 | |
1260 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> | ||
1261 | XmlDocument doc = new XmlDocument(); | ||
1262 | XmlElement stateData = doc.CreateElement("", "State", ""); | ||
1263 | XmlAttribute stateID = doc.CreateAttribute("", "UUID", ""); | ||
1264 | stateID.Value = itemID.ToString(); | ||
1265 | stateData.Attributes.Append(stateID); | ||
1266 | XmlAttribute assetID = doc.CreateAttribute("", "Asset", ""); | ||
1267 | assetID.Value = instance.AssetID.ToString(); | ||
1268 | stateData.Attributes.Append(assetID); | ||
1269 | doc.AppendChild(stateData); | ||
1270 | |||
1271 | // Add <ScriptState>...</ScriptState> | ||
1272 | XmlNode xmlstate = doc.ImportNode(rootNode, true); | ||
1273 | stateData.AppendChild(xmlstate); | ||
1274 | |||
1275 | string assemName = instance.GetAssemblyName(); | ||
1276 | |||
1277 | string fn = Path.GetFileName(assemName); | ||
1278 | |||
1279 | string assem = String.Empty; | ||
1280 | |||
1281 | if (File.Exists(assemName + ".text")) | ||
1282 | { | ||
1283 | FileInfo tfi = new FileInfo(assemName + ".text"); | ||
1284 | |||
1285 | if (tfi != null) | ||
1286 | { | ||
1287 | Byte[] tdata = new Byte[tfi.Length]; | ||
1288 | |||
1289 | try | ||
1290 | { | ||
1291 | FileStream tfs = File.Open(assemName + ".text", | ||
1292 | FileMode.Open, FileAccess.Read); | ||
1293 | tfs.Read(tdata, 0, tdata.Length); | ||
1294 | tfs.Close(); | ||
1295 | |||
1296 | assem = new System.Text.ASCIIEncoding().GetString(tdata); | ||
1297 | } | ||
1298 | catch (Exception e) | ||
1299 | { | ||
1300 | m_log.DebugFormat("[XEngine]: Unable to open script textfile {0}, reason: {1}", assemName+".text", e.Message); | ||
1301 | } | ||
1302 | } | ||
1303 | } | ||
1304 | else | ||
1305 | { | ||
1306 | FileInfo fi = new FileInfo(assemName); | ||
1307 | |||
1308 | if (fi != null) | ||
1309 | { | ||
1310 | Byte[] data = new Byte[fi.Length]; | ||
1311 | |||
1312 | try | ||
1313 | { | ||
1314 | FileStream fs = File.Open(assemName, FileMode.Open, FileAccess.Read); | ||
1315 | fs.Read(data, 0, data.Length); | ||
1316 | fs.Close(); | ||
1317 | |||
1318 | assem = System.Convert.ToBase64String(data); | ||
1319 | } | ||
1320 | catch (Exception e) | ||
1321 | { | ||
1322 | m_log.DebugFormat("[XEngine]: Unable to open script assembly {0}, reason: {1}", assemName, e.Message); | ||
1323 | } | ||
1324 | |||
1325 | } | ||
1326 | } | ||
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 | |||
1341 | XmlElement assemblyData = doc.CreateElement("", "Assembly", ""); | ||
1342 | XmlAttribute assemblyName = doc.CreateAttribute("", "Filename", ""); | ||
1343 | |||
1344 | assemblyName.Value = fn; | ||
1345 | assemblyData.Attributes.Append(assemblyName); | ||
1346 | |||
1347 | assemblyData.InnerText = assem; | ||
1348 | |||
1349 | stateData.AppendChild(assemblyData); | ||
1269 | 1350 | ||
1270 | return instance.CanBeDeleted(); | 1351 | XmlElement mapData = doc.CreateElement("", "LineMap", ""); |
1352 | XmlAttribute mapName = doc.CreateAttribute("", "Filename", ""); | ||
1353 | |||
1354 | mapName.Value = fn + ".map"; | ||
1355 | mapData.Attributes.Append(mapName); | ||
1356 | |||
1357 | mapData.InnerText = map; | ||
1358 | |||
1359 | stateData.AppendChild(mapData); | ||
1360 | return doc.InnerXml; | ||
1271 | } | 1361 | } |
1272 | 1362 | ||
1273 | private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) | 1363 | private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) |
1274 | { | 1364 | { |
1275 | return false; | 1365 | return false; |
1276 | } | 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(mfs); | ||
1456 | |||
1457 | msw.Write(mapE.InnerText); | ||
1458 | |||
1459 | msw.Close(); | ||
1460 | mfs.Close(); | ||
1461 | } | ||
1277 | } | 1462 | } |
1278 | } | 1463 | } |