From ce19234dc865e645166dbe5cc52b6d8eb7c6d0af Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Mon, 5 May 2008 15:53:11 +0000
Subject: * Unraveled the DEBUG_CHANNEL mystery. * Moved script errors to the
debug channel. * Typing '/2147483647 OK' results in a debug_channel message.
* Expanded the available parameters that are send-able through IClientAPI
---
OpenSim/Framework/IClientAPI.cs | 12 +++++++--
.../Region/ClientStack/LindenUDP/LLClientView.cs | 10 ++++----
.../Environment/Modules/Avatar/Chat/ChatModule.cs | 30 +++++++++++++++-------
.../Environment/Scenes/Scene.PacketHandlers.cs | 3 +++
.../Region/Examples/SimpleModule/ComplexObject.cs | 4 +--
.../Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 +--
.../ScriptEngineBase/EventQueueThreadClass.cs | 4 +--
.../ScriptEngine/DotNetEngine/ScriptManager.cs | 2 +-
8 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 02ecc1a..a58114c 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Framework
// 3 is an obsolete version of Say
StartTyping = 4,
StopTyping = 5,
+ DebugChannel = 6,
Broadcast = 0xFF
}
@@ -82,6 +83,7 @@ namespace OpenSim.Framework
protected IScene m_scene;
protected IClientAPI m_sender;
protected ChatTypeEnum m_type;
+ protected LLUUID m_fromID;
public ChatFromViewerArgs()
{
@@ -144,6 +146,12 @@ namespace OpenSim.Framework
set { m_sender = value; }
}
+ public LLUUID SenderUUID
+ {
+ get { return m_fromID; }
+ set { m_fromID = value; }
+ }
+
///
///
///
@@ -653,8 +661,8 @@ namespace OpenSim.Framework
void SendKillObject(ulong regionHandle, uint localID);
void SendAnimations(LLUUID[] animID, int[] seqs, LLUUID sourceAgentId);
void SendRegionHandshake(RegionInfo regionInfo);
- void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
- void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+ void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID, byte source, byte audible);
+ void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID, byte source, byte audible);
void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent,
LLUUID imSessionID, string fromName, byte dialog, uint timeStamp);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 475788a..4ff27e7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -898,18 +898,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
///
///
///
- public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
+ public void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID, byte source, byte audible)
{
- SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
+ SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID, source, audible);
}
- public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
+ public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID, byte source, byte audible)
{
ChatFromSimulatorPacket reply = (ChatFromSimulatorPacket)PacketPool.Instance.GetPacket(PacketType.ChatFromSimulator);
- reply.ChatData.Audible = 1;
+ reply.ChatData.Audible = audible;
reply.ChatData.Message = message;
reply.ChatData.ChatType = type;
- reply.ChatData.SourceType = 1;
+ reply.ChatData.SourceType = source;
reply.ChatData.Position = fromPos;
reply.ChatData.FromName = Helpers.StringToField(fromName);
reply.ChatData.OwnerID = fromAgentID;
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
index 15720fc..9f3429e 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
string fromName = e.From;
string message = e.Message;
- LLUUID fromAgentID = LLUUID.Zero;
+ LLUUID fromAgentID = e.SenderUUID;
if (e.Sender != null)
{
@@ -208,10 +208,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
// We only want to relay stuff on channel 0
- if (e.Channel == 0)
+ if (e.Channel == 0 || e.Channel == 2147483647)
{
+ if (e.Channel == 2147483647)
+ e.Type = ChatTypeEnum.DebugChannel;
+
// IRC stuff
- if (e.Message.Length > 0)
+ if (e.Message.Length > 0 && e.Channel == 0)
{
if (m_irc.Connected && (avatar != null)) // this is to keep objects from talking to IRC
{
@@ -223,8 +226,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{
s.ForEachScenePresence(delegate(ScenePresence presence)
{
- TrySendChatMessage(presence, fromPos, regionPos,
- fromAgentID, fromName, e.Type, message);
+ if (e.Channel == 2147483647)
+ {
+ TrySendChatMessage(presence, fromPos, regionPos,
+ fromAgentID, fromName, e.Type, message, ChatSourceType.Object);
+ }
+ else
+ {
+ TrySendChatMessage(presence, fromPos, regionPos,
+ fromAgentID, fromName, e.Type, message, ChatSourceType.Agent);
+
+ }
});
}
}
@@ -290,7 +302,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
}
private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos,
- LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message)
+ LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message, ChatSourceType src)
{
if (!presence.IsChildAgent)
{
@@ -306,7 +318,7 @@ namespace OpenSim.Region.Environment.Modules.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);
+ presence.ControllingClient.SendChatMessage(message, (byte) type, fromPos, fromName, fromAgentID,(byte)src,(byte)ChatAudibleLevel.Fully);
}
}
@@ -633,7 +645,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
avatar.ControllingClient.SendChatMessage(
Helpers.StringToField(data["msg"]), 255,
pos, data["nick"],
- LLUUID.Zero);
+ LLUUID.Zero,(byte)ChatSourceType.Agent,(byte)ChatAudibleLevel.Fully);
}
});
}
@@ -678,7 +690,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
avatar.ControllingClient.SendChatMessage(
Helpers.StringToField(message), 255,
pos, sender,
- LLUUID.Zero);
+ LLUUID.Zero,(byte)ChatSourceType.Object,(byte)ChatAudibleLevel.Fully);
}
});
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index dccc09a..b4a581d 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -53,6 +53,8 @@ namespace OpenSim.Region.Environment.Scenes
args.Channel = channel;
args.Type = type;
args.Position = fromPos;
+ args.SenderUUID = fromAgentID;
+
ScenePresence user = GetScenePresence(fromAgentID);
if (user != null)
@@ -61,6 +63,7 @@ namespace OpenSim.Region.Environment.Scenes
args.Sender = null;
args.From = fromName;
+ //args.
m_simChatModule.SimChat(this, args);
}
diff --git a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
index abad098..8efbf27 100644
--- a/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
+++ b/OpenSim/Region/Examples/SimpleModule/ComplexObject.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Examples.SimpleModule
remoteClient.SendKillObject(m_regionHandle, part.LocalId);
remoteClient.AddMoney(1);
- remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero);
+ remoteClient.SendChatMessage("Poof!", 1, AbsolutePosition, "Party Party", LLUUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
}
public override void OnGrabGroup(LLVector3 offsetPos, IClientAPI remoteClient)
@@ -129,7 +129,7 @@ namespace OpenSim.Region.Examples.SimpleModule
m_scene.RemoveEntity(this);
remoteClient.SendKillObject(m_regionHandle, m_rootPart.LocalId);
remoteClient.AddMoney(50);
- remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero);
+ remoteClient.SendChatMessage("KABLAM!!!", 1, AbsolutePosition, "Groupie Groupie", LLUUID.Zero, (byte)ChatSourceType.Object, (byte)ChatAudibleLevel.Fully);
}
}
}
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 1a8f808..3a64698 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -296,12 +296,12 @@ namespace OpenSim.Region.Examples.SimpleModule
}
public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName,
- LLUUID fromAgentID)
+ LLUUID fromAgentID, byte source, byte audible)
{
}
public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName,
- LLUUID fromAgentID)
+ LLUUID fromAgentID, byte source, byte audible)
{
}
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
index 1b1a5fa..2a6f775 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
@@ -326,8 +326,8 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null)
//{
- m_ScriptEngine.World.SimChat(Helpers.StringToField(text),
- ChatTypeEnum.Say, 0,
+ m_ScriptEngine.World.SimChat(Helpers.StringToField(text.Substring(0,999)),
+ ChatTypeEnum.DebugChannel, 2147483647,
m_host.AbsolutePosition,
m_host.Name, m_host.UUID);
}
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index 32c98a8..ed2c0a3 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -114,7 +114,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
string text = "Error compiling script:\r\n" + e.Message.ToString();
if (text.Length > 1500)
text = text.Substring(0, 1500);
- World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition,
+ World.SimChat(Helpers.StringToField(text), ChatTypeEnum.DebugChannel, 2147483647, m_host.AbsolutePosition,
m_host.Name, m_host.UUID);
}
catch (Exception e2) // LEGIT: User Scripting
--
cgit v1.1