i18n: sweep all remaining dynamic prose (oper commands, XLINE/FILTER/DNSBL notices, whois/vhost/knock/dcc/title/reputation/tline/rmode, hash, rename) through trf; +\xNN catalog escape; fr+es now 236 entries each
This commit is contained in:
parent
ef96bcbd06
commit
9b51db07f5
32 changed files with 295 additions and 128 deletions
|
|
@ -66,12 +66,10 @@ impl Command for Tban {
|
|||
(u.nick.clone(), u.prefix())
|
||||
};
|
||||
if s.channels[&key].bans.iter().any(|b| b.mask == mask) {
|
||||
let m = s.trf("{0} is already banned on {1}", &[mask.as_str(), chan.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(
|
||||
":{} NOTICE {nick} :{mask} is already banned on {chan}",
|
||||
s.name
|
||||
),
|
||||
format!(":{} NOTICE {nick} :{m}", s.name),
|
||||
);
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
|
|
@ -127,12 +125,10 @@ impl Command for Knock {
|
|||
.cloned()
|
||||
.unwrap_or_else(|| "requesting an invite".to_string());
|
||||
let who = s.users[&uid].prefix();
|
||||
let m = s.trf("[Knock] {0} is knocking: {1}", &[who.as_str(), reason.as_str()]);
|
||||
s.to_channel(
|
||||
&key,
|
||||
&format!(
|
||||
":{} NOTICE {chan} :[Knock] {who} is knocking: {reason}",
|
||||
s.name
|
||||
),
|
||||
&format!(":{} NOTICE {chan} :{m}", s.name),
|
||||
None,
|
||||
);
|
||||
s.numeric(
|
||||
|
|
@ -314,9 +310,10 @@ impl Command for Invite {
|
|||
let maxinv = s.conf_num("maxinvites", 100usize);
|
||||
if s.channels[&key].invites.len() >= maxinv && !s.channels[&key].invites.contains(&tuid) {
|
||||
let nick = s.users.get(&uid).map(|u| u.nick.clone()).unwrap_or_default();
|
||||
let m = s.trf("Channel invite list is full", &[]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(":{} NOTICE {nick} :{chan} :Channel invite list is full", s.name),
|
||||
format!(":{} NOTICE {nick} :{chan} :{m}", s.name),
|
||||
);
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
|
|
@ -408,12 +405,10 @@ impl Command for Uninvite {
|
|||
format!(":{} NOTICE {nick} :{who} {word} {chan}", s.name),
|
||||
);
|
||||
if removed {
|
||||
let m = s.trf("Your invite to {0} was revoked", &[chan.as_str()]);
|
||||
s.send(
|
||||
tuid,
|
||||
format!(
|
||||
":{} NOTICE {who} :Your invite to {chan} was revoked",
|
||||
s.name
|
||||
),
|
||||
format!(":{} NOTICE {who} :{m}", s.name),
|
||||
);
|
||||
}
|
||||
CmdResult::Ok
|
||||
|
|
@ -563,7 +558,8 @@ impl Command for Rename {
|
|||
s.fail(uid, "RENAME", "CANNOT_RENAME", "The channel cannot be renamed.");
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
s.snotice_c('a', &format!("{oldname} renamed to {new} by {prefix}"));
|
||||
let m = s.trf("{0} renamed to {1} by {2}", &[oldname.as_str(), new.as_str(), prefix.as_str()]);
|
||||
s.snotice_c('a', &m);
|
||||
s.propagate_rename(&uuid, &oldname, new, &reason, None);
|
||||
CmdResult::Ok
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,9 @@ impl Command for Admin {
|
|||
RPL_ADMINME,
|
||||
&format!("{} :Administrative info", s.name),
|
||||
);
|
||||
s.numeric(uid, RPL_ADMINLOC1, &format!(":{} IRC network", s.network));
|
||||
let network = s.network.clone();
|
||||
let m = s.trf("{0} IRC network", &[network.as_str()]);
|
||||
s.numeric(uid, RPL_ADMINLOC1, &format!(":{m}"));
|
||||
s.numeric(
|
||||
uid,
|
||||
RPL_ADMINLOC2,
|
||||
|
|
|
|||
|
|
@ -53,12 +53,10 @@ impl Command for SslInfo {
|
|||
};
|
||||
let tls = if secure { "yes" } else { "no" };
|
||||
let fp = certfp.unwrap_or_else(|| "none".to_string());
|
||||
let m = s.trf("SSLINFO {0}: TLS={1} certfp={2}", &[nick.as_str(), tls, fp.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(
|
||||
":{} NOTICE {asker} :SSLINFO {nick}: TLS={tls} certfp={fp}",
|
||||
s.name
|
||||
),
|
||||
format!(":{} NOTICE {asker} :{m}", s.name),
|
||||
);
|
||||
CmdResult::Ok
|
||||
}
|
||||
|
|
@ -437,9 +435,10 @@ impl Command for Whois {
|
|||
// +W showwhois — tell the target that someone looked them up
|
||||
if showwhois && !is_self {
|
||||
let by = s.users.get(&uid).map(|u| u.prefix()).unwrap_or_default();
|
||||
let m = s.trf("{0} did a /WHOIS on you", &[by.as_str()]);
|
||||
s.send(
|
||||
tuid,
|
||||
format!(":{} NOTICE {nick} :*** {by} did a /WHOIS on you", s.name),
|
||||
format!(":{} NOTICE {nick} :*** {m}", s.name),
|
||||
);
|
||||
}
|
||||
s.numeric(uid, RPL_ENDOFWHOIS, &format!("{nick} :End of /WHOIS list"));
|
||||
|
|
|
|||
|
|
@ -543,12 +543,10 @@ pub(crate) fn deliver(s: &mut Server, uid: Uid, params: &[String], notice: bool)
|
|||
.map(|u| u.nick.clone())
|
||||
.unwrap_or_default(),
|
||||
);
|
||||
let m = s.trf("Cannot message {0}: a TLS connection is required (+z)", &[tn.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(
|
||||
":{} NOTICE {sn} :Cannot message {tn}: a TLS connection is required (+z)",
|
||||
s.name
|
||||
),
|
||||
format!(":{} NOTICE {sn} :{m}", s.name),
|
||||
);
|
||||
}
|
||||
return CmdResult::Fail;
|
||||
|
|
|
|||
|
|
@ -398,14 +398,12 @@ impl Command for GlobOps {
|
|||
.filter(|(_, u)| u.flags.oper)
|
||||
.map(|(&u, _)| u)
|
||||
.collect();
|
||||
let m = s.trf("GLOBOPS from {0}: {1}", &[from.as_str(), params[0].as_str()]);
|
||||
for o in opers {
|
||||
let nick = s.users.get(&o).map(|u| u.nick.clone()).unwrap_or_default();
|
||||
s.send(
|
||||
o,
|
||||
format!(
|
||||
":{} NOTICE {nick} :*** GLOBOPS from {from}: {}",
|
||||
s.name, params[0]
|
||||
),
|
||||
format!(":{} NOTICE {nick} :*** {m}", s.name),
|
||||
);
|
||||
}
|
||||
CmdResult::Ok
|
||||
|
|
@ -731,9 +729,10 @@ fn do_xline(s: &mut Server, uid: Uid, params: &[String], kind: XKind) -> CmdResu
|
|||
if s.remove_xline(kind, &mask, &nick) {
|
||||
s.propagate_delline(kind.tag(), &mask);
|
||||
} else {
|
||||
let m = s.trf("{0}-line not found: {1}", &[kind.tag(), mask.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(":{} NOTICE {nick} :{}-line not found: {mask}", s.name, kind.tag()),
|
||||
format!(":{} NOTICE {nick} :{m}", s.name),
|
||||
);
|
||||
}
|
||||
return CmdResult::Ok;
|
||||
|
|
@ -878,17 +877,20 @@ impl Command for Rline {
|
|||
if s.remove_xline(XKind::Rline, &pattern, &nick) {
|
||||
s.propagate_delline("R", &pattern);
|
||||
} else {
|
||||
let m = s.trf("R-line not found: {0}", &[pattern.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(":{} NOTICE {nick} :R-line not found: {pattern}", s.name),
|
||||
format!(":{} NOTICE {nick} :{m}", s.name),
|
||||
);
|
||||
}
|
||||
return CmdResult::Ok;
|
||||
}
|
||||
if let Err(e) = crate::regex::Regex::new(&pattern) {
|
||||
let e = e.to_string();
|
||||
let m = s.trf("Invalid RLINE regex: {0}", &[e.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(":{} NOTICE {nick} :Invalid RLINE regex: {e}", s.name),
|
||||
format!(":{} NOTICE {nick} :{m}", s.name),
|
||||
);
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
|
|
@ -952,7 +954,8 @@ impl Command for NickLock {
|
|||
u.flags.nick_locked = true;
|
||||
}
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used NICKLOCK on {newnick}"));
|
||||
let m = s.trf("{0} used NICKLOCK on {1}", &[by.as_str(), newnick.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -977,7 +980,8 @@ impl Command for NickUnlock {
|
|||
u.flags.nick_locked = false;
|
||||
}
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used NICKUNLOCK on {}", params[0]));
|
||||
let m = s.trf("{0} used NICKUNLOCK on {1}", &[by.as_str(), params[0].as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1049,7 +1053,8 @@ impl Command for Squit {
|
|||
return CmdResult::Fail;
|
||||
};
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('l', &format!("{by} used SQUIT on {name}"));
|
||||
let m = s.trf("{0} used SQUIT on {1}", &[by.as_str(), name.as_str()]);
|
||||
s.snotice_c('l', &m);
|
||||
s.close_link(via, &format!("SQUIT from {by}"));
|
||||
CmdResult::Ok
|
||||
}
|
||||
|
|
@ -1209,7 +1214,9 @@ impl Command for SaMode {
|
|||
let r = apply_mode(s, uid, params);
|
||||
s.mode_sudo = false;
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used SAMODE: {}", params.join(" ")));
|
||||
let joined = params.join(" ");
|
||||
let m = s.trf("{0} used SAMODE: {1}", &[by.as_str(), joined.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
r
|
||||
}
|
||||
}
|
||||
|
|
@ -1248,7 +1255,8 @@ impl Command for SaTopic {
|
|||
s.to_channel(&key, &format!(":{prefix} TOPIC {chan} :{text}"), None);
|
||||
s.propagate_topic(uid, chan, &text);
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used SATOPIC on {chan}"));
|
||||
let m = s.trf("{0} used SATOPIC on {1}", &[by.as_str(), chan.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1313,7 +1321,8 @@ impl Command for SaKick {
|
|||
s.events
|
||||
.push_back(Hook::Part(tuid, key, "kicked".to_string()));
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used SAKICK on {victim} in {chan}"));
|
||||
let m = s.trf("{0} used SAKICK on {1} in {2}", &[by.as_str(), victim.as_str(), chan.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1343,7 +1352,8 @@ impl Command for SaQuit {
|
|||
s.send(tuid, format!("ERROR :Closing link: (SAQUIT: {reason})"));
|
||||
s.remove_user(tuid, &format!("Quit: {reason}"));
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used SAQUIT on {}: {reason}", params[0]));
|
||||
let m = s.trf("{0} used SAQUIT on {1}: {2}", &[by.as_str(), params[0].as_str(), reason.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1379,7 +1389,8 @@ impl Command for ChgName {
|
|||
}
|
||||
s.notify_peers(t, &line, |c| c.setname);
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used CHGNAME on {}: {realname}", params[0]));
|
||||
let m = s.trf("{0} used CHGNAME on {1}: {2}", &[by.as_str(), params[0].as_str(), realname.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1436,7 +1447,8 @@ impl Command for ClearChan {
|
|||
}
|
||||
s.channels.retain(|_, c| c.keep_alive());
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used CLEARCHAN on {chan}"));
|
||||
let m = s.trf("{0} used CLEARCHAN on {1}", &[by.as_str(), chan.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
@ -1553,7 +1565,8 @@ impl Command for SwhoisCmd {
|
|||
}
|
||||
}
|
||||
let by = oper_nick(s, uid);
|
||||
s.snotice_c('v', &format!("{by} used SWHOIS on {}: {text}", params[0]));
|
||||
let m = s.trf("{0} used SWHOIS on {1}: {2}", &[by.as_str(), params[0].as_str(), text.as_str()]);
|
||||
s.snotice_c('v', &m);
|
||||
CmdResult::Ok
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,10 @@ impl Command for Vhost {
|
|||
match host {
|
||||
Some(h) => {
|
||||
s.change_host_ident(uid, None, Some(&h));
|
||||
let m = s.trf("Your vhost is now {0}", &[h.as_str()]);
|
||||
s.send(
|
||||
uid,
|
||||
format!(":{} NOTICE {nick} :Your vhost is now {h}", s.name),
|
||||
format!(":{} NOTICE {nick} :{m}", s.name),
|
||||
);
|
||||
}
|
||||
None => {
|
||||
|
|
|
|||
|
|
@ -351,7 +351,9 @@ impl Command for Signore {
|
|||
.map(|u| u.signore.len() >= max && !u.signore.contains(&mask))
|
||||
.unwrap_or(true);
|
||||
if full {
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :Your SIGNORE list is full ({max} max)."));
|
||||
let maxs = max.to_string();
|
||||
let m = s.trf("Your SIGNORE list is full ({0} max).", &[maxs.as_str()]);
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :{m}"));
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
if let Some(u) = s.users.get_mut(&uid) {
|
||||
|
|
@ -359,12 +361,14 @@ impl Command for Signore {
|
|||
u.signore.push(mask.clone());
|
||||
}
|
||||
}
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :SIGNORE \x02{mask}\x02 added — you and they can no longer see each other's messages."));
|
||||
let m = s.trf("SIGNORE \x02{0}\x02 added — you and they can no longer see each other's messages.", &[mask.as_str()]);
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :{m}"));
|
||||
} else {
|
||||
if let Some(u) = s.users.get_mut(&uid) {
|
||||
u.signore.retain(|x| x != &mask);
|
||||
}
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :SIGNORE \x02{mask}\x02 removed."));
|
||||
let m = s.trf("SIGNORE \x02{0}\x02 removed.", &[mask.as_str()]);
|
||||
s.send(uid, format!(":{sn} NOTICE {nick} :{m}"));
|
||||
}
|
||||
// Persist the change to the user's services account (no-op if not logged in).
|
||||
s.push_signore_to_services(uid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue