From fbc933ac47b23437a453f0f655d9d9868d1855c3 Mon Sep 17 00:00:00 2001 From: emerson Date: Wed, 2 Feb 2022 12:51:34 -0500 Subject: [PATCH] Fix channel renaming M->I --- README.md | 2 +- src/IRCUser.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0d0710f..91003e5 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Note that there are no PMs, because Matrix doesn't differentiate between DMs and | Encrypted rooms | ❌ | ❌ | [#20](https://todo.sr.ht/~emerson/reflectionircd/20) | | Rich text | ❌ | ❌ | [#31](https://todo.sr.ht/~emerson/reflectionircd/31) | | Presence | ❌ | ❌ | [#25](https://todo.sr.ht/~emerson/reflectionircd/25) Note that not all homeservers have presence enabled | -| Channel renaming (IRCv3) | 🟨 | ❌ | [#29](https://todo.sr.ht/~emerson/reflectionircd/29) [#16](https://todo.sr.ht/~emerson/reflectionircd/16) Only when the canonical alias changes | +| Channel renaming (IRCv3) | ✅ | ❌ | [#16](https://todo.sr.ht/~emerson/reflectionircd/16) | | Message replies (IRCv3) | ✅ | ✅ | Clients without support will still receive the reply message, but it won't be marked as a reply | | Message reactions (IRCv3) | ✅ | ✅ | Can't undo reactions yet | | Extended invites (IRCv3) | ✅ | ✅ || diff --git a/src/IRCUser.ts b/src/IRCUser.ts index 41736c0..948523c 100644 --- a/src/IRCUser.ts +++ b/src/IRCUser.ts @@ -260,9 +260,11 @@ export class IRCUser { } updateRoomName(newNameEvent: any, targetChannel: Channel) { - const newName: string = newNameEvent["content"]["alias"]; - if (!newName || newName === targetChannel.name) + let newName: string = newNameEvent["content"]["alias"]; + if (newName === targetChannel.name) return; + if (!newName || newName === "") + newName = targetChannel.roomId; const oldName = targetChannel.name; this.channels.delete(oldName); targetChannel.name = newName; @@ -272,7 +274,7 @@ export class IRCUser { client.sendMessage(this.server.name, "RENAME", [oldName, targetChannel.name, "New channel name set"], new Map()); } else { - client.sendMessage(this.server.name, "PART", [oldName, "Renaming channel"], new Map()); + client.sendMessage(this.getMask(), "PART", [oldName, `Renaming channel to ${newName}`], new Map()); this.joinNewIRCClient(client, targetChannel); } })