Ejemplo n.º 1
0
        public override void Run(IIrcUser client, IrcMessage message)
        {
            if (message.Params.Length != 1)
            {
                SendMessage(IrcNumericResponceId.ERR_NONICKNAMEGIVEN, client, "No nickname given");
                return;
            }
            if (!IRC.CheckString(message.Params[0], IRC.NICKNAME))
            {
                SendMessage(IrcNumericResponceId.ERR_ERRONEUSNICKNAME, client, "Erroneous nickname");
                return;
            }
            if (!client.IrcServer.CheckNick(message.Params[0]))
            {
                SendMessage(IrcNumericResponceId.ERR_NICKNAMEINUSE, client, "Nickname is already in use");
                return;
            }
            string oldNick = client.Nick;

            client.Channels.ForEach(channel => channel.Nick(client, message.Params[0]));
            if (!string.IsNullOrEmpty(client.User))
            {
                Say(client, "NICK", message.Params[0]);
            }
            client.Nick = message.Params[0];
        }