chanserv: give SOP/AOP/HOP/VOP four distinct access tiers matching Anope, classified by capability
All checks were successful
CI / check (push) Successful in 3m55s
All checks were successful
CI / check (push) Successful in 3m55s
This commit is contained in:
parent
f5c976eb56
commit
c8106035df
6 changed files with 119 additions and 41 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use echo_api::Store;
|
||||
use echo_api::{Sender, ServiceCtx};
|
||||
use echo_api::{access_role, Sender, ServiceCtx};
|
||||
use echo_api::NetView;
|
||||
|
||||
// STATUS <#channel> [nick]: show a user's access level (self if no nick).
|
||||
|
|
@ -19,10 +19,11 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net:
|
|||
let level = match account.as_deref() {
|
||||
None => "none (not logged in)",
|
||||
Some(a) if info.founder.eq_ignore_ascii_case(a) => "founder",
|
||||
Some(a) => match info.join_mode(a) {
|
||||
Some("+o") => "op",
|
||||
Some("+v") => "voice",
|
||||
_ => "none",
|
||||
// Classify by resolved tier so halfop and sop read distinctly, matching
|
||||
// ALIST and the XOP lists.
|
||||
Some(a) => match info.access.iter().find(|e| e.account.eq_ignore_ascii_case(a)) {
|
||||
Some(e) => access_role(&e.level).label(),
|
||||
None => "none",
|
||||
},
|
||||
};
|
||||
ctx.notice(me, from.uid, format!("\x02{label}\x02 access on \x02{chan}\x02: \x02{level}\x02"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue