Add support for RPL_ISUPPORT

This commit is contained in:
Simon Ser 2021-01-22 11:34:04 +01:00
parent 4acacc1f22
commit b3f8b0c97d
2 changed files with 28 additions and 0 deletions

View file

@ -3,6 +3,7 @@ export const RPL_WELCOME = "001";
export const RPL_YOURHOST = "002";
export const RPL_CREATED = "003";
export const RPL_MYINFO = "004";
export const RPL_ISUPPORT = "005";
export const RPL_ENDOFWHO = "315";
export const RPL_NOTOPIC = "331";
export const RPL_TOPIC = "332";
@ -313,3 +314,21 @@ export function parseCTCP(msg) {
ctcp.command = ctcp.command.toUpperCase();
return ctcp;
}
export function parseISUPPORT(tokens, params) {
tokens.forEach((tok) => {
if (tok.startsWith("-")) {
var k = tok.slice(1);
params.delete(k.toUpperCase());
return;
}
var i = tok.indexOf("=");
var k = tok, v = "";
if (i >= 0) {
k = tok.slice(0, i);
v = tok.slice(i + 1);
}
params.set(k.toUpperCase(), v);
});
}