From c95bdb83c0d91ecb4c5a73e3ae4deadbcc54955f Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 9 Sep 2008 05:25:29 +0000 Subject: * Adds OnGenericMessage and SendGenericMessage functionality to IClientAPI. * Please don't break the build. *fingers crossed* --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Region/ClientStack') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3c860a9..f778557 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -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 OnLogout; public event ObjectPermissions OnObjectPermissions; public event Action OnConnectionClosed; @@ -1119,6 +1121,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } + public void SendGenericMessage(string method, List 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); + } + /// /// Send the region heightmap to the client /// @@ -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 msg = new List(); + + 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) { -- cgit v1.1