aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-11-04 20:48:35 +0000
committerSean Dague2008-11-04 20:48:35 +0000
commitea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5 (patch)
tree624703525f12a0dd375ddb1d0b58c204e5235f46 /OpenSim
parent* Stop a non WebException in an XMLRPC request from bringing down the whole sim (diff)
downloadopensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.zip
opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.gz
opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.bz2
opensim-SC-ea27b95f8e27a9fc20b6ef25cdeea086f03a8fd5.tar.xz
From: Rob Smart <SMARTROB@uk.ibm.com>
This patch allows an object to directly message another object given its key using the method osMessageObject(key objectUUID,string message). to communicate with an object it must implement the dataserver listener method. The dataserver method is passed the key of the calling object and a string message.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs33
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs7
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs7
3 files changed, 46 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index ee95342..ead88d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -31,6 +31,7 @@ using System.Runtime.Remoting.Lifetime;
31using OpenMetaverse; 31using OpenMetaverse;
32using Nini.Config; 32using Nini.Config;
33using OpenSim; 33using OpenSim;
34using OpenSim.Framework;
34using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces; 36using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes; 37using OpenSim.Region.Environment.Scenes;
@@ -41,6 +42,13 @@ using OpenSim.Region.ScriptEngine.Interfaces;
41using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 42using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
42using TPFlags = OpenSim.Framework.Constants.TeleportFlags; 43using TPFlags = OpenSim.Framework.Constants.TeleportFlags;
43 44
45using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat;
46using LSL_Integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
47using LSL_Key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
48using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
49using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
50using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
51using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
44 52
45namespace OpenSim.Region.ScriptEngine.Shared.Api 53namespace OpenSim.Region.ScriptEngine.Shared.Api
46{ 54{
@@ -91,6 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
91 public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi 99 public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi
92 { 100 {
93 internal IEventReceiver m_ScriptEngine; 101 internal IEventReceiver m_ScriptEngine;
102 internal ILSL_Api m_LSL_Api; // get a reference to the LSL API so we can call methods housed there
94 internal SceneObjectPart m_host; 103 internal SceneObjectPart m_host;
95 internal uint m_localID; 104 internal uint m_localID;
96 internal UUID m_itemID; 105 internal UUID m_itemID;
@@ -106,6 +115,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
106 m_host = host; 115 m_host = host;
107 m_localID = localID; 116 m_localID = localID;
108 m_itemID = itemID; 117 m_itemID = itemID;
118
119
109 120
110 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) 121 if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
111 m_OSFunctionsEnabled = true; 122 m_OSFunctionsEnabled = true;
@@ -932,5 +943,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
932 943
933 return jsondata; 944 return jsondata;
934 } 945 }
946
947 // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function
948 // the dataserver function is passed the ID of the calling function and a string message
949 public void osMessageObject(LSL_Key objectUUID,string message)
950 {
951 CheckThreatLevel(ThreatLevel.Low,"osMessageObject");
952 m_host.AddScriptLPS(1);
953
954
955 object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()),new LSL_Types.LSLString(message) };
956
957 SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID));
958
959 m_ScriptEngine.PostObjectEvent(
960 sceneOP.LocalId, new EventParams(
961 "dataserver", resobj,
962 new DetectParams[0]));
963
964 }
965
935 } 966 }
967
968
936} 969}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 92b77a4..b1749f9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -26,6 +26,11 @@
26 */ 26 */
27using System.Collections; 27using System.Collections;
28using OpenSim.Region.ScriptEngine.Interfaces; 28using OpenSim.Region.ScriptEngine.Interfaces;
29
30using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
31using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
32using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
33
29namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces 34namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
30{ 35{
31 public enum ThreatLevel 36 public enum ThreatLevel
@@ -89,5 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
89 void osSetParcelMediaTime(double time); 94 void osSetParcelMediaTime(double time);
90 Hashtable osParseJSON(string JSON); 95 Hashtable osParseJSON(string JSON);
91 96
97 void osMessageObject(key objectUUID,string message);
98
92 } 99 }
93} 100}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index d92ae7f..35a8830 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -35,9 +35,9 @@ using OpenSim.Region.Environment.Interfaces;
35using OpenSim.Region.ScriptEngine.Interfaces; 35using OpenSim.Region.ScriptEngine.Interfaces;
36using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 36using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
37using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger; 37using integer = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger;
38using key = System.String;
39using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 38using vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
40using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 39using rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
40using key = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
41 41
42namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase 42namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
43{ 43{
@@ -231,6 +231,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
231 { 231 {
232 return m_OSSL_Functions.osParseJSON(JSON); 232 return m_OSSL_Functions.osParseJSON(JSON);
233 } 233 }
234
235 public void osMessageObject(key objectUUID,string message)
236 {
237 m_OSSL_Functions.osMessageObject(objectUUID,message);
238 }
234 239
235 public OSSLPrim Prim; 240 public OSSLPrim Prim;
236 241