summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/chanserv.example.conf16
-rw-r--r--modules/commands/cs_unban.cpp16
2 files changed, 25 insertions, 7 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf
index e5d623223..71965cc94 100644
--- a/data/chanserv.example.conf
+++ b/data/chanserv.example.conf
@@ -756,6 +756,22 @@ privilege
}
/*
+ * UNBANME privilege.
+ *
+ * Used by chanserv/unban.
+ *
+ * Users with this permission can unban themself through ChanServ.
+ */
+privilege
+{
+ name = "UNBANME"
+ rank = 200
+ level = 4
+ flag = "U"
+ xop = "HOP"
+}
+
+/*
* VOICE privilege.
*
* Used by chanserv/mode and chanserv/modes.
diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp
index fec777cc0..832c1cfcb 100644
--- a/modules/commands/cs_unban.cpp
+++ b/modules/commands/cs_unban.cpp
@@ -40,7 +40,7 @@ class CommandCSUnban : public Command
unsigned count = 0;
for (auto *ci : queue)
{
- if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN"))
+ if (!ci->c || !(source.AccessFor(ci).HasPriv("UNBAN") || source.AccessFor(ci).HasPriv("UNBANME")))
continue;
FOREACH_MOD(OnChannelUnban, (source.GetUser(), ci));
@@ -69,12 +69,6 @@ class CommandCSUnban : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("UNBAN") && !source.HasPriv("chanserv/kick"))
- {
- source.Reply(ACCESS_DENIED);
- return;
- }
-
User *u2 = source.GetUser();
if (params.size() > 1)
u2 = User::Find(params[1], true);
@@ -85,6 +79,14 @@ class CommandCSUnban : public Command
return;
}
+ if (!source.AccessFor(ci).HasPriv("UNBAN") &&
+ !(u2 == source.GetUser() && source.AccessFor(ci).HasPriv("UNBANME")) &&
+ !source.HasPriv("chanserv/kick"))
+ {
+ source.Reply(ACCESS_DENIED);
+ return;
+ }
+
bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;