diff options
author | Adam <Adam@anope.org> | 2014-06-23 09:45:15 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-06-23 09:45:15 -0400 |
commit | fd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (patch) | |
tree | 1d68e86065e0b012aee41533d4f9b289ee0707ac /modules/commands/cs_ban.cpp | |
parent | 148b26f687ce85dc01e852a2358b03d493757ada (diff) | |
parent | 9a947fa4359c667be58ebae4634d9ac0e53d5db4 (diff) |
Merge branch '2.0' into 2.1
Conflicts:
cmake/Anope.cmake
cmake/FindGettext.cmake
include/access.h
include/messages.h
include/modes.h
include/modules.h
include/users.h
modules/CMakeLists.txt
modules/commands/bs_bot.cpp
modules/commands/cs_access.cpp
modules/commands/cs_ban.cpp
modules/commands/cs_clone.cpp
modules/commands/cs_flags.cpp
modules/commands/cs_info.cpp
modules/commands/cs_list.cpp
modules/commands/cs_log.cpp
modules/commands/cs_mode.cpp
modules/commands/cs_status.cpp
modules/commands/cs_suspend.cpp
modules/commands/cs_updown.cpp
modules/commands/cs_xop.cpp
modules/commands/ms_check.cpp
modules/commands/ns_access.cpp
modules/commands/ns_cert.cpp
modules/commands/ns_group.cpp
modules/commands/ns_register.cpp
modules/commands/ns_set.cpp
modules/commands/ns_suspend.cpp
modules/commands/os_session.cpp
modules/commands/os_svs.cpp
modules/extra/m_ldap_authentication.cpp
modules/extra/m_regex_pcre.cpp
modules/extra/m_sql_authentication.cpp
modules/extra/stats/m_chanstats.cpp
modules/protocol/bahamut.cpp
modules/protocol/hybrid.cpp
modules/protocol/inspircd12.cpp
modules/protocol/inspircd20.cpp
modules/protocol/unreal.cpp
modules/pseudoclients/chanserv.cpp
modules/pseudoclients/chanserv/channel.cpp
modules/pseudoclients/nickserv/nickserv.cpp
modules/webcpanel/pages/chanserv/access.cpp
src/access.cpp
src/bots.cpp
src/channels.cpp
src/language.cpp
src/modes.cpp
src/modulemanager.cpp
src/process.cpp
src/users.cpp
src/version.sh
Diffstat (limited to 'modules/commands/cs_ban.cpp')
-rw-r--r-- | modules/commands/cs_ban.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 3571ccdf3..e8674600d 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -19,15 +19,16 @@ class TempBan : public Timer private: Anope::string channel; Anope::string mask; + Anope::string mode; public: - TempBan(time_t seconds, Channel *c, const Anope::string &banmask) : Timer(me, seconds), channel(c->name), mask(banmask) { } + TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { } void Tick(time_t ctime) override { Channel *c = Channel::Find(this->channel); if (c) - c->RemoveMode(NULL, "BAN", this->mask); + c->RemoveMode(NULL, mode, this->mask); } }; @@ -43,6 +44,8 @@ class CommandCSBan : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &chan = params[0]; + Configuration::Block *block = Config->GetCommand(source); + const Anope::string &mode = block->Get<Anope::string>("mode", "BAN"); ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) @@ -58,9 +61,9 @@ class CommandCSBan : public Command return; } - if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c)) + if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c)) { - source.Reply(_("The ban list for %s is full."), c->name.c_str()); + source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str()); return; } @@ -141,12 +144,12 @@ class CommandCSBan : public Command bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; - if (!c->HasMode("BAN", mask)) + if (!c->HasMode(mode, mask)) { - c->SetMode(NULL, "BAN", mask); + c->SetMode(NULL, mode, mask); if (ban_time) { - new TempBan(ban_time, c, mask); + new TempBan(ban_time, c, mask, mode); source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), mask, Anope::Duration(ban_time, source.GetAccount())); } } @@ -155,10 +158,13 @@ class CommandCSBan : public Command if (!c->FindUser(u2)) return; - if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) - c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); - else - c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + if (block->Get<bool>("kick", "yes")) + { + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) + c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); + else + c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + } } else { @@ -166,12 +172,12 @@ class CommandCSBan : public Command bool override = !founder && !u_access.HasPriv("BAN"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target; - if (!c->HasMode("BAN", target)) + if (!c->HasMode(mode, target)) { - c->SetMode(NULL, "BAN", target); + c->SetMode(NULL, mode, target); if (ban_time) { - new TempBan(ban_time, c, target); + new TempBan(ban_time, c, target, mode); source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), target, Anope::Duration(ban_time, source.GetAccount())); } } @@ -197,11 +203,14 @@ class CommandCSBan : public Command else if (uc->user->IsProtected()) continue; - ++kicked; - if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) - c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); - else - c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); + if (block->Get<bool>("kick", "yes")) + { + ++kicked; + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) + c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); + else + c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); + } } } |