diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 43c8c70d92..76578df907 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -50,10 +50,12 @@ namespace OpenSim.Framework Whisper = 0, Say = 1, Shout = 2, + // 3 is an obsolete version of Say StartTyping = 4, StopTyping = 5, Broadcast = 0xFF - } ; + } + public enum ThrottleOutPacketType : int { Resend = 0, @@ -135,6 +137,9 @@ namespace OpenSim.Framework set { m_sender = value; } } + /// + /// + /// public IScene Scene { get { return m_scene; } @@ -153,18 +158,27 @@ namespace OpenSim.Framework private sbyte m_discardLevel; private uint m_packetNumber; + /// + /// + /// public uint PacketNumber { get { return m_packetNumber; } set { m_packetNumber = value; } } + /// + /// + /// public sbyte DiscardLevel { get { return m_discardLevel; } set { m_discardLevel = value; } } + /// + /// + /// public LLUUID RequestedAssetID { get { return m_requestedAssetID; } @@ -176,6 +190,9 @@ namespace OpenSim.Framework { private List m_nowWearing = new List(); + /// + /// + /// public List NowWearing { get { return m_nowWearing; } @@ -269,6 +286,7 @@ namespace OpenSim.Framework public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset); public delegate void AgentSit(IClientAPI remoteClient, LLUUID agentID); + public delegate void AvatarPickerRequest(IClientAPI remoteClient, LLUUID agentdata, LLUUID queryID, string UserQuery); public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient); @@ -340,7 +358,6 @@ namespace OpenSim.Framework public delegate void ObjectPermissions(IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID, List permChanges); - public interface IClientAPI { event ImprovedInstantMessage OnInstantMessage; diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 540536e167..5d5629b721 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -587,7 +587,6 @@ namespace OpenSim.Region.ClientStack /// /// /// - /// TODO /// /// public void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index ef462243f7..081e7ac272 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -110,6 +110,43 @@ namespace OpenSim.Region.Environment.Modules client.OnChatFromViewer += SimChat; } + private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos, + LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message) + { + if (!presence.IsChildAgent) + { + LLVector3 fromRegionPos = fromPos + regionPos; + LLVector3 toRegionPos = presence.AbsolutePosition + regionPos; + int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos)); + + switch (type) + { + case ChatTypeEnum.Whisper: + if (dis < m_whisperdistance) + { + // TODO: should change so the message is sent through the avatar rather than direct to the ClientView + presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID); + } + break; + case ChatTypeEnum.Say: + if (dis < m_saydistance) + { + presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID); + } + break; + case ChatTypeEnum.Shout: + if (dis < m_shoutdistance) + { + presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID); + } + break; + case ChatTypeEnum.Broadcast: + presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID); + break; + } + } + } + public void SimChat(Object sender, ChatFromViewerArgs e) { ScenePresence avatar = null; @@ -123,12 +160,10 @@ namespace OpenSim.Region.Environment.Modules // Filled in since it's easier than rewriting right now. LLVector3 fromPos = e.Position; - LLVector3 fromRegionPos = e.Position + - new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, - 0); + LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); + string fromName = e.From; string message = e.Message; - byte type = (byte) e.Type; LLUUID fromAgentID = LLUUID.Zero; if (e.Sender != null) @@ -139,32 +174,11 @@ namespace OpenSim.Region.Environment.Modules if (avatar != null) { fromPos = avatar.AbsolutePosition; - fromRegionPos = fromPos + - new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); + regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); fromName = avatar.Firstname + " " + avatar.Lastname; fromAgentID = e.Sender.AgentId; } - string typeName; - switch (e.Type) - { - case ChatTypeEnum.Broadcast: - typeName = "broadcasts"; - break; - case ChatTypeEnum.Say: - typeName = "says"; - break; - case ChatTypeEnum.Shout: - typeName = "shouts"; - break; - case ChatTypeEnum.Whisper: - typeName = "whispers"; - break; - default: - typeName = "unknown"; - break; - } - if (e.Message.Length > 0) { if (m_irc.Connected) @@ -174,69 +188,13 @@ namespace OpenSim.Region.Environment.Modules if (e.Channel == 0) { - foreach (Scene m_scene in m_scenes) + foreach (Scene s in m_scenes) { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) - { - if (!presence.IsChildAgent) - { - int dis = -100000; - - LLVector3 avatarRegionPos = presence.AbsolutePosition + - new LLVector3( - scene.RegionInfo.RegionLocX * 256, - scene.RegionInfo.RegionLocY * 256, - 0); - dis = - Math.Abs((int) Util.GetDistanceTo(avatarRegionPos, fromRegionPos)); - - switch (e.Type) - { - case ChatTypeEnum.Whisper: - if (dis < m_whisperdistance) - { - //should change so the message is sent through the avatar rather than direct to the ClientView - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - case ChatTypeEnum.Say: - if (dis < m_saydistance) - { - //Console.WriteLine("sending chat"); - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - case ChatTypeEnum.Shout: - if (dis < m_shoutdistance) - { - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - } - break; - - case ChatTypeEnum.Broadcast: - presence.ControllingClient.SendChatMessage(message, - type, - fromPos, - fromName, - fromAgentID); - break; - default: - break; - } - } - }); + s.ForEachScenePresence(delegate(ScenePresence presence) + { + TrySendChatMessage(presence, fromPos, regionPos, + fromAgentID, fromName, e.Type, message); + }); } } } diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 23dd0d9b03..cf6a94dcbe 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs @@ -65,12 +65,12 @@ namespace OpenSim.Region.Environment.Modules LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog) { - foreach (Scene m_scene in m_scenes) + foreach (Scene scene in m_scenes) { - if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) + if (scene.Entities.ContainsKey(toAgentID) && scene.Entities[toAgentID] is ScenePresence) { - // Local Message - ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; + // Local message + ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; if (!user.IsChildAgent) { user.ControllingClient.SendInstantMessage(fromAgentID, fromAgentSession, message, @@ -83,6 +83,7 @@ namespace OpenSim.Region.Environment.Modules } // Still here, try send via Grid + // TODO } public void PostInitialise() diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 745345d338..0c9f38caa3 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -156,10 +156,10 @@ namespace OpenSim.Region.Environment.Scenes } } } + public void ProcessAvatarPickerRequest(IClientAPI client, LLUUID avatarID, LLUUID RequestID, string query) { //EventManager.TriggerAvatarPickerRequest(); - List AvatarResponses = new List(); AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); @@ -167,7 +167,7 @@ namespace OpenSim.Region.Environment.Scenes AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); AvatarPickerReplyPacket.DataBlock[] searchData = new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); - + agentData.AgentID = avatarID; agentData.QueryID = RequestID; replyPacket.AgentData = agentData; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 05a59a2a16..8eef40ba13 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.Environment.Scenes public Int32 CreationDate; public uint ParentID = 0; - // Main grid has default permissions as follows + // Main grid has default permissions as follows // public uint OwnerMask = FULL_MASK_PERMISSIONS_OWNER; public uint NextOwnerMask = OBJNEXT_OWNER; @@ -85,7 +85,6 @@ namespace OpenSim.Region.Environment.Scenes [XmlIgnore] public uint TimeStampLastActivity = 0; // Will be used for AutoReturn - /// /// Only used internally to schedule client updates /// diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 1b660b8dd3..353382d7dc 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs @@ -59,7 +59,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler private LLUUID m_itemID; private bool throwErrorOnNotImplemented = true; - public LSL_BuiltIn_Commands(ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) { m_ScriptEngine = ScriptEngine; @@ -67,11 +66,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler m_localID = localID; m_itemID = itemID; - //MainLog.Instance.Notice("ScriptEngine", "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); } - private string m_state = "default"; public string State() @@ -95,7 +92,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler return lease; } - public Scene World { get { return m_ScriptEngine.World; } @@ -1022,7 +1018,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler m_host.SetText(text, av3, alpha); } - public double llWater(LSL_Types.Vector3 offset) { NotImplemented("llWater"); @@ -2300,4 +2295,4 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler throw new NotImplementedException("Command not implemented: " + Command); } } -} \ No newline at end of file +}