Parse ISUPPORT tokens in client

This commit is contained in:
Simon Ser 2021-05-11 16:03:16 +02:00
parent e242d5222e
commit 305ffb569c
2 changed files with 7 additions and 4 deletions

View file

@ -514,11 +514,8 @@ export default class App extends Component {
this.setBufferState({ network: netID, name: SERVER_BUFFER }, { serverInfo }); this.setBufferState({ network: netID, name: SERVER_BUFFER }, { serverInfo });
break; break;
case irc.RPL_ISUPPORT: case irc.RPL_ISUPPORT:
var tokens = msg.params.slice(1, -1);
this.setNetworkState(netID, (network) => { this.setNetworkState(netID, (network) => {
var isupport = new Map(network.isupport); return { isupport: new Map(client.isupport) };
irc.parseISUPPORT(tokens, isupport);
return { isupport };
}); });
break; break;
case irc.RPL_NOTOPIC: case irc.RPL_NOTOPIC:

View file

@ -28,6 +28,7 @@ export default class Client extends EventTarget {
nick = null; nick = null;
availableCaps = {}; availableCaps = {};
enabledCaps = {}; enabledCaps = {};
isupport = new Map();
ws = null; ws = null;
params = { params = {
@ -82,6 +83,7 @@ export default class Client extends EventTarget {
this.enabledCaps = {}; this.enabledCaps = {};
this.batches = new Map(); this.batches = new Map();
this.pendingHistory = Promise.resolve(null); this.pendingHistory = Promise.resolve(null);
this.isupport = new Map();
if (this.autoReconnect) { if (this.autoReconnect) {
console.info("Reconnecting to server in " + RECONNECT_DELAY_SEC + " seconds"); console.info("Reconnecting to server in " + RECONNECT_DELAY_SEC + " seconds");
@ -158,6 +160,10 @@ export default class Client extends EventTarget {
this.setStatus(Client.Status.REGISTERED); this.setStatus(Client.Status.REGISTERED);
this.serverPrefix = msg.prefix; this.serverPrefix = msg.prefix;
break; break;
case irc.RPL_ISUPPORT:
var tokens = msg.params.slice(1, -1);
irc.parseISUPPORT(tokens, this.isupport);
break;
case "CAP": case "CAP":
this.handleCap(msg); this.handleCap(msg);
break; break;