From 0b4e15bc3586422d273bd8845962a2db681230e2 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Thu, 8 Nov 2007 03:11:10 +0000
Subject: converted hard-coded chat type values to ChatTypeEnum
---
.../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 10 +++-------
.../Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs | 3 ++-
OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs | 3 ++-
OpenSim/Region/Environment/Interfaces/IWorldComm.cs | 3 ++-
OpenSim/Region/Environment/Modules/WorldCommModule.cs | 14 +++++++-------
OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 4 ++--
.../Compiler/Server_API/LSL_BuiltIn_Commands.cs | 15 ++++++---------
.../Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | 3 ++-
OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 3 ++-
9 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index 7bc3ce4..64921d7 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -270,24 +270,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
public void llWhisper(int channelID, string text)
{
- //type for whisper is 0
World.SimChat(Helpers.StringToField(text),
- 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
public void llSay(int channelID, string text)
{
- //type for say is 1
-
World.SimChat(Helpers.StringToField(text),
- 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Say, 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, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
public int llListen(int channelID, string name, string ID, string msg)
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
index 31d090f..91d4558 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -31,6 +31,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Threading;
using libsecondlife;
+using OpenSim.Framework;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
using OpenSim.Region.Environment.Scenes.Scripting;
@@ -205,7 +206,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine
IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null)
//{
- m_ScriptEngine.World.SimChat(Helpers.StringToField(text), 1, 0,
+ m_ScriptEngine.World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0,
m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
catch
diff --git a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
index 2149bf0..85e9a9c 100644
--- a/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Grid/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -33,6 +33,7 @@ using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using libsecondlife;
+using OpenSim.Framework;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
using OpenSim.Region.Environment.Scenes;
@@ -318,7 +319,7 @@ namespace OpenSim.Grid.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, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
catch (Exception e2)
{
diff --git a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
index 27b5466..d8811c6 100644
--- a/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
+++ b/OpenSim/Region/Environment/Interfaces/IWorldComm.cs
@@ -27,6 +27,7 @@
*/
using libsecondlife;
+using OpenSim.Framework;
using OpenSim.Region.Environment.Modules;
namespace OpenSim.Region.Environment.Interfaces
@@ -34,7 +35,7 @@ namespace OpenSim.Region.Environment.Interfaces
public interface IWorldComm
{
int Listen(uint LocalID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg);
- void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg);
+ void DeliverMessage(string sourceItemID, ChatTypeEnum type, int channel, string name, string msg);
bool HasMessages();
ListenerInfo GetNextMessage();
void ListenControl(int handle, int active);
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
index 7a631d7..a31b484 100644
--- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs
+++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Modules
private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
{
DeliverMessage(e.Sender.AgentId.ToString(),
- (int) e.Type, e.Channel,
+ e.Type, e.Channel,
e.Sender.FirstName + " " + e.Sender.LastName,
e.Message);
}
@@ -140,8 +140,8 @@ namespace OpenSim.Region.Environment.Modules
// and if so if this message fits the filter. If it does, then
// enqueue the message for delivery to the objects listen event handler.
// Objects that do an llSay have their messages delivered here, and for
- // nearby avatards, the SimChat function is used.
- public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg)
+ // nearby avatars, the SimChat function is used.
+ public void DeliverMessage(string sourceItemID, ChatTypeEnum type, int channel, string name, string msg)
{
SceneObjectPart source = null;
ScenePresence avatar = null;
@@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Modules
switch (type)
{
- case 0: // Whisper
+ case ChatTypeEnum.Whisper:
if ((dis < 10) && (dis > -10))
{
@@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules
}
break;
- case 1: // Say
+ case ChatTypeEnum.Say:
if ((dis < 30) && (dis > -30))
{
@@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules
}
break;
- case 2: // Shout
+ case ChatTypeEnum.Shout:
if ((dis < 100) && (dis > -100))
{
ListenerInfo isListener = m_listenerManager.IsListenerMatch(
@@ -218,7 +218,7 @@ namespace OpenSim.Region.Environment.Modules
}
break;
- case 0xff: // Broadcast
+ case ChatTypeEnum.Broadcast:
ListenerInfo isListen =
m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg);
if (isListen != null)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index a9f6991..a57041b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void SimChat(byte[] message, byte type, int channel, LLVector3 fromPos, string fromName,
+ public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName,
LLUUID fromAgentID)
{
if (m_simChatModule != null)
@@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
args.Message = Util.FieldToString(message);
args.Channel = channel;
- args.Type = (ChatTypeEnum) type;
+ args.Type = type;
args.Position = fromPos;
ScenePresence user = GetScenePresence(fromAgentID);
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 737dee6..e3504d3 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
@@ -270,32 +270,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llWhisper(int channelID, string text)
{
- //type for whisper is 0
World.SimChat(Helpers.StringToField(text),
- 0, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
- wComm.DeliverMessage(m_host.UUID.ToString(), 0, channelID, m_host.Name, text);
+ wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Whisper, channelID, m_host.Name, text);
}
public void llSay(int channelID, string text)
{
- //type for say is 1
World.SimChat(Helpers.StringToField(text),
- 1, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
- wComm.DeliverMessage(m_host.UUID.ToString(), 1, channelID, m_host.Name, text);
+ wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Say, channelID, m_host.Name, text);
}
public void llShout(int channelID, string text)
{
- //type for shout is 2
World.SimChat(Helpers.StringToField(text),
- 2, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface();
- wComm.DeliverMessage(m_host.UUID.ToString(), 2, channelID, m_host.Name, text);
+ wComm.DeliverMessage(m_host.UUID.ToString(), ChatTypeEnum.Shout, channelID, m_host.Name, text);
}
public int llListen(int channelID, string name, string ID, string msg)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
index f215dd5..d79a8a6 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs
@@ -31,6 +31,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Threading;
using libsecondlife;
+using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
@@ -212,7 +213,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, 0,
+ m_ScriptEngine.World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0,
m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
catch
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
index a3cf9f7..5b6a9d1 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs
@@ -33,6 +33,7 @@ using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using libsecondlife;
+using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
@@ -323,7 +324,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, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
+ World.SimChat(Helpers.StringToField(text), ChatTypeEnum.Say, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
}
catch (Exception e2)
{
--
cgit v1.1