experimental IRC changes, because it's friday, and I'm curious if this

will work.
0.6.0-stable
Sean Dague 2008-06-06 20:21:25 +00:00
parent be44969927
commit 2cfdfaeaa5
1 changed files with 21 additions and 8 deletions

View File

@ -237,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
{ {
try 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.OnChatFromViewer += SimChat;
client.OnLogout += ClientLoggedOut; client.OnLogout += ClientLoggedOut;
@ -250,6 +250,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
m_log.DebugFormat("[IRC] {0} logging on", clientName); m_log.DebugFormat("[IRC] {0} logging on", clientName);
m_irc.PrivMsg(m_irc.Nick, "Sim", m_irc.PrivMsg(m_irc.Nick, "Sim",
String.Format("notices {0} logging on", clientName)); String.Format("notices {0} logging on", clientName));
m_irc.NewUser(clientName);
} }
m_last_new_user = clientName; m_last_new_user = clientName;
} }
@ -284,9 +285,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
if ((m_irc.Enabled) && (m_irc.Connected)) if ((m_irc.Enabled) && (m_irc.Connected))
{ {
string regionName = presence.Scene.RegionInfo.RegionName; 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_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.PrivMsg(m_irc.Nick, "Sim", String.Format("notices {0} left {1}", clientName, regionName));
m_irc.RemoveUser(clientName);
} }
} }
catch (Exception) catch (Exception)
@ -482,12 +484,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Chat
listener.Start(); listener.Start();
ThreadTracker.Add(listener); ThreadTracker.Add(listener);
m_writer.WriteLine(m_user); NewUser(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();
m_log.Info("[IRC]: Connection fully established"); m_log.Info("[IRC]: Connection fully established");
m_connected = true; 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() public void Reconnect()
{ {
m_connected = false; m_connected = false;