Migrate interpolated service messages to the t! macro (8 modules)
This commit is contained in:
parent
b462d37bd5
commit
d207c3d60d
133 changed files with 782 additions and 702 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use echo_api::{Sender, ServiceCtx, Store};
|
||||
use echo_api::{t, 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) {
|
||||
|
|
@ -10,7 +10,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
ctx.notice(me, from.uid, "Syntax: REQUEST <host>");
|
||||
return;
|
||||
};
|
||||
let host = match super::prepare_vhost(host, account, db) {
|
||||
let host = match super::prepare_vhost(host, account, db, ctx) {
|
||||
Ok(h) => h,
|
||||
Err(msg) => {
|
||||
ctx.notice(me, from.uid, msg);
|
||||
|
|
@ -18,16 +18,16 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
}
|
||||
};
|
||||
if db.vhost_is_forbidden(&host) {
|
||||
ctx.notice(me, from.uid, format!("\x02{host}\x02 isn't allowed here. Please choose another."));
|
||||
ctx.notice(me, from.uid, t!(ctx, "\x02{host}\x02 isn't allowed here. Please choose another.", host = host));
|
||||
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."));
|
||||
ctx.notice(me, from.uid, t!(ctx, "Please wait \x02{wait}\x02s before requesting another vhost.", wait = wait));
|
||||
return;
|
||||
}
|
||||
match db.request_vhost(account, &host) {
|
||||
Ok(()) => ctx.notice(me, from.uid, format!("Requested vhost \x02{host}\x02 — an operator will review it.")),
|
||||
Ok(()) => ctx.notice(me, from.uid, t!(ctx, "Requested vhost \x02{host}\x02 — an operator will review it.", host = host)),
|
||||
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