Beispiel #1
0
        // 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
        }
Beispiel #2
0
        // 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
        }
Beispiel #3
0
        public void RemoveUser(UserInfo user)
        {
            var upci = UserPerChannelInfos[user.Nick];

            UserPerChannelInfos.TryRemove(user.Nick, out UserPerChannelInfo info);
            user.UserPerChannelInfos.Remove(upci);

            if (UserPerChannelInfos.Count == 0)
            {
                IrcDaemon.Channels.TryRemove(Name, out ChannelInfo channel);
            }
        }
Beispiel #4
0
        public void RemoveUser(UserInfo user)
        {
            var upci = UserPerChannelInfos[user.Nick];

            UserPerChannelInfos.Remove(user.Nick);
            user.UserPerChannelInfos.Remove(upci);

            if (UserPerChannelInfos.Any() == false)
            {
                IrcDaemon.Channels.Remove(Name);
            }
        }