// Cleanly Quit a user, in any case, Connection dropped, QuitMesssage, all traces of 'this' must be removed. public void Remove(string message) { // Clean up channels foreach (var upci in UserPerChannelInfos.Reverse <UserPerChannelInfo>()) { // Important: remove nick first! or we end in a exception-catch endless loop upci.ChannelInfo.RemoveUser(this); IrcDaemon.Commands.Send(new QuitArgument(this, upci.ChannelInfo, message)); } Debug.Assert(UserPerChannelInfos.Any() == false); // Clean up server if (Nick != null && IrcDaemon.Nicks.ContainsKey(Nick)) { IrcDaemon.Nicks.Remove(Nick); } if (IrcDaemon.Sockets.ContainsKey(Socket)) { IrcDaemon.Sockets.Remove(Socket); } // Close connection Socket.Close(); // Ready for destruction }
// Cleanly Quit a user, in any case, Connection dropped, QuitMesssage, all traces of 'this' must be removed. public void Remove(string message) { // Clean up channels foreach (var upci in UserPerChannelInfos.Reverse <UserPerChannelInfo>()) { // Important: remove nick first! or we end in a exception-catch endless loop upci.ChannelInfo.RemoveUser(this); IrcDaemon.Commands.Send(new QuitArgument(this, upci.ChannelInfo, message)); } Debug.Assert(UserPerChannelInfos.Any() == false); // Clean up server UserInfo info; if (Nick != null) { IrcDaemon.Nicks.TryRemove(Nick, out info); } IrcDaemon.Users.TryRemove(ProfileId, out info); // Close connection Socket.Close(); // Ready for destruction }