diff options
author | Charles Krinke | 2008-07-12 17:19:24 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-12 17:19:24 +0000 |
commit | 0b28cf84f125a8c42faa6691fa2d19f1af204cce (patch) | |
tree | efa72d581a6321fc99cb7dffbb0f556bfa68f1fa | |
parent | Mantis#1714. Thank you kindly, Krtaylor for a patch that: (diff) | |
download | opensim-SC-0b28cf84f125a8c42faa6691fa2d19f1af204cce.zip opensim-SC-0b28cf84f125a8c42faa6691fa2d19f1af204cce.tar.gz opensim-SC-0b28cf84f125a8c42faa6691fa2d19f1af204cce.tar.bz2 opensim-SC-0b28cf84f125a8c42faa6691fa2d19f1af204cce.tar.xz |
Mantis#1718. Thank you kindly, Mircea for a patch that:
Adds some IRC bridge improvement.
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index f90b7e6..9240e5a 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs | |||
@@ -181,7 +181,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
181 | if (m_irc.Equals(sender)) return; | 181 | if (m_irc.Equals(sender)) return; |
182 | 182 | ||
183 | ScenePresence avatar = null; | 183 | ScenePresence avatar = null; |
184 | Scene scene = (Scene) e.Scene; | 184 | Scene scene = (Scene)e.Scene; |
185 | 185 | ||
186 | if (scene == null) | 186 | if (scene == null) |
187 | scene = m_scenes[0]; | 187 | scene = m_scenes[0]; |
@@ -249,7 +249,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
249 | { | 249 | { |
250 | m_log.DebugFormat("[IRC] {0} logging on", clientName); | 250 | m_log.DebugFormat("[IRC] {0} logging on", clientName); |
251 | m_irc.PrivMsg(m_irc.Nick, "Sim", | 251 | m_irc.PrivMsg(m_irc.Nick, "Sim", |
252 | String.Format("notices {0} logging on", clientName)); | 252 | String.Format("notices {0} logging on", clientName)); |
253 | } | 253 | } |
254 | m_last_new_user = clientName; | 254 | m_last_new_user = clientName; |
255 | } | 255 | } |
@@ -309,6 +309,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
309 | // but filters out multiple reports | 309 | // but filters out multiple reports |
310 | if (clientName != m_last_leaving_user) | 310 | if (clientName != m_last_leaving_user) |
311 | { | 311 | { |
312 | Console.WriteLine("Avatar was seen logging out."); | ||
313 | Console.ReadLine(); | ||
314 | Console.WriteLine(); | ||
312 | m_last_leaving_user = clientName; | 315 | m_last_leaving_user = clientName; |
313 | m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", clientName)); | 316 | m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging out", clientName)); |
314 | m_log.InfoFormat("[IRC]: {0} logging out", clientName); | 317 | m_log.InfoFormat("[IRC]: {0} logging out", clientName); |
@@ -367,6 +370,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
367 | 370 | ||
368 | private string m_basenick = null; | 371 | private string m_basenick = null; |
369 | private string m_channel = null; | 372 | private string m_channel = null; |
373 | private bool m_nrnick = false; | ||
370 | private bool m_connected = false; | 374 | private bool m_connected = false; |
371 | private bool m_enabled = false; | 375 | private bool m_enabled = false; |
372 | private List<Scene> m_last_scenes = null; | 376 | private List<Scene> m_last_scenes = null; |
@@ -380,7 +384,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
380 | private NetworkStream m_stream; | 384 | private NetworkStream m_stream; |
381 | internal object m_syncConnect = new object(); | 385 | internal object m_syncConnect = new object(); |
382 | private TcpClient m_tcp; | 386 | private TcpClient m_tcp; |
383 | private string m_user = "USER OpenSimBot 8 * :I'm an OpenSim to irc bot"; | 387 | private string m_user = "USER OpenSimBot 8 * :I'm an OpenSim to IRC bot"; |
384 | private StreamWriter m_writer; | 388 | private StreamWriter m_writer; |
385 | 389 | ||
386 | private Thread pingSender; | 390 | private Thread pingSender; |
@@ -418,13 +422,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
418 | m_server = config.Configs["IRC"].GetString("server"); | 422 | m_server = config.Configs["IRC"].GetString("server"); |
419 | m_nick = config.Configs["IRC"].GetString("nick"); | 423 | m_nick = config.Configs["IRC"].GetString("nick"); |
420 | m_basenick = m_nick; | 424 | m_basenick = m_nick; |
425 | m_nrnick = config.Configs["IRC"].GetBoolean("nicknum"); | ||
421 | m_channel = config.Configs["IRC"].GetString("channel"); | 426 | m_channel = config.Configs["IRC"].GetString("channel"); |
422 | m_port = (uint) config.Configs["IRC"].GetInt("port", (int) m_port); | 427 | m_port = (uint)config.Configs["IRC"].GetInt("port", (int)m_port); |
423 | m_user = config.Configs["IRC"].GetString("username", m_user); | 428 | m_user = config.Configs["IRC"].GetString("username", m_user); |
424 | m_privmsgformat = config.Configs["IRC"].GetString("msgformat", m_privmsgformat); | 429 | m_privmsgformat = config.Configs["IRC"].GetString("msgformat", m_privmsgformat); |
425 | if (m_server != null && m_nick != null && m_channel != null) | 430 | if (m_server != null && m_nick != null && m_channel != null) |
426 | { | 431 | { |
427 | m_nick = m_nick + Util.RandomClass.Next(1, 99); | 432 | if (m_nrnick == true) |
433 | { | ||
434 | m_nick = m_nick + Util.RandomClass.Next(1, 99); | ||
435 | } | ||
428 | m_enabled = true; | 436 | m_enabled = true; |
429 | } | 437 | } |
430 | } | 438 | } |
@@ -463,7 +471,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
463 | m_last_scenes = scenes; | 471 | m_last_scenes = scenes; |
464 | } | 472 | } |
465 | 473 | ||
466 | m_tcp = new TcpClient(m_server, (int) m_port); | 474 | m_tcp = new TcpClient(m_server, (int)m_port); |
467 | m_log.Info("[IRC]: Connecting..."); | 475 | m_log.Info("[IRC]: Connecting..."); |
468 | m_stream = m_tcp.GetStream(); | 476 | m_stream = m_tcp.GetStream(); |
469 | m_log.Info("[IRC]: Connected to " + m_server); | 477 | m_log.Info("[IRC]: Connected to " + m_server); |
@@ -737,7 +745,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
737 | Int32 commandCode = Int32.Parse(commArgs[1]); | 745 | Int32 commandCode = Int32.Parse(commArgs[1]); |
738 | switch (commandCode) | 746 | switch (commandCode) |
739 | { | 747 | { |
740 | case (int) ErrorReplies.NicknameInUse: | 748 | case (int)ErrorReplies.NicknameInUse: |
741 | // Gen a new name | 749 | // Gen a new name |
742 | m_nick = m_basenick + Util.RandomClass.Next(1, 99); | 750 | m_nick = m_basenick + Util.RandomClass.Next(1, 99); |
743 | m_log.ErrorFormat("[IRC]: IRC SERVER reports NicknameInUse, trying {0}", m_nick); | 751 | m_log.ErrorFormat("[IRC]: IRC SERVER reports NicknameInUse, trying {0}", m_nick); |
@@ -747,9 +755,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat | |||
747 | m_writer.WriteLine(String.Format("JOIN {0}", m_channel)); | 755 | m_writer.WriteLine(String.Format("JOIN {0}", m_channel)); |
748 | m_writer.Flush(); | 756 | m_writer.Flush(); |
749 | break; | 757 | break; |
750 | case (int) ErrorReplies.NotRegistered: | 758 | case (int)ErrorReplies.NotRegistered: |
751 | break; | 759 | break; |
752 | case (int) Replies.EndOfMotd: | 760 | case (int)Replies.EndOfMotd: |
753 | break; | 761 | break; |
754 | } | 762 | } |
755 | } | 763 | } |