From 095ed3c8c8774e46a90e2cbab50f5965caf5b6c7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 22 Apr 2025 22:53:40 +0100 Subject: Allow users to unmark themselves as a channel successor. Closes #501. --- modules/chanserv/cs_set.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index b2287988a..c77d2d675 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -949,7 +949,15 @@ public: if (MOD_RESULT == EVENT_STOP) return; - if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration")) + auto can_set_successor = ci->HasExt("SECUREFOUNDER") + ? source.IsFounder(ci) + : source.AccessFor(ci).HasPriv("FOUNDER"); + + // Special case: users can remove themselves as successor with no other privs. + if (param.empty() && source.GetAccount() && source.GetAccount() == ci->GetSuccessor()) + can_set_successor = true; + + if (MOD_RESULT != EVENT_ALLOW && !can_set_successor && source.permission.empty() && !source.HasPriv("chanserv/administration")) { source.Reply(ACCESS_DENIED); return; -- cgit