Esempio n. 1
0
        private void server_NickError(object sender, NickErrorEventArgs e)
        {
            if (server.Connection.Registered || server.Connection.HandleNickTaken) return;
            string newNick;
            switch (nickRetry)
            {
                case 0:
                    newNick = Settings.Default.SecondNick;
                    DisplayNickTakenMessage(e.BadNick, newNick);
                    server.Connection.Sender.Register(newNick);
                    nickRetry = 1;
                    break;
                case 1:
                    newNick = Settings.Default.ThirdNick;
                    DisplayNickTakenMessage(e.BadNick, newNick);
                    server.Connection.Sender.Register(Settings.Default.ThirdNick);
                    nickRetry = 2;
                    break;
            }

            if (nickRetry == 2 || nickRetryFailed)
            {
                nickRetryFailed = true;
                //If the following is successful then nickRetryFailed will be set back to false
                var generator = new NameGenerator();
                string nick;
                do
                {
                    nick = generator.MakeName();
                } while (!Rfc2812Util.IsValidNick(nick) || nick.Length == 1);
                server.Connection.Sender.Register(nick);
            }
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 private void OnNickError(object sender, NickErrorEventArgs ea)
 {
     //If this is our initial connection attempt
     if (!Registered && HandleNickTaken)
     {
         var generator = new NameGenerator();
         string nick;
         do
         {
             nick = generator.MakeName();
         } while (!Rfc2812Util.IsValidNick(nick) || nick.Length == 1);
         //Try to reconnect
         Sender.Register(nick);
     }
 }