profilelink/hidelist: unify the WHOIS label to English "Profile:" (was "Profil:" for logged-in users) and make hidelist honour the last matching config line (conf last-wins semantics) instead of the first
This commit is contained in:
parent
303fc0c8dc
commit
55174ec017
2 changed files with 8 additions and 3 deletions
|
|
@ -23,13 +23,18 @@ pub fn denied(s: &Server, uid: Uid, key: &str, modechar: char) -> bool {
|
||||||
if s.is_oper(uid) {
|
if s.is_oper(uid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// last matching line wins, mirroring conf()'s last-value-overrides semantics
|
||||||
|
let mut req: Option<u8> = None;
|
||||||
for line in s.conf_all("hidelist") {
|
for line in s.conf_all("hidelist") {
|
||||||
let mut it = line.split_whitespace();
|
let mut it = line.split_whitespace();
|
||||||
if let (Some(mc), Some(rank)) = (it.next(), it.next()) {
|
if let (Some(mc), Some(rank)) = (it.next(), it.next()) {
|
||||||
if mc.chars().next() == Some(modechar) {
|
if mc.chars().next() == Some(modechar) {
|
||||||
return s.rank(uid, key) < rank_value(rank);
|
req = Some(rank_value(rank));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
match req {
|
||||||
|
Some(r) => s.rank(uid, key) < r,
|
||||||
|
None => false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ pub fn line(s: &Server, account: &Option<String>) -> Option<String> {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
Some(match account {
|
Some(match account {
|
||||||
Some(acct) => format!("Profil: {base}{acct}"),
|
Some(acct) => format!("Profile: {base}{acct}"),
|
||||||
None => "Profile: The user is not logged in or the account is not registered.".to_string(),
|
None => "Profile: The user is not logged in or the account is not registered.".to_string(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue