Fix for #176 (... doesn't appear in chat bubbles). This also gets the viewer to handle starting/stopping of the typing animation.

afrisby
Jeff Ames 2007-12-13 07:10:32 +00:00
parent 525139a161
commit 83ca8bd178
3 changed files with 27 additions and 76 deletions

View File

@ -2095,9 +2095,8 @@ namespace OpenSim.Region.ClientStack
{ {
NeedAck.Add(Pack.Header.Sequence, Pack); NeedAck.Add(Pack.Header.Sequence, Pack);
} }
catch (Exception e) // HACKY catch (Exception) // HACKY
{ {
e.ToString();
// Ignore // Ignore
// Seems to throw a exception here occasionally // Seems to throw a exception here occasionally
// of 'duplicate key' despite being locked. // of 'duplicate key' despite being locked.
@ -2159,17 +2158,17 @@ namespace OpenSim.Region.ClientStack
// Actually make the byte array and send it // Actually make the byte array and send it
try try
{ {
byte[] sendbuffer = Pack.ToBytes(); byte[] sendbuffer = Pack.ToBytes();
if (Pack.Header.Zerocoded) if (Pack.Header.Zerocoded)
{ {
byte[] ZeroOutBuffer = new byte[4096]; byte[] ZeroOutBuffer = new byte[4096];
int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer); int packetsize = Helpers.ZeroEncode(sendbuffer, sendbuffer.Length, ZeroOutBuffer);
m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode); m_networkServer.SendPacketTo(ZeroOutBuffer, packetsize, SocketFlags.None, m_circuitCode);
} }
else else
{ {
m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode); m_networkServer.SendPacketTo(sendbuffer, sendbuffer.Length, SocketFlags.None, m_circuitCode);
} }
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -119,31 +119,15 @@ namespace OpenSim.Region.Environment.Modules
LLVector3 toRegionPos = presence.AbsolutePosition + regionPos; LLVector3 toRegionPos = presence.AbsolutePosition + regionPos;
int dis = Math.Abs((int) Util.GetDistanceTo(toRegionPos, fromRegionPos)); 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: return;
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;
} }
// 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); 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) s.ForEachScenePresence(delegate(ScenePresence presence)
{ {
case ChatTypeEnum.StartTyping: TrySendChatMessage(presence, fromPos, regionPos,
avatar.setTyping(true); fromAgentID, fromName, e.Type, message);
break; });
case ChatTypeEnum.StopTyping:
avatar.setTyping(false);
break;
}
} }
} }
} }

View File

@ -964,23 +964,6 @@ namespace OpenSim.Region.Environment.Scenes
m_forcesList.Add(newVelocity); m_forcesList.Add(newVelocity);
} }
/// <summary>
/// Sets whether or not the agent is typing.
/// </summary>
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 #endregion
#region Overridden Methods #region Overridden Methods