diff --git a/assets/client.js b/assets/client.js index 6e17e80..5317e5f 100644 --- a/assets/client.js +++ b/assets/client.js @@ -181,9 +181,6 @@ function connect() { ws.onopen = function() { console.log("Connection opened"); - // TODO: wait for RPL_WELCOME - connectElt.style.display = "none"; - if (server.pass) { ws.send(formatMessage({ command: "PASS", params: [server.pass] })); } @@ -199,6 +196,10 @@ function connect() { console.log(msg); switch (msg.command) { + case RPL_WELCOME: + console.log("Registration complete"); + connectElt.style.display = "none"; + break; case "NOTICE": case "PRIVMSG": var target = msg.params[0]; diff --git a/assets/irc.js b/assets/irc.js index 66e4921..bd91da6 100644 --- a/assets/irc.js +++ b/assets/irc.js @@ -1,3 +1,5 @@ +const RPL_WELCOME = "001"; + function parsePrefix(s) { var prefix = { name: null,