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};
|
||||
|
||||
// SET NOTIFY {ON|OFF} | SET LIMIT <n>|NONE: your MemoServ preferences.
|
||||
pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||
|
|
@ -13,7 +13,7 @@ pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut S
|
|||
}
|
||||
};
|
||||
db.set_memo_notify(account, on);
|
||||
ctx.notice(me, from.uid, format!("New-memo notification is now \x02{}\x02.", if on { "on" } else { "off" }));
|
||||
ctx.notice(me, from.uid, t!(ctx, "New-memo notification is now \x02{state}\x02.", state = if on { "on" } else { "off" }));
|
||||
}
|
||||
Some("LIMIT") => {
|
||||
let limit = match args.get(2) {
|
||||
|
|
@ -22,15 +22,15 @@ pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut S
|
|||
Some(&n) => match n.parse::<u32>() {
|
||||
Ok(v) if v <= super::MAX_MEMOS as u32 => Some(v),
|
||||
_ => {
|
||||
ctx.notice(me, from.uid, format!("The limit must be a number from 0 to {}, or NONE.", super::MAX_MEMOS));
|
||||
ctx.notice(me, from.uid, t!(ctx, "The limit must be a number from 0 to {max}, or NONE.", max = super::MAX_MEMOS));
|
||||
return;
|
||||
}
|
||||
},
|
||||
};
|
||||
db.set_memo_limit(account, limit);
|
||||
match limit {
|
||||
Some(v) => ctx.notice(me, from.uid, format!("Your mailbox limit is now \x02{v}\x02.")),
|
||||
None => ctx.notice(me, from.uid, format!("Your mailbox limit is now the network default (\x02{}\x02).", super::MAX_MEMOS)),
|
||||
Some(v) => ctx.notice(me, from.uid, t!(ctx, "Your mailbox limit is now \x02{v}\x02.", v = v)),
|
||||
None => ctx.notice(me, from.uid, t!(ctx, "Your mailbox limit is now the network default (\x02{max}\x02).", max = super::MAX_MEMOS)),
|
||||
}
|
||||
}
|
||||
_ => ctx.notice(me, from.uid, "Syntax: SET NOTIFY {ON|OFF} | SET LIMIT <n>|NONE"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue