aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorMelanie2010-01-29 07:20:13 +0000
committerMelanie2010-01-29 07:21:06 +0000
commita87a247f0548d39a8c39b1d28123d7da8db44598 (patch)
tree7f9f77c38a224bc6d4bea7ccced1d4710c8a91b1 /OpenSim/Region/OptionalModules/Scripting
parentMerge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff)
downloadopensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.zip
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.gz
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.bz2
opensim-SC-a87a247f0548d39a8c39b1d28123d7da8db44598.tar.xz
Revert "Updates all IRegionModules to the new style region modules."
This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs64
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs28
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs30
5 files changed, 45 insertions, 84 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
index f24bcdc..4521f8e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs
@@ -38,7 +38,6 @@ using System.Security.Policy;
38using System.Text; 38using System.Text;
39using log4net; 39using log4net;
40using Microsoft.CSharp; 40using Microsoft.CSharp;
41using Mono.Addins;
42using Nini.Config; 41using Nini.Config;
43using OpenMetaverse; 42using OpenMetaverse;
44using OpenSim.Framework; 43using OpenSim.Framework;
@@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Scenes;
47 46
48namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 47namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
49{ 48{
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 public class MRMModule : IRegionModule, IMRMModule
51 public class MRMModule : INonSharedRegionModule, IMRMModule
52 { 50 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 private Scene m_scene; 52 private Scene m_scene;
@@ -64,14 +62,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
64 62
65 private IConfig m_config; 63 private IConfig m_config;
66 64
67 private bool m_hidden = true;
68
69 public void RegisterExtension<T>(T instance) 65 public void RegisterExtension<T>(T instance)
70 { 66 {
71 m_extensions[typeof (T)] = instance; 67 m_extensions[typeof (T)] = instance;
72 } 68 }
73 69
74 public void Initialise(IConfigSource source) 70 public void Initialise(Scene scene, IConfigSource source)
75 { 71 {
76 if (source.Configs["MRM"] != null) 72 if (source.Configs["MRM"] != null)
77 { 73 {
@@ -80,10 +76,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
80 if (source.Configs["MRM"].GetBoolean("Enabled", false)) 76 if (source.Configs["MRM"].GetBoolean("Enabled", false))
81 { 77 {
82 m_log.Info("[MRM] Enabling MRM Module"); 78 m_log.Info("[MRM] Enabling MRM Module");
83 79 m_scene = scene;
80
84 // when hidden, we don't listen for client initiated script events 81 // when hidden, we don't listen for client initiated script events
85 // only making the MRM engine available for region modules 82 // only making the MRM engine available for region modules
86 m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false); 83 if (!source.Configs["MRM"].GetBoolean("Hidden", false))
84 {
85 scene.EventManager.OnRezScript += EventManager_OnRezScript;
86 scene.EventManager.OnStopScript += EventManager_OnStopScript;
87 }
88
89 scene.EventManager.OnFrame += EventManager_OnFrame;
90
91 scene.RegisterModuleInterface<IMRMModule>(this);
87 } 92 }
88 else 93 else
89 { 94 {
@@ -96,39 +101,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
96 } 101 }
97 } 102 }
98 103
99 public Type ReplaceableInterface
100 {
101 get { return null; }
102 }
103
104 public void AddRegion(Scene scene)
105 {
106 m_scene = scene;
107 if (!m_hidden)
108 {
109 scene.EventManager.OnRezScript += EventManager_OnRezScript;
110 scene.EventManager.OnStopScript += EventManager_OnStopScript;
111 }
112 scene.EventManager.OnFrame += EventManager_OnFrame;
113
114 scene.RegisterModuleInterface<IMRMModule>(this);
115 }
116 public void RegionLoaded(Scene scene)
117 {
118 }
119
120 public void RemoveRegion(Scene scene)
121 {
122 if (!m_hidden)
123 {
124 scene.EventManager.OnRezScript -= EventManager_OnRezScript;
125 scene.EventManager.OnStopScript -= EventManager_OnStopScript;
126 }
127 scene.EventManager.OnFrame -= EventManager_OnFrame;
128
129 scene.UnregisterModuleInterface<IMRMModule>(this);
130 }
131
132 void EventManager_OnStopScript(uint localID, UUID itemID) 104 void EventManager_OnStopScript(uint localID, UUID itemID)
133 { 105 {
134 if (m_scripts.ContainsKey(itemID)) 106 if (m_scripts.ContainsKey(itemID))
@@ -330,6 +302,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
330 mmb.InitMiniModule(world, host, itemID); 302 mmb.InitMiniModule(world, host, itemID);
331 } 303 }
332 304
305 public void PostInitialise()
306 {
307
308 }
309
333 public void Close() 310 public void Close()
334 { 311 {
335 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts) 312 foreach (KeyValuePair<UUID, MRMBase> pair in m_scripts)
@@ -343,6 +320,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
343 get { return "MiniRegionModule"; } 320 get { return "MiniRegionModule"; }
344 } 321 }
345 322
323 public bool IsSharedModule
324 {
325 get { return false; }
326 }
327
346 /// <summary> 328 /// <summary>
347 /// Stolen from ScriptEngine Common 329 /// Stolen from ScriptEngine Common
348 /// </summary> 330 /// </summary>
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 999756a..c653e98 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -100,10 +100,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
100 if (!m_enabled) 100 if (!m_enabled)
101 return; 101 return;
102 102
103 scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; 103 m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue;
104 scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; 104 m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded;
105 105
106 scene = null; 106 m_scene = null;
107 } 107 }
108 108
109 public void Close() 109 public void Close()
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
index df01938..44c9ada 100644
--- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
@@ -58,7 +58,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms
58 58
59 public void RemoveRegion(Scene scene) 59 public void RemoveRegion(Scene scene)
60 { 60 {
61 scene.UnregisterModuleInterface<IScriptModuleComms>(this);
62 } 61 }
63 62
64 public void RegionLoaded(Scene scene) 63 public void RegionLoaded(Scene scene)
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
index f2a0e53..d18ac0a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31 31
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36 35
@@ -50,8 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
50 public string uri; 49 public string uri;
51 } 50 }
52 51
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 52 public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter
54 public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter
55 { 53 {
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57 55
@@ -61,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
61 private bool m_Enabled = false; 59 private bool m_Enabled = false;
62 private string m_ServerURI = String.Empty; 60 private string m_ServerURI = String.Empty;
63 61
64 public void Initialise(IConfigSource config) 62 public void Initialise(Scene scene, IConfigSource config)
65 { 63 {
66 IConfig startupConfig = config.Configs["Startup"]; 64 IConfig startupConfig = config.Configs["Startup"];
67 if (startupConfig == null) 65 if (startupConfig == null)
@@ -77,26 +75,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
77 return; 75 return;
78 } 76 }
79 77
78 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
80 m_Enabled = true; 79 m_Enabled = true;
81 } 80 }
82 } 81 }
83 82
84 public void AddRegion(Scene scene) 83 public void PostInitialise()
85 { 84 {
86 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
87 }
88 public void RegionLoaded(Scene scene)
89 {
90 }
91
92 public void RemoveRegion(Scene scene)
93 {
94 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
95 }
96
97 public Type ReplaceableInterface
98 {
99 get { return null; }
100 } 85 }
101 86
102 public void Close() 87 public void Close()
@@ -108,6 +93,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule
108 get { return "XmlRpcGridRouterModule"; } 93 get { return "XmlRpcGridRouterModule"; }
109 } 94 }
110 95
96 public bool IsSharedModule
97 {
98 get { return false; }
99 }
100
111 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 101 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
112 { 102 {
113 if (!m_Channels.ContainsKey(itemID)) 103 if (!m_Channels.ContainsKey(itemID))
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
index 4d39345..32659c8 100644
--- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs
@@ -29,7 +29,6 @@ using System;
29using System.Reflection; 29using System.Reflection;
30 30
31using log4net; 31using log4net;
32using Mono.Addins;
33using Nini.Config; 32using Nini.Config;
34using OpenMetaverse; 33using OpenMetaverse;
35 34
@@ -40,12 +39,11 @@ using OpenSim.Region.Framework.Scenes;
40 39
41namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule 40namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
42{ 41{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 42 public class XmlRpcRouter : IRegionModule, IXmlRpcRouter
44 public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter
45 { 43 {
46 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private bool m_enabled = false; 45
48 public void Initialise(IConfigSource config) 46 public void Initialise(Scene scene, IConfigSource config)
49 { 47 {
50 IConfig startupConfig = config.Configs["Startup"]; 48 IConfig startupConfig = config.Configs["Startup"];
51 if (startupConfig == null) 49 if (startupConfig == null)
@@ -54,25 +52,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
54 if (startupConfig.GetString("XmlRpcRouterModule", 52 if (startupConfig.GetString("XmlRpcRouterModule",
55 "XmlRpcRouterModule") == "XmlRpcRouterModule") 53 "XmlRpcRouterModule") == "XmlRpcRouterModule")
56 { 54 {
57 m_enabled = true; 55 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
58 } 56 }
59 } 57 }
60 public void AddRegion(Scene scene)
61 {
62 scene.RegisterModuleInterface<IXmlRpcRouter>(this);
63 }
64 public void RegionLoaded(Scene scene)
65 {
66 }
67
68 public void RemoveRegion(Scene scene)
69 {
70 scene.UnregisterModuleInterface<IXmlRpcRouter>(this);
71 }
72 58
73 public Type ReplaceableInterface 59 public void PostInitialise()
74 { 60 {
75 get { return null; }
76 } 61 }
77 62
78 public void Close() 63 public void Close()
@@ -84,6 +69,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule
84 get { return "XmlRpcRouterModule"; } 69 get { return "XmlRpcRouterModule"; }
85 } 70 }
86 71
72 public bool IsSharedModule
73 {
74 get { return false; }
75 }
76
87 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) 77 public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri)
88 { 78 {
89 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); 79 scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri});