chanserv: require channel-operator status to register

Registering a channel now needs the caller to actually hold operator
status in it, so you can't register a channel you don't control. The
network view tracks per-channel ops from FJOIN prefixes and FMODE +o/-o.
This commit is contained in:
Jean Chevronnet 2026-07-12 13:57:29 +00:00
parent 0681c7a3b2
commit 921088bfca
No known key found for this signature in database
5 changed files with 88 additions and 23 deletions

View file

@ -74,6 +74,11 @@ impl Service for ChanServ {
ctx.notice(me, from.uid, "You need to be logged in to register a channel. Identify to NickServ first.");
return;
};
// You can only register a channel you actually control right now.
if !net.is_op(chan, from.uid) {
ctx.notice(me, from.uid, format!("You must be a channel operator (\x02@\x02) in \x02{chan}\x02 to register it."));
return;
}
match db.register_channel(chan, account) {
Ok(()) => {
ctx.channel_mode(me, chan, "+r"); // mark the channel registered