aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs18
1 files changed, 5 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
index f5bd44d..bdd07e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs
@@ -109,10 +109,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
109 109
110 internal int m_resetk = 0; 110 internal int m_resetk = 0;
111 111
112 // Working threads
113
114 private Thread m_listener = null;
115
116 private Object msyncConnect = new Object(); 112 private Object msyncConnect = new Object();
117 113
118 internal bool m_randomizeNick = true; // add random suffix 114 internal bool m_randomizeNick = true; // add random suffix
@@ -363,10 +359,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
363 359
364 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port); 360 m_log.InfoFormat("[IRC-Connector-{0}]: Connected to {1}:{2}", idn, m_server, m_port);
365 361
366 m_listener = new Thread(new ThreadStart(ListenerRun)); 362 Watchdog.StartThread(ListenerRun, "IRCConnectionListenerThread", ThreadPriority.Normal, true, false);
367 m_listener.Name = "IRCConnectorListenerThread";
368 m_listener.IsBackground = true;
369 m_listener.Start();
370 363
371 // This is the message order recommended by RFC 2812 364 // This is the message order recommended by RFC 2812
372 if (m_password != null) 365 if (m_password != null)
@@ -510,21 +503,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
510 { 503 {
511 while (m_enabled && m_connected) 504 while (m_enabled && m_connected)
512 { 505 {
513
514 if ((inputLine = m_reader.ReadLine()) == null) 506 if ((inputLine = m_reader.ReadLine()) == null)
515 throw new Exception("Listener input socket closed"); 507 throw new Exception("Listener input socket closed");
516 508
509 Watchdog.UpdateThread();
510
517 // m_log.Info("[IRCConnector]: " + inputLine); 511 // m_log.Info("[IRCConnector]: " + inputLine);
518 512
519 if (inputLine.Contains("PRIVMSG")) 513 if (inputLine.Contains("PRIVMSG"))
520 { 514 {
521
522 Dictionary<string, string> data = ExtractMsg(inputLine); 515 Dictionary<string, string> data = ExtractMsg(inputLine);
523 516
524 // Any chat ??? 517 // Any chat ???
525 if (data != null) 518 if (data != null)
526 { 519 {
527
528 OSChatMessage c = new OSChatMessage(); 520 OSChatMessage c = new OSChatMessage();
529 c.Message = data["msg"]; 521 c.Message = data["msg"];
530 c.Type = ChatTypeEnum.Region; 522 c.Type = ChatTypeEnum.Region;
@@ -540,9 +532,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
540 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9)); 532 c.Message = String.Format("/me {0}", c.Message.Substring(8, c.Message.Length - 9));
541 533
542 ChannelState.OSChat(this, c, false); 534 ChannelState.OSChat(this, c, false);
543
544 } 535 }
545
546 } 536 }
547 else 537 else
548 { 538 {
@@ -562,6 +552,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat
562 552
563 if (m_enabled && (m_resetk == resetk)) 553 if (m_enabled && (m_resetk == resetk))
564 Reconnect(); 554 Reconnect();
555
556 Watchdog.RemoveThread();
565 } 557 }
566 558
567 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)", 559 private Regex RE = new Regex(@":(?<nick>[\w-]*)!(?<user>\S*) PRIVMSG (?<channel>\S+) :(?<msg>.*)",