diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 21 |
1 files changed, 19 insertions, 2 deletions
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 | |||
154 | } | 154 | } |
155 | client.OnLogout += ClientLoggedOut; | 155 | client.OnLogout += ClientLoggedOut; |
156 | client.OnConnectionClosed += ClientLoggedOut; | 156 | client.OnConnectionClosed += ClientLoggedOut; |
157 | //client.OnDisconnectUser += ClientLoggedOut; | ||
158 | client.OnLogout += ClientLoggedOut; | ||
157 | } | 159 | } |
158 | catch (Exception ex) | 160 | catch (Exception ex) |
159 | { | 161 | { |
@@ -323,6 +325,7 @@ namespace OpenSim.Region.Environment.Modules | |||
323 | private string m_nick = null; | 325 | private string m_nick = null; |
324 | private string m_basenick = null; | 326 | private string m_basenick = null; |
325 | private string m_channel = null; | 327 | private string m_channel = null; |
328 | private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"; | ||
326 | 329 | ||
327 | private NetworkStream m_stream; | 330 | private NetworkStream m_stream; |
328 | private TcpClient m_tcp; | 331 | private TcpClient m_tcp; |
@@ -356,7 +359,13 @@ namespace OpenSim.Region.Environment.Modules | |||
356 | // ; USER <irc_user> <visible=8,invisible=0> * : <IRC_realname> | 359 | // ; USER <irc_user> <visible=8,invisible=0> * : <IRC_realname> |
357 | // channel = #opensim-regions | 360 | // channel = #opensim-regions |
358 | // port = 6667 | 361 | // port = 6667 |
359 | // | 362 | // ;MSGformat fields : 0=botnick, 1=user, 2=region, 3=message |
363 | // ;for <bot>:<user in region> :<message> | ||
364 | // ;msgformat = "PRIVMSG {0} :<{1} in {2}>: {3}" | ||
365 | // ;for <bot>:<message> - <user of region> : | ||
366 | // ;msgformat = "PRIVMSG {0} : {3} - {1} of {2}" | ||
367 | // ;for <bot>:<message> - from <user> : | ||
368 | // ;msgformat = "PRIVMSG {0} : {3} - from {1}" | ||
360 | // Traps I/O disconnects so it does not crash the sim | 369 | // Traps I/O disconnects so it does not crash the sim |
361 | // Trys to reconnect if disconnected and someone says something | 370 | // Trys to reconnect if disconnected and someone says something |
362 | // Tells IRC server "QUIT" when doing a close (just to be nice) | 371 | // Tells IRC server "QUIT" when doing a close (just to be nice) |
@@ -370,6 +379,7 @@ namespace OpenSim.Region.Environment.Modules | |||
370 | m_channel = config.Configs["IRC"].GetString("channel"); | 379 | m_channel = config.Configs["IRC"].GetString("channel"); |
371 | m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); | 380 | m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); |
372 | m_user = config.Configs["IRC"].GetString("username", m_user); | 381 | m_user = config.Configs["IRC"].GetString("username", m_user); |
382 | m_privmsgformat = config.Configs["IRC"].GetString("msgformat", m_privmsgformat); | ||
373 | if (m_server != null && m_nick != null && m_channel != null) | 383 | if (m_server != null && m_nick != null && m_channel != null) |
374 | { | 384 | { |
375 | m_nick = m_nick + Util.RandomClass.Next(1, 99); | 385 | m_nick = m_nick + Util.RandomClass.Next(1, 99); |
@@ -456,7 +466,14 @@ namespace OpenSim.Region.Environment.Modules | |||
456 | 466 | ||
457 | try | 467 | try |
458 | { | 468 | { |
459 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); | 469 | if (m_privmsgformat == null) |
470 | { | ||
471 | m_writer.WriteLine("PRIVMSG {0} :<{1} in {2}>: {3}", m_channel, from, region, msg); | ||
472 | } | ||
473 | else | ||
474 | { | ||
475 | m_writer.WriteLine(m_privmsgformat, m_channel, from, region, msg); | ||
476 | } | ||
460 | m_writer.Flush(); | 477 | m_writer.Flush(); |
461 | m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg); | 478 | m_log.Verbose("IRC", "PrivMsg " + from + " in " + region + " :" + msg); |
462 | } | 479 | } |