This cleans up a merge mess from the earlier checkin and implements llOwnerSay()
via the newly created Scene.SimBroadcast() call.0.6.0-stable
parent
42cdf3c240
commit
1bb1d5d9b0
|
@ -85,6 +85,7 @@ namespace OpenSim.Framework
|
|||
|
||||
protected IScene m_scene;
|
||||
protected IClientAPI m_sender;
|
||||
protected object m_senderObject;
|
||||
protected ChatTypeEnum m_type;
|
||||
protected LLUUID m_fromID;
|
||||
|
||||
|
@ -140,6 +141,9 @@ namespace OpenSim.Framework
|
|||
|
||||
#region IEventArgs Members
|
||||
|
||||
/// TODO: Sender and SenderObject should just be Sender and of
|
||||
/// type IChatSender
|
||||
|
||||
/// <summary>
|
||||
/// The client responsible for sending the message, or null.
|
||||
/// </summary>
|
||||
|
@ -149,6 +153,15 @@ namespace OpenSim.Framework
|
|||
set { m_sender = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The object responsible for sending the message, or null.
|
||||
/// </summary>
|
||||
public object SenderObject
|
||||
{
|
||||
get { return m_senderObject; }
|
||||
set { m_senderObject = value; }
|
||||
}
|
||||
|
||||
public LLUUID SenderUUID
|
||||
{
|
||||
get { return m_fromID; }
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace OpenSim.Grid.ScriptEngine.Common
|
|||
LSL_Types.Vector3 llRot2Up(LSL_Types.Quaternion r);
|
||||
LSL_Types.Quaternion llRotBetween(LSL_Types.Vector3 start, LSL_Types.Vector3 end);
|
||||
void llWhisper(int channelID, string text);
|
||||
//void llSay(int channelID, string text);
|
||||
void llSay(int channelID, string text);
|
||||
void llShout(int channelID, string text);
|
||||
int llListen(int channelID, string name, string ID, string msg);
|
||||
|
|
|
@ -243,6 +243,11 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
m_LSL_Functions.llShout(channelID, text);
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
m_LSL_Functions.llOwnerSay(msg);
|
||||
}
|
||||
|
||||
public int llListen(int channelID, string name, string ID, string msg)
|
||||
{
|
||||
return m_LSL_Functions.llListen(channelID, name, ID, msg);
|
||||
|
@ -1617,11 +1622,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
return m_LSL_Functions.llGetInventoryCreator(item);
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
m_LSL_Functions.llOwnerSay(msg);
|
||||
}
|
||||
|
||||
public void llRequestSimulatorData(string simulator, int data)
|
||||
{
|
||||
m_LSL_Functions.llRequestSimulatorData(simulator, data);
|
||||
|
|
|
@ -272,19 +272,30 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
|
|||
public void llWhisper(int channelID, string text)
|
||||
{
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
|
||||
public void llSay(int channelID, string text)
|
||||
{
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
|
||||
public void llShout(int channelID, string text)
|
||||
{
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
m_log.DebugFormat("llOwnerSay(\"{0}\")", msg);
|
||||
World.SimChatBroadcast(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Owner, 0, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
|
||||
public int llListen(int channelID, string name, string ID, string msg)
|
||||
|
@ -2032,11 +2043,6 @@ namespace OpenSim.Grid.ScriptEngine.DotNetEngine.Compiler
|
|||
return "";
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
NotImplemented("llOwnerSay");
|
||||
}
|
||||
|
||||
public void llRequestSimulatorData(string simulator, int data)
|
||||
{
|
||||
NotImplemented("llRequestSimulatorData");
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
#region ISimChat Members
|
||||
public void SimBroadcast(Object sender, ChatFromViewerArgs c)
|
||||
{
|
||||
// We only want to relay stuff on channel 0
|
||||
// We only want to relay stuff on channel 0 and on the debug channel
|
||||
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
|
||||
|
||||
if (c.Channel == DEBUG_CHANNEL)
|
||||
|
@ -118,12 +118,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
LLVector3 pos = new LLVector3(128, 128, 30);
|
||||
((Scene)c.Scene).ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
if (!presence.IsChildAgent) return;
|
||||
if (presence.IsChildAgent) return;
|
||||
|
||||
presence.ControllingClient.SendChatMessage(c.Message,
|
||||
1, //255,
|
||||
IClientAPI client = presence.ControllingClient;
|
||||
|
||||
if ((c.Type == ChatTypeEnum.Owner) &&
|
||||
(null != c.SenderObject) &&
|
||||
(((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId))
|
||||
return;
|
||||
|
||||
if (null == c.SenderObject)
|
||||
client.SendChatMessage(c.Message, (byte)c.Type,
|
||||
pos, c.From, LLUUID.Zero,
|
||||
c.Channel == DEBUG_CHANNEL? (byte)ChatSourceType.Object : (byte)ChatSourceType.Agent,
|
||||
(byte)ChatSourceType.Agent,
|
||||
(byte)ChatAudibleLevel.Fully);
|
||||
else
|
||||
client.SendChatMessage(c.Message, (byte)c.Type,
|
||||
pos, c.From, LLUUID.Zero,
|
||||
(byte)ChatSourceType.Object,
|
||||
(byte)ChatAudibleLevel.Fully);
|
||||
});
|
||||
}
|
||||
|
@ -147,7 +159,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
string fromName = e.From;
|
||||
string message = e.Message;
|
||||
LLUUID fromAgentID = e.SenderUUID;
|
||||
LLUUID fromID = e.SenderUUID;
|
||||
|
||||
if (e.Sender != null)
|
||||
{
|
||||
|
@ -160,7 +172,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize,
|
||||
scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
|
||||
fromName = avatar.Firstname + " " + avatar.Lastname;
|
||||
fromAgentID = e.Sender.AgentId;
|
||||
fromID = e.Sender.AgentId;
|
||||
}
|
||||
|
||||
if (e.Channel == DEBUG_CHANNEL)
|
||||
|
@ -175,13 +187,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
if (e.Channel == DEBUG_CHANNEL)
|
||||
{
|
||||
TrySendChatMessage(presence, fromPos, regionPos,
|
||||
fromAgentID, fromName, e.Type,
|
||||
fromID, fromName, e.Type,
|
||||
message, ChatSourceType.Object);
|
||||
}
|
||||
else
|
||||
{
|
||||
TrySendChatMessage(presence, fromPos, regionPos,
|
||||
fromAgentID, fromName, e.Type,
|
||||
fromID, fromName, e.Type,
|
||||
message, ChatSourceType.Agent);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -88,6 +88,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
{
|
||||
m_irc = new IRCChatModule(config);
|
||||
}
|
||||
|
||||
if (m_irc_connector == null)
|
||||
{
|
||||
m_irc_connector = new Thread(IRCConnectRun);
|
||||
|
@ -183,6 +184,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
m_irc_connector.Name = "IRCConnectorThread";
|
||||
m_irc_connector.IsBackground = true;
|
||||
}
|
||||
|
||||
if (!m_irc_connector.IsAlive)
|
||||
{
|
||||
m_irc_connector.Start();
|
||||
|
@ -196,21 +198,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
if (e.Message.StartsWith("/me ") && (null != avatar))
|
||||
e.Message = String.Format("{0} {1}", fromName, e.Message.Substring(4));
|
||||
if (e.Channel == 0 || e.Channel == DEBUG_CHANNEL)
|
||||
{
|
||||
if (e.Channel == DEBUG_CHANNEL)
|
||||
e.Type = ChatTypeEnum.DebugChannel;
|
||||
|
||||
// IRC stuff
|
||||
if (e.Message.Length > 0 && e.Channel == 0)
|
||||
{
|
||||
if (m_irc.Connected && (avatar != null)) // this is to keep objects from talking to IRC
|
||||
{
|
||||
// this is to keep objects from talking to IRC
|
||||
if (m_irc.Connected && (avatar != null))
|
||||
m_irc.PrivMsg(fromName, scene.RegionInfo.RegionName, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -528,14 +520,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
// Get some direct matches $1 $4 is a
|
||||
if ((matches.Count == 0) || (matches.Count != 1) || (matches[0].Groups.Count != 5))
|
||||
{
|
||||
result = new Dictionary<string, string>();
|
||||
result.Add("nick", matches[0].Groups[1].Value);
|
||||
result.Add("user", matches[0].Groups[2].Value);
|
||||
result.Add("channel", matches[0].Groups[3].Value);
|
||||
result.Add("msg", matches[0].Groups[4].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Info("[IRC]: Number of matches: " + matches.Count);
|
||||
if (matches.Count > 0)
|
||||
|
@ -641,7 +625,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
public void BroadcastSim(string sender, string format, params string[] args)
|
||||
{
|
||||
LLVector3 pos = new LLVector3(128, 128, 20);
|
||||
try
|
||||
{
|
||||
ChatFromViewerArgs c = new ChatFromViewerArgs();
|
||||
|
@ -781,8 +764,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
|
|||
|
||||
public void eventIrcMode(string[] commArgs)
|
||||
{
|
||||
string IrcChannel = commArgs[2];
|
||||
string IrcUser = commArgs[0].Split('!')[0];
|
||||
string UserMode = "";
|
||||
for (int i = 3; i < commArgs.Length; i++)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,39 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
{
|
||||
public partial class Scene
|
||||
{
|
||||
protected void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName,
|
||||
LLUUID fromID, bool fromAgent, bool broadcast)
|
||||
{
|
||||
ChatFromViewerArgs args = new ChatFromViewerArgs();
|
||||
|
||||
args.Message = Helpers.FieldToUTF8String(message);
|
||||
args.Channel = channel;
|
||||
args.Type = type;
|
||||
args.Position = fromPos;
|
||||
args.SenderUUID = fromID;
|
||||
args.Scene = this;
|
||||
|
||||
if (fromAgent)
|
||||
{
|
||||
ScenePresence user = GetScenePresence(fromID);
|
||||
if (user != null)
|
||||
args.Sender = user.ControllingClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectPart obj = GetSceneObjectPart(fromID);
|
||||
args.SenderObject = obj;
|
||||
}
|
||||
|
||||
args.From = fromName;
|
||||
//args.
|
||||
|
||||
if (broadcast)
|
||||
EventManager.TriggerOnChatBroadcast(this, args);
|
||||
else
|
||||
EventManager.TriggerOnChatFromWorld(this, args);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -43,27 +76,23 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="fromName"></param>
|
||||
/// <param name="fromAgentID"></param>
|
||||
public void SimChat(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName,
|
||||
LLUUID fromAgentID)
|
||||
LLUUID fromID, bool fromAgent)
|
||||
{
|
||||
ChatFromViewerArgs args = new ChatFromViewerArgs();
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, false);
|
||||
}
|
||||
|
||||
args.Message = Helpers.FieldToUTF8String(message);
|
||||
args.Channel = channel;
|
||||
args.Type = type;
|
||||
args.Position = fromPos;
|
||||
args.SenderUUID = fromAgentID;
|
||||
args.Scene = this;
|
||||
|
||||
ScenePresence user = GetScenePresence(fromAgentID);
|
||||
if (user != null)
|
||||
args.Sender = user.ControllingClient;
|
||||
else
|
||||
args.Sender = null;
|
||||
|
||||
args.From = fromName;
|
||||
//args.
|
||||
|
||||
EventManager.TriggerOnChatFromWorld(this, args);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="fromPos"></param>
|
||||
/// <param name="fromName"></param>
|
||||
/// <param name="fromAgentID"></param>
|
||||
public void SimChatBroadcast(byte[] message, ChatTypeEnum type, int channel, LLVector3 fromPos, string fromName,
|
||||
LLUUID fromID, bool fromAgent)
|
||||
{
|
||||
SimChat(message, type, channel, fromPos, fromName, fromID, fromAgent, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -113,7 +113,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public IXfer XferManager;
|
||||
|
||||
protected IHttpRequests m_httpRequestModule;
|
||||
protected ISimChat m_simChatModule;
|
||||
protected IXMLRPC m_xmlrpcModule;
|
||||
protected IWorldComm m_worldCommModule;
|
||||
protected IAvatarFactory m_AvatarFactory;
|
||||
|
@ -637,7 +636,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// </summary>
|
||||
public void SetModuleInterfaces()
|
||||
{
|
||||
m_simChatModule = RequestModuleInterface<ISimChat>();
|
||||
m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
|
||||
m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
|
||||
m_worldCommModule = RequestModuleInterface<IWorldComm>();
|
||||
|
|
|
@ -285,6 +285,11 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
m_LSL_Functions.llShout(channelID, text);
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
m_LSL_Functions.llOwnerSay(msg);
|
||||
}
|
||||
|
||||
public void llRegionSay(int channelID, string text)
|
||||
{
|
||||
m_LSL_Functions.llRegionSay(channelID, text);
|
||||
|
@ -1673,11 +1678,6 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
return m_LSL_Functions.llGetInventoryCreator(item);
|
||||
}
|
||||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
m_LSL_Functions.llOwnerSay(msg);
|
||||
}
|
||||
|
||||
public void llRequestSimulatorData(string simulator, int data)
|
||||
{
|
||||
m_LSL_Functions.llRequestSimulatorData(simulator, data);
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
/// </summary>
|
||||
public class LSL_BuiltIn_Commands : MarshalByRefObject, LSL_BuiltIn_Commands_Interface
|
||||
{
|
||||
// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
internal ScriptEngineBase.ScriptEngine m_ScriptEngine;
|
||||
internal SceneObjectPart m_host;
|
||||
|
@ -409,7 +409,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||
|
||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
|
||||
|
@ -419,7 +419,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||
|
||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
|
||||
|
@ -429,7 +429,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||
|
||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
|
||||
|
@ -5478,15 +5478,13 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
|
||||
public void llOwnerSay(string msg)
|
||||
{
|
||||
//m_host.AddScriptLPS(1); // since we reuse llInstantMessage
|
||||
//temp fix so that lsl wiki examples aren't annoying to use to test other functions
|
||||
//should be similar to : llInstantMessage(llGetOwner(),msg)
|
||||
// llGetOwner ==> m_host.ObjectOwner.ToString()
|
||||
llInstantMessage(m_host.ObjectOwner.ToString(),msg);
|
||||
m_host.AddScriptLPS(1);
|
||||
World.SimChatBroadcast(Helpers.StringToField(msg),
|
||||
ChatTypeEnum.Owner, 0, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID, false);
|
||||
|
||||
//World.SimChat(Helpers.StringToField(msg), ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
|
||||
//IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
//wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
|
||||
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
|
||||
}
|
||||
|
||||
public void llRequestSimulatorData(string simulator, int data)
|
||||
|
|
|
@ -333,7 +333,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
|||
m_ScriptEngine.World.SimChat(Helpers.StringToField(text),
|
||||
ChatTypeEnum.DebugChannel, 2147483647,
|
||||
m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID);
|
||||
m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
|
|
@ -140,8 +140,8 @@ 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.DebugChannel, 2147483647, m_host.AbsolutePosition,
|
||||
m_host.Name, m_host.UUID);
|
||||
World.SimChat(Helpers.StringToField(text), ChatTypeEnum.DebugChannel, 2147483647,
|
||||
m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
|
||||
}
|
||||
catch (Exception e2) // LEGIT: User Scripting
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue