diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 68 |
1 files changed, 27 insertions, 41 deletions
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index b118257..a21aefe 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.Environment.Modules | |||
75 | catch (Exception) | 75 | catch (Exception) |
76 | { | 76 | { |
77 | } | 77 | } |
78 | |||
78 | try | 79 | try |
79 | { | 80 | { |
80 | m_defaultzone = config.Configs["IRC"].GetString("nick","Sim"); | 81 | m_defaultzone = config.Configs["IRC"].GetString("nick","Sim"); |
@@ -97,7 +98,6 @@ namespace OpenSim.Region.Environment.Modules | |||
97 | m_irc_connector.Name = "IRCConnectorThread"; | 98 | m_irc_connector.Name = "IRCConnectorThread"; |
98 | m_irc_connector.IsBackground = true; | 99 | m_irc_connector.IsBackground = true; |
99 | } | 100 | } |
100 | |||
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
@@ -118,10 +118,9 @@ namespace OpenSim.Region.Environment.Modules | |||
118 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); | 118 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | catch (Exception ex) | 121 | catch (Exception) |
122 | { | 122 | { |
123 | } | 123 | } |
124 | |||
125 | } | 124 | } |
126 | } | 125 | } |
127 | 126 | ||
@@ -195,8 +194,8 @@ namespace OpenSim.Region.Environment.Modules | |||
195 | m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString()); | 194 | m_log.Error("[IRC]: ClientLoggedOut exception trap:" + ex.ToString()); |
196 | } | 195 | } |
197 | } | 196 | } |
198 | |||
199 | } | 197 | } |
198 | |||
200 | private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos, | 199 | private void TrySendChatMessage(ScenePresence presence, LLVector3 fromPos, LLVector3 regionPos, |
201 | LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message) | 200 | LLUUID fromAgentID, string fromName, ChatTypeEnum type, string message) |
202 | { | 201 | { |
@@ -253,7 +252,7 @@ namespace OpenSim.Region.Environment.Modules | |||
253 | } | 252 | } |
254 | 253 | ||
255 | // Try to reconnect to server if not connected | 254 | // Try to reconnect to server if not connected |
256 | if ((m_irc.Enabled)&&(!m_irc.Connected)) | 255 | if (m_irc.Enabled && !m_irc.Connected) |
257 | { | 256 | { |
258 | // In a non-blocking way. Eventually the connector will get it started | 257 | // In a non-blocking way. Eventually the connector will get it started |
259 | try | 258 | try |
@@ -267,7 +266,7 @@ namespace OpenSim.Region.Environment.Modules | |||
267 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); | 266 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); |
268 | } | 267 | } |
269 | } | 268 | } |
270 | catch (Exception ex) | 269 | catch (Exception) |
271 | { | 270 | { |
272 | } | 271 | } |
273 | } | 272 | } |
@@ -285,10 +284,10 @@ namespace OpenSim.Region.Environment.Modules | |||
285 | foreach (Scene s in m_scenes) | 284 | foreach (Scene s in m_scenes) |
286 | { | 285 | { |
287 | s.ForEachScenePresence(delegate(ScenePresence presence) | 286 | s.ForEachScenePresence(delegate(ScenePresence presence) |
288 | { | 287 | { |
289 | TrySendChatMessage(presence, fromPos, regionPos, | 288 | TrySendChatMessage(presence, fromPos, regionPos, |
290 | fromAgentID, fromName, e.Type, message); | 289 | fromAgentID, fromName, e.Type, message); |
291 | }); | 290 | }); |
292 | } | 291 | } |
293 | } | 292 | } |
294 | } | 293 | } |
@@ -312,18 +311,18 @@ namespace OpenSim.Region.Environment.Modules | |||
312 | string sourceRegion = null; | 311 | string sourceRegion = null; |
313 | foreach (Scene s in m_scenes) | 312 | foreach (Scene s in m_scenes) |
314 | { | 313 | { |
315 | s.ForEachScenePresence(delegate(ScenePresence presence) | 314 | s.ForEachScenePresence(delegate(ScenePresence presence) |
316 | { | 315 | { |
317 | if ((presence.IsChildAgent==false) | 316 | if ((presence.IsChildAgent==false) |
318 | &&(presence.Firstname==client_FirstName) | 317 | &&(presence.Firstname==client_FirstName) |
319 | &&(presence.Lastname==client_LastName)) | 318 | &&(presence.Lastname==client_LastName)) |
320 | { | 319 | { |
321 | sourceRegion = presence.Scene.RegionInfo.RegionName; | 320 | sourceRegion = presence.Scene.RegionInfo.RegionName; |
322 | //sourceRegion= s.RegionInfo.RegionName; | 321 | //sourceRegion= s.RegionInfo.RegionName; |
323 | } | 322 | } |
324 | }); | 323 | }); |
325 | if (sourceRegion != null) return sourceRegion; | 324 | if (sourceRegion != null) return sourceRegion; |
326 | } | 325 | } |
327 | if (m_defaultzone == null) { m_defaultzone = "Sim"; } | 326 | if (m_defaultzone == null) { m_defaultzone = "Sim"; } |
328 | return m_defaultzone; | 327 | return m_defaultzone; |
329 | } | 328 | } |
@@ -475,7 +474,6 @@ namespace OpenSim.Region.Environment.Modules | |||
475 | m_reader.Close(); | 474 | m_reader.Close(); |
476 | m_tcp.Close(); | 475 | m_tcp.Close(); |
477 | if (m_enabled) { Connect(m_last_scenes); } | 476 | if (m_enabled) { Connect(m_last_scenes); } |
478 | |||
479 | } | 477 | } |
480 | 478 | ||
481 | public void PrivMsg(string from, string region, string msg) | 479 | public void PrivMsg(string from, string region, string msg) |
@@ -539,9 +537,9 @@ namespace OpenSim.Region.Environment.Modules | |||
539 | 537 | ||
540 | public void PingRun() | 538 | public void PingRun() |
541 | { | 539 | { |
542 | // IRC keep alive thread | 540 | // IRC keep alive thread |
543 | // send PING ever 15 seconds | 541 | // send PING ever 15 seconds |
544 | while (true) | 542 | while (true) |
545 | { | 543 | { |
546 | try | 544 | try |
547 | { | 545 | { |
@@ -594,8 +592,6 @@ namespace OpenSim.Region.Environment.Modules | |||
594 | } | 592 | } |
595 | }); | 593 | }); |
596 | } | 594 | } |
597 | |||
598 | |||
599 | } | 595 | } |
600 | else | 596 | else |
601 | { | 597 | { |
@@ -645,7 +641,6 @@ namespace OpenSim.Region.Environment.Modules | |||
645 | catch (Exception ex) // IRC gate should not crash Sim | 641 | catch (Exception ex) // IRC gate should not crash Sim |
646 | { | 642 | { |
647 | m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace); | 643 | m_log.Error("[IRC]: BroadcastSim Exception Trap:" + ex.ToString() + "\n" + ex.StackTrace); |
648 | |||
649 | } | 644 | } |
650 | } | 645 | } |
651 | 646 | ||
@@ -701,7 +696,6 @@ namespace OpenSim.Region.Environment.Modules | |||
701 | 696 | ||
702 | m_writer.WriteLine("PONG " + p_reply); | 697 | m_writer.WriteLine("PONG " + p_reply); |
703 | m_writer.Flush(); | 698 | m_writer.Flush(); |
704 | |||
705 | } | 699 | } |
706 | else if (commArgs[0] == c_server) | 700 | else if (commArgs[0] == c_server) |
707 | { | 701 | { |
@@ -727,10 +721,9 @@ namespace OpenSim.Region.Environment.Modules | |||
727 | break; | 721 | break; |
728 | } | 722 | } |
729 | } | 723 | } |
730 | catch (Exception ex) | 724 | catch (Exception) |
731 | { | 725 | { |
732 | } | 726 | } |
733 | |||
734 | } | 727 | } |
735 | else | 728 | else |
736 | { | 729 | { |
@@ -746,8 +739,6 @@ namespace OpenSim.Region.Environment.Modules | |||
746 | case "QUIT": eventIrcQuit(commArgs); break; | 739 | case "QUIT": eventIrcQuit(commArgs); break; |
747 | case "PONG": break; // that's nice | 740 | case "PONG": break; // that's nice |
748 | } | 741 | } |
749 | |||
750 | |||
751 | } | 742 | } |
752 | } | 743 | } |
753 | 744 | ||
@@ -756,7 +747,6 @@ namespace OpenSim.Region.Environment.Modules | |||
756 | string IrcChannel = commArgs[2]; | 747 | string IrcChannel = commArgs[2]; |
757 | string IrcUser = commArgs[0].Split('!')[0]; | 748 | string IrcUser = commArgs[0].Split('!')[0]; |
758 | BroadcastSim(IrcUser + " is joining " + IrcChannel, m_nick); | 749 | BroadcastSim(IrcUser + " is joining " + IrcChannel, m_nick); |
759 | |||
760 | } | 750 | } |
761 | 751 | ||
762 | public void eventIrcPart(string[] commArgs) | 752 | public void eventIrcPart(string[] commArgs) |
@@ -764,8 +754,8 @@ namespace OpenSim.Region.Environment.Modules | |||
764 | string IrcChannel = commArgs[2]; | 754 | string IrcChannel = commArgs[2]; |
765 | string IrcUser = commArgs[0].Split('!')[0]; | 755 | string IrcUser = commArgs[0].Split('!')[0]; |
766 | BroadcastSim(IrcUser + " is parting " + IrcChannel, m_nick); | 756 | BroadcastSim(IrcUser + " is parting " + IrcChannel, m_nick); |
767 | |||
768 | } | 757 | } |
758 | |||
769 | public void eventIrcMode(string[] commArgs) | 759 | public void eventIrcMode(string[] commArgs) |
770 | { | 760 | { |
771 | string IrcChannel = commArgs[2]; | 761 | string IrcChannel = commArgs[2]; |
@@ -780,14 +770,13 @@ namespace OpenSim.Region.Environment.Modules | |||
780 | { | 770 | { |
781 | UserMode = UserMode.Remove(0, 1); | 771 | UserMode = UserMode.Remove(0, 1); |
782 | } | 772 | } |
783 | |||
784 | } | 773 | } |
774 | |||
785 | public void eventIrcNickChange(string[] commArgs) | 775 | public void eventIrcNickChange(string[] commArgs) |
786 | { | 776 | { |
787 | string UserOldNick = commArgs[0].Split('!')[0]; | 777 | string UserOldNick = commArgs[0].Split('!')[0]; |
788 | string UserNewNick = commArgs[2].Remove(0, 1); | 778 | string UserNewNick = commArgs[2].Remove(0, 1); |
789 | BroadcastSim(UserOldNick + " changed their nick to " + UserNewNick, m_nick); | 779 | BroadcastSim(UserOldNick + " changed their nick to " + UserNewNick, m_nick); |
790 | |||
791 | } | 780 | } |
792 | 781 | ||
793 | public void eventIrcKick(string[] commArgs) | 782 | public void eventIrcKick(string[] commArgs) |
@@ -804,7 +793,6 @@ namespace OpenSim.Region.Environment.Modules | |||
804 | if (UserKicked == m_nick) | 793 | if (UserKicked == m_nick) |
805 | { | 794 | { |
806 | BroadcastSim("Hey, that was me!!!", m_nick); | 795 | BroadcastSim("Hey, that was me!!!", m_nick); |
807 | |||
808 | } | 796 | } |
809 | } | 797 | } |
810 | 798 | ||
@@ -818,10 +806,8 @@ namespace OpenSim.Region.Environment.Modules | |||
818 | QuitMessage += commArgs[i] + " "; | 806 | QuitMessage += commArgs[i] + " "; |
819 | } | 807 | } |
820 | BroadcastSim(IrcUser + " quits saying " + QuitMessage, m_nick); | 808 | BroadcastSim(IrcUser + " quits saying " + QuitMessage, m_nick); |
821 | |||
822 | } | 809 | } |
823 | 810 | ||
824 | |||
825 | public void Close() | 811 | public void Close() |
826 | { | 812 | { |
827 | m_connected = false; | 813 | m_connected = false; |