opmoderated channel mode (+U — route unprivileged messages to ops)
This commit is contained in:
parent
4a53c80d4d
commit
4d6525cac2
4 changed files with 26 additions and 4 deletions
10
src/mode.rs
10
src/mode.rs
|
|
@ -89,6 +89,7 @@ static CHAN_MODES: &[&(dyn ChanMode + Sync)] = &[
|
|||
&ALLOWINVITE,
|
||||
&PERMANENT,
|
||||
&KICKNOREJOIN,
|
||||
&OPMODERATED,
|
||||
];
|
||||
|
||||
// --- prefix modes (+q/+a/+o/+h/+v): a per-member rank, needs a nick ----------
|
||||
|
|
@ -307,6 +308,9 @@ fn set_allowinvite(m: &mut ChanModes, v: bool) {
|
|||
fn set_permanent(m: &mut ChanModes, v: bool) {
|
||||
m.permanent = v;
|
||||
}
|
||||
fn set_opmoderated(m: &mut ChanModes, v: bool) {
|
||||
m.opmoderated = v;
|
||||
}
|
||||
static NOKICKS: Flag = Flag {
|
||||
ch: 'Q',
|
||||
set: set_nokicks,
|
||||
|
|
@ -319,6 +323,10 @@ static PERMANENT: Flag = Flag {
|
|||
ch: 'P',
|
||||
set: set_permanent,
|
||||
};
|
||||
static OPMODERATED: Flag = Flag {
|
||||
ch: 'U',
|
||||
set: set_opmoderated,
|
||||
};
|
||||
|
||||
impl ChanMode for Flag {
|
||||
fn letter(&self) -> char {
|
||||
|
|
@ -1142,7 +1150,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn registry_covers_all_channel_modes() {
|
||||
for c in "qaohvbeIklmntiszpONCTcSRMfjFLgGuBQAPJ".chars() {
|
||||
for c in "qaohvbeIklmntiszpONCTcSRMfjFLgGuBQAPJU".chars() {
|
||||
assert!(chan_mode(c).is_some(), "missing handler for +{c}");
|
||||
}
|
||||
assert!(chan_mode('y').is_none());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue