channel: cull an empty channel when a mode change (-P/-r) removes its last reason to persist
This commit is contained in:
parent
b451ccbfd8
commit
3f9aa8c6eb
1 changed files with 7 additions and 0 deletions
|
|
@ -176,6 +176,13 @@ pub fn apply_mode(s: &mut Server, uid: Uid, params: &[String]) -> CmdResult {
|
||||||
let src_uuid = s.users[&uid].uuid.clone();
|
let src_uuid = s.users[&uid].uuid.clone();
|
||||||
s.propagate_chan_mode(&src_uuid, target, &applied, &echoed);
|
s.propagate_chan_mode(&src_uuid, target, &applied, &echoed);
|
||||||
}
|
}
|
||||||
|
// A mode change may have removed the channel's last reason to exist while it has
|
||||||
|
// no members (e.g. -P / -r on an empty channel): destroy it now, as an empty
|
||||||
|
// channel is normally culled the moment its final member leaves.
|
||||||
|
let cull = s.channels.get(&key).is_some_and(|c| !c.keep_alive());
|
||||||
|
if cull {
|
||||||
|
s.channels.remove(&key);
|
||||||
|
}
|
||||||
CmdResult::Ok
|
CmdResult::Ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue