From eb78ac343e68d36a84fdc7fec47797233699cccc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 17 Aug 2009 19:48:32 +0100 Subject: Apply http://opensimulator.org/mantis/view.php?id=3538 Add ability to silence IRC relay of region joins and quits from certain users This is useful for admins who wish to remain hidden, or service bots. Thanks RemedyTomm --- .../OptionalModules/Avatar/Chat/ChannelState.cs | 10 +++++++-- .../OptionalModules/Avatar/Chat/RegionState.cs | 12 +++++++++-- bin/OpenSim.ini.example | 25 +++++++++++++--------- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index f03e5fc..b61959f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs @@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat internal string _accessPassword = String.Empty; internal Regex AccessPasswordRegex = null; + internal List ExcludeList = new List(); internal string AccessPassword { get { return _accessPassword; } @@ -210,8 +211,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay); cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword)); m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); - - + string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); + cs.ExcludeList = new List(excludes.Length); + foreach(string name in excludes) + { + cs.ExcludeList.Add(name.Trim().ToLower()); + } + // Fail if fundamental information is still missing if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index 203948e..c49d942 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs @@ -145,7 +145,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting)) { m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name); - cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); + //Check if this person is excluded from IRC + if (!cs.ExcludeList.Contains(client.Name.ToLower())) + { + cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); + } } client.OnLogout -= OnClientLoggedOut; client.OnConnectionClosed -= OnClientLoggedOut; @@ -209,7 +213,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat { string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName); - cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); + //Check if this person is excluded from IRC + if (!cs.ExcludeList.Contains(clientName.ToLower())) + { + cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); + } } } } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 166f2c6..9a17c58 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -679,16 +679,21 @@ ;relay_chat = true ;access_password = foobar - ;fallback_region = name of "default" region - ;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message - ; must start with "PRIVMSG {0} : " or irc server will get upset - ;for : : - ;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" - ;for : - : - msgformat = "PRIVMSG {0} : {3} - {1} of {2}" - ;for : - from : - ;msgformat = "PRIVMSG {0} : {3} - from {1}" - + ;;fallback_region = name of "default" region + ;;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message + ;; must start with "PRIVMSG {0} : " or irc server will get upset + ;;for : : + ;;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" + ;;for : - : + ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}" + ;;for : - from : + ;;msgformat = "PRIVMSG {0} : {3} - from {1}" + + ;; exclude_list allows you to stop the IRC connector from announcing the + ;;arrival and departure of certain users. For example: admins, bots. + + ;exclude_list=User 1,User 2,User 3 + ;[CMS] ;enabled = true -- cgit v1.1