diff --git a/src/js/irc.js b/src/js/irc.js index 2eb6d27..b980a35 100644 --- a/src/js/irc.js +++ b/src/js/irc.js @@ -281,8 +281,8 @@ class IRCConnectionHandler { let list = null switch (line.command) { - case 'error': - this.conn.emit('connectionError', new Error('IRCError' + line.raw)) + case 'ERROR': + this.conn.emit('connectionError', new Error('IRCError ' + line.message)) break case 'PONG': this.conn.ping = Date.now() - this.conn.pingSent diff --git a/src/js/main.js b/src/js/main.js index 9c92018..5b0fb46 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1313,6 +1313,10 @@ class ConnectionHandler { irc.chat.newServerChatBuffer(client) irc.chat.joinChannels(client.data.actualServer, data.channels) }) + client.once('connectionError', (e) => { + if (e.message.indexOf('IRCError') !== 0) return + irc.auther.authMessage(e.message, true) + }) client.connect().catch(e => { console.error(e) irc.auther.authMessage('Socket connection failed!', true) @@ -1457,6 +1461,7 @@ class IRCConnector { } fillFormFromURI (urlParams) { + let skipServer = false if (this.defaults.server) { clientdom.connector.server.value = this.defaults.server } @@ -1494,6 +1499,7 @@ class IRCConnector { case 'server': case 'host': if (validators.iporhost(value)) { + skipServer = true clientdom.connector.server.value = value } break @@ -1518,7 +1524,7 @@ class IRCConnector { clientdom.connector.channel.value = window.location.hash } - if (window.location.pathname.length > 4) { + if (window.location.pathname.length > 4 && !skipServer) { let t1 = window.location.pathname.substring(1, window.location.pathname.length - 1) let proposed = ''