mirror of
https://codeberg.org/emersion/gamja
synced 2025-03-13 07:48:37 +01:00
Implement /kick and KICK handling in buffers
This commit is contained in:
parent
1d983bd142
commit
d34bff9ed6
16
commands.js
16
commands.js
@ -56,6 +56,22 @@ export default {
|
|||||||
getActiveClient(app).send({ command: "JOIN", params: [channel] });
|
getActiveClient(app).send({ command: "JOIN", params: [channel] });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"kick": {
|
||||||
|
usage: "<user>",
|
||||||
|
description: "Remove a user from the channel",
|
||||||
|
execute: (app, args) => {
|
||||||
|
var user = args[0];
|
||||||
|
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
||||||
|
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
|
||||||
|
throw new Error("Not in a channel");
|
||||||
|
}
|
||||||
|
var params = [activeBuffer.name, user];
|
||||||
|
if (args.length > 1) {
|
||||||
|
params.push(args.slice(1).join(" "));
|
||||||
|
}
|
||||||
|
getActiveClient(app).send({ command: "KICK", params });
|
||||||
|
},
|
||||||
|
},
|
||||||
"me": {
|
"me": {
|
||||||
usage: "<action>",
|
usage: "<action>",
|
||||||
description: "Send an action message to the current buffer",
|
description: "Send an action message to the current buffer",
|
||||||
|
@ -690,6 +690,22 @@ export default class App extends Component {
|
|||||||
});
|
});
|
||||||
this.addMessage(netID, channel, msg);
|
this.addMessage(netID, channel, msg);
|
||||||
|
|
||||||
|
if (msg.prefix.name == client.nick) {
|
||||||
|
this.receipts.delete(channel);
|
||||||
|
this.saveReceipts();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "KICK":
|
||||||
|
var channel = msg.params[0];
|
||||||
|
var user = msg.params[1];
|
||||||
|
|
||||||
|
this.setBufferState({ network: netID, name: channel }, (buf) => {
|
||||||
|
var members = new Map(buf.members);
|
||||||
|
members.delete(user);
|
||||||
|
return { members };
|
||||||
|
});
|
||||||
|
this.addMessage(netID, channel, msg);
|
||||||
|
|
||||||
if (msg.prefix.name == client.nick) {
|
if (msg.prefix.name == client.nick) {
|
||||||
this.receipts.delete(channel);
|
this.receipts.delete(channel);
|
||||||
this.saveReceipts();
|
this.saveReceipts();
|
||||||
|
@ -94,6 +94,11 @@ class LogLine extends Component {
|
|||||||
${createNick(msg.prefix.name)} has left
|
${createNick(msg.prefix.name)} has left
|
||||||
`;
|
`;
|
||||||
break;
|
break;
|
||||||
|
case "KICK":
|
||||||
|
content = html`
|
||||||
|
${createNick(msg.params[1])} was kicked by ${createNick(msg.prefix.name)} (${msg.params.slice(2)})
|
||||||
|
`;
|
||||||
|
break;
|
||||||
case "QUIT":
|
case "QUIT":
|
||||||
content = html`
|
content = html`
|
||||||
${createNick(msg.prefix.name)} has quit
|
${createNick(msg.prefix.name)} has quit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user