From 20a77a6d4b05ee15b7b04a81920d19462e6e542a Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 12 Jul 2007 15:16:19 +0000 Subject: [PATCH] Fixed a number of bugs in the local InstantMessage handling, sending InstantMessages will no longer crash the server. But they still aren't really working correctly, you can't type replies to received messages. --- .../Framework/Communications/IGridServices.cs | 2 -- .../General/Interfaces/IClientAPI.cs | 2 +- OpenSim/Region/Capabilities/Caps.cs | 6 +++- .../Region/Capabilities/LLSDCapsDetails.cs | 2 ++ OpenSim/Region/ClientStack/ClientView.API.cs | 36 +++++++++++-------- .../ClientStack/ClientView.ProcessPackets.cs | 2 -- .../Scenes/Scene.PacketHandlers.cs | 6 ++-- 7 files changed, 33 insertions(+), 23 deletions(-) diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index c296209184..d2e5ab69f0 100644 --- a/OpenSim/Framework/Communications/IGridServices.cs +++ b/OpenSim/Framework/Communications/IGridServices.cs @@ -31,8 +31,6 @@ using OpenSim.Framework.Types; namespace OpenSim.Framework.Communications { - - public interface IGridServices { RegionCommsListener RegisterRegion(RegionInfo regionInfos); diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index d409ebe76e..9079ca5f96 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -154,7 +154,7 @@ namespace OpenSim.Framework.Interfaces void SendRegionHandshake(RegionInfo regionInfo); void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); - void SendInstantMessage(string message, LLUUID target); + void SendInstantMessage(string message, LLUUID target, string fromName, LLUUID id); void SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 7216691e25..7acbf8e53d 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -79,7 +79,7 @@ namespace OpenSim.Region.Capabilities AddLegacyCapsHandler(httpListener, m_requestPath, CapsRequest); // AddLegacyCapsHandler( httpListener, eventQueue, ProcessEventQueue); - // AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); + // AddLegacyCapsHandler( httpListener, m_requestTexture, RequestTexture); } [Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] @@ -98,6 +98,7 @@ namespace OpenSim.Region.Capabilities /// public string CapsRequest(string request, string path, string param) { + // Console.WriteLine("caps request " + request); string result = LLSDHelpers.SerialiseLLSDReply(this.GetCapabilities()); return result; } @@ -112,6 +113,8 @@ namespace OpenSim.Region.Capabilities string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath; caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; + //caps.RequestTextureDownload = capsBaseUrl + m_requestTexture; + // caps.ChatSessionRequest = capsBaseUrl + m_requestTexture; return caps; } @@ -149,6 +152,7 @@ namespace OpenSim.Region.Capabilities /// public string RequestTexture(string request, string path, string param) { + Console.WriteLine("texture request " + request); // Needs implementing (added to remove compiler warning) return ""; } diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs index 1522559863..ecb2328450 100644 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs @@ -6,6 +6,8 @@ namespace OpenSim.Region.Capabilities public string MapLayer = ""; public string NewFileAgentInventory = ""; //public string EventQueueGet = ""; + //public string RequestTextureDownload = ""; + //public string ChatSessionRequest = ""; public LLSDCapsDetails() { diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index e88995fc96..5be82dd0bd 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -245,23 +245,29 @@ namespace OpenSim.Region.ClientStack /// TODO /// /// - public void SendInstantMessage(string message, LLUUID target) + public void SendInstantMessage(string message, LLUUID target, string fromName) { - ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); - msg.AgentData.AgentID = this.AgentID; - msg.AgentData.SessionID = this.SessionID; + if (message != "typing") + { + Encoding enc = Encoding.ASCII; + ImprovedInstantMessagePacket msg = new ImprovedInstantMessagePacket(); + msg.AgentData.AgentID = this.AgentID; + msg.AgentData.SessionID = this.SessionID; + msg.MessageBlock.FromAgentName = enc.GetBytes(fromName + " \0"); + msg.MessageBlock.Dialog = 0; + msg.MessageBlock.FromGroup = false; + msg.MessageBlock.ID = target.Combine(this.SecureSessionID); + msg.MessageBlock.Offline = 0; + msg.MessageBlock.ParentEstateID = 0; + msg.MessageBlock.Position = new LLVector3(); + msg.MessageBlock.RegionID = new LLUUID(); + msg.MessageBlock.Timestamp = 0; + msg.MessageBlock.ToAgentID = target; + msg.MessageBlock.Message = enc.GetBytes(message + "\0"); + msg.MessageBlock.BinaryBucket = new byte[0]; - msg.MessageBlock.Dialog = 0; - msg.MessageBlock.FromGroup = false; - msg.MessageBlock.ID = target.Combine(this.AgentID); - msg.MessageBlock.Offline = 0; - msg.MessageBlock.ParentEstateID = 0; - msg.MessageBlock.Position = new LLVector3(); - msg.MessageBlock.RegionID = new LLUUID(); - msg.MessageBlock.Timestamp = 0; - msg.MessageBlock.ToAgentID = target; - - this.OutPacket(msg); + this.OutPacket(msg); + } } /// diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 32658988a1..e5249f9892 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -102,9 +102,7 @@ namespace OpenSim.Region.ClientStack this.OnInstantMessage(msgpack.AgentData.AgentID, msgpack.MessageBlock.ToAgentID, msgpack.MessageBlock.Timestamp, IMfromName, IMmessage); } - break; - case PacketType.RezObject: RezObjectPacket rezPacket = (RezObjectPacket)Pack; AgentInventory inven = this.m_inventoryCache.GetAgentsInventory(this.AgentID); diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 1753772685..14bf87c3d1 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -113,8 +113,10 @@ namespace OpenSim.Region.Environment.Scenes if (this.Avatars.ContainsKey(fromAgentID)) { // Local sim message - ScenePresence avatar = this.Avatars[fromAgentID]; - avatar.ControllingClient.SendInstantMessage(message, toAgentID); + ScenePresence fromAvatar = this.Avatars[fromAgentID]; + ScenePresence toAvatar = this.Avatars[toAgentID]; + string fromName = fromAvatar.firstname + " " + fromAvatar.lastname; + toAvatar.ControllingClient.SendInstantMessage(message, toAgentID, fromName); } else {