From 88277366bf2cad50947c55d1bf6bf6115ec98fe5 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Tue, 23 Sep 2008 20:02:32 +0000
Subject: Switches the direct event postings in the API file over to the
Shared/ new style of parameter passing, using the IEventReceiver interface.
---
.../Common/ScriptEngineBase/EventQueueManager.cs | 7 +++++-
.../Common/ScriptEngineBase/ScriptEngine.cs | 3 ++-
.../Common/ScriptEngineBase/ScriptManager.cs | 29 ++++++++++------------
3 files changed, 21 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region/ScriptEngine/Common/ScriptEngineBase')
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
index ac0ab7e..8538c13 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueManager.cs
@@ -355,10 +355,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
/// Array of parameters to match event mask
public bool AddToScriptQueue(uint localID, UUID itemID, string FunctionName, Queue_llDetectParams_Struct qParams, params object[] param)
{
- List keylist = new List(m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID));
+ List keylist = m_ScriptEngine.m_ScriptManager.GetScriptKeys(localID);
+System.Console.WriteLine("==> got {0} keys", keylist.Count);
if (!keylist.Contains(itemID)) // We don't manage that script
+ {
+System.Console.WriteLine("==> Script not found");
return false;
+ }
lock (eventQueue)
{
@@ -379,6 +383,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
// Add it to queue
eventQueue.Enqueue(QIS);
+System.Console.WriteLine("==> PostedEvent");
}
return true;
}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
index 79f521d..01af0af 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptEngine.cs
@@ -197,7 +197,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
public bool PostScriptEvent(UUID itemID, EventParams p)
{
- return m_EventQueueManager.AddToScriptQueue(0, itemID, p.EventName, EventQueueManager.llDetectNull, p.Params);
+ uint localID = m_ScriptManager.GetLocalID(itemID);
+ return m_EventQueueManager.AddToScriptQueue(localID, itemID, p.EventName, EventQueueManager.llDetectNull, p.Params);
}
#endregion
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
index 8d4dc56..ff8e16f 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs
@@ -341,6 +341,16 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
Script.Exec.ExecuteEvent(FunctionName, args);
}
+ public uint GetLocalID(UUID itemID)
+ {
+ foreach (KeyValuePair > k in Scripts)
+ {
+ if (k.Value.ContainsKey(itemID))
+ return k.Key;
+ }
+ return 0;
+ }
+
public int GetStateEventFlags(uint localID, UUID itemID)
{
// Console.WriteLine("GetStateEventFlags for <" + localID + "," + itemID + ">");
@@ -368,22 +378,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
public List GetScriptKeys(uint localID)
{
- if (localID == 0) // Find it
- {
- List keylist = new List();
-
- foreach (Dictionary d in Scripts.Values)
- {
- foreach (UUID id in d.Keys)
- {
- if (!keylist.Contains(id))
- keylist.Add(id);
- }
- }
- }
-
if (Scripts.ContainsKey(localID) == false)
- return null;
+ return new List();
Dictionary Obj;
Scripts.TryGetValue(localID, out Obj);
@@ -395,6 +391,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
{
lock (scriptLock)
{
+ IScript Script = null;
+
if (Scripts.ContainsKey(localID) == false)
return null;
@@ -404,7 +402,6 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
return null;
// Get script
- IScript Script;
Obj.TryGetValue(itemID, out Script);
return Script;
}
--
cgit v1.1