From 760ece2595caa7a47205bd96e207e431a548f01d Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Mon, 4 Feb 2008 10:23:13 +0000 Subject: * Chat Message format patch from kinoc (#443) Thanks! --- OpenSim/Region/Environment/Modules/ChatModule.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Modules') diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 5ca0ed7..749a923 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -154,6 +154,8 @@ namespace OpenSim.Region.Environment.Modules } client.OnLogout += ClientLoggedOut; client.OnConnectionClosed += ClientLoggedOut; + //client.OnDisconnectUser += ClientLoggedOut; + client.OnLogout += ClientLoggedOut; } catch (Exception ex) { @@ -323,6 +325,7 @@ namespace OpenSim.Region.Environment.Modules private string m_nick = null; private string m_basenick = null; private string m_channel = null; + private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"; private NetworkStream m_stream; private TcpClient m_tcp; @@ -356,7 +359,13 @@ namespace OpenSim.Region.Environment.Modules // ; USER * : // channel = #opensim-regions // port = 6667 - // + // ;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message + // ;for : : + // ;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" + // ;for : - : + // ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}" + // ;for : - from : + // ;msgformat = "PRIVMSG {0} : {3} - from {1}" // Traps I/O disconnects so it does not crash the sim // Trys to reconnect if disconnected and someone says something // Tells IRC server "QUIT" when doing a close (just to be nice) @@ -370,6 +379,7 @@ namespace OpenSim.Region.Environment.Modules m_channel = config.Configs["IRC"].GetString("channel"); m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); m_user = config.Configs["IRC"].GetString("username", m_user); + m_privmsgformat = config.Configs["IRC"].GetString("msgformat", m_privmsgformat); if (m_server != null && m_nick != null && m_channel != null) { m_nick = m_nick + Util.RandomClass.Next(1, 99); @@ -456,7 +466,14 @@ namespace OpenSim.Region.Environment.Modules try { - m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); + if (m_privmsgformat == null) + { + m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); + } + else + { + m_writer.WriteLine(m_privmsgformat, m_channel, from, region, msg); + } m_writer.Flush(); m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg); } -- cgit v1.1