Fix script error messages not showing up in viewer 3 and associated viewers.

Viewer 3 will discard such a message if the chat message owner does not match the avatar.
We were filling the ownerID with the primID, so this never matched, hence viewer 3 did not see any script error messages.
This commit fills the ownerID in with the prim ownerID so the script owner will receive script error messages.
This does not affect viewer 1 and associated viewers which continue to process script errors as normal.
integration
Justin Clark-Casey (justincc) 2012-10-25 03:26:12 +01:00
parent 8af8319b95
commit c13a99dc5c
9 changed files with 75 additions and 34 deletions

View File

@ -33,7 +33,8 @@ namespace OpenSim.Framework.Client
{ {
event ChatMessage OnChatFromClient; event ChatMessage OnChatFromClient;
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, void SendChatMessage(
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
byte audible); byte audible);
} }
} }

View File

@ -1099,7 +1099,19 @@ namespace OpenSim.Framework
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs); void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args); void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, /// <summary>
/// Send chat to the viewer.
/// </summary>
/// <param name='message'></param>
/// <param name='type'></param>
/// <param name='fromPos'></param>
/// <param name='fromName'></param>
/// <param name='fromAgentID'></param>
/// <param name='ownerID'></param>
/// <param name='source'></param>
/// <param name='audible'></param>
void SendChatMessage(
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
byte audible); byte audible);
void SendInstantMessage(GridInstantMessage im); void SendInstantMessage(GridInstantMessage im);

View File

@ -817,8 +817,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(mov, ThrottleOutPacketType.Unknown); OutPacket(mov, ThrottleOutPacketType.Unknown);
} }
public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, public void SendChatMessage(
UUID fromAgentID, byte source, byte audible) string message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, UUID ownerID, byte source, byte audible)
{ {
ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator); ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
reply.ChatData.Audible = audible; reply.ChatData.Audible = audible;
@ -827,7 +828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.ChatData.SourceType = source; reply.ChatData.SourceType = source;
reply.ChatData.Position = fromPos; reply.ChatData.Position = fromPos;
reply.ChatData.FromName = Util.StringToBytes256(fromName); reply.ChatData.FromName = Util.StringToBytes256(fromName);
reply.ChatData.OwnerID = fromAgentID; reply.ChatData.OwnerID = ownerID;
reply.ChatData.SourceID = fromAgentID; reply.ChatData.SourceID = fromAgentID;
OutPacket(reply, ThrottleOutPacketType.Task); OutPacket(reply, ThrottleOutPacketType.Task);

View File

@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
{ {
string fromName = c.From; string fromName = c.From;
UUID fromID = UUID.Zero; UUID fromID = UUID.Zero;
UUID ownerID = UUID.Zero;
UUID targetID = c.TargetUUID; UUID targetID = c.TargetUUID;
string message = c.Message; string message = c.Message;
IScene scene = c.Scene; IScene scene = c.Scene;
@ -208,12 +209,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromPos = avatar.AbsolutePosition; fromPos = avatar.AbsolutePosition;
fromName = avatar.Name; fromName = avatar.Name;
fromID = c.Sender.AgentId; fromID = c.Sender.AgentId;
ownerID = c.Sender.AgentId;
break; break;
case ChatSourceType.Object: case ChatSourceType.Object:
fromID = c.SenderUUID; fromID = c.SenderUUID;
if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
break; break;
} }
@ -236,7 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
s.ForEachRootScenePresence( s.ForEachRootScenePresence(
delegate(ScenePresence presence) delegate(ScenePresence presence)
{ {
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType, false)) if (TrySendChatMessage(
presence, fromPos, regionPos, fromID, ownerID, fromName, c.Type, message, sourceType, false))
receiverIDs.Add(presence.UUID); receiverIDs.Add(presence.UUID);
} }
); );
@ -248,7 +254,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
ScenePresence presence = s.GetScenePresence(targetID); ScenePresence presence = s.GetScenePresence(targetID);
if (presence != null && !presence.IsChildAgent) if (presence != null && !presence.IsChildAgent)
{ {
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true)) if (TrySendChatMessage(
presence, fromPos, regionPos, fromID, ownerID, fromName, ChatTypeEnum.Say, message, sourceType, true))
receiverIDs.Add(presence.UUID); receiverIDs.Add(presence.UUID);
} }
} }
@ -306,8 +313,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
return; return;
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, client.SendChatMessage(
c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully); (byte)sourceType, (byte)ChatAudibleLevel.Fully);
receiverIDs.Add(client.AgentId); receiverIDs.Add(client.AgentId);
}); });
@ -322,14 +331,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
/// <param name="fromPos"></param> /// <param name="fromPos"></param>
/// <param name="regionPos">/param> /// <param name="regionPos">/param>
/// <param name="fromAgentID"></param> /// <param name="fromAgentID"></param>
/// <param name='ownerID'>
/// Owner of the message. For at least some messages from objects, this has to be correctly filled with the owner's UUID.
/// This is the case for script error messages in viewer 3 since LLViewer change EXT-7762
/// </param>
/// <param name="fromName"></param> /// <param name="fromName"></param>
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="message"></param> /// <param name="message"></param>
/// <param name="src"></param> /// <param name="src"></param>
/// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a /// <returns>true if the message was sent to the receiver, false if it was not sent due to failing a
/// precondition</returns> /// precondition</returns>
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos, protected virtual bool TrySendChatMessage(
UUID fromAgentID, string fromName, ChatTypeEnum type, ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src, bool ignoreDistance) string message, ChatSourceType src, bool ignoreDistance)
{ {
// don't send stuff to child agents // don't send stuff to child agents
@ -353,8 +367,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
} }
// TODO: should change so the message is sent through the avatar rather than direct to the ClientView // 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, presence.ControllingClient.SendChatMessage(
fromAgentID, (byte)src, (byte)ChatAudibleLevel.Fully); message, (byte) type, fromPos, fromName,
fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully);
return true; return true;
} }

View File

@ -38,6 +38,18 @@ namespace OpenSim.Region.Framework.Scenes
{ {
public partial class Scene public partial class Scene
{ {
/// <summary>
/// Send chat to listeners.
/// </summary>
/// <param name='message'></param>
/// <param name='type'>/param>
/// <param name='channel'></param>
/// <param name='fromPos'></param>
/// <param name='fromName'></param>
/// <param name='fromID'></param>
/// <param name='targetID'></param>
/// <param name='fromAgent'></param>
/// <param name='broadcast'></param>
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName, protected void SimChat(byte[] message, ChatTypeEnum type, int channel, Vector3 fromPos, string fromName,
UUID fromID, UUID targetID, bool fromAgent, bool broadcast) UUID fromID, UUID targetID, bool fromAgent, bool broadcast)
{ {

View File

@ -954,7 +954,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
} }
public void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source, byte audible) public void SendChatMessage(
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source, byte audible)
{ {
if (audible > 0 && message.Length > 0) if (audible > 0 && message.Length > 0)
IRC_SendChannelPrivmsg(fromName, message); IRC_SendChannelPrivmsg(fromName, message);

View File

@ -546,7 +546,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
c.SenderUUID = UUID.Zero; c.SenderUUID = UUID.Zero;
c.Scene = agent.Scene; c.Scene = agent.Scene;
agent.ControllingClient.SendChatMessage(msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero, agent.ControllingClient.SendChatMessage(
msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero, UUID.Zero,
(byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully); (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
} }

View File

@ -603,13 +603,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
} }
public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, public virtual void SendChatMessage(
UUID fromAgentID, byte source, byte audible) string message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, UUID ownerID, byte source, byte audible)
{ {
} }
public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName, public virtual void SendChatMessage(
UUID fromAgentID, byte source, byte audible) byte[] message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, UUID ownerID, byte source, byte audible)
{ {
} }

View File

@ -528,13 +528,9 @@ namespace OpenSim.Tests.Common.Mock
{ {
} }
public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, public virtual void SendChatMessage(
UUID fromAgentID, byte source, byte audible) string message, byte type, Vector3 fromPos, string fromName,
{ UUID fromAgentID, UUID ownerID, byte source, byte audible)
}
public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName,
UUID fromAgentID, byte source, byte audible)
{ {
} }