From b38cde945f3cf5ef365bdb3839183adcd881d8b8 Mon Sep 17 00:00:00 2001 From: Jean Date: Sun, 19 Jul 2026 04:21:25 +0000 Subject: [PATCH] Persist CS TOPIC so KEEPTOPIC and TOPICLOCK keep the set topic --- modules/chanserv/src/topic.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/chanserv/src/topic.rs b/modules/chanserv/src/topic.rs index 58ff955..62338cd 100644 --- a/modules/chanserv/src/topic.rs +++ b/modules/chanserv/src/topic.rs @@ -2,7 +2,7 @@ use echo_api::Store; use echo_api::{Sender, ServiceCtx}; // TOPIC <#channel> : set the channel topic (empty clears it). -pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &dyn Store) { +pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) { let Some(&chan) = args.get(1) else { ctx.notice(me, from.uid, "Syntax: TOPIC <#channel> "); return; @@ -12,5 +12,9 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: } let text = if args.len() > 2 { args[2..].join(" ") } else { String::new() }; ctx.topic(me, chan, &text); + // Persist it too: the ircd filters our own FTOPIC back out, so without this the + // stored topic stays stale and KEEPTOPIC/TOPICLOCK restore the old one on + // recreation/restart. Ignore NoChannel (require_op already proved it exists). + let _ = db.set_channel_topic(chan, &text); ctx.notice(me, from.uid, format!("Topic for \x02{chan}\x02 updated.")); }