mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-14 19:05:01 -05:00
Unescape ISUPPORT values
This allows ISUPPORT values to contain spaces. References: https://github.com/ircdocs/modern-irc/pull/137
This commit is contained in:
parent
34aea84dde
commit
12440691c9
1 changed files with 8 additions and 1 deletions
|
@ -364,6 +364,13 @@ export function parseCTCP(msg) {
|
|||
return ctcp;
|
||||
}
|
||||
|
||||
function unescapeISUPPORTValue(s) {
|
||||
return s.replace(/\\x[0-9A-Z]{2}/gi, (esc) => {
|
||||
let hex = esc.slice(2);
|
||||
return String.fromCharCode(parseInt(hex, 16));
|
||||
});
|
||||
}
|
||||
|
||||
export function parseISUPPORT(tokens, params) {
|
||||
let changed = [];
|
||||
tokens.forEach((tok) => {
|
||||
|
@ -377,7 +384,7 @@ export function parseISUPPORT(tokens, params) {
|
|||
let k = tok, v = "";
|
||||
if (i >= 0) {
|
||||
k = tok.slice(0, i);
|
||||
v = tok.slice(i + 1);
|
||||
v = unescapeISUPPORTValue(tok.slice(i + 1));
|
||||
}
|
||||
|
||||
k = k.toUpperCase();
|
||||
|
|
Loading…
Reference in a new issue