Index: xul/content/handlers.js =================================================================== RCS file: /cvsroot/mozilla/extensions/irc/xul/content/handlers.js,v retrieving revision 1.172 retrieving revision 1.173 diff -d -p -u -6 -r1.172 -r1.173 --- xul/content/handlers.js 17 Mar 2008 17:44:32 -0000 1.172 +++ xul/content/handlers.js 18 Apr 2008 03:02:54 -0000 1.173 @@ -1799,13 +1799,13 @@ function my_433 (e) } if (this.state == NET_CONNECTING) { // Force a number, thanks. var nickIndex = 1 * arrayIndexOf(this.prefs["nicknameList"], nick); - var newnick; + var newnick = null; dd("433: failed with " + nick + " (" + nickIndex + ")"); var tryList = true; if ((("_firstNick" in this) && (this._firstNick == -1)) || @@ -1833,21 +1833,29 @@ function my_433 (e) dd(" trying " + newnick + " (" + nickIndex + ")"); // Save first index we've tried. if (!("_firstNick" in this)) this._firstNick = nickIndex; } - else + else if (this.NICK_RETRIES > 0) { newnick = this.INITIAL_NICK + "_"; + this.NICK_RETRIES--; dd(" trying " + newnick); } - this.INITIAL_NICK = newnick; - this.display(getMsg(MSG_RETRY_NICK, [nick, newnick]), "433"); - this.primServ.changeNick(newnick); + if (newnick) + { + this.INITIAL_NICK = newnick; + this.display(getMsg(MSG_RETRY_NICK, [nick, newnick]), "433"); + this.primServ.changeNick(newnick); + } + else + { + this.display(getMsg(MSG_NICK_IN_USE, nick), "433"); + } } else { this.display(getMsg(MSG_NICK_IN_USE, nick), "433"); } } @@ -1870,12 +1878,14 @@ function my_sconnect (e) { if (jsenv.HAS_SERVER_SOCKETS) client.ident.addNetwork(this, e.server); else display(MSG_IDENT_SERVER_NOT_POSSIBLE, MT_WARN); } + + this.NICK_RETRIES = this.prefs["nicknameList"].length + 3; } CIRCNetwork.prototype.onError = function my_neterror (e) { var msg;