link: rework s2s wire format to the standard v4 server protocol (10-field uid, letters-comma fjoin, ijoin, timestamped fmode, ftopic, uuid kick) so external services link

This commit is contained in:
Jean Chevronnet 2026-08-15 11:51:18 +00:00
parent f921c2eb9c
commit 1c8799d785
5 changed files with 415 additions and 116 deletions

View file

@ -525,7 +525,7 @@ impl Command for Kick {
&format!(":{prefix} KICK {chan} {victim} :{reason}"),
None,
);
s.propagate_from_user(uid, &format!("KICK {chan} {victim} :{reason}")); // tell links
s.propagate_kick(uid, chan, victim, &reason); // tell links
if let Some(ch) = s.channels.get_mut(&key) {
ch.members.remove(&tuid);
if ch.modes.kicknorejoin.is_some() {
@ -606,7 +606,7 @@ impl Command for TopicCmd {
});
}
s.to_channel(&key, &format!(":{prefix} TOPIC {target} :{text}"), None);
s.propagate_from_user(uid, &format!("TOPIC {target} :{text}")); // tell links
s.propagate_topic(uid, target, &text); // tell links
CmdResult::Ok
}
}

View file

@ -167,8 +167,9 @@ pub fn apply_mode(s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
None,
);
}
s.propagate_from_user(uid, &format!("MODE {target} {applied}{pstr}"));
// links
// links: a timestamped FMODE sourced from the acting user's uuid
let src_uuid = s.users[&uid].uuid.clone();
s.propagate_chan_mode(&src_uuid, target, &applied, &echoed);
}
CmdResult::Ok
}
@ -229,7 +230,9 @@ pub fn svs_set_chan_modes(s: &mut Server, target: &str, modestring: &str, args:
&format!(":{} MODE {target} {applied}{pstr}", s.name),
None,
);
s.propagate(&format!(":{} MODE {target} {applied}{pstr}", s.sid), None); // links
// links: a timestamped FMODE sourced from this server's sid
let sid = s.sid.clone();
s.propagate_chan_mode(&sid, target, &applied, &echoed);
true
}

View file

@ -1132,7 +1132,7 @@ impl Command for SaTopic {
});
}
s.to_channel(&key, &format!(":{prefix} TOPIC {chan} :{text}"), None);
s.propagate_from_user(uid, &format!("TOPIC {chan} :{text}"));
s.propagate_topic(uid, chan, &text);
let by = oper_nick(s, uid);
s.snotice(&format!("{by} used SATOPIC on {chan}"));
CmdResult::Ok
@ -1184,7 +1184,7 @@ impl Command for SaKick {
&format!(":{prefix} KICK {chan} {victim} :{reason}"),
None,
);
s.propagate_from_user(uid, &format!("KICK {chan} {victim} :{reason}"));
s.propagate_kick(uid, chan, victim, &reason);
if let Some(ch) = s.channels.get_mut(&key) {
ch.members.remove(&tuid);
}
@ -1305,7 +1305,7 @@ impl Command for ClearChan {
&format!(":{prefix} KICK {chan} {victim} :{reason}"),
None,
);
s.propagate_from_user(uid, &format!("KICK {chan} {victim} :{reason}"));
s.propagate_kick(uid, &chan, &victim, &reason);
if let Some(ch) = s.channels.get_mut(&key) {
ch.members.remove(&tuid);
}