diff options
author | Charles Krinke | 2008-05-28 02:06:56 +0000 |
---|---|---|
committer | Charles Krinke | 2008-05-28 02:06:56 +0000 |
commit | 6d51eef9cee86c74f00fd149327a378053a597b2 (patch) | |
tree | 60993888c310eb6b505523d6da2579838ba57cd8 | |
parent | Thank you kindly, Melanie for a patch that adds a two-stage (diff) | |
download | opensim-SC-6d51eef9cee86c74f00fd149327a378053a597b2.zip opensim-SC-6d51eef9cee86c74f00fd149327a378053a597b2.tar.gz opensim-SC-6d51eef9cee86c74f00fd149327a378053a597b2.tar.bz2 opensim-SC-6d51eef9cee86c74f00fd149327a378053a597b2.tar.xz |
Thank you, Grumly57 kindly for:
This patch proposes a new function : osOpenRemoteDataChannel(key channeID)
that allow to open an XMLRPC channel for remote_data event. The difference
is that the channelID can be customized instead of being randomly generated.
6 files changed, 33 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs index 6c1d025..a2c164f 100644 --- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs +++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs | |||
@@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Interfaces | |||
32 | { | 32 | { |
33 | public interface IXMLRPC | 33 | public interface IXMLRPC |
34 | { | 34 | { |
35 | LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID); | 35 | LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID, LLUUID channelID); |
36 | void CloseXMLRPCChannel(LLUUID channelKey); | 36 | void CloseXMLRPCChannel(LLUUID channelKey); |
37 | bool hasRequests(); | 37 | bool hasRequests(); |
38 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); | 38 | void RemoteDataReply(string channel, string message_id, string sdata, int idata); |
diff --git a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs index bf21dd3..aa7a20f 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -160,6 +160,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
160 | * | 160 | * |
161 | * Generate a LLUUID channel key and add it and | 161 | * Generate a LLUUID channel key and add it and |
162 | * the prim id to dictionary <channelUUID, primUUID> | 162 | * the prim id to dictionary <channelUUID, primUUID> |
163 | * | ||
164 | * A custom channel key can be proposed. | ||
165 | * Otherwise, passing LLUUID.Zero will generate | ||
166 | * and return a random channel | ||
163 | * | 167 | * |
164 | * First check if there is a channel assigned for | 168 | * First check if there is a channel assigned for |
165 | * this itemID. If there is, then someone called | 169 | * this itemID. If there is, then someone called |
@@ -169,9 +173,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
169 | * | 173 | * |
170 | * ********************************************/ | 174 | * ********************************************/ |
171 | 175 | ||
172 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) | 176 | public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID, LLUUID channelID) |
173 | { | 177 | { |
174 | LLUUID channel = new LLUUID(); | 178 | LLUUID newChannel = LLUUID.Zero; |
175 | 179 | ||
176 | //Is a dupe? | 180 | //Is a dupe? |
177 | foreach (RPCChannelInfo ci in m_openChannels.Values) | 181 | foreach (RPCChannelInfo ci in m_openChannels.Values) |
@@ -179,22 +183,22 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC | |||
179 | if (ci.GetItemID().Equals(itemID)) | 183 | if (ci.GetItemID().Equals(itemID)) |
180 | { | 184 | { |
181 | // return the original channel ID for this item | 185 | // return the original channel ID for this item |
182 | channel = ci.GetChannelID(); | 186 | newChannel = ci.GetChannelID(); |
183 | break; | 187 | break; |
184 | } | 188 | } |
185 | } | 189 | } |
186 | 190 | ||
187 | if (channel == LLUUID.Zero) | 191 | if (newChannel == LLUUID.Zero) |
188 | { | 192 | { |
189 | channel = LLUUID.Random(); | 193 | newChannel = (channelID == LLUUID.Zero) ? LLUUID.Random() : channelID; |
190 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); | 194 | RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel); |
191 | lock (XMLRPCListLock) | 195 | lock (XMLRPCListLock) |
192 | { | 196 | { |
193 | m_openChannels.Add(channel, rpcChanInfo); | 197 | m_openChannels.Add(newChannel, rpcChanInfo); |
194 | } | 198 | } |
195 | } | 199 | } |
196 | 200 | ||
197 | return channel; | 201 | return newChannel; |
198 | } | 202 | } |
199 | 203 | ||
200 | // Delete channels based on itemID | 204 | // Delete channels based on itemID |
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 07db853..b7b040d 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs | |||
@@ -2011,6 +2011,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2011 | m_LSL_Functions.osSetStateEvents(events); | 2011 | m_LSL_Functions.osSetStateEvents(events); |
2012 | } | 2012 | } |
2013 | 2013 | ||
2014 | public void osOpenRemoteDataChannel(string channel) | ||
2015 | { | ||
2016 | m_LSL_Functions.osOpenRemoteDataChannel(channel); | ||
2017 | } | ||
2018 | |||
2014 | // | 2019 | // |
2015 | 2020 | ||
2016 | public double llList2Float(LSL_Types.list src, int index) | 2021 | public double llList2Float(LSL_Types.list src, int index) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index cd2015f..6bdfe9a 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -4362,7 +4362,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
4362 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | 4362 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); |
4363 | if (xmlrpcMod.IsEnabled()) | 4363 | if (xmlrpcMod.IsEnabled()) |
4364 | { | 4364 | { |
4365 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); | 4365 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, LLUUID.Zero); |
4366 | object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; | 4366 | object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; |
4367 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); | 4367 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); |
4368 | } | 4368 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index 03d3a41..bd7ad82 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs | |||
@@ -31,6 +31,7 @@ using Nini.Config; | |||
31 | using OpenSim.Framework.Console; | 31 | using OpenSim.Framework.Console; |
32 | using OpenSim.Region.Environment.Interfaces; | 32 | using OpenSim.Region.Environment.Interfaces; |
33 | using OpenSim.Region.Environment.Scenes; | 33 | using OpenSim.Region.Environment.Scenes; |
34 | using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; | ||
34 | 35 | ||
35 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; | 36 | //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; |
36 | 37 | ||
@@ -531,5 +532,16 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
531 | m_host.SetScriptEvents(m_itemID, events); | 532 | m_host.SetScriptEvents(m_itemID, events); |
532 | } | 533 | } |
533 | 534 | ||
535 | public void osOpenRemoteDataChannel(string channel) | ||
536 | { | ||
537 | m_host.AddScriptLPS(1); | ||
538 | IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); | ||
539 | if (xmlrpcMod.IsEnabled()) | ||
540 | { | ||
541 | LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, new LLUUID(channel)); | ||
542 | object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; | ||
543 | m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); | ||
544 | } | ||
545 | } | ||
534 | } | 546 | } |
535 | } | 547 | } |
diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs index aa9c8c7..171bffd 100644 --- a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs | |||
@@ -62,5 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
62 | string osDrawImage(string drawList, int width, int height, string imageUrl); | 62 | string osDrawImage(string drawList, int width, int height, string imageUrl); |
63 | void osSetStateEvents(int events); | 63 | void osSetStateEvents(int events); |
64 | 64 | ||
65 | void osOpenRemoteDataChannel(string channel); | ||
66 | |||
65 | } | 67 | } |
66 | } | 68 | } |