Exempt service bots from ChannelOp secureops and bound the last-seen map

This commit is contained in:
Jean Chevronnet 2026-07-19 13:17:54 +00:00
parent 7528b78bf7
commit d0c7cb6905
No known key found for this signature in database
2 changed files with 35 additions and 13 deletions

View file

@ -1434,7 +1434,10 @@ impl Engine {
NetEvent::ChannelOp { channel, uid, op } => {
self.network.set_op(&channel, &uid, op);
// SECUREOPS: a user who gains +o without op-level access loses it.
if op {
// A services bot assigned here is staff, not a member — never subject
// to secureops (the Join path exempts it the same way).
let is_bot = self.bot_uids.values().any(|b| b == &uid);
if op && !is_bot {
if let Some(c) = self.db.channel(&channel) {
if c.settings.secureops && !self.network.account_of(&uid).is_some_and(|a| c.is_op(a)) {
let from = self.chan_service.clone().unwrap_or_default();