From 37b63636eecabe3569f09781f4bb5b319cd85e24 Mon Sep 17 00:00:00 2001 From: Dahlia Trimble Date: Sun, 18 Jan 2009 10:50:53 +0000 Subject: Added an optional password for the IRC module --- OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs | 4 ++++ OpenSim/Region/Environment/Modules/Avatar/Chat/IRCConnector.cs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChannelState.cs index 213ae96..8f1ad00 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 1dec9a5..e1c0ac4 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); -- cgit v1.1