From 1bb1d5d9b06887380eec0696102eb859f04810e6 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 26 May 2008 15:37:31 +0000 Subject: This cleans up a merge mess from the earlier checkin and implements llOwnerSay() via the newly created Scene.SimBroadcast() call. --- .../Environment/Modules/Avatar/Chat/ChatModule.cs | 34 +++++++++++++++------- .../Modules/Avatar/Chat/IRCBridgeModule.cs | 29 ++++-------------- 2 files changed, 28 insertions(+), 35 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Avatar') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs index e12588c..c3fc26e 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs @@ -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,13 +118,25 @@ 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; + + IClientAPI client = presence.ControllingClient; + + if ((c.Type == ChatTypeEnum.Owner) && + (null != c.SenderObject) && + (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) + return; - presence.ControllingClient.SendChatMessage(c.Message, - 1, //255, - pos, c.From, LLUUID.Zero, - c.Channel == DEBUG_CHANNEL? (byte)ChatSourceType.Object : (byte)ChatSourceType.Agent, - (byte)ChatAudibleLevel.Fully); + if (null == c.SenderObject) + client.SendChatMessage(c.Message, (byte)c.Type, + pos, c.From, LLUUID.Zero, + (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); } }); diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index 18106be..452ea7b 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs @@ -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,20 +198,10 @@ 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 @@ -529,14 +521,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(); - 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++) { -- cgit v1.1