diff options
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index 0ec4025..0605590 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs | |||
@@ -130,10 +130,18 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
130 | 130 | ||
131 | public void RegisterScriptInvocation(object target, string meth) | 131 | public void RegisterScriptInvocation(object target, string meth) |
132 | { | 132 | { |
133 | m_log.DebugFormat("[MODULE COMMANDS] Register method {0} from type {1}",meth,target.GetType().Name); | ||
134 | |||
135 | |||
133 | MethodInfo mi = target.GetType().GetMethod(meth, | 136 | MethodInfo mi = target.GetType().GetMethod(meth, |
134 | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); | 137 | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); |
138 | if (mi == null) | ||
139 | { | ||
140 | m_log.WarnFormat("[MODULE COMMANDS] Failed to register method {0}",meth); | ||
141 | return; | ||
142 | } | ||
143 | |||
135 | Type delegateType; | 144 | Type delegateType; |
136 | |||
137 | var typeArgs = mi.GetParameters() | 145 | var typeArgs = mi.GetParameters() |
138 | .Select(p => p.ParameterType) | 146 | .Select(p => p.ParameterType) |
139 | .ToList(); | 147 | .ToList(); |
@@ -153,13 +161,13 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
153 | lock (m_scriptInvocation) | 161 | lock (m_scriptInvocation) |
154 | { | 162 | { |
155 | ParameterInfo[] parameters = fcall.Method.GetParameters (); | 163 | ParameterInfo[] parameters = fcall.Method.GetParameters (); |
156 | if (parameters.Length == 0) // Must have one UUID param | 164 | if (parameters.Length < 2) // Must have two UUID params |
157 | return; | 165 | return; |
158 | 166 | ||
159 | // Hide the first parameter | 167 | // Hide the first two parameters |
160 | Type[] parmTypes = new Type[parameters.Length - 1]; | 168 | Type[] parmTypes = new Type[parameters.Length - 2]; |
161 | for (int i = 1 ; i < parameters.Length ; i++) | 169 | for (int i = 2 ; i < parameters.Length ; i++) |
162 | parmTypes[i - 1] = parameters[i].ParameterType; | 170 | parmTypes[i - 2] = parameters[i].ParameterType; |
163 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); | 171 | m_scriptInvocation[fcall.Method.Name] = new ScriptInvocationData(fcall.Method.Name, fcall, parmTypes, fcall.Method.ReturnType); |
164 | } | 172 | } |
165 | } | 173 | } |
@@ -197,6 +205,8 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
197 | return "modInvokeR"; | 205 | return "modInvokeR"; |
198 | else if (sid.ReturnType == typeof(object[])) | 206 | else if (sid.ReturnType == typeof(object[])) |
199 | return "modInvokeL"; | 207 | return "modInvokeL"; |
208 | |||
209 | m_log.WarnFormat("[MODULE COMMANDS] failed to find match for {0} with return type {1}",fname,sid.ReturnType.Name); | ||
200 | } | 210 | } |
201 | } | 211 | } |
202 | 212 | ||
@@ -239,9 +249,10 @@ namespace OpenSim.Region.CoreModules.Scripting.ScriptModuleComms | |||
239 | return null; | 249 | return null; |
240 | } | 250 | } |
241 | 251 | ||
242 | public object InvokeOperation(UUID scriptid, string fname, params object[] parms) | 252 | public object InvokeOperation(UUID hostid, UUID scriptid, string fname, params object[] parms) |
243 | { | 253 | { |
244 | List<object> olist = new List<object>(); | 254 | List<object> olist = new List<object>(); |
255 | olist.Add(hostid); | ||
245 | olist.Add(scriptid); | 256 | olist.Add(scriptid); |
246 | foreach (object o in parms) | 257 | foreach (object o in parms) |
247 | olist.Add(o); | 258 | olist.Add(o); |