From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../OptionalModules/Avatar/Chat/ChannelState.cs | 27 +++++----- .../OptionalModules/Avatar/Chat/IRCBridgeModule.cs | 4 +- .../OptionalModules/Avatar/Chat/IRCConnector.cs | 58 ++++++++++------------ .../OptionalModules/Avatar/Chat/RegionState.cs | 43 +++++++--------- 4 files changed, 61 insertions(+), 71 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Avatar/Chat') diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index b5d9fda..27ab32f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -38,7 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Avatar.Chat { - // An instance of this class exists for each unique combination of + // An instance of this class exists for each unique combination of // IRC chat interface characteristics, as determined by the supplied // configuration file. @@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static Regex arg = new Regex(@"\[[^\[\]]*\]"); + private static Regex arg = new Regex(@"(?", idn, from, + // m_log.DebugFormat("[IRC-Connector-{0}] PrivMsg to IRC from {1}: <{2}>", idn, from, // String.Format(pattern, m_ircChannel, from, region, msg)); // One message to the IRC server @@ -521,11 +506,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat c.Message = data["msg"]; c.Type = ChatTypeEnum.Region; c.Position = CenterOfRegion; - c.From = data["nick"]; + c.From = data["nick"] + "@IRC"; c.Sender = null; c.SenderUUID = UUID.Zero; - // Is message "\001ACTION foo bar\001"? + // Is message "\001ACTION foo bar\001"? // Then change to: "/me foo bar" if ((1 == c.Message[0]) && c.Message.Substring(1).StartsWith("ACTION")) @@ -623,8 +608,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat string parms = String.Empty; // ":" indicates that a prefix is present - // There are NEVER more than 17 real - // fields. A parameter that starts with + // There are NEVER more than 17 real + // fields. A parameter that starts with // ":" indicates that the remainder of the // line is a single parameter value. @@ -659,6 +644,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat version = commArgs[2]; usermod = commArgs[3]; chanmod = commArgs[4]; + + m_writer.WriteLine(String.Format("JOIN {0}", m_ircChannel)); + m_writer.Flush(); + m_log.InfoFormat("[IRC-Connector-{0}]: sent request to join {1} ", idn, m_ircChannel); + break; case "005": // Server information break; @@ -721,11 +711,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat case "PONG": break; case "JOIN": - if (m_pending) - { - m_log.InfoFormat("[IRC-Connector-{0}] [{1}] Connected", idn, cmd); - m_pending = false; - } + m_log.DebugFormat("[IRC-Connector-{0}] [{1}] parms = <{2}>", idn, cmd, parms); eventIrcJoin(pfx, cmd, parms); break; @@ -767,7 +753,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat if (IrcChannel.StartsWith(":")) IrcChannel = IrcChannel.Substring(1); - m_log.DebugFormat("[IRC-Connector-{0}] Event: IRCJoin {1}:{2}", idn, m_server, m_ircChannel); + if(IrcChannel == m_ircChannel) + { + m_log.InfoFormat("[IRC-Connector-{0}] Joined requested channel {1} at {2}", idn, IrcChannel,m_server); + m_pending = false; + } + else + m_log.InfoFormat("[IRC-Connector-{0}] Joined unknown channel {1} at {2}", idn, IrcChannel,m_server); BroadcastSim(IrcUser, "/me joins {0}", IrcChannel); } @@ -881,7 +873,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat } // Being marked connected is not enough to ping. Socket establishment can sometimes take a long - // time, in which case the watch dog might try to ping the server before the socket has been + // time, in which case the watch dog might try to ping the server before the socket has been // set up, with nasty side-effects. else if (_pdk_ == 0) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index 6ea542c..a3ef83b 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs @@ -389,39 +389,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat } m_log.DebugFormat("[IRC-Region {0}] heard on channel {1} : {2}", Region, msg.Channel, msg.Message); - string txt = msg.Message; - if (null != avatar) + if (null != avatar && cs.RelayChat && (msg.Channel == 0 || msg.Channel == DEBUG_CHANNEL)) { - if ((!cs.RelayChat) || (msg.Channel != 0 && msg.Channel != DEBUG_CHANNEL)) - return; + string txt = msg.Message; + if (txt.StartsWith("/me ")) + txt = String.Format("{0} {1}", fromName, msg.Message.Substring(4)); + + cs.irc.PrivMsg(cs.PrivateMessageFormat, fromName, Region, txt); + return; } - else + + if (null == avatar && cs.RelayPrivateChannels && null != cs.AccessPassword && + msg.Channel == cs.RelayChannelOut) { - if (cs.RelayPrivateChannels && msg.Channel == cs.RelayChannelOut) + Match m = cs.AccessPasswordRegex.Match(msg.Message); + if (null != m) { - if (null != cs.AccessPassword) - { - Match m = cs.AccessPasswordRegex.Match(msg.Message); - if (null != m) - { - if (m.Groups["avatar"].ToString() != "") - fromName = m.Groups["avatar"].ToString(); - if (m.Groups["message"].ToString() != "") - txt = m.Groups["message"].ToString(); - } - } + m_log.DebugFormat("[IRC] relaying message from {0}: {1}", m.Groups["avatar"].ToString(), + m.Groups["message"].ToString()); + cs.irc.PrivMsg(cs.PrivateMessageFormat, m.Groups["avatar"].ToString(), + scene.RegionInfo.RegionName, m.Groups["message"].ToString()); } - fromName = "OBJECT: " + fromName; } - - if (txt.StartsWith("/me ")) - txt = String.Format("{0} {1}", fromName, msg.Message.Substring(4)); - m_log.DebugFormat("[IRC] relaying message from {0}: {1}", fromName, txt); - cs.irc.PrivMsg(cs.PrivateMessageFormat, fromName, Region, txt); } - // This method gives the region an opportunity to interfere with + // This method gives the region an opportunity to interfere with // message delivery. For now we just enforce the enable/disable // flag. @@ -435,7 +428,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat } } - // This supports any local message traffic that might be needed in + // This supports any local message traffic that might be needed in // support of command processing. At present there is none. internal void LocalChat(string msg) -- cgit v1.1