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
33
modules/hostserv/src/request.rs
Normal file
33
modules/hostserv/src/request.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
use fedserv_api::{Sender, ServiceCtx, Store};
|
||||
|
||||
// REQUEST <host>: ask for a vhost, to be approved by an operator.
|
||||
pub fn handle(me: &str, from: &Sender, args: &[&str], 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(&host) = args.get(1) else {
|
||||
ctx.notice(me, from.uid, "Syntax: REQUEST <host>");
|
||||
return;
|
||||
};
|
||||
let host = match super::prepare_vhost(host, account, db) {
|
||||
Ok(h) => h,
|
||||
Err(msg) => {
|
||||
ctx.notice(me, from.uid, msg);
|
||||
return;
|
||||
}
|
||||
};
|
||||
if db.vhost_is_forbidden(&host) {
|
||||
ctx.notice(me, from.uid, format!("\x02{host}\x02 isn't allowed here. Please choose another."));
|
||||
return;
|
||||
}
|
||||
let wait = db.vhost_request_wait(account);
|
||||
if wait > 0 {
|
||||
ctx.notice(me, from.uid, format!("Please wait \x02{wait}\x02s before requesting another vhost."));
|
||||
return;
|
||||
}
|
||||
match db.request_vhost(account, &host) {
|
||||
Ok(()) => ctx.notice(me, from.uid, format!("Requested vhost \x02{host}\x02 — an operator will review it.")),
|
||||
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