diff options
author | Adam <Adam@anope.org> | 2010-11-14 17:05:35 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:33:58 -0500 |
commit | 2e9a632e1410fbeadc1b7a0418cf66247e0e458c (patch) | |
tree | 027177fef4b96c545a7a0c06a399cc8238554807 /modules/core/os_sqline.cpp | |
parent | 3c9d4e9dafdd0918a3539e545cc99646e604757d (diff) |
Allow akill/szline/sqline to accept user names as a mask argument
Diffstat (limited to 'modules/core/os_sqline.cpp')
-rw-r--r-- | modules/core/os_sqline.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/core/os_sqline.cpp b/modules/core/os_sqline.cpp index e409c1bd7..72969aa54 100644 --- a/modules/core/os_sqline.cpp +++ b/modules/core/os_sqline.cpp @@ -169,6 +169,21 @@ class CommandOSSQLine : public Command reason += " " + params[3]; if (!mask.empty() && !reason.empty()) { + User *user = finduser(mask); + if (user) + mask = "*@" + user->host; + unsigned int affected = 0; + for (patricia_tree<User>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it) + if (Anope::Match((*it)->GetIdent() + "@" + (*it)->host, mask)) + ++affected; + float percent = static_cast<float>(affected) / static_cast<float>(UserListByNick.size()) * 100.0; + + if (percent > 95) + { + u->SendMessage(OperServ, USERHOST_MASK_TOO_WIDE, mask.c_str()); + Log(LOG_ADMIN, u, this) << "tried to SQLine " << percent << "% of the network (" << affected << " users)"; + return MOD_CONT; + } XLine *x = SQLine->Add(OperServ, u, mask, expires, reason); if (!x) @@ -206,7 +221,7 @@ class CommandOSSQLine : public Command buf = "expires in " + stringify(wall_expiry) + " " + s + (wall_expiry == 1 ? "" : "s"); } - ircdproto->SendGlobops(OperServ, "%s added an SQLINE for %s (%s)", u->nick.c_str(), mask.c_str(), buf.c_str()); + ircdproto->SendGlobops(OperServ, "%s added an SQLINE for %s (%s) [affects %i user(s) (%.2f%%)]", u->nick.c_str(), mask.c_str(), buf.c_str(), affected, percent); } if (readonly) |