* 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
parent
1b1808d45d
commit
f8ddf7429e
|
@ -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);
|
||||
|
|
|
@ -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){}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -161,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules
|
|||
avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
|
||||
if (avatar != null)
|
||||
{
|
||||
dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
||||
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
|
@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue