From 12a38ace902799ded4eee568189fcf77095ffa68 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 25 May 2021 20:22:21 +0200 Subject: [PATCH] Add support for IRCv3 setname --- commands.js | 12 ++++++++++++ components/app.js | 6 ++++++ lib/client.js | 5 ++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/commands.js b/commands.js index 872148e..7dad527 100644 --- a/commands.js +++ b/commands.js @@ -144,6 +144,18 @@ export default { app.reconnect(); }, }, + "setname": { + usage: "", + 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: "", description: "Change the topic of the current channel", diff --git a/components/app.js b/components/app.js index 44e27f0..7e47fe1 100644 --- a/components/app.js +++ b/components/app.js @@ -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]; diff --git a/lib/client.js b/lib/client.js index f77122f..8297ec9 100644 --- a/lib/client.js +++ b/lib/client.js @@ -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", ];