Set channel mode +r when a channel is registered

ChanServ sends FMODE to mark a registered channel +r (the m_services
c_registered mode), and -r on drop. Sourced from our server, which the
ircd requires for that mode, with a low TS so it applies to the existing
channel.
This commit is contained in:
Jean Chevronnet 2026-07-12 08:33:39 +00:00
parent 89593ebeb4
commit 64500906d8
No known key found for this signature in database
5 changed files with 33 additions and 6 deletions

View file

@ -179,6 +179,12 @@ impl Protocol for InspIrcd {
let now = SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(self.ts);
vec![self.from_us(format!("SVSNICK {} {} {}", uid, nick, now))]
}
// FMODE <chan> <ts> <modes>. The ircd drops an FMODE whose TS is newer
// than the channel's, so we send TS 1 to guarantee it applies to the
// existing channel. Sourced from our server, which +r requires.
NetAction::ChannelMode { channel, modes } => {
vec![self.from_us(format!("FMODE {} 1 {}", channel, modes))]
}
NetAction::Raw(s) => vec![s.clone()],
// Internal: the link layer handles this before serialization.
NetAction::DeferRegister { .. } => vec![],

View file

@ -38,6 +38,9 @@ pub enum NetAction {
// Force a user's nick (SVSNICK), e.g. renaming to a guest nick on logout.
// The protocol stamps the new nick's timestamp.
ForceNick { uid: String, nick: String },
// Set channel modes from services, e.g. +r on a registered channel. The
// protocol stamps a timestamp the ircd will accept.
ChannelMode { channel: String, modes: String },
Raw(String),
// Internal only, never serialized to the wire: a registration whose password
// still needs its (expensive) key derivation. The link layer runs the