Add support for IRCv3 setname

This commit is contained in:
Simon Ser 2021-05-25 20:22:21 +02:00
parent 92535fae24
commit 12a38ace90
3 changed files with 22 additions and 1 deletions

View file

@ -144,6 +144,18 @@ export default {
app.reconnect();
},
},
"setname": {
usage: "<realname>",
description: "Change current realname",
execute: (app, args) => {
var newRealname = args.join(" ");
var client = getActiveClient(app);
if (!client.enabledCaps["setname"]) {
throw new Error("Server doesn't support changing the realname");
}
client.send({ command: "SETNAME", params: [newRealname] });
},
},
"topic": {
usage: "<topic>",
description: "Change the topic of the current channel",

View file

@ -725,6 +725,12 @@ export default class App extends Component {
});
affectedBuffers.forEach((name) => this.addMessage(netID, name, msg));
break;
case "SETNAME":
this.setBufferState({ network: netID, name: msg.prefix.name }, (buf) => {
var who = { ...buf.who, realname: msg.params[0] };
return { who }
});
break;
case "TOPIC":
var channel = msg.params[0];
var topic = msg.params[1];

View file

@ -5,11 +5,14 @@ import * as irc from "./irc.js";
const permanentCaps = [
"away-notify",
"batch",
"draft/chathistory",
"echo-message",
"message-tags",
"multi-prefix",
"server-time",
"setname",
"draft/chathistory",
"soju.im/bouncer-networks",
];