* 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
0.6.0-stable
Teravus Ovares 2008-05-05 15:53:11 +00:00
parent 1130c3067c
commit ce19234dc8
8 changed files with 46 additions and 23 deletions

View File

@ -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; }
}
/// <summary>
///
/// </summary>
@ -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);

View File

@ -898,18 +898,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="fromPos"></param>
/// <param name="fromName"></param>
/// <param name="fromAgentID"></param>
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;

View File

@ -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);
}
});
}

View File

@ -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);
}

View File

@ -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);
}
}
}

View File

@ -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)
{
}

View File

@ -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);
}

View File

@ -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