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; ...@@ -8,7 +8,7 @@ var old_auto_terminate=js.auto_terminate;
js.on_exit("js.auto_terminate=old_auto_terminate"); js.on_exit("js.auto_terminate=old_auto_terminate");
js.auto_terminate=false; js.auto_terminate=false;
const REVISION = "1.61"; const REVISION = "1.62";
const SPACEx80 = " "; const SPACEx80 = " ";
const MAX_HIST = 50; const MAX_HIST = 50;
...@@ -144,7 +144,11 @@ channels=new Channels(); ...@@ -144,7 +144,11 @@ channels=new Channels();
// Wait for welcome message... // Wait for welcome message...
while(!connected) { while(!connected) {
if(sock.poll(connect_timeout)) { if(sock.poll(connect_timeout)) {
wait_for(["433","422","376"]); 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; connected=1;
} }
else { else {
...@@ -631,7 +635,7 @@ function wait_for(commands) { ...@@ -631,7 +635,7 @@ function wait_for(commands) {
var message=""; var message="";
var i=0; var i=0;
while(1) { while(sock.poll(connect_timeout)) {
if(!sock.is_connected) { if(!sock.is_connected) {
alert("Lost connection"); alert("Lost connection");
sock.close(); sock.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment