NickServ: add SET KILL to toggle nick protection

Nick protection was unconditional. SET KILL OFF lets an account opt out —
an unidentified user keeping one of its nicks is no longer prompted or
renamed to a guest. Stored inverted (no_protect) so protection stays the
default. Accepts Anope's ON/QUICK/IMMED/OFF; grace is a fixed interval
here, so the finer variants simply enable protection like ON.
This commit is contained in:
Jean Chevronnet 2026-07-16 01:43:10 +00:00
parent 87e21ff85f
commit 2c4bc9079c
No known key found for this signature in database
11 changed files with 106 additions and 9 deletions

View file

@ -16,6 +16,7 @@ pub enum Event {
AccountEmailSet { account: String, email: Option<String> },
AccountGreetSet { account: String, greet: String },
AccountAutoOpSet { account: String, on: bool },
AccountKillSet { account: String, on: bool },
AccountPasswordSet { account: String, scram256: String, scram512: String },
AccountDropped { account: String },
AccountVerified { account: String },
@ -149,6 +150,7 @@ impl Event {
| Event::AccountEmailSet { .. }
| Event::AccountGreetSet { .. }
| Event::AccountAutoOpSet { .. }
| Event::AccountKillSet { .. }
| Event::AccountPasswordSet { .. }
| Event::AccountDropped { .. }
| Event::AccountVerified { .. }
@ -280,6 +282,11 @@ pub(crate) fn apply(accounts: &mut HashMap<String, Account>, channels: &mut Hash
a.no_autoop = !on;
}
}
Event::AccountKillSet { account, on } => {
if let Some(a) = accounts.get_mut(&key(&account)) {
a.no_protect = !on;
}
}
Event::AccountPasswordSet { account, scram256, scram512 } => {
if let Some(a) = accounts.get_mut(&key(&account)) {
a.scram256 = Some(scram256);