diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 815537325f..747ad5c933 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -34,7 +34,7 @@ using OpenSim.Framework.Data;
namespace OpenSim.Framework.Interfaces
{
- public delegate void ChatFromViewer(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+ public delegate void ChatFromViewer(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
public delegate void ImprovedInstantMessage(LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, string fromAgentName, string message, byte dialog); // Cut down from full list
public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 pos);
public delegate void ModifyTerrain(float height, float seconds, byte size, byte action, float north, float west, IClientAPI remoteClient);
diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs
index 56faae267f..cf7e448ad8 100644
--- a/OpenSim/Framework/General/NullClientAPI.cs
+++ b/OpenSim/Framework/General/NullClientAPI.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Framework
public virtual void SendKillObject(ulong regionHandle, uint localID){}
public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
public virtual void SendRegionHandshake(RegionInfo regionInfo){}
- public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
+ public virtual void SendChatMessage(string message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) { }
public virtual void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID){}
public virtual void SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp){}
public virtual void SendLayerData(float[] map){}
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 031e50aafd..c97ba3768c 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -243,14 +243,7 @@ namespace OpenSim.Region.ClientStack
SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
}
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
+
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
Encoding enc = Encoding.ASCII;
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index fab5433dc5..fe3e82c7f4 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -107,9 +107,12 @@ namespace OpenSim.Region.ClientStack
byte type = inchatpack.ChatData.Type;
LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
LLUUID fromAgentID = AgentID;
+
+ int channel = inchatpack.ChatData.Channel;
+
if (OnChatFromViewer != null)
{
- this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
+ this.OnChatFromViewer(message, type, channel, fromPos, fromName, fromAgentID);
}
break;
case PacketType.ImprovedInstantMessage:
diff --git a/OpenSim/Region/Environment/Interfaces/ISimChat.cs b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
index 0b83b34a80..73ef476ec7 100644
--- a/OpenSim/Region/Environment/Interfaces/ISimChat.cs
+++ b/OpenSim/Region/Environment/Interfaces/ISimChat.cs
@@ -7,6 +7,6 @@ namespace OpenSim.Region.Environment.Interfaces
{
public interface ISimChat
{
- void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
+ void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID);
}
}
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index b38665d333..a46343b911 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Modules
}
}
- public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
+ public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
ScenePresence avatar = null;
avatar = m_scene.RequestAvatar(fromAgentID);
@@ -149,54 +149,68 @@ namespace OpenSim.Region.Environment.Modules
if (connected)
{
- m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " + Util.FieldToString(message));
+ m_ircWriter.WriteLine("PRIVMSG " + m_channel + " :" + "<" + fromName + ">: " +
+ Util.FieldToString(message));
m_ircWriter.Flush();
}
- m_scene.ForEachScenePresence(delegate(ScenePresence presence)
- {
- int dis = -1000;
+ if (channel == 0)
+ {
+ m_scene.ForEachScenePresence(delegate(ScenePresence presence)
+ {
+ int dis = -1000;
- //err ??? the following code seems to be request a scenePresence when it already has a ref to it
- avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
- if (avatar != null)
- {
- dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos);
- }
+ //err ??? the following code seems to be request a scenePresence when it already has a ref to it
+ avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
+ if (avatar != null)
+ {
+ dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
+ }
- switch (type)
- {
- case 0: // Whisper
- if ((dis < 10) && (dis > -10))
- {
- //should change so the message is sent through the avatar rather than direct to the ClientView
- presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
- fromAgentID);
- }
- break;
- case 1: // Say
- if ((dis < 30) && (dis > -30))
- {
- //Console.WriteLine("sending chat");
- presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
- fromAgentID);
- }
- break;
- case 2: // Shout
- if ((dis < 100) && (dis > -100))
- {
- presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
- fromAgentID);
- }
- break;
+ switch (type)
+ {
+ case 0: // Whisper
+ if ((dis < 10) && (dis > -10))
+ {
+ //should change so the message is sent through the avatar rather than direct to the ClientView
+ presence.ControllingClient.SendChatMessage(message,
+ type,
+ fromPos,
+ fromName,
+ fromAgentID);
+ }
+ break;
+ case 1: // Say
+ if ((dis < 30) && (dis > -30))
+ {
+ //Console.WriteLine("sending chat");
+ presence.ControllingClient.SendChatMessage(message,
+ type,
+ fromPos,
+ fromName,
+ fromAgentID);
+ }
+ break;
+ case 2: // Shout
+ if ((dis < 100) && (dis > -100))
+ {
+ presence.ControllingClient.SendChatMessage(message,
+ type,
+ fromPos,
+ fromName,
+ fromAgentID);
+ }
+ break;
- case 0xff: // Broadcast
- presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
- fromAgentID);
- break;
- }
- });
+ case 0xff: // Broadcast
+ presence.ControllingClient.SendChatMessage(message, type,
+ fromPos,
+ fromName,
+ fromAgentID);
+ break;
+ }
+ });
+ }
}
-
}
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index ab65e36a36..881b4a1570 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -102,11 +102,11 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
+ public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
if (m_simChatModule != null)
{
- m_simChatModule.SimChat(message, type, fromPos, fromName, fromAgentID);
+ m_simChatModule.SimChat(message, type, channel, fromPos, fromName, fromAgentID);
}
}
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 7e6101cef6..b009192d52 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -211,7 +211,7 @@ namespace SimpleApp
{
if (OnChatFromViewer != null)
{
- this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId);
+ this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, 0, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId);
}
count = -1;
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 028544e7b8..fe20e9980a 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -168,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
{
//type for whisper is 0
World.SimChat(Helpers.StringToField(text),
- 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
public void llSay(int channelID, string text)
@@ -176,14 +176,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
//type for say is 1
World.SimChat(Helpers.StringToField(text),
- 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
public void llShout(int channelID, string text)
{
//type for shout is 2
World.SimChat(Helpers.StringToField(text),
- 2, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
public int llListen(int channelID, string name, string ID, string msg) { return 0; }
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 955e978bec..aa36ea2567 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -197,7 +197,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null)
//{
- m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
} catch {
//}
//else
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index f731cb47f3..c521d471d1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -310,7 +310,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), 1, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ World.SimChat(Helpers.StringToField(text), 1, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
catch (Exception e2)
{