diff options
| author | Adam <Adam@anope.org> | 2015-01-05 16:31:09 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2015-01-05 19:00:51 -0500 |
| commit | d79d8e2608e304760c42bdf87502e3bc51781b88 (patch) | |
| tree | 179913b8b328f88d52d84c3453fceb28a2d63422 /modules/commands/os_defcon.cpp | |
| parent | 8ab1c71d7dc7a0d47e5711dc72e3fc9c3ee850bb (diff) | |
| parent | c46ec39e5088119cd21f5f7e16e64e61a876ca20 (diff) | |
Merge branch '2.0' into 2.1
Conflicts:
CMakeLists.txt
include/modules.h
include/serialize.h
modules/commands/bs_assign.cpp
modules/commands/bs_badwords.cpp
modules/commands/bs_bot.cpp
modules/commands/bs_control.cpp
modules/commands/bs_kick.cpp
modules/commands/cs_access.cpp
modules/commands/cs_akick.cpp
modules/commands/cs_drop.cpp
modules/commands/cs_entrymsg.cpp
modules/commands/cs_flags.cpp
modules/commands/cs_info.cpp
modules/commands/cs_invite.cpp
modules/commands/cs_kick.cpp
modules/commands/cs_mode.cpp
modules/commands/cs_register.cpp
modules/commands/cs_seen.cpp
modules/commands/cs_set.cpp
modules/commands/cs_suspend.cpp
modules/commands/cs_topic.cpp
modules/commands/cs_unban.cpp
modules/commands/cs_xop.cpp
modules/commands/hs_del.cpp
modules/commands/hs_list.cpp
modules/commands/hs_request.cpp
modules/commands/ms_ignore.cpp
modules/commands/ms_send.cpp
modules/commands/ns_recover.cpp
modules/commands/ns_register.cpp
modules/commands/ns_suspend.cpp
modules/commands/os_dns.cpp
modules/commands/os_noop.cpp
modules/commands/os_oper.cpp
modules/commands/os_session.cpp
modules/database/db_sql_live.cpp
modules/encryption/enc_bcrypt.cpp
modules/extra/m_ldap_authentication.cpp
modules/extra/m_ldap_oper.cpp
modules/fantasy.cpp
modules/m_dnsbl.cpp
modules/m_sasl.cpp
modules/protocol/hybrid.cpp
modules/protocol/inspircd20.cpp
modules/protocol/unreal.cpp
modules/pseudoclients/chanserv.cpp
modules/pseudoclients/nickserv.cpp
modules/webcpanel/pages/chanserv/access.cpp
modules/webcpanel/webcpanel.cpp
modules/webcpanel/webcpanel.h
src/command.cpp
src/messages.cpp
src/modulemanager.cpp
src/regchannel.cpp
src/serialize.cpp
Diffstat (limited to 'modules/commands/os_defcon.cpp')
| -rw-r--r-- | modules/commands/os_defcon.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 498af9a8a..804b66c27 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -454,7 +454,16 @@ class OSDefcon : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { - if (command->name == "nickserv/register" || command->name == "nickserv/group") + if (DConfig.Check(DEFCON_OPER_ONLY) && !source.IsOper()) + { + source.Reply(_("Services are in DefCon mode, please try again later.")); + return EVENT_STOP; + } + else if (DConfig.Check(DEFCON_SILENT_OPER_ONLY) && !source.IsOper()) + { + return EVENT_STOP; + } + else if (command->name == "nickserv/register" || command->name == "nickserv/group") { if (DConfig.Check(DEFCON_NO_NEW_NICKS)) { @@ -502,15 +511,10 @@ class OSDefcon : public Module XLine x("*@" + u->host, OperServ ? OperServ->nick : "defcon", Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); akills->Send(NULL, &x); } - if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) - { - u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason); - return; - } if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { - u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason); + u->Kill(OperServ, DConfig.akillreason); return; } @@ -535,13 +539,13 @@ class OSDefcon : public Module ++session->hits; if (akills && DConfig.max_session_kill && session->hits >= DConfig.max_session_kill) { - XLine x("*@" + u->host, OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); + XLine x("*@" + session->addr.mask(), OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); akills->Send(NULL, &x); - Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << u->host << "\002 due to excessive connections"; + Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << session->addr.mask() << "\002 due to excessive connections"; } else { - u->Kill(OperServ ? OperServ->nick : "", "Defcon session limit exceeded"); + u->Kill(OperServ, "Defcon session limit exceeded"); } } } @@ -588,7 +592,7 @@ static void runDefCon() { Log(OperServ, "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) - it->second->SetModes(OperServ, false, "%s", newmodes.c_str()); + it->second->SetModes(OperServ, true, "%s", newmodes.c_str()); } } } |
