Group the module crates under modules/
The service pseudo-clients and the ircd protocol link sat flat at the repo root, mixed in with the daemon core and the SDK. Move them all under modules/ so the tree separates concerns cleanly: the daemon in src/, the SDK every module links against in api/, and the loadable modules — the pseudo-clients plus the protocol link — in modules/. Workspace members, the daemon's per-crate dependency paths, and each module's api path are updated to match; the docs follow. No code change.
This commit is contained in:
parent
6f76f9722c
commit
ad2a623120
116 changed files with 69 additions and 46 deletions
|
|
@ -1,35 +0,0 @@
|
|||
use fedserv_api::{Sender, ServiceCtx, Store};
|
||||
|
||||
// DEFAULT: give yourself the auto-vhost from the network template, with your
|
||||
// account name substituted for $account.
|
||||
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||
let Some(account) = from.account else {
|
||||
ctx.notice(me, from.uid, "You need to identify to NickServ first.");
|
||||
return;
|
||||
};
|
||||
let Some(template) = db.vhost_template() else {
|
||||
ctx.notice(me, from.uid, "This network has no auto-vhost template.");
|
||||
return;
|
||||
};
|
||||
// Sanitise the account into a host-safe label (lowercase, alphanumerics only).
|
||||
let label: String = account.to_ascii_lowercase().chars().filter(|c| c.is_ascii_alphanumeric()).collect();
|
||||
if label.is_empty() {
|
||||
ctx.notice(me, from.uid, "Your account name has no usable characters for a vhost.");
|
||||
return;
|
||||
}
|
||||
let generated = template.replace("$account", &label);
|
||||
let host = match super::prepare_vhost(&generated, account, db) {
|
||||
Ok(h) if !db.vhost_is_forbidden(&h) => h,
|
||||
_ => {
|
||||
ctx.notice(me, from.uid, "Sorry, a vhost couldn't be generated for your account.");
|
||||
return;
|
||||
}
|
||||
};
|
||||
match db.set_vhost(account, &host, "template", None) {
|
||||
Ok(()) => {
|
||||
ctx.apply_vhost(from.uid, &host);
|
||||
ctx.notice(me, from.uid, format!("You now have the vhost \x02{host}\x02."));
|
||||
}
|
||||
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue