Scaffold the federated services daemon

Protocol-agnostic core: a Protocol trait maps raw server-to-server lines to a
normalized event/action model, so the engine never touches a raw line and a new
ircd is one new module. Adds event-log state (state is a fold over the log) and
a service framework. First protocol impl links to an InspIRCd (insp4) uplink —
completes the CAPAB/SERVER handshake, bursts, and introduces NickServ.
This commit is contained in:
Jean Chevronnet 2026-07-11 19:28:30 +00:00
commit f82ab0c70a
No known key found for this signature in database
15 changed files with 890 additions and 0 deletions

29
src/engine/service.rs Normal file
View file

@ -0,0 +1,29 @@
use crate::proto::NetAction;
// A pseudo-client (NickServ, ChanServ, OperServ, ...). Introduced at burst,
// receives the commands users message it, and pushes actions onto the ctx.
pub trait Service: Send {
fn nick(&self) -> &str;
fn uid(&self) -> &str;
fn host(&self) -> &str {
"services.local"
}
fn gecos(&self) -> &str;
fn on_command(&mut self, from: &str, args: &[&str], ctx: &mut ServiceCtx);
}
// What a service can do in response to a command, collected for the link to flush.
#[derive(Default)]
pub struct ServiceCtx {
pub actions: Vec<NetAction>,
}
impl ServiceCtx {
pub fn notice(&mut self, from: &str, to: &str, text: impl Into<String>) {
self.actions.push(NetAction::Notice {
from: from.to_string(),
to: to.to_string(),
text: text.into(),
});
}
}