Skip to content
Snippets Groups Projects
Commit 906ee60f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't hang if/when nick is rejected

Change wait_for() to no longer loop indefinitely.

If nick is rejected (e.g. begins with number), prepend '_' to it.

Increment version number to 1.62

Fixes issue #723
parent 44626dfe
No related branches found
No related tags found
No related merge requests found
Pipeline #5923 passed
......@@ -8,7 +8,7 @@ var old_auto_terminate=js.auto_terminate;
js.on_exit("js.auto_terminate=old_auto_terminate");
js.auto_terminate=false;
const REVISION = "1.61";
const REVISION = "1.62";
const SPACEx80 = " ";
const MAX_HIST = 50;
......@@ -144,8 +144,12 @@ channels=new Channels();
// Wait for welcome message...
while(!connected) {
if(sock.poll(connect_timeout)) {
wait_for(["433","422","376"]);
connected=1;
if(wait_for(["433","432","422","376"]) == 432) {
log(LOG_WARNING, "Nick rejected with error 432, auto-fixing nick");
nick = "_" + nick;
send_cmd("NICK", nick);
} else
connected=1;
}
else {
alert("Response timeout");
......@@ -631,7 +635,7 @@ function wait_for(commands) {
var message="";
var i=0;
while(1) {
while(sock.poll(connect_timeout)) {
if(!sock.is_connected) {
alert("Lost connection");
sock.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment