aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorMelanie2009-11-10 03:36:43 +0000
committerMelanie2009-11-10 03:36:43 +0000
commitba99081bbe42efa06f8b7a5bedb5db79afa99445 (patch)
treea27a090d9436a240194bc77c7f0c34ba31c0a69f /OpenSim/Region/ScriptEngine/Shared/Api
parentMerge branch 'master' of ssh://dahlia@myConnection01/var/git/opensim (diff)
downloadopensim-SC_OLD-ba99081bbe42efa06f8b7a5bedb5db79afa99445.zip
opensim-SC_OLD-ba99081bbe42efa06f8b7a5bedb5db79afa99445.tar.gz
opensim-SC_OLD-ba99081bbe42efa06f8b7a5bedb5db79afa99445.tar.bz2
opensim-SC_OLD-ba99081bbe42efa06f8b7a5bedb5db79afa99445.tar.xz
Add IScriptModuleComms interface and region module to handle dispatch of
script messages to region modules and sending back replies. Hook IScriptModuleComms.OnScriptCommand to see commands and use DispatchReply to reply to the script. It is recommended to pass the "id" parameter from the event as the "k" parameter of the reply. The script will receive the reply as a link message from link -1.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 88b6091..d4facdd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection;
29using System.Collections; 30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.Runtime.Remoting.Lifetime; 32using System.Runtime.Remoting.Lifetime;
@@ -59,6 +60,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
59 internal uint m_localID; 60 internal uint m_localID;
60 internal UUID m_itemID; 61 internal UUID m_itemID;
61 internal bool m_MODFunctionsEnabled = false; 62 internal bool m_MODFunctionsEnabled = false;
63 internal IScriptModuleComms m_comms = null;
62 64
63 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) 65 public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
64 { 66 {
@@ -69,6 +71,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
69 71
70 if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false)) 72 if (m_ScriptEngine.Config.GetBoolean("AllowMODFunctions", false))
71 m_MODFunctionsEnabled = true; 73 m_MODFunctionsEnabled = true;
74
75 m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
76 if (m_comms == null)
77 m_MODFunctionsEnabled = false;
72 } 78 }
73 79
74 public override Object InitializeLifetimeService() 80 public override Object InitializeLifetimeService()
@@ -110,12 +116,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
110 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message); 116 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, message);
111 } 117 }
112 118
113 public string modSendCommand(string modules, string command, string k) 119 public string modSendCommand(string module, string command, string k)
114 { 120 {
115 if (!m_MODFunctionsEnabled) 121 if (!m_MODFunctionsEnabled)
116 return ""; 122 {
123 MODShoutError("Module command functions not enabled");
124 return UUID.Zero.ToString();;
125 }
126
127 UUID req = UUID.Random();
128
129 m_comms.RaiseEvent(m_itemID, req.ToString(), module, command, k);
117 130
118 return ""; 131 return req.ToString();
119 } 132 }
120 } 133 }
121} 134}