* Wired up chat so that channel goes into OnChatFromViewer. However:

* There's no libsl reply packet field for it, I guess other channels than 0 makes no sense sending back to clients.
  * We do not currently support objects listening, so there's really no way of actually using this feature.
So; somebody please wire chat all the way to the scripts.
afrisby
lbsa71 2007-09-14 13:46:05 +00:00
parent 1b1808d45d
commit f8ddf7429e
11 changed files with 73 additions and 63 deletions

View File

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

View File

@ -243,14 +243,7 @@ namespace OpenSim.Region.ClientStack
SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
}
/// <summary>
///
/// </summary>
/// <param name="message"></param>
/// <param name="type"></param>
/// <param name="fromPos"></param>
/// <param name="fromName"></param>
/// <param name="fromAgentID"></param>
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
{
Encoding enc = Encoding.ASCII;

View File

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

View File

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

View File

@ -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,10 +149,13 @@ 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();
}
if (channel == 0)
{
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
int dis = -1000;
@ -170,7 +173,10 @@ namespace OpenSim.Region.Environment.Modules
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,
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
@ -178,25 +184,33 @@ namespace OpenSim.Region.Environment.Modules
if ((dis < 30) && (dis > -30))
{
//Console.WriteLine("sending chat");
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 2: // Shout
if ((dis < 100) && (dis > -100))
{
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
presence.ControllingClient.SendChatMessage(message,
type,
fromPos,
fromName,
fromAgentID);
}
break;
case 0xff: // Broadcast
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
presence.ControllingClient.SendChatMessage(message, type,
fromPos,
fromName,
fromAgentID);
break;
}
});
}
}
}
}

View File

@ -102,11 +102,11 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="fromPos"></param>
/// <param name="fromName"></param>
/// <param name="fromAgentID"></param>
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);
}
}

View File

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

View File

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

View File

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

View File

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