From 20a77a6d4b05ee15b7b04a81920d19462e6e542a Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 12 Jul 2007 15:16:19 +0000 Subject: 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. --- OpenSim/Framework/Communications/IGridServices.cs | 2 -- OpenSim/Framework/General/Interfaces/IClientAPI.cs | 2 +- OpenSim/Region/Capabilities/Caps.cs | 6 +++- OpenSim/Region/Capabilities/LLSDCapsDetails.cs | 2 ++ OpenSim/Region/ClientStack/ClientView.API.cs | 38 +++++++++++++--------- .../ClientStack/ClientView.ProcessPackets.cs | 2 -- .../Environment/Scenes/Scene.PacketHandlers.cs | 6 ++-- 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs index c296209..d2e5ab6 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 d409ebe..9079ca5 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 7216691..7acbf8e 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 1522559..ecb2328 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 e88995f..5be82dd 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; - - 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); + 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]; + + this.OutPacket(msg); + } } /// diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 3265898..e5249f9 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 1753772..14bf87c 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 { -- cgit v1.1