aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 16:35:00 +0000
committerAdam Frisby2008-05-01 16:35:00 +0000
commit13526097f24b7a8ad63b1d482c44b44397fa055f (patch)
tree7a82c20ed7c63e2aea5ad3863325e37f64e1cbea /OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
parent* Breaking all the code, breaking all the code..! (diff)
downloadopensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.zip
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.gz
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.bz2
opensim-SC_OLD-13526097f24b7a8ad63b1d482c44b44397fa055f.tar.xz
* Spring cleaning on Region.Environment.
* Converted a large number of read-only fields to be actually, readonly. * Reformatted code sections. * Removed redundant code.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs56
1 files changed, 28 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
index 15720fc..8d42681 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/ChatModule.cs
@@ -44,15 +44,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
44 public class ChatModule : IRegionModule, ISimChat 44 public class ChatModule : IRegionModule, ISimChat
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private string m_defaultzone = null; 47 private readonly List<Scene> m_scenes = new List<Scene>();
48 private string m_defaultzone;
48 49
49 private IRCChatModule m_irc = null; 50 private IRCChatModule m_irc;
50 private Thread m_irc_connector = null; 51 private Thread m_irc_connector;
51 52
52 private string m_last_leaving_user = null; 53 private string m_last_leaving_user;
53 private string m_last_new_user = null; 54 private string m_last_new_user;
54 private int m_saydistance = 30; 55 private int m_saydistance = 30;
55 private List<Scene> m_scenes = new List<Scene>();
56 private int m_shoutdistance = 100; 56 private int m_shoutdistance = 100;
57 internal object m_syncInit = new object(); 57 internal object m_syncInit = new object();
58 internal object m_syncLogout = new object(); 58 internal object m_syncLogout = new object();
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
257 } 257 }
258 catch (Exception ex) 258 catch (Exception ex)
259 { 259 {
260 m_log.Error("[IRC]: NewClient exception trap:" + ex.ToString()); 260 m_log.Error("[IRC]: NewClient exception trap:" + ex);
261 } 261 }
262 } 262 }
263 263
@@ -284,7 +284,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
284 } 284 }
285 catch (Exception ex) 285 catch (Exception ex)
286 { 286 {
287 m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString()); 287 m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex);
288 } 288 }
289 } 289 }
290 } 290 }
@@ -372,24 +372,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
372 #endregion 372 #endregion
373 373
374 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 374 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
375 private Thread listener;
376 375
377 private string m_basenick = null; 376 private readonly string m_basenick;
378 private string m_channel = null; 377 private readonly string m_channel;
379 private bool m_connected = false; 378 private readonly bool m_enabled;
380 private bool m_enabled = false; 379 private readonly uint m_port = 6668;
381 private List<Scene> m_last_scenes = null; 380 private readonly string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}";
382 private string m_nick = null; 381 private readonly string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
383 private uint m_port = 6668; 382 private Thread listener;
384 private string m_privmsgformat = "PRIVMSG {0} :<{1} in {2}>: {3}"; 383 private bool m_connected;
384 private List<Scene> m_last_scenes;
385 private string m_nick;
385 private StreamReader m_reader; 386 private StreamReader m_reader;
386 private List<Scene> m_scenes = null; 387 private List<Scene> m_scenes;
387 private string m_server = null; 388 private string m_server;
388 389
389 private NetworkStream m_stream; 390 private NetworkStream m_stream;
390 internal object m_syncConnect = new object(); 391 internal object m_syncConnect = new object();
391 private TcpClient m_tcp; 392 private TcpClient m_tcp;
392 private string m_user = "USER OpenSimBot 8 * :I'm a OpenSim to irc bot";
393 private StreamWriter m_writer; 393 private StreamWriter m_writer;
394 394
395 private Thread pingSender; 395 private Thread pingSender;
@@ -478,13 +478,13 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
478 m_reader = new StreamReader(m_stream); 478 m_reader = new StreamReader(m_stream);
479 m_writer = new StreamWriter(m_stream); 479 m_writer = new StreamWriter(m_stream);
480 480
481 pingSender = new Thread(new ThreadStart(PingRun)); 481 pingSender = new Thread(PingRun);
482 pingSender.Name = "PingSenderThread"; 482 pingSender.Name = "PingSenderThread";
483 pingSender.IsBackground = true; 483 pingSender.IsBackground = true;
484 pingSender.Start(); 484 pingSender.Start();
485 ThreadTracker.Add(pingSender); 485 ThreadTracker.Add(pingSender);
486 486
487 listener = new Thread(new ThreadStart(ListenerRun)); 487 listener = new Thread(ListenerRun);
488 listener.Name = "IRCChatModuleListenerThread"; 488 listener.Name = "IRCChatModuleListenerThread";
489 listener.IsBackground = true; 489 listener.IsBackground = true;
490 listener.Start(); 490 listener.Start();
@@ -545,7 +545,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
545 } 545 }
546 catch (Exception ex) 546 catch (Exception ex)
547 { 547 {
548 m_log.Error("[IRC]: PrivMsg exception trap:" + ex.ToString()); 548 m_log.Error("[IRC]: PrivMsg exception trap:" + ex);
549 } 549 }
550 } 550 }
551 551
@@ -588,7 +588,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
588 { 588 {
589 try 589 try
590 { 590 {
591 if (m_connected == true) 591 if (m_connected)
592 { 592 {
593 m_writer.WriteLine("PING :" + m_server); 593 m_writer.WriteLine("PING :" + m_server);
594 m_writer.Flush(); 594 m_writer.Flush();
@@ -602,7 +602,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
602 } 602 }
603 catch (Exception ex) 603 catch (Exception ex)
604 { 604 {
605 m_log.Error("[IRC]: PingRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace); 605 m_log.Error("[IRC]: PingRun exception trap:" + ex + "\n" + ex.StackTrace);
606 } 606 }
607 } 607 }
608 } 608 }
@@ -615,7 +615,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
615 { 615 {
616 try 616 try
617 { 617 {
618 while ((m_connected == true) && ((inputLine = m_reader.ReadLine()) != null)) 618 while (m_connected && ((inputLine = m_reader.ReadLine()) != null))
619 { 619 {
620 // Console.WriteLine(inputLine); 620 // Console.WriteLine(inputLine);
621 if (inputLine.Contains(m_channel)) 621 if (inputLine.Contains(m_channel))
@@ -659,7 +659,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
659 } 659 }
660 catch (Exception ex) 660 catch (Exception ex)
661 { 661 {
662 m_log.Error("[IRC]: ListenerRun exception trap:" + ex.ToString() + "\n" + ex.StackTrace); 662 m_log.Error("[IRC]: ListenerRun exception trap:" + ex + "\n" + ex.StackTrace);
663 } 663 }
664 } 664 }
665 } 665 }
@@ -685,7 +685,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
685 } 685 }
686 catch (Exception ex) // IRC gate should not crash Sim 686 catch (Exception ex) // IRC gate should not crash Sim
687 { 687 {
688 m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace); 688 m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex + "\n" + ex.StackTrace);
689 } 689 }
690 } 690 }
691 691