* Adds OnGenericMessage and SendGenericMessage functionality to IClientAPI.

* Please don't break the build. *fingers crossed*
0.6.0-stable
Adam Frisby 2008-09-09 05:25:29 +00:00
parent 4f85a9aa72
commit c95bdb83c0
4 changed files with 59 additions and 2 deletions

View File

@ -39,6 +39,8 @@ namespace OpenSim.Framework
public delegate void ChatMessage(Object sender, OSChatMessage e);
public delegate void GenericMessage(Object sender, string method, List<String> args);
public delegate void TextureRequest(Object sender, TextureRequestArgs e);
public delegate void AvatarNowWearing(Object sender, AvatarWearingArgs e);
@ -356,6 +358,9 @@ namespace OpenSim.Framework
// [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")]
uint CircuitCode { get; }
event GenericMessage OnGenericMessage;
// [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")]
event ImprovedInstantMessage OnInstantMessage;
// [Obsolete("LLClientView Specific - Replace with more bare-bones arguments. Rename OnChat.")]
@ -547,6 +552,8 @@ namespace OpenSim.Framework
UUID imSessionID, string fromName, byte dialog, uint timeStamp,
byte[] binaryBucket);
void SendGenericMessage(string method, List<string> message);
void SendLayerData(float[] map);
void SendLayerData(int px, int py, float[] map);

View File

@ -120,6 +120,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/* Instantiated Designated Event Delegates */
//- used so we don't create new objects for each incoming packet and then toss it out later */
private GenericMessage handlerGenericMessage = null;
private RequestAvatarProperties handlerRequestAvatarProperties = null; //OnRequestAvatarProperties;
private UpdateAvatarProperties handlerUpdateAvatarProperties = null; // OnUpdateAvatarProperties;
private ChatMessage handlerChatFromViewer = null; //OnChatFromViewer;
@ -820,6 +821,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
# endregion
// Previously ClientView.API partial class
public event GenericMessage OnGenericMessage;
public event Action<IClientAPI> OnLogout;
public event ObjectPermissions OnObjectPermissions;
public event Action<IClientAPI> OnConnectionClosed;
@ -1119,6 +1121,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
public void SendGenericMessage(string method, List<string> message)
{
GenericMessagePacket gmp = new GenericMessagePacket();
gmp.MethodData.Method = Utils.StringToBytes(method);
gmp.ParamList = new GenericMessagePacket.ParamListBlock[message.Count];
int i = 0;
foreach (string val in message)
{
gmp.ParamList[i] = new GenericMessagePacket.ParamListBlock();
gmp.ParamList[i++].Parameter = Utils.StringToBytes(val);
}
OutPacket(gmp, ThrottleOutPacketType.Task);
}
/// <summary>
/// Send the region heightmap to the client
/// </summary>
@ -3320,6 +3337,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.ParcelBuy, HandleParcelBuyRequest);
AddLocalPacketHandler(PacketType.UUIDGroupNameRequest, HandleUUIDGroupNameRequest);
AddLocalPacketHandler(PacketType.ObjectGroup, HandleObjectGroupRequest);
AddLocalPacketHandler(PacketType.GenericMessage, HandleGenericMessage);
}
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
@ -3380,6 +3398,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
public bool HandleGenericMessage(IClientAPI sender, Packet pack)
{
GenericMessagePacket gmpack = (GenericMessagePacket) pack;
handlerGenericMessage = OnGenericMessage;
List<string> msg = new List<string>();
if(handlerGenericMessage != null)
{
string method = Util.FieldToString(gmpack.MethodData.Method);
foreach (GenericMessagePacket.ParamListBlock block in gmpack.ParamList)
{
msg.Add(Util.FieldToString(block.Parameter));
}
handlerGenericMessage(this, method, msg);
}
return true;
}
public bool HandleObjectGroupRequest(IClientAPI sender, Packet Pack)
{

View File

@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event MoneyTransferRequest OnMoneyTransferRequest;
public event ParcelBuy OnParcelBuy;
public event Action<IClientAPI> OnConnectionClosed;
public event GenericMessage OnGenericMessage;
public event ImprovedInstantMessage OnInstantMessage;
public event ChatMessage OnChatFromViewer;
public event TextureRequest OnRequestTexture;
@ -465,6 +465,11 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
{
}
public void SendGenericMessage(string method, List<string> message)
{
}
public virtual void SendLayerData(float[] map)
{
}
@ -762,6 +767,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
get { return m_circuitCode; }
set { m_circuitCode = value; }
}
public void SendBlueBoxMessage(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message)
{

View File

@ -141,7 +141,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event MoveTaskInventory OnMoveTaskItem;
public event RemoveTaskInventory OnRemoveTaskItem;
public event RequestAsset OnRequestAsset;
public event GenericMessage OnGenericMessage;
public event UUIDNameRequest OnNameFromUUIDRequest;
public event UUIDNameRequest OnUUIDGroupNameRequest;
@ -379,6 +379,11 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public void SendGenericMessage(string method, List<string> message)
{
}
public virtual void SendLayerData(float[] map)
{
}
@ -751,6 +756,7 @@ namespace OpenSim.Region.Examples.SimpleModule
get { return m_circuitCode; }
set { m_circuitCode = value; }
}
public void SendBlueBoxMessage(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message)
{