Connection error display

This commit is contained in:
Evert Prants 2020-02-08 12:50:56 +02:00
parent 25e83a7c30
commit 2d1b534d16
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 9 additions and 3 deletions

View File

@ -281,8 +281,8 @@ class IRCConnectionHandler {
let list = null let list = null
switch (line.command) { switch (line.command) {
case 'error': case 'ERROR':
this.conn.emit('connectionError', new Error('IRCError' + line.raw)) this.conn.emit('connectionError', new Error('IRCError ' + line.message))
break break
case 'PONG': case 'PONG':
this.conn.ping = Date.now() - this.conn.pingSent this.conn.ping = Date.now() - this.conn.pingSent

View File

@ -1313,6 +1313,10 @@ class ConnectionHandler {
irc.chat.newServerChatBuffer(client) irc.chat.newServerChatBuffer(client)
irc.chat.joinChannels(client.data.actualServer, data.channels) 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 => { client.connect().catch(e => {
console.error(e) console.error(e)
irc.auther.authMessage('Socket connection failed!', true) irc.auther.authMessage('Socket connection failed!', true)
@ -1457,6 +1461,7 @@ class IRCConnector {
} }
fillFormFromURI (urlParams) { fillFormFromURI (urlParams) {
let skipServer = false
if (this.defaults.server) { if (this.defaults.server) {
clientdom.connector.server.value = this.defaults.server clientdom.connector.server.value = this.defaults.server
} }
@ -1494,6 +1499,7 @@ class IRCConnector {
case 'server': case 'server':
case 'host': case 'host':
if (validators.iporhost(value)) { if (validators.iporhost(value)) {
skipServer = true
clientdom.connector.server.value = value clientdom.connector.server.value = value
} }
break break
@ -1518,7 +1524,7 @@ class IRCConnector {
clientdom.connector.channel.value = window.location.hash 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 t1 = window.location.pathname.substring(1, window.location.pathname.length - 1)
let proposed = '' let proposed = ''