* 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
|
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 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 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);
|
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 SendKillObject(ulong regionHandle, uint localID){}
|
||||||
public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
|
public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){}
|
||||||
public virtual void SendRegionHandshake(RegionInfo regionInfo){}
|
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 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 SendInstantMessage(LLUUID fromAgent, LLUUID fromAgentSession, string message, LLUUID toAgent, LLUUID imSessionID, string fromName, byte dialog, uint timeStamp){}
|
||||||
public virtual void SendLayerData(float[] map){}
|
public virtual void SendLayerData(float[] map){}
|
||||||
|
|
|
@ -243,14 +243,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
SendChatMessage(Helpers.StringToField(message), type, fromPos, fromName, fromAgentID);
|
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)
|
public void SendChatMessage(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
|
||||||
{
|
{
|
||||||
Encoding enc = Encoding.ASCII;
|
Encoding enc = Encoding.ASCII;
|
||||||
|
|
|
@ -107,9 +107,12 @@ namespace OpenSim.Region.ClientStack
|
||||||
byte type = inchatpack.ChatData.Type;
|
byte type = inchatpack.ChatData.Type;
|
||||||
LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
|
LLVector3 fromPos = new LLVector3(); // ClientAvatar.Pos;
|
||||||
LLUUID fromAgentID = AgentID;
|
LLUUID fromAgentID = AgentID;
|
||||||
|
|
||||||
|
int channel = inchatpack.ChatData.Channel;
|
||||||
|
|
||||||
if (OnChatFromViewer != null)
|
if (OnChatFromViewer != null)
|
||||||
{
|
{
|
||||||
this.OnChatFromViewer(message, type, fromPos, fromName, fromAgentID);
|
this.OnChatFromViewer(message, type, channel, fromPos, fromName, fromAgentID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PacketType.ImprovedInstantMessage:
|
case PacketType.ImprovedInstantMessage:
|
||||||
|
|
|
@ -7,6 +7,6 @@ namespace OpenSim.Region.Environment.Interfaces
|
||||||
{
|
{
|
||||||
public interface ISimChat
|
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;
|
ScenePresence avatar = null;
|
||||||
avatar = m_scene.RequestAvatar(fromAgentID);
|
avatar = m_scene.RequestAvatar(fromAgentID);
|
||||||
|
@ -149,54 +149,68 @@ namespace OpenSim.Region.Environment.Modules
|
||||||
|
|
||||||
if (connected)
|
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();
|
m_ircWriter.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
if (channel == 0)
|
||||||
{
|
{
|
||||||
int dis = -1000;
|
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
|
||||||
|
{
|
||||||
|
int dis = -1000;
|
||||||
|
|
||||||
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
|
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
|
||||||
avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
|
avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
|
||||||
if (avatar != null)
|
if (avatar != null)
|
||||||
{
|
{
|
||||||
dis = (int)avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 0: // Whisper
|
case 0: // Whisper
|
||||||
if ((dis < 10) && (dis > -10))
|
if ((dis < 10) && (dis > -10))
|
||||||
{
|
{
|
||||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
//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,
|
||||||
fromAgentID);
|
type,
|
||||||
}
|
fromPos,
|
||||||
break;
|
fromName,
|
||||||
case 1: // Say
|
fromAgentID);
|
||||||
if ((dis < 30) && (dis > -30))
|
}
|
||||||
{
|
break;
|
||||||
//Console.WriteLine("sending chat");
|
case 1: // Say
|
||||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
if ((dis < 30) && (dis > -30))
|
||||||
fromAgentID);
|
{
|
||||||
}
|
//Console.WriteLine("sending chat");
|
||||||
break;
|
presence.ControllingClient.SendChatMessage(message,
|
||||||
case 2: // Shout
|
type,
|
||||||
if ((dis < 100) && (dis > -100))
|
fromPos,
|
||||||
{
|
fromName,
|
||||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
fromAgentID);
|
||||||
fromAgentID);
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case 2: // Shout
|
||||||
|
if ((dis < 100) && (dis > -100))
|
||||||
|
{
|
||||||
|
presence.ControllingClient.SendChatMessage(message,
|
||||||
|
type,
|
||||||
|
fromPos,
|
||||||
|
fromName,
|
||||||
|
fromAgentID);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 0xff: // Broadcast
|
case 0xff: // Broadcast
|
||||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
presence.ControllingClient.SendChatMessage(message, type,
|
||||||
fromAgentID);
|
fromPos,
|
||||||
break;
|
fromName,
|
||||||
}
|
fromAgentID);
|
||||||
});
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,11 +102,11 @@ 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, 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)
|
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)
|
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;
|
count = -1;
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
{
|
{
|
||||||
//type for whisper is 0
|
//type for whisper is 0
|
||||||
World.SimChat(Helpers.StringToField(text),
|
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)
|
public void llSay(int channelID, string text)
|
||||||
|
@ -176,14 +176,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
||||||
//type for say is 1
|
//type for say is 1
|
||||||
|
|
||||||
World.SimChat(Helpers.StringToField(text),
|
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)
|
public void llShout(int channelID, string text)
|
||||||
{
|
{
|
||||||
//type for shout is 2
|
//type for shout is 2
|
||||||
World.SimChat(Helpers.StringToField(text),
|
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; }
|
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);
|
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, 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 {
|
} catch {
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
|
|
|
@ -310,7 +310,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, 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)
|
catch (Exception e2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue