From 83ca8bd178c397c58d13e2a7fd089f2d2998784b Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 13 Dec 2007 07:10:32 +0000 Subject: Fix for #176 (... doesn't appear in chat bubbles). This also gets the viewer to handle starting/stopping of the typing animation. --- OpenSim/Region/ClientStack/ClientView.cs | 25 +++++---- OpenSim/Region/Environment/Modules/ChatModule.cs | 61 ++++++---------------- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 17 ------ 3 files changed, 27 insertions(+), 76 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 750226d..653077f 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -2095,9 +2095,8 @@ namespace OpenSim.Region.ClientStack { NeedAck.Add(Pack.Header.Sequence, Pack); } - catch (Exception e) // HACKY + catch (Exception) // HACKY { - e.ToString(); // Ignore // Seems to throw a exception here occasionally // of 'duplicate key' despite being locked. @@ -2159,17 +2158,17 @@ namespace OpenSim.Region.ClientStack // Actually make the byte array and send it try { - byte[] sendbuffer = Pack.ToBytes(); - if (Pack.Header.Zerocoded) - { - byte[] ZeroOutBuffer = new byte[4096]; - int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); - m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); - } - else - { - m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); - } + byte[] sendbuffer = Pack.ToBytes(); + if (Pack.Header.Zerocoded) + { + byte[] ZeroOutBuffer = new byte[4096]; + int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); + m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); + } + else + { + m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); + } } catch (Exception e) { diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 081e7ac..75d3670 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -119,31 +119,15 @@ namespace OpenSim.Region.Environment.Modules LLVector3 toRegionPos = presence.AbsolutePosition + regionPos; int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos)); - switch (type) + if (type == ChatTypeEnum.Whisper && dis > m_whisperdistance || + type == ChatTypeEnum.Say && dis > m_saydistance || + type == ChatTypeEnum.Shout && dis > m_shoutdistance) { - 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; + return; } + + // 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); } } @@ -185,32 +169,17 @@ namespace OpenSim.Region.Environment.Modules { m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message); } - - if (e.Channel == 0) - { - foreach (Scene s in m_scenes) - { - s.ForEachScenePresence(delegate(ScenePresence presence) - { - TrySendChatMessage(presence, fromPos, regionPos, - fromAgentID, fromName, e.Type, message); - }); - } - } } - else + + if (e.Channel == 0) { - if (avatar != null) + foreach (Scene s in m_scenes) { - switch (e.Type) - { - case ChatTypeEnum.StartTyping: - avatar.setTyping(true); - break; - case ChatTypeEnum.StopTyping: - avatar.setTyping(false); - break; - } + s.ForEachScenePresence(delegate(ScenePresence presence) + { + TrySendChatMessage(presence, fromPos, regionPos, + fromAgentID, fromName, e.Type, message); + }); } } } diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 512eed0..3460e8f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -964,23 +964,6 @@ namespace OpenSim.Region.Environment.Scenes m_forcesList.Add(newVelocity); } - /// - /// Sets whether or not the agent is typing. - /// - public void setTyping(bool typing) - { - if (m_isChildAgent) - { - MainLog.Instance.Warn("setTyping called on child agent"); - return; - } - - if (typing) - AddAnimation(Animations.AnimsLLUUID["TYPE"], 1); - else - RemoveAnimation(Animations.AnimsLLUUID["TYPE"]); - } - #endregion #region Overridden Methods -- cgit v1.1