summaryrefslogtreecommitdiff
path: root/modules/commands/cs_unban.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-04-25 16:51:06 -0400
committerAdam <Adam@anope.org>2014-04-25 16:51:06 -0400
commit6a03eb69ebbe773f1d4139ff88d74ecdb2b0af4b (patch)
treed370fbc4a1dd55b72dbcda9f2aff24678d5626f3 /modules/commands/cs_unban.cpp
parent4fa2a00bd595eb120e6acde5eb167759c2018e33 (diff)
Add "virtual mode" support
This allows fully tracking extbans and other modes set by a different underlying mode, such as InspIRCd's namedmodes Add two configuration options to cs_ban to configure which mode is set and whether or not to kick banned users. Add default "mute" fantasy command to botserv.example.conf
Diffstat (limited to 'modules/commands/cs_unban.cpp')
-rw-r--r--modules/commands/cs_unban.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp
index 56a482985..9fd6400a8 100644
--- a/modules/commands/cs_unban.cpp
+++ b/modules/commands/cs_unban.cpp
@@ -22,6 +22,13 @@ class CommandCSUnban : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
+ ChannelMode *cm = ModeManager::FindChannelModeByName("BAN");
+ if (!cm)
+ return;
+
+ std::vector<ChannelMode *> modes = cm->listeners;
+ modes.push_back(cm);
+
if (params.empty())
{
if (!source.GetUser())
@@ -38,8 +45,9 @@ class CommandCSUnban : public Command
if (!ci->c || !source.AccessFor(ci).HasPriv("UNBAN"))
continue;
- if (ci->c->Unban(source.GetUser(), true))
- ++count;
+ for (unsigned j = 0; j < modes.size(); ++j)
+ if (ci->c->Unban(source.GetUser(), modes[j]->name, true))
+ ++count;
}
Log(LOG_COMMAND, source, this, NULL) << "on all channels";
@@ -80,7 +88,8 @@ class CommandCSUnban : public Command
bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unban " << u2->nick;
- ci->c->Unban(u2, source.GetUser() == u2);
+ for (unsigned i = 0; i < modes.size(); ++i)
+ ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2);
if (u2 == source.GetUser())
source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str());
else