Introduce Client.who

This commit is contained in:
Simon Ser 2021-05-31 17:11:42 +02:00
parent 02145b45ad
commit 619f1db08f
2 changed files with 20 additions and 1 deletions

View File

@ -914,7 +914,7 @@ export default class App extends Component {
this.switchToChannel = target;
client.send({ command: "JOIN", params: [target] });
} else {
client.send({ command: "WHO", params: [target] });
client.who(target);
this.createBuffer(netID, target);
this.switchBuffer({ network: netID, name: target });
}

View File

@ -293,6 +293,25 @@ export default class Client extends EventTarget {
}
}
who(mask) {
var msg = { command: "WHO", params: [mask] };
var l = [];
return this.roundtrip(msg, (event) => {
var msg = event.detail.message;
switch (msg.command) {
case irc.RPL_WHOREPLY:
// TODO: match with mask
l.push(msg);
break;
case irc.RPL_ENDOFWHO:
if (msg.params[1] === mask) {
return l;
}
break;
}
});
}
whois(target) {
var targetCM = this.cm(target);
var msg = { command: "WHOIS", params: [target] };