diff --git a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs index 6c1d0256c2..a2c164ff74 100644 --- a/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs +++ b/OpenSim/Region/Environment/Interfaces/IXMLRPC.cs @@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Interfaces { public interface IXMLRPC { - LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID); + LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID, LLUUID channelID); void CloseXMLRPCChannel(LLUUID channelKey); bool hasRequests(); 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 bf21dd35b0..aa7a20f265 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 * * Generate a LLUUID channel key and add it and * the prim id to dictionary + * + * A custom channel key can be proposed. + * Otherwise, passing LLUUID.Zero will generate + * and return a random channel * * First check if there is a channel assigned for * this itemID. If there is, then someone called @@ -169,9 +173,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC * * ********************************************/ - public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID) + public LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID, LLUUID channelID) { - LLUUID channel = new LLUUID(); + LLUUID newChannel = LLUUID.Zero; //Is a dupe? foreach (RPCChannelInfo ci in m_openChannels.Values) @@ -179,22 +183,22 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC if (ci.GetItemID().Equals(itemID)) { // return the original channel ID for this item - channel = ci.GetChannelID(); + newChannel = ci.GetChannelID(); break; } } - if (channel == LLUUID.Zero) + if (newChannel == LLUUID.Zero) { - channel = LLUUID.Random(); - RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); + newChannel = (channelID == LLUUID.Zero) ? LLUUID.Random() : channelID; + RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel); lock (XMLRPCListLock) { - m_openChannels.Add(channel, rpcChanInfo); + m_openChannels.Add(newChannel, rpcChanInfo); } } - return channel; + return newChannel; } // 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 07db853e0c..b7b040d6bd 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 m_LSL_Functions.osSetStateEvents(events); } + public void osOpenRemoteDataChannel(string channel) + { + m_LSL_Functions.osOpenRemoteDataChannel(channel); + } + // 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 cd2015f903..6bdfe9a06a 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 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); if (xmlrpcMod.IsEnabled()) { - LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID); + LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, LLUUID.Zero); 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) }; m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); } diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands.cs index 03d3a41624..bd7ad82673 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; using OpenSim.Framework.Console; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; +using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase; //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; @@ -531,5 +532,16 @@ namespace OpenSim.Region.ScriptEngine.Common m_host.SetScriptEvents(m_itemID, events); } + public void osOpenRemoteDataChannel(string channel) + { + m_host.AddScriptLPS(1); + IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface(); + if (xmlrpcMod.IsEnabled()) + { + LLUUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, new LLUUID(channel)); + 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) }; + m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); + } + } } } diff --git a/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/OSSL_BuilIn_Commands_Interface.cs index aa9c8c79c9..171bffdee8 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 string osDrawImage(string drawList, int width, int height, string imageUrl); void osSetStateEvents(int events); + void osOpenRemoteDataChannel(string channel); + } }