From bdab40280b64e31b763a99f6c2011e7e91e7d0fa Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 8 Jul 2007 03:32:27 +0000 Subject: * Added instant message support for the local region. Grid support forthcoming. --- OpenSim/Framework/General/Interfaces/IClientAPI.cs | 3 ++ OpenSim/Framework/General/OpenSim.Framework.csproj | 40 ++++++++++++---------- OpenSim/Region/ClientStack/ClientView.API.cs | 25 ++++++++++++++ .../ClientStack/ClientView.ProcessPackets.cs | 14 ++++++++ .../Environment/Scenes/Scene.PacketHandlers.cs | 24 +++++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 1 + 6 files changed, 89 insertions(+), 18 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 2c7e143..acacabe 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -34,6 +34,7 @@ using OpenSim.Framework.Types; namespace OpenSim.Framework.Interfaces { public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID); + public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message); // Cut down from full list public delegate void RezObject(AssetBase primAsset, LLVector3 pos); public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west); public delegate void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam); @@ -74,6 +75,7 @@ namespace OpenSim.Framework.Interfaces public interface IClientAPI { + event ImprovedInstantMessage OnInstantMessage; event ChatFromViewer OnChatFromViewer; event RezObject OnRezObject; event ModifyTerrain OnModifyTerrain; @@ -146,6 +148,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 SendLayerData(float[] map); void SendLayerData(int px, int py, float[] map); void MoveAgentIntoRegion(RegionInfo regInfo, LLVector3 pos, LLVector3 look); diff --git a/OpenSim/Framework/General/OpenSim.Framework.csproj b/OpenSim/Framework/General/OpenSim.Framework.csproj index c5124cd..192e757 100644 --- a/OpenSim/Framework/General/OpenSim.Framework.csproj +++ b/OpenSim/Framework/General/OpenSim.Framework.csproj @@ -1,4 +1,4 @@ - + Local 8.0.50727 @@ -6,7 +6,8 @@ {8ACA2445-0000-0000-0000-000000000000} Debug AnyCPU - + + OpenSim.Framework @@ -15,9 +16,11 @@ IE50 false Library - + + OpenSim.Framework - + + @@ -28,7 +31,8 @@ TRACE;DEBUG - + + True 4096 False @@ -37,7 +41,8 @@ False False 4 - + + False @@ -46,7 +51,8 @@ TRACE - + + False 4096 True @@ -55,36 +61,34 @@ False False 4 - + + - + ..\..\..\bin\Db4objects.Db4o.dll False - + ..\..\..\bin\libsecondlife.dll False - + System.dll False - + System.Xml.dll False - - ..\..\..\bin\XMLRPC.dll - False - + OpenSim.Framework.Console {A7CD0630-0000-0000-0000-000000000000} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False + False @@ -201,4 +205,4 @@ - + \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 9e7117f..cefe856 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -40,6 +40,7 @@ namespace OpenSim.Region.ClientStack { partial class ClientView { + public event ImprovedInstantMessage OnInstantMessage; public event ChatFromViewer OnChatFromViewer; public event RezObject OnRezObject; public event GenericCall4 OnDeRezObject; @@ -236,6 +237,30 @@ namespace OpenSim.Region.ClientStack this.OutPacket(reply); } + /// + /// + /// + /// TODO + /// + /// + public void SendInstantMessage(string message, LLUUID target) + { + 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); + } /// /// Send the region heightmap to the client diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 0114fb1..def14c7 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -92,6 +92,20 @@ namespace OpenSim.Region.ClientStack this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID); } break; + case PacketType.ImprovedInstantMessage: + ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; + + string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); + string IMmessage = Util.FieldToString(msgpack.MessageBlock.Message); + + if (OnInstantMessage != null) + { + 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 bcef137..7535049 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -100,6 +100,30 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// + /// Inefficient. TODO: Fixme + /// + /// + /// + /// + /// + public void InstantMessage(LLUUID fromAgentID, LLUUID toAgentID, uint timestamp, string fromAgentName, string message) + { + if (this.Avatars.ContainsKey(toAgentID)) + { + // Local sim message + ScenePresence avatar = this.Avatars[toAgentID]; + + + } + else + { + // Grid message + } + } + + /// + /// + /// /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1f370c4..fdf3cc8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -450,6 +450,7 @@ namespace OpenSim.Region.Environment.Scenes client.OnRegionHandShakeReply += this.SendLayerData; //remoteClient.OnRequestWearables += new GenericCall(this.GetInitialPrims); client.OnChatFromViewer += this.SimChat; + client.OnInstantMessage += this.InstantMessage; client.OnRequestWearables += this.InformClientOfNeighbours; client.OnAddPrim += this.AddNewPrim; client.OnUpdatePrimPosition += this.UpdatePrimPosition; -- cgit v1.1