From 3d8e96491bb5a228b260e76c1bc9b16d8e960db4 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Mon, 9 Feb 2026 08:08:15 +0100 Subject: [PATCH 1/2] topic: display topic when no arguments are given That's what the help says that we do, so do it. Fixes: https://github.com/thelounge/thelounge/issues/5026 --- server/plugins/inputs/topic.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/plugins/inputs/topic.ts b/server/plugins/inputs/topic.ts index 5fb76994..15a1be4e 100644 --- a/server/plugins/inputs/topic.ts +++ b/server/plugins/inputs/topic.ts @@ -19,6 +19,14 @@ const input: PluginInputHandler = function ({irc}, chan, cmd, args) { return; } + const cleanArgs = args.map((s) => s.trim()).filter((s) => s !== ""); + + if (cleanArgs.length === 0) { + irc.raw("TOPIC", chan.name); + return; + } + + // we use the non trimmed args here, the user may have added white space on purpose irc.setTopic(chan.name, args.join(" ")); return true; }; From 91fb1ee343a733c0a3373a953e0ef46a646db884 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Mon, 9 Feb 2026 08:16:27 +0100 Subject: [PATCH 2/2] add cleartopic command Fixes: https://github.com/thelounge/thelounge/issues/4687 --- client/components/Windows/Help.vue | 9 +++++++++ server/plugins/inputs/topic.ts | 7 ++++++- server/types/modules/irc-framework.d.ts | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/client/components/Windows/Help.vue b/client/components/Windows/Help.vue index d0715a2e..e10adf41 100644 --- a/client/components/Windows/Help.vue +++ b/client/components/Windows/Help.vue @@ -793,6 +793,15 @@ +
+
+ /cleartopic +
+
+

Clear the topic in the current channel.

+
+
+
/unban nick diff --git a/server/plugins/inputs/topic.ts b/server/plugins/inputs/topic.ts index 15a1be4e..9b890ac2 100644 --- a/server/plugins/inputs/topic.ts +++ b/server/plugins/inputs/topic.ts @@ -4,7 +4,7 @@ import Msg from "../../models/msg"; import {MessageType} from "../../../shared/types/msg"; import {ChanType} from "../../../shared/types/chan"; -const commands = ["topic"]; +const commands = ["topic", "cleartopic"]; const input: PluginInputHandler = function ({irc}, chan, cmd, args) { if (chan.type !== ChanType.CHANNEL) { @@ -19,6 +19,11 @@ const input: PluginInputHandler = function ({irc}, chan, cmd, args) { return; } + if (cmd === "cleartopic") { + irc.clearTopic(chan.name); + return; + } + const cleanArgs = args.map((s) => s.trim()).filter((s) => s !== ""); if (cleanArgs.length === 0) { diff --git a/server/types/modules/irc-framework.d.ts b/server/types/modules/irc-framework.d.ts index ef9f82df..2e8062af 100644 --- a/server/types/modules/irc-framework.d.ts +++ b/server/types/modules/irc-framework.d.ts @@ -206,6 +206,8 @@ declare module "irc-framework" { setTopic(channel: string, newTopic: string): void; + clearTopic(channel: string): void; + ctcpRequest(target: string, type: string, ...params: Array): void; ctcpResponse(target: string, type: string, ...params: Array): void;