* Chat Message format patch from kinoc (#443) Thanks!

ThreadPoolClientBranch
Adam Frisby 2008-02-04 10:23:13 +00:00
parent 8213297999
commit 760ece2595
3 changed files with 33 additions and 6 deletions

View File

@ -23,8 +23,8 @@ OpenSim Developers
* Danx0r * Danx0r
* Dalien * Dalien
* Darok * Darok
* chi11ken * chi11ken (3Di)
* adjohn * adjohn (3Di)
* Alondria * Alondria
Patches Patches

View File

@ -154,6 +154,8 @@ namespace OpenSim.Region.Environment.Modules
} }
client.OnLogout += ClientLoggedOut; client.OnLogout += ClientLoggedOut;
client.OnConnectionClosed += ClientLoggedOut; client.OnConnectionClosed += ClientLoggedOut;
//client.OnDisconnectUser += ClientLoggedOut;
client.OnLogout += ClientLoggedOut;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -323,6 +325,7 @@ namespace OpenSim.Region.Environment.Modules
private string m_nick = null; private string m_nick = null;
private string m_basenick = null; private string m_basenick = null;
private string m_channel = null; private string m_channel = null;
private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
private NetworkStream m_stream; private NetworkStream m_stream;
private TcpClient m_tcp; private TcpClient m_tcp;
@ -356,7 +359,13 @@ namespace OpenSim.Region.Environment.Modules
// ; USER <irc_user> <visible=8,invisible=0> * : <IRC_realname> // ; USER <irc_user> <visible=8,invisible=0> * : <IRC_realname>
// channel = #opensim-regions // channel = #opensim-regions
// port = 6667 // port = 6667
// // ;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message
// ;for <bot>:<user in region> :<message>
// ;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"
// ;for <bot>:<message> - <user of region> :
// ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}"
// ;for <bot>:<message> - from <user> :
// ;msgformat = "PRIVMSG {0} : {3} - from {1}"
// Traps I/O disconnects so it does not crash the sim // Traps I/O disconnects so it does not crash the sim
// Trys to reconnect if disconnected and someone says something // Trys to reconnect if disconnected and someone says something
// Tells IRC server "QUIT" when doing a close (just to be nice) // 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_channel = config.Configs["IRC"].GetString("channel");
m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port);
m_user = config.Configs["IRC"].GetString("username", m_user); 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) if (m_server != null && m_nick != null && m_channel != null)
{ {
m_nick = m_nick + Util.RandomClass.Next(1, 99); m_nick = m_nick + Util.RandomClass.Next(1, 99);
@ -455,8 +465,15 @@ namespace OpenSim.Region.Environment.Modules
// One message to the IRC server // One message to the IRC server
try try
{
if (m_privmsgformat == null)
{ {
m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); 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_writer.Flush();
m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg); m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg);
} }

View File

@ -18,10 +18,10 @@ physics = basicphysics
; *** Prim Storage - only leave one storage_plugin uncommented *** ; *** Prim Storage - only leave one storage_plugin uncommented ***
; --- The NullStorage stores nothing - effectively disabling persistence: ; --- 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: ; --- 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"; storage_connection_string="URI=file:OpenSim.db,version=3";
; --- To use MySQL storage, supply your own connectionstring (this is only an example): ; --- 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 ;server = name.of.irc.server.on.the.net
;nick = OpenSimBotNameProbablyMakeThisShorter ;nick = OpenSimBotNameProbablyMakeThisShorter
;channel = #the_irc_channel_you_want_to_connect_to ;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 <bot>:<user in region> :<message>
;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"
;for <bot>:<message> - <user of region> :
msgformat = "PRIVMSG {0} : {3} - {1} of {2}"
;for <bot>:<message> - from <user> :
;msgformat = "PRIVMSG {0} : {3} - from {1}"
; Uncomment the following to control the progression of daytime ; Uncomment the following to control the progression of daytime
; in the Sim. The defaults are what is shown below ; in the Sim. The defaults are what is shown below
@ -231,3 +240,4 @@ CompileWithDebugInformation=true
; Remove old scripts on next startup ; Remove old scripts on next startup
CleanUpOldScriptsOnStartup=true CleanUpOldScriptsOnStartup=true