From 2cfdfaeaa5580750a6469fee7376f12fda850275 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 6 Jun 2008 20:21:25 +0000 Subject: [PATCH] experimental IRC changes, because it's friday, and I'm curious if this will work. --- .../Modules/Avatar/Chat/IRCBridgeModule.cs | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs index 16fd7535a3..01099e9f19 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Chat/IRCBridgeModule.cs @@ -237,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat { try { - string clientName = String.Format("{0} {1}", client.FirstName, client.LastName); + string clientName = String.Format("{0}{1}", client.FirstName, client.LastName); client.OnChatFromViewer += SimChat; client.OnLogout += ClientLoggedOut; @@ -250,6 +250,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat m_log.DebugFormat("[IRC] {0} logging on", clientName); m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} logging on", clientName)); + m_irc.NewUser(clientName); } m_last_new_user = clientName; } @@ -284,9 +285,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat if ((m_irc.Enabled) && (m_irc.Connected)) { string regionName = presence.Scene.RegionInfo.RegionName; - string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); + string clientName = String.Format("{0}{1}", presence.Firstname, presence.Lastname); m_log.DebugFormat("[IRC] noticing {0} in {1}", clientName, regionName); m_irc.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} left {1}", clientName, regionName)); + m_irc.RemoveUser(clientName); } } catch (Exception) @@ -482,12 +484,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat listener.Start(); ThreadTracker.Add(listener); - m_writer.WriteLine(m_user); - m_writer.Flush(); - m_writer.WriteLine(String.Format("NICK {0}", m_nick)); - m_writer.Flush(); - m_writer.WriteLine(String.Format("JOIN {0}", m_channel)); - m_writer.Flush(); + NewUser(m_user); + m_log.Info("[IRC]: Connection fully established"); m_connected = true; } @@ -500,6 +498,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat } } + public void NewUser(string nick) + { + m_writer.WriteLine(nick); + m_writer.Flush(); + m_writer.WriteLine(String.Format("NICK {0}", m_nick)); + m_writer.Flush(); + m_writer.WriteLine(String.Format("JOIN {0}", m_channel)); + m_writer.Flush(); + } + + public void RemoveUser(string nick) + { + m_writer.WriteLine(String.Format("QUIT :{0}", nick)); + } + public void Reconnect() { m_connected = false;