diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs index 213ae969c6..8f1ad00ecf 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs @@ -56,6 +56,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat // default values (retained for compatability). internal string Server = null; + internal string Password = null; internal string IrcChannel = null; internal string BaseNickname = "OSimBot"; internal uint Port = 6667; @@ -118,6 +119,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat internal ChannelState(ChannelState model) { Server = model.Server; + Password = model.Password; IrcChannel = model.IrcChannel; Port = model.Port; BaseNickname = model.BaseNickname; @@ -159,6 +161,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat cs.Server = Substitute(rs, config.GetString("server", null)); m_log.DebugFormat("[IRC-Channel-{0}] Server : <{1}>", cs.idn, cs.Server); + cs.Password = Substitute(rs, config.GetString("password", null)); + // probably not a good idea to put a password in the log file cs.IrcChannel = Substitute(rs, config.GetString("channel", null)); m_log.DebugFormat("[IRC-Channel-{0}] IrcChannel : <{1}>", cs.idn, cs.IrcChannel); cs.Port = Convert.ToUInt32(Substitute(rs, config.GetString("port", Convert.ToString(cs.Port)))); diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs index 1dec9a564b..e1c0ac48f7 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs @@ -146,6 +146,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat get { return m_server; } set { m_server = value; } } + private string m_password = null; + public string Password + { + get { return m_password; } + set { m_password = value; } + } private string m_user = "USER OpenSimBot 8 * :I'm an OpenSim to IRC bot"; public string User @@ -183,6 +189,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat // Setup IRC session parameters m_server = cs.Server; + m_password = cs.Password; m_baseNick = cs.BaseNickname; m_randomizeNick = cs.RandomizeNickname; m_ircChannel = cs.IrcChannel; @@ -346,7 +353,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat ThreadTracker.Add(m_listener); // This is the message order recommended by RFC 2812 - + if (m_password != null) + m_writer.WriteLine(String.Format("PASS {0}", m_password)); m_writer.WriteLine(String.Format("NICK {0}", m_nick)); m_writer.Flush(); m_writer.WriteLine(m_user); diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 05680ab398..f202e18377 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -512,6 +512,8 @@ InterregionComms = "RESTComms" ;[IRC] ;enabled = true ; you need to set this otherwise it won't connect ;server = name.of.irc.server.on.the.net + ;; user password - only use this if the server requires one + ;password = mypass ;nick = OpenSimBotNameProbablyMakeThisShorter ;channel = #the_irc_channel_you_want_to_connect_to ;port = 6667