remove trailing x01 from action, fix topic set time

This commit is contained in:
Evert Prants 2020-02-03 22:32:40 +02:00
parent 394eb42fbc
commit 6c6aa85bf4
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 2 additions and 5 deletions

View File

@ -76,7 +76,6 @@ async function _waitOpen (s) {
try {
await new Promise((resolve, reject) => {
o = function () {
console.log('removing events', o, c)
s.removeEventListener('close', c)
s.removeEventListener('open', o)
resolve()
@ -105,11 +104,9 @@ async function _trySocket (address, port, ssl, useTranslator) {
}
let tSock = new WebSocket(proto + '://' + conn)
try {
console.log('Waiting to open')
await _waitOpen(tSock)
} catch (e) {
console.error(e)
console.error('Waiting to open failed')
return _trySocket(address, port, ssl, true)
}
@ -482,7 +479,7 @@ class IRCConnectionHandler {
break
case '333':
this.conn.emit('pass_to_client', {
type: 'channel_topic', channel: line.arguments[1], set_by: line.arguments[2], time: line.arguments[3], server: serverName
type: 'channel_topic', channel: line.arguments[1], set_by: line.arguments[2], time: (line.arguments[3] || line.trailing), server: serverName
})
break
case '375':
@ -758,7 +755,6 @@ class IRCConnection extends EventEmitter {
this.socket.addEventListener('message', (e) => {
let line = e.data
if (line.indexOf('PING') === 0) {
console.log('%s server pinged us (%s)', new Date(), line)
this.write('PONG %s', line.substring(4))
return
}

View File

@ -1998,6 +1998,7 @@ class IRCChatWindow {
if (message.type === 'privmsg' && message.message.indexOf('\x01ACTION') === 0) {
message.message = message.message.substring(8)
message.message = message.message.substring(0, message.message.length - 1)
message.type = 'action'
}