converted hard-coded chat type values to ChatTypeEnum

afrisby
Jeff Ames 2007-11-08 03:11:10 +00:00
parent 9e9dad1cde
commit 0b4e15bc35
9 changed files with 28 additions and 30 deletions

View File

@ -270,24 +270,20 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
public void llWhisper(int channelID, string text) public void llWhisper(int channelID, string text)
{ {
//type for whisper is 0
World.SimChat(Helpers.StringToField(text), 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) public void llSay(int channelID, string text)
{ {
//type for say is 1
World.SimChat(Helpers.StringToField(text), 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) public void llShout(int channelID, string text)
{ {
//type for shout is 2
World.SimChat(Helpers.StringToField(text), 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) public int llListen(int channelID, string name, string ID, string msg)

View File

@ -31,6 +31,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
@ -205,7 +206,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine
IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null) //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); m_host.AbsolutePosition, m_host.Name, m_host.UUID);
} }
catch catch

View File

@ -33,6 +33,7 @@ using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler; using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler;
using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL; using OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
@ -318,7 +319,7 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine
string text = "Error compiling script:\r\n" + e.Message.ToString(); string text = "Error compiling script:\r\n" + e.Message.ToString();
if (text.Length > 1500) if (text.Length > 1500)
text = text.Substring(0, 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) catch (Exception e2)
{ {

View File

@ -27,6 +27,7 @@
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Modules; using OpenSim.Region.Environment.Modules;
namespace OpenSim.Region.Environment.Interfaces namespace OpenSim.Region.Environment.Interfaces
@ -34,7 +35,7 @@ namespace OpenSim.Region.Environment.Interfaces
public interface IWorldComm public interface IWorldComm
{ {
int Listen(uint LocalID, LLUUID itemID, LLUUID hostID, int channel, string name, string id, string msg); 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(); bool HasMessages();
ListenerInfo GetNextMessage(); ListenerInfo GetNextMessage();
void ListenControl(int handle, int active); void ListenControl(int handle, int active);

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.Environment.Modules
private void DeliverClientMessage(Object sender, ChatFromViewerArgs e) private void DeliverClientMessage(Object sender, ChatFromViewerArgs e)
{ {
DeliverMessage(e.Sender.AgentId.ToString(), DeliverMessage(e.Sender.AgentId.ToString(),
(int) e.Type, e.Channel, e.Type, e.Channel,
e.Sender.FirstName + " " + e.Sender.LastName, e.Sender.FirstName + " " + e.Sender.LastName,
e.Message); e.Message);
} }
@ -140,8 +140,8 @@ namespace OpenSim.Region.Environment.Modules
// and if so if this message fits the filter. If it does, then // and if so if this message fits the filter. If it does, then
// enqueue the message for delivery to the objects listen event handler. // enqueue the message for delivery to the objects listen event handler.
// Objects that do an llSay have their messages delivered here, and for // Objects that do an llSay have their messages delivered here, and for
// nearby avatards, the SimChat function is used. // nearby avatars, the SimChat function is used.
public void DeliverMessage(string sourceItemID, int type, int channel, string name, string msg) public void DeliverMessage(string sourceItemID, ChatTypeEnum type, int channel, string name, string msg)
{ {
SceneObjectPart source = null; SceneObjectPart source = null;
ScenePresence avatar = null; ScenePresence avatar = null;
@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Modules
switch (type) switch (type)
{ {
case 0: // Whisper case ChatTypeEnum.Whisper:
if ((dis < 10) && (dis > -10)) if ((dis < 10) && (dis > -10))
{ {
@ -191,7 +191,7 @@ namespace OpenSim.Region.Environment.Modules
} }
break; break;
case 1: // Say case ChatTypeEnum.Say:
if ((dis < 30) && (dis > -30)) if ((dis < 30) && (dis > -30))
{ {
@ -205,7 +205,7 @@ namespace OpenSim.Region.Environment.Modules
} }
break; break;
case 2: // Shout case ChatTypeEnum.Shout:
if ((dis < 100) && (dis > -100)) if ((dis < 100) && (dis > -100))
{ {
ListenerInfo isListener = m_listenerManager.IsListenerMatch( ListenerInfo isListener = m_listenerManager.IsListenerMatch(
@ -218,7 +218,7 @@ namespace OpenSim.Region.Environment.Modules
} }
break; break;
case 0xff: // Broadcast case ChatTypeEnum.Broadcast:
ListenerInfo isListen = ListenerInfo isListen =
m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg); m_listenerManager.IsListenerMatch(sourceItemID, eb, channel, name, msg);
if (isListen != null) if (isListen != null)

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="fromPos"></param> /// <param name="fromPos"></param>
/// <param name="fromName"></param> /// <param name="fromName"></param>
/// <param name="fromAgentID"></param> /// <param name="fromAgentID"></param>
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) LLUUID fromAgentID)
{ {
if (m_simChatModule != null) if (m_simChatModule != null)
@ -74,7 +74,7 @@ namespace OpenSim.Region.Environment.Scenes
args.Message = Util.FieldToString(message); args.Message = Util.FieldToString(message);
args.Channel = channel; args.Channel = channel;
args.Type = (ChatTypeEnum) type; args.Type = type;
args.Position = fromPos; args.Position = fromPos;
ScenePresence user = GetScenePresence(fromAgentID); ScenePresence user = GetScenePresence(fromAgentID);

View File

@ -270,32 +270,29 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llWhisper(int channelID, string text) public void llWhisper(int channelID, string text)
{ {
//type for whisper is 0
World.SimChat(Helpers.StringToField(text), 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<IWorldComm>(); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
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) public void llSay(int channelID, string text)
{ {
//type for say is 1
World.SimChat(Helpers.StringToField(text), 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<IWorldComm>(); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
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) public void llShout(int channelID, string text)
{ {
//type for shout is 2
World.SimChat(Helpers.StringToField(text), 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<IWorldComm>(); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
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) public int llListen(int channelID, string name, string ID, string msg)

View File

@ -31,6 +31,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 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); IScriptHost m_host = m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null) //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); m_host.AbsolutePosition, m_host.Name, m_host.UUID);
} }
catch catch

View File

@ -33,6 +33,7 @@ using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Threading; using System.Threading;
using libsecondlife; using libsecondlife;
using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler; using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler;
using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL; 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(); string text = "Error compiling script:\r\n" + e.Message.ToString();
if (text.Length > 1500) if (text.Length > 1500)
text = text.Substring(0, 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) catch (Exception e2)
{ {