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.
0.6.0-stable
Charles Krinke 2008-05-28 02:06:56 +00:00
parent 5f2b8fd5e1
commit 6d51eef9ce
6 changed files with 33 additions and 10 deletions

View File

@ -32,7 +32,7 @@ namespace OpenSim.Region.Environment.Interfaces
{ {
public interface IXMLRPC public interface IXMLRPC
{ {
LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID); LLUUID OpenXMLRPCChannel(uint localID, LLUUID itemID, LLUUID channelID);
void CloseXMLRPCChannel(LLUUID channelKey); void CloseXMLRPCChannel(LLUUID channelKey);
bool hasRequests(); bool hasRequests();
void RemoteDataReply(string channel, string message_id, string sdata, int idata); void RemoteDataReply(string channel, string message_id, string sdata, int idata);

View File

@ -161,6 +161,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
* Generate a LLUUID channel key and add it and * Generate a LLUUID channel key and add it and
* the prim id to dictionary <channelUUID, primUUID> * the prim id to dictionary <channelUUID, primUUID>
* *
* 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 * First check if there is a channel assigned for
* this itemID. If there is, then someone called * this itemID. If there is, then someone called
* llOpenRemoteDataChannel twice. Just return the * llOpenRemoteDataChannel twice. Just return the
@ -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? //Is a dupe?
foreach (RPCChannelInfo ci in m_openChannels.Values) foreach (RPCChannelInfo ci in m_openChannels.Values)
@ -179,22 +183,22 @@ namespace OpenSim.Region.Environment.Modules.Scripting.XMLRPC
if (ci.GetItemID().Equals(itemID)) if (ci.GetItemID().Equals(itemID))
{ {
// return the original channel ID for this item // return the original channel ID for this item
channel = ci.GetChannelID(); newChannel = ci.GetChannelID();
break; break;
} }
} }
if (channel == LLUUID.Zero) if (newChannel == LLUUID.Zero)
{ {
channel = LLUUID.Random(); newChannel = (channelID == LLUUID.Zero) ? LLUUID.Random() : channelID;
RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, channel); RPCChannelInfo rpcChanInfo = new RPCChannelInfo(localID, itemID, newChannel);
lock (XMLRPCListLock) lock (XMLRPCListLock)
{ {
m_openChannels.Add(channel, rpcChanInfo); m_openChannels.Add(newChannel, rpcChanInfo);
} }
} }
return channel; return newChannel;
} }
// Delete channels based on itemID // Delete channels based on itemID

View File

@ -2011,6 +2011,11 @@ namespace OpenSim.Region.ScriptEngine.Common
m_LSL_Functions.osSetStateEvents(events); m_LSL_Functions.osSetStateEvents(events);
} }
public void osOpenRemoteDataChannel(string channel)
{
m_LSL_Functions.osOpenRemoteDataChannel(channel);
}
// //
public double llList2Float(LSL_Types.list src, int index) public double llList2Float(LSL_Types.list src, int index)

View File

@ -4362,7 +4362,7 @@ namespace OpenSim.Region.ScriptEngine.Common
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
if (xmlrpcMod.IsEnabled()) 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) }; 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); m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj);
} }

View File

@ -31,6 +31,7 @@ using Nini.Config;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase;
//using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; //using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
@ -531,5 +532,16 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.SetScriptEvents(m_itemID, events); m_host.SetScriptEvents(m_itemID, events);
} }
public void osOpenRemoteDataChannel(string channel)
{
m_host.AddScriptLPS(1);
IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
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);
}
}
} }
} }

View File

@ -62,5 +62,7 @@ namespace OpenSim.Region.ScriptEngine.Common
string osDrawImage(string drawList, int width, int height, string imageUrl); string osDrawImage(string drawList, int width, int height, string imageUrl);
void osSetStateEvents(int events); void osSetStateEvents(int events);
void osOpenRemoteDataChannel(string channel);
} }
} }