Implement /close

This commit is contained in:
Simon Ser 2020-06-24 15:56:30 +02:00
parent df0981e8e0
commit c1c9aa261e
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -277,6 +277,22 @@ export default class App extends Component {
}
this.disconnect();
break;
case "close":
var target = this.state.activeBuffer;
if (!target || target == SERVER_BUFFER) {
console.error("Not in a user or channel buffer");
return;
}
if (this.isChannel(target)) {
this.client.send({ command: "PART", params: [channel] });
}
this.switchBuffer(SERVER_BUFFER);
this.setState((state) => {
var buffers = new Map(state.buffers);
buffers.delete(target);
return { buffers };
});
break;
case "join":
var channel = args[0];
if (!channel) {