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;
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
byte audible);
void SendChatMessage(
string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, UUID ownerID, byte source,
byte audible);
}
}
}

View File

@ -1099,8 +1099,20 @@ namespace OpenSim.Framework
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args);
void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, UUID fromAgentID, byte source,
byte audible);
/// <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);
void SendInstantMessage(GridInstantMessage im);

View File

@ -817,8 +817,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(mov, ThrottleOutPacketType.Unknown);
}
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)
{
ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
reply.ChatData.Audible = audible;
@ -827,7 +828,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
reply.ChatData.SourceType = source;
reply.ChatData.Position = fromPos;
reply.ChatData.FromName = Util.StringToBytes256(fromName);
reply.ChatData.OwnerID = fromAgentID;
reply.ChatData.OwnerID = ownerID;
reply.ChatData.SourceID = fromAgentID;
OutPacket(reply, ThrottleOutPacketType.Task);

View File

@ -186,6 +186,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
{
string fromName = c.From;
UUID fromID = UUID.Zero;
UUID ownerID = UUID.Zero;
UUID targetID = c.TargetUUID;
string message = c.Message;
IScene scene = c.Scene;
@ -208,12 +209,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
fromPos = avatar.AbsolutePosition;
fromName = avatar.Name;
fromID = c.Sender.AgentId;
ownerID = c.Sender.AgentId;
break;
case ChatSourceType.Object:
fromID = c.SenderUUID;
if (c.SenderObject != null && c.SenderObject is SceneObjectPart)
ownerID = ((SceneObjectPart)c.SenderObject).OwnerID;
break;
}
@ -236,7 +241,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
s.ForEachRootScenePresence(
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);
}
);
@ -248,8 +254,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
ScenePresence presence = s.GetScenePresence(targetID);
if (presence != null && !presence.IsChildAgent)
{
if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, ChatTypeEnum.Say, message, sourceType, true))
receiverIDs.Add(presence.UUID);
if (TrySendChatMessage(
presence, fromPos, regionPos, fromID, ownerID, fromName, ChatTypeEnum.Say, message, sourceType, true))
receiverIDs.Add(presence.UUID);
}
}
}
@ -305,9 +312,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
(null != c.SenderObject) &&
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
return;
client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
client.SendChatMessage(
c.Message, (byte)cType, CenterOfRegion, fromName, fromID, fromID,
(byte)sourceType, (byte)ChatAudibleLevel.Fully);
receiverIDs.Add(client.AgentId);
});
@ -322,15 +331,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
/// <param name="fromPos"></param>
/// <param name="regionPos">/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="type"></param>
/// <param name="message"></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
/// precondition</returns>
protected virtual bool TrySendChatMessage(ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src, bool ignoreDistance)
protected virtual bool TrySendChatMessage(
ScenePresence presence, Vector3 fromPos, Vector3 regionPos,
UUID fromAgentID, UUID ownerID, string fromName, ChatTypeEnum type,
string message, ChatSourceType src, bool ignoreDistance)
{
// don't send stuff to child agents
if (presence.IsChildAgent) return false;
@ -353,10 +367,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
}
// 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, (byte)src, (byte)ChatAudibleLevel.Fully);
presence.ControllingClient.SendChatMessage(
message, (byte) type, fromPos, fromName,
fromAgentID, ownerID, (byte)src, (byte)ChatAudibleLevel.Fully);
return true;
}
}
}
}

View File

@ -38,6 +38,18 @@ namespace OpenSim.Region.Framework.Scenes
{
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,
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)
IRC_SendChannelPrivmsg(fromName, message);

View File

@ -546,8 +546,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge
c.SenderUUID = UUID.Zero;
c.Scene = agent.Scene;
agent.ControllingClient.SendChatMessage(msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero,
(byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
agent.ControllingClient.SendChatMessage(
msg, (byte) ChatTypeEnum.Say, PosOfGod, m_whoami, UUID.Zero, UUID.Zero,
(byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
}
private static void checkStringParameters(XmlRpcRequest request, string[] param)

View File

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