Commit 2d1b534d authored by Evert Prants's avatar Evert Prants

Connection error display

parent 25e83a7c
......@@ -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
......
......@@ -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 = ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment