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! --- CONTRIBUTORS.txt | 4 ++-- OpenSim/Region/Environment/Modules/ChatModule.cs | 21 +++++++++++++++++++-- bin/OpenSim.ini.example | 14 ++++++++++++-- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 263bb90..4379771 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -23,8 +23,8 @@ OpenSim Developers * Danx0r * Dalien * Darok -* chi11ken -* adjohn +* chi11ken (3Di) +* adjohn (3Di) * Alondria Patches 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); } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 55d261c..3bcbdd2 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -18,10 +18,10 @@ physics = basicphysics ; *** Prim Storage - only leave one storage_plugin uncommented *** ; --- The NullStorage stores nothing - effectively disabling persistence: -; storage_plugin = "OpenSim.DataStore.NullStorage.dll" +storage_plugin = "OpenSim.DataStore.NullStorage.dll" ; --- To use sqlite as region storage: -storage_plugin = "OpenSim.Framework.Data.SQLite.dll" +;storage_plugin = "OpenSim.Framework.Data.SQLite.dll" storage_connection_string="URI=file:OpenSim.db,version=3"; ; --- To use MySQL storage, supply your own connectionstring (this is only an example): @@ -99,6 +99,15 @@ shout_distance = 100 ;server = name.of.irc.server.on.the.net ;nick = OpenSimBotNameProbablyMakeThisShorter ;channel = #the_irc_channel_you_want_to_connect_to +;port = 6667 +;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}" ; Uncomment the following to control the progression of daytime ; in the Sim. The defaults are what is shown below @@ -231,3 +240,4 @@ CompileWithDebugInformation=true ; Remove old scripts on next startup CleanUpOldScriptsOnStartup=true + -- cgit v1.1